From 333e2cfe6cea8e0beaa00383361db4bef6968c35 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Thu, 7 Jul 2011 09:46:52 +0000 Subject: [PATCH] 2011-07-07 Sergio Martin * include/functions_servers.php godmode/servers/manage_recontask.php godmode/servers/manage_recontask_form.php: Added switch to enable/disabe a recon task git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4519 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 ++++ .../godmode/servers/manage_recontask.php | 38 +++++++++++++++---- .../godmode/servers/manage_recontask_form.php | 4 ++ pandora_console/include/functions_servers.php | 7 ++++ 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 427140cfc5..43a0bcd3b9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2011-07-07 Sergio Martin + + * include/functions_servers.php + godmode/servers/manage_recontask.php + godmode/servers/manage_recontask_form.php: Added switch to + enable/disabe a recon task + 2011-07-07 Juan Manuel Ramon * include/styles/pandora_black.css: Changed some imcompatible diff --git a/pandora_console/godmode/servers/manage_recontask.php b/pandora_console/godmode/servers/manage_recontask.php index bf1d55ddee..4e4c601c61 100644 --- a/pandora_console/godmode/servers/manage_recontask.php +++ b/pandora_console/godmode/servers/manage_recontask.php @@ -2,7 +2,7 @@ // Pandora FMS - http://pandorafms.com // ================================================== -// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas +// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas // Please see http://pandorafms.org for full contribution list // This program is free software; you can redistribute it and/or @@ -46,6 +46,23 @@ if (isset ($_GET["delete"])) { echo '

'.__('Error deleting recon task').'

'; } } +else if(isset($_GET["disabled"])) { + $id = get_parameter_get ("id"); + $disabled = get_parameter_get ("disabled"); + + $result = db_process_sql_update('trecon_task', array('disabled' => $disabled), array('id_rt' => $id)); + + if ($result !== false) { + echo '

'.__('Successfully updated recon task').'

'; + // If the action is enabled, we force recon_task to be queued asap + if($disabled == 0) { + servers_force_recon_task($id); + } + } + else { + echo '

'.__('Error updating recon task').'

'; + } +} // -------------------------------- // GET PARAMETERS IF UPDATE OR CREATE @@ -169,7 +186,6 @@ if (isset($_GET["create"])) { else $result = false; - if ($result !== false) { echo '

'.__('Successfully created recon task').'

'; } @@ -200,14 +216,14 @@ if ($result !== false) { $table->cellspacing = 4; $table->class = "databox"; $table->data = array (); - $table->size = array (); - $table->size[8] = '70px'; + + $table->style[8] = 'text-align: center;'; foreach ($result as $row) { $data = array(); $data[0] = ''.$row["name"].''; - + if ($row["id_recon_script"] == 0) $data[1] = $row["subnet"]; else @@ -255,10 +271,16 @@ if ($result !== false) { } // ACTION - $data[8] = "" . html_print_image("images/eye.png", true) . "  " . - '' . html_print_image("images/config.png", true) . '  ' . - '' . html_print_image("images/cross.png", true, array("border" => '0')) . ''; + $data[8] = '' . html_print_image("images/eye.png", true) . ' '; + $data[8] .= '' . html_print_image("images/cross.png", true, array("border" => '0')) . ' '; + $data[8] .= '' .html_print_image("images/config.png", true) . ' '; + if($row["disabled"] == 0) { + $data[8] .= '' .html_print_image("images/b_yellow.png", true) . ''; + } + else { + $data[8] .= '' .html_print_image("images/b_white.png", true) . ''; + } $table->data[] = $data; } diff --git a/pandora_console/godmode/servers/manage_recontask_form.php b/pandora_console/godmode/servers/manage_recontask_form.php index 4f7570a40a..f7324e4e99 100644 --- a/pandora_console/godmode/servers/manage_recontask_form.php +++ b/pandora_console/godmode/servers/manage_recontask_form.php @@ -94,6 +94,10 @@ $table->rowclass[5]="network_sweep"; $table->rowclass[7]="network_sweep"; $table->rowclass[8]="network_sweep"; $table->rowclass[11]="network_sweep"; +$table->rowclass[17]="network_sweep"; +$table->rowclass[18]="network_sweep"; +$table->rowclass[19]="network_sweep"; +$table->rowclass[20]="network_sweep"; $table->rowclass[6]="recon_script"; $table->rowclass[12]="recon_script"; diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 5a978c2fe3..183ba2bcb7 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -55,6 +55,13 @@ function servers_get_names () { return $servers; } +/** + * This function forces a recon task to be queued by the server asap + */ +function servers_force_recon_task($id_recon_task) { + $values = array('utimestamp' => 0, 'status' => 1); + db_process_sql_update('trecon_task', $values, array('id_rt' => $id_recon_task)); +} /** * This function will get several metrics from the database to get info about server performance