2011-07-07 Sergio Martin <sergio.martin@artica.es>

* 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
This commit is contained in:
zarzuelo 2011-07-07 09:46:52 +00:00
parent a05338916e
commit 413087a36d
4 changed files with 48 additions and 8 deletions

View File

@ -1,3 +1,10 @@
2011-07-07 Sergio Martin <sergio.martin@artica.es>
* 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 <juanmanuel.ramon@artica.es>
* include/styles/pandora_black.css: Changed some imcompatible

View File

@ -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 '<h3 class="error">'.__('Error deleting recon task').'</h3>';
}
}
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 '<h3 class="suc">'.__('Successfully updated recon task').'</h3>';
// If the action is enabled, we force recon_task to be queued asap
if($disabled == 0) {
servers_force_recon_task($id);
}
}
else {
echo '<h3 class="error">'.__('Error updating recon task').'</h3>';
}
}
// --------------------------------
// GET PARAMETERS IF UPDATE OR CREATE
@ -169,7 +186,6 @@ if (isset($_GET["create"])) {
else
$result = false;
if ($result !== false) {
echo '<h3 class="suc">'.__('Successfully created recon task').'</h3>';
}
@ -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] = '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'"><b>'.$row["name"].'</b></a>';
if ($row["id_recon_script"] == 0)
$data[1] = $row["subnet"];
else
@ -255,10 +271,16 @@ if ($result !== false) {
}
// ACTION
$data[8] = "<a href='index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id=".$row["id_recon_server"]."'>" . html_print_image("images/eye.png", true) . "</a>&nbsp;&nbsp;" .
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">' . html_print_image("images/config.png", true) . '</a>&nbsp;&nbsp;' .
'<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
$data[8] = '<a href="index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id='.$row["id_recon_server"].'">' . html_print_image("images/eye.png", true) . '</a>&nbsp;';
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>&nbsp;';
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">' .html_print_image("images/config.png", true) . '</a>&nbsp;';
if($row["disabled"] == 0) {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=1">' .html_print_image("images/b_yellow.png", true) . '</a>';
}
else {
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=0">' .html_print_image("images/b_white.png", true) . '</a>';
}
$table->data[] = $data;
}

View File

@ -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";

View File

@ -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