pandorafms/pandora_console/godmode/servers/manage_recontask.php

138 lines
5.3 KiB
PHP
Raw Normal View History

<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
2008-08-11 Esteban Sanchez <estebans@artica.es> * include/functions_db.php: Added __ as an alias of lang_string(). * include/functions_reporting_pdf.php, include/functions_reporting.php, include/functions.php, include/functions_visual_map.php, index.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/incidents/incident_note.php, operation/incidents/incident_search.php, operation/incidents/incident_statistics.php, operation/snmpconsole/snmp_alert.php, operation/snmpconsole/snmp_view.php, operation/users/user.php, operation/users/user_edit.php, operation/users/user_statistics.php, operation/events/event_statistics.php, operation/events/events.php, operation/visual_console/render_view.php, operation/visual_console/index.php, operation/extensions.php, operation/agentes/estado_alertas.php, operation/agentes/status_monitor.php, operation/agentes/estado_grupo.php, operation/agentes/export_csv.php, operation/agentes/datos_agente.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_generalagente.php, operation/agentes/estado_agente.php, operation/agentes/bulbs.php, operation/agentes/status_events.php, operation/agentes/sla_view.php, operation/agentes/exportdata.php, operation/agentes/estado_monitores.php, operation/agentes/ver_agente.php, operation/agentes/estadisticas.php, operation/agentes/tactical.php, operation/agentes/networkmap.php, operation/messages/message.php, operation/reporting/reporting_viewer.php, operation/reporting/graph_viewer.php, operation/reporting/custom_reporting.php, operation/servers/view_server.php, operation/servers/view_server_detail.php, operation/menu.php, reporting/fgraph.php, reporting/stat_win.php, ajax.php, general/logoff.php, general/pandora_help.php, general/footer.php, general/noaccess.php, general/logon_failed.php, general/links_menu.php, general/login_page.php, general/logon_ok.php, general/header.php, general/main_menu.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/setup/news.php, godmode/setup/links.php, godmode/setup/setup.php, godmode/users/user_list.php, godmode/users/configure_user.php, godmode/profiles/profile_list.php, godmode/admin_access_logs.php, godmode/db/db_info_data.php, godmode/db/db_main.php, godmode/db/db_audit.php, godmode/db/db_sanity.php, godmode/db/db_refine.php, godmode/db/db_info.php, godmode/db/db_event.php, godmode/db/db_purge.php, godmode/extensions.php, godmode/agentes/agent_template.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/alert_manager.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/alert_manager_editor.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager.php, godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php, godmode/agentes/agent_disk_conf_editor.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php, godmode/modules/manage_network_components_form.php, godmode/modules/manage_nc_groups_form.php, godmode/modules/manage_network_templates.php, godmode/modules/module_list.php, godmode/modules/manage_network_templates_form.php, godmode/modules/manage_network_components_form_network.php, godmode/modules/manage_network_components_form_wmi.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php, godmode/reporting/reporting_builder.php, godmode/reporting/map_builder.php, godmode/reporting/graph_builder.php, godmode/servers/plugin.php, godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php, godmode/servers/manage_recontask_form.php, godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php, godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a instead of $lang_label to future use of gettext. Style corrections. * godmode/agentes/planned_downtime.php: Rewritten to use Pandora functions and adopt the UI style. Replaced lang_string with __(). * pandoradb.sql: Fields in tplanned_downtime renamed to fit guidelines. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
require ("include/config.php");
2008-08-11 Esteban Sanchez <estebans@artica.es> * include/functions_db.php: Added __ as an alias of lang_string(). * include/functions_reporting_pdf.php, include/functions_reporting.php, include/functions.php, include/functions_visual_map.php, index.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/incidents/incident_note.php, operation/incidents/incident_search.php, operation/incidents/incident_statistics.php, operation/snmpconsole/snmp_alert.php, operation/snmpconsole/snmp_view.php, operation/users/user.php, operation/users/user_edit.php, operation/users/user_statistics.php, operation/events/event_statistics.php, operation/events/events.php, operation/visual_console/render_view.php, operation/visual_console/index.php, operation/extensions.php, operation/agentes/estado_alertas.php, operation/agentes/status_monitor.php, operation/agentes/estado_grupo.php, operation/agentes/export_csv.php, operation/agentes/datos_agente.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/estado_generalagente.php, operation/agentes/estado_agente.php, operation/agentes/bulbs.php, operation/agentes/status_events.php, operation/agentes/sla_view.php, operation/agentes/exportdata.php, operation/agentes/estado_monitores.php, operation/agentes/ver_agente.php, operation/agentes/estadisticas.php, operation/agentes/tactical.php, operation/agentes/networkmap.php, operation/messages/message.php, operation/reporting/reporting_viewer.php, operation/reporting/graph_viewer.php, operation/reporting/custom_reporting.php, operation/servers/view_server.php, operation/servers/view_server_detail.php, operation/menu.php, reporting/fgraph.php, reporting/stat_win.php, ajax.php, general/logoff.php, general/pandora_help.php, general/footer.php, general/noaccess.php, general/logon_failed.php, general/links_menu.php, general/login_page.php, general/logon_ok.php, general/header.php, general/main_menu.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/setup/news.php, godmode/setup/links.php, godmode/setup/setup.php, godmode/users/user_list.php, godmode/users/configure_user.php, godmode/profiles/profile_list.php, godmode/admin_access_logs.php, godmode/db/db_info_data.php, godmode/db/db_main.php, godmode/db/db_audit.php, godmode/db/db_sanity.php, godmode/db/db_refine.php, godmode/db/db_info.php, godmode/db/db_event.php, godmode/db/db_purge.php, godmode/extensions.php, godmode/agentes/agent_template.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/alert_manager.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/alert_manager_editor.php, godmode/agentes/manage_config.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/module_manager.php, godmode/agentes/modificar_agente.php, godmode/agentes/configurar_agente.php, godmode/agentes/agent_disk_conf_editor.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php, godmode/modules/manage_network_components_form.php, godmode/modules/manage_nc_groups_form.php, godmode/modules/manage_network_templates.php, godmode/modules/module_list.php, godmode/modules/manage_network_templates_form.php, godmode/modules/manage_network_components_form_network.php, godmode/modules/manage_network_components_form_wmi.php, godmode/modules/manage_network_components.php, godmode/modules/manage_nc_groups.php, godmode/reporting/reporting_builder.php, godmode/reporting/map_builder.php, godmode/reporting/graph_builder.php, godmode/servers/plugin.php, godmode/servers/manage_recontask.php, godmode/servers/modificar_server.php, godmode/servers/manage_recontask_form.php, godmode/alerts/modify_alert.php, godmode/alerts/configure_alert.php, godmode/menu.php: Replaced $id_user with $config['id_user']. Use __a instead of $lang_label to future use of gettext. Style corrections. * godmode/agentes/planned_downtime.php: Rewritten to use Pandora functions and adopt the UI style. Replaced lang_string with __(). * pandoradb.sql: Fields in tplanned_downtime renamed to fit guidelines. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1005 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-08-11 12:59:07 +02:00
check_login ();
if (! give_acl ($config['id_user'], 0, "LM")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Recon Task Management");
require ("general/noaccess.php");
exit;
}
// --------------------------------
// DELETE A RECON TASKs
// --------------------------------
if (isset ($_GET["delete"])) {
$id = get_parameter_get ("delete");
$sql = sprintf("DELETE FROM trecon_task WHERE id_rt = '%d'",$id);
$result = process_sql ($sql);
if ($result !== false) {
echo '<h3 class="suc">'.__('Successfully deleted recon task').'</h3>';
} else {
echo '<h3 class="error">'.__('Error deleting recon task').'</h3>';
}
}
// --------------------------------
// GET PARAMETERS IF UPDATE OR CREATE
// --------------------------------
if ((isset ($_GET["update"])) OR ((isset ($_GET["create"])))) {
$name = get_parameter_post ("name");
$network = get_parameter_post ("network");
$description = get_parameter_post ("description");
$id_recon_server = get_parameter_post ("id_recon_server");
$interval = get_parameter_post ("interval");
$id_group = get_parameter_post ("id_group");
$create_incident = get_parameter_post ("create_incident");
$id_network_profile = get_parameter_post ("id_network_profile");
$id_os = get_parameter_post ("id_os", 10);
}
// --------------------------------
// UPDATE A RECON TASK
// --------------------------------
if (isset($_GET["update"])) {
$id = get_parameter_get ("update");
$sql = sprintf ("UPDATE trecon_task SET id_os = %d, name = '%s', subnet = '%s',
description = '%s', id_recon_server = %d, create_incident = %b, id_group = %d, interval_sweep = %u,
id_network_profile = %d WHERE id_rt = %u",$id_os,$name,$network,$description,$id_recon_server,$create_incident,$id_group,$interval,$id_network_profile,$id);
if (process_sql ($sql) !== false) {
echo '<h3 class="suc">'.__('Successfully updated recon task').'</h3>';
} else {
echo '<h3 class="error">'.__('Error updating recon task').'</h3>';
}
}
// --------------------------------
// CREATE A RECON TASK
// --------------------------------
if (isset($_GET["create"])) {
$sql = sprintf ("INSERT INTO trecon_task
(name, subnet, description, id_recon_server, create_incident, id_group, id_network_profile, interval_sweep, id_os)
VALUES ( '%s', '%s', '%s', %u, %b, %d, %d, %u, %d)",$name,$network,$description,$id_recon_server,$create_incident,$id_group,$id_network_profile,$interval,$id_os);
if (process_sql ($sql) !== false) {
echo '<h3 class="suc">'.__('Successfully created recon task').'</h3>';
} else {
echo '<h3 class="error">'.__('Error creating recon task').'</h3>';
}
}
// --------------------------------
// SHOW TABLE WITH ALL RECON TASKs
// --------------------------------
2009-04-13 Esteban Sanchez <estebans@artica.es> * general/footer.php: Removed Firefox icon. Style correction. * godmode/agentes/agent_manager.php: Replaced &gt; with &raquo;. Style correction when setting bold attributes. * godmode/agentes/manage_config_remote.php, godmode/agentes/modificar_agente.php, godmode/agentes/module_manager.php, godmode/alerts/alert_list.php, godmode/db/db_audit.php, godmode/db/db_event.php, godmode/db/db_info.php, godmode/db/db_main.php, godmode/db/db_purge.php, godmode/db/db_refine.php, godmode/groups/configure_group.php, godmode/groups/group_list.php, godmode/modules/manage_nc_groups.php, godmode/modules/manage_network_components.php, godmode/modules/manage_network_templates.php, godmode/modules/manage_network_templates_form.php, godmode/modules/module_list.php, godmode/profiles/profile_list.php, godmode/reporting/graph_builder.php, godmode/reporting/map_builder.php, godmode/reporting/reporting_builder.php, godmode/servers/manage_export.php, godmode/servers/manage_export_form.php, godmode/servers/manage_recontask.php, godmode/servers/manage_recontask_form.php, godmode/servers/modificar_server.php, godmode/setup/setup_visuals.php, godmode/setup/links.php, godmode/setup/news.php, godmode/snmpconsole/snmp_alert.php, godmode/users/configure_user.php, godmode/users/user_list.php, operation/agentes/alerts_status.php, operation/agentes/estado_generalagente.php, operation/agentes/estado_agente.php, operation/agentes/estado_grupo.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/exportdata.php, operation/agentes/networkmap.php, operation/agentes/status_monitor.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/incidents/incident_statistics.php, operation/messages/message.php, operation/reporting/custom_reporting.php, operation/reporting/graph_viewer.php, operation/reporting/reporting_viewer.php, operation/servers/view_server.php, operation/users/user.php, operation/users/user_edit.php, operation/users/user_statistics.php, operation/visual_console/index.php, godmode/agentes/agent_template.php: Replaced &gt; with &raquo; * operation/agentes/datos_agente.php: Return instead of exit * include/javascript/jquery.pandora.controls.js: Added pandoraSelectOS control to preview the OS icon on a select. * include/functions_reports.php: Fixed a bug on delete_report() that returns error when the report has no content. * include/functions_ui.php: Removed border attribute on print_os_icon(). Some fixes to meta refresh element on process_page_head(). Fixed format_filesize() when length is zero. * godmode/menu.php: Replaced link to file manager. Added enterprise hook. * godmode/setup/file_manager.php: Renamed from obfuscated name filemgr.php * include/styles/pandora.css: Textarea width reduced to 99% * godmode/setup/setup.php: Added get_os_icon AJAX operation. * images/mimetypes/, images/mimetypes/zip.png, images/mimetypes/image.png, images/mimetypes/unknown.png, images/mimetypes/directory.png: Added to repository. Mime type icons. * extras/pandoradb_migrate_v2.x_to_v3.0.sql: Removed date comments. * include/functions_filemanager.php: Added to repository. Minimal API for file manager system. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1608 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-04-13 11:50:56 +02:00
echo "<h2>".__('Pandora servers')." &raquo; ".__('Manage recontask')."</h2>";
$result = get_db_all_rows_in_table ("trecon_task");
$color=1;
if ($result !== false) {
$table->head = array (__('Name'), __('Network'), __('Module template'), __('Group'), __('Incident'), __('OS'), __('Interval'), __('Action'));
$table->align = array ("","","","center","","","center","center");
$table->width = 700;
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->class = "databox";
foreach ($result as $row) {
$table->data[] = array (
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'"><b>'.$row["name"].'</b></a>',
// Network (subnet)
$row["subnet"],
// Module template name
2008-12-16 Evi Vanoost <vanooste@rcbi.rochester.edu> * general/logon_ok.php, godmode/agentes/modificar_agente.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_recontask.php, godmode/setup/news.php, operation/agentes/datos_agente.php, operation/agentes/estado_agente.php, operation/agentes/status_events.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incidents.php, operation/incidents/incident_detail.php, operation/messages/message.php: Function updates and new function definitions * include/functions.php: safe_input used utf_decode which gives problems with foreign chars since everything else is (or should be UTF-8) fixed. format_datetime is no longer necessary - use print_timestamp for output. Extended multibyte wrapper functions. * include/functions_db.php: give_server_name is now get_server_name; dame_so_name is now get_os_name; dame_so_icon is now print_os_icon; show_icon_group is now print_group_icon; give_network_profile_name is now get_networkprofile_name; smal_event_table is now print_events_table * include/functions_events.php: print_events_table was moved here and fixed. Now calculates the cutoff of event and agent text. * include/functions_html.php: Added title to print_table function and updated documentation. print_timestamp now uses the new function definitions (array) and handles 0-dates better. print_group_icon and print_os_icon added and extended. Added print_agent_name. This function fixes issues that show up when cutting off agent names with multibyte char * operation/servers/view_server.php: Rewrite with new functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1295 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-17 15:26:42 +01:00
'<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates&id='.$row["id_network_profile"].'">'.get_networkprofile_name ($row["id_network_profile"]).'</a>',
// GROUP
2008-12-16 Evi Vanoost <vanooste@rcbi.rochester.edu> * general/logon_ok.php, godmode/agentes/modificar_agente.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_recontask.php, godmode/setup/news.php, operation/agentes/datos_agente.php, operation/agentes/estado_agente.php, operation/agentes/status_events.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incidents.php, operation/incidents/incident_detail.php, operation/messages/message.php: Function updates and new function definitions * include/functions.php: safe_input used utf_decode which gives problems with foreign chars since everything else is (or should be UTF-8) fixed. format_datetime is no longer necessary - use print_timestamp for output. Extended multibyte wrapper functions. * include/functions_db.php: give_server_name is now get_server_name; dame_so_name is now get_os_name; dame_so_icon is now print_os_icon; show_icon_group is now print_group_icon; give_network_profile_name is now get_networkprofile_name; smal_event_table is now print_events_table * include/functions_events.php: print_events_table was moved here and fixed. Now calculates the cutoff of event and agent text. * include/functions_html.php: Added title to print_table function and updated documentation. print_timestamp now uses the new function definitions (array) and handles 0-dates better. print_group_icon and print_os_icon added and extended. Added print_agent_name. This function fixes issues that show up when cutting off agent names with multibyte char * operation/servers/view_server.php: Rewrite with new functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1295 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-17 15:26:42 +01:00
print_group_icon ($row["id_group"], true),
// INCIDENT
(($row["create_incident"] == 1) ? __('Yes') : __('No')),
// OS
2008-12-16 Evi Vanoost <vanooste@rcbi.rochester.edu> * general/logon_ok.php, godmode/agentes/modificar_agente.php, godmode/agentes/planned_downtime.php, godmode/agentes/manage_recontask.php, godmode/setup/news.php, operation/agentes/datos_agente.php, operation/agentes/estado_agente.php, operation/agentes/status_events.php, operation/agentes/tactical.php, operation/events/events.php, operation/incidents/incidents.php, operation/incidents/incident_detail.php, operation/messages/message.php: Function updates and new function definitions * include/functions.php: safe_input used utf_decode which gives problems with foreign chars since everything else is (or should be UTF-8) fixed. format_datetime is no longer necessary - use print_timestamp for output. Extended multibyte wrapper functions. * include/functions_db.php: give_server_name is now get_server_name; dame_so_name is now get_os_name; dame_so_icon is now print_os_icon; show_icon_group is now print_group_icon; give_network_profile_name is now get_networkprofile_name; smal_event_table is now print_events_table * include/functions_events.php: print_events_table was moved here and fixed. Now calculates the cutoff of event and agent text. * include/functions_html.php: Added title to print_table function and updated documentation. print_timestamp now uses the new function definitions (array) and handles 0-dates better. print_group_icon and print_os_icon added and extended. Added print_agent_name. This function fixes issues that show up when cutting off agent names with multibyte char * operation/servers/view_server.php: Rewrite with new functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1295 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-12-17 15:26:42 +01:00
(($row["id_os"] > 0) ? print_os_icon ($row["id_os"], false, true) : __('Any')),
// INTERVAL
human_time_description_raw($row["interval_sweep"]),
// ACTION
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">
<img src="images/cross.png" border="0" /></a>&nbsp;&nbsp;<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">
<img src="images/config.png" /></a>'
);
}
print_table ($table);
unset ($table);
} else {
echo '<div class="nf">'.__('There are no recon task configured').'</div>';
}
echo '<div class="action-buttons" style="width: 700px">';
echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create">';
echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true);
echo '</form>';
echo "</div>";
?>