2009-01-12 Sancho Lerena <slerena@artica.es>
* pandoradb.sql: Removed fields "timestamp" and "id_agente" (and altered some indexes) on tagente_datos, tagente_datos_string and tagente_datos_inc. tagente_estado table: removed cambio, added status_changes, last_status. tagente_modulo: added five new fields (warning,critical mgmt., flipflop detection, history module and delete_pending bit. * agent_manager.php: Group ALL not shown anymore. * configurar_agente.php: Support for new options. Delete a module now mark for deletion the module, not delete data (It's VERY slow!). * modificar_agente.php: Delete agent now uses the global function, minor fixes. * module_manager_editor.php: New fields initializacion. * module_manager_editor_network.php: At this time, the first module editor who implements the new fields and improve old ones (tcp data). * setup.php: Added support for new token: event_view_hr (Filter of max old (in hr) for the event viewer. Removed old tokens show_unknown and show_lastalert. * functions.php: format_for_graph() has an important BUG that makes all units rendered without the "K" !!!!. Fixed. * delete_agent.php: Delete remote config (if present). Also mark for deletion modules instead delete them (and let the data without being deleted, because it's a HUGE consuming time, and it's left for the daily db maintance process). * estado_agente.php: Updated code for view new status. * estado_generalagente.php: Total packets are removed from this view, this was a huge time consuming SQL operation that don't give important infomation. Groupname is now visualized. * estado_ultimopaquete.php, * estado_monitores.php, * estado_grupo.php: Rewritten much code to view new status and other minor changes. * ver_agente.php: Data view now works under the tabs and other minor changes. * events.php: Support for the new events and status. Added filter for username and for a max. hours old events. Some boxes are now hidden by default. * fgraph.php: Some graphs are now fixed and uses tagente_datos and tagent_access with utimestamp and without id_agent index. Works faster * images/*: Updated icons (module types) and two new bulb colors. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1326 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
|
@ -1,3 +1,60 @@
|
|||
2009-01-12 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* pandoradb.sql: Removed fields "timestamp" and "id_agente" (and altered
|
||||
some indexes) on tagente_datos, tagente_datos_string and
|
||||
tagente_datos_inc.
|
||||
|
||||
tagente_estado table: removed cambio, added status_changes, last_status.
|
||||
tagente_modulo: added five new fields (warning,critical mgmt., flipflop
|
||||
detection, history module and delete_pending bit.
|
||||
|
||||
* agent_manager.php: Group ALL not shown anymore.
|
||||
|
||||
* configurar_agente.php: Support for new options. Delete a module now
|
||||
mark for deletion the module, not delete data (It's VERY slow!).
|
||||
|
||||
* modificar_agente.php: Delete agent now uses the global function,
|
||||
minor fixes.
|
||||
|
||||
* module_manager_editor.php: New fields initializacion.
|
||||
|
||||
* module_manager_editor_network.php: At this time, the first module
|
||||
editor who implements the new fields and improve old ones (tcp data).
|
||||
|
||||
* setup.php: Added support for new token: event_view_hr (Filter of max
|
||||
old (in hr) for the event viewer. Removed old tokens show_unknown and
|
||||
show_lastalert.
|
||||
|
||||
* functions.php: format_for_graph() has an important BUG that makes
|
||||
all units rendered without the "K" !!!!. Fixed.
|
||||
|
||||
* delete_agent.php: Delete remote config (if present). Also mark
|
||||
for deletion modules instead delete them (and let the data without
|
||||
being deleted, because it's a HUGE consuming time, and it's left
|
||||
for the daily db maintance process).
|
||||
|
||||
* estado_agente.php: Updated code for view new status.
|
||||
|
||||
* estado_generalagente.php: Total packets are removed from this view,
|
||||
this was a huge time consuming SQL operation that don't give important
|
||||
infomation. Groupname is now visualized.
|
||||
|
||||
* estado_ultimopaquete.php,
|
||||
* estado_monitores.php,
|
||||
* estado_grupo.php: Rewritten much code to view new status and other
|
||||
minor changes.
|
||||
|
||||
* ver_agente.php: Data view now works under the tabs and other minor
|
||||
changes.
|
||||
|
||||
* events.php: Support for the new events and status. Added filter for
|
||||
username and for a max. hours old events. Some boxes are now hidden
|
||||
by default.
|
||||
|
||||
* fgraph.php: Some graphs are now fixed and uses tagente_datos and
|
||||
tagent_access with utimestamp and without id_agent index. Works faster
|
||||
|
||||
|
||||
2009-01-09 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* general/footer.php, operation/agentes/sla_view.php,
|
||||
|
|
|
@ -95,10 +95,10 @@ $groups = get_user_groups ($config["id_user"]);
|
|||
$agents = get_group_agents (array_keys ($groups));
|
||||
|
||||
$table->data[2][0] = '<b>'.__('Parent').'</b>';
|
||||
$table->data[2][1] = print_select ($agents, 'id_parent', $id_parent, '', get_agent_name ($id_parent, "lower"), $id_parent, true, false, false); //I use get_agent_name because the user might not have rights to the current parent
|
||||
$table->data[2][1] = print_select ($agents, 'id_parent', $id_parent, '', __('None'), 0, true, false, false); //I use get_agent_name because the user might not have rights to the current parent
|
||||
|
||||
$table->data[3][0] = '<b>'.__('Group').'</b>';
|
||||
$table->data[3][1] = print_select ($groups, 'grupo', $grupo, '', '', 0, true, false, false);
|
||||
$table->data[3][1] = print_select_from_sql ('SELECT id_grupo, nombre FROM tgrupo WHERE id_grupo > 1 ORDER BY nombre', 'grupo', $grupo, '', '', 0, true);
|
||||
|
||||
$table->data[4][0] = '<b>'.__('Interval').'</b>';
|
||||
$table->data[4][1] = print_input_text ('intervalo', $intervalo, '', 16, 100, true);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
enterprise_include ('godmode/agentes/configurar_agente.php');
|
||||
|
@ -34,6 +35,7 @@ if (! give_acl($config["id_user"], $group, "AW")) {
|
|||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Get passed variables
|
||||
$tab = get_parameter_get ("tab", "main");
|
||||
$form_moduletype = get_parameter_post ("form_moduletype");
|
||||
|
@ -148,17 +150,17 @@ if (isset ($_POST["create_agent"])) { // Create a new and shiny agent
|
|||
|
||||
// Create special module agent_keepalive
|
||||
$sql = "INSERT INTO tagente_modulo
|
||||
(nombre, id_agente, id_tipo_modulo, descripcion, id_modulo, custom_id)
|
||||
(nombre, id_agente, id_tipo_modulo, descripcion, id_modulo,min_warning, max_warning )
|
||||
VALUES
|
||||
('agent_keepalive',".$id_agente.",100,'Agent Keepalive monitor',1,'".$custom_id."')";
|
||||
('agent_keepalive',".$id_agente.",100,'Agent Keepalive monitor',1 ,0,1)";
|
||||
$id_agent_module = process_sql ($sql, "insert_id");
|
||||
|
||||
if ($id_agent_module !== false) {
|
||||
// Create agent_keepalive in tagente_estado table
|
||||
$sql = "INSERT INTO tagente_estado
|
||||
(id_agente_modulo, datos, timestamp, cambio, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try)
|
||||
(id_agente_modulo, datos, timestamp, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try)
|
||||
VALUES
|
||||
(".$id_agent_module.",1,'',0,0,".$id_agente.",0,0,0,0,0)";
|
||||
(".$id_agent_module.",'',0,0,".$id_agente.",0,0,0,0,0)";
|
||||
$result = process_sql ($sql);
|
||||
if ($result === false) {
|
||||
$agent_created_ok = 0;
|
||||
|
@ -697,6 +699,7 @@ if ((isset ($_POST["update_module"])) || (isset ($_POST["insert_module"]))) {
|
|||
$form_minvalue = (int) get_parameter_post ("form_minvalue",0);
|
||||
$form_maxvalue = (int) get_parameter ("form_maxvalue",0);
|
||||
$form_interval = (int) get_parameter ("form_interval",300);
|
||||
$form_id_prediction_module = (int) get_parameter ("form_id_prediction_module",0);
|
||||
$form_id_plugin = (int) get_parameter ("form_id_plugin",0);
|
||||
$form_id_export = (int) get_parameter ("form_id_export",0);
|
||||
$form_disabled = (bool) get_parameter ("form_disabled",0);
|
||||
|
@ -711,6 +714,12 @@ if ((isset ($_POST["update_module"])) || (isset ($_POST["insert_module"]))) {
|
|||
$form_plugin_parameter = (string) get_parameter ("form_plugin_parameter","");
|
||||
$form_id_modulo = (int) get_parameter ("form_id_modulo",0);
|
||||
$form_custom_id = (string) get_parameter ("form_custom_id","");
|
||||
$form_history_data = (int) get_parameter('form_history_data',0);
|
||||
$form_min_warning = (float) get_parameter ('form_min_warning', 0);
|
||||
$form_max_warning = (float) get_parameter ('form_max_warning', 0);
|
||||
$form_min_critical = (float) get_parameter ('form_min_critical', 0);
|
||||
$form_max_critical = (float) get_parameter ('form_max_critical', 0);
|
||||
$form_ff_event = (int) get_parameter ('form_ff_event', 0);
|
||||
}
|
||||
|
||||
// MODULE UPDATE
|
||||
|
@ -747,10 +756,16 @@ if ((isset ($_POST["update_module"])) && (!isset ($_POST["oid"]))) { // if modif
|
|||
post_process = %f,
|
||||
prediction_module = %d,
|
||||
max_timeout = %d,
|
||||
custom_id = '%s'
|
||||
custom_id = '%s',
|
||||
history_data = %d,
|
||||
min_warning = %f,
|
||||
max_warning = %f,
|
||||
min_critical = %f,
|
||||
max_critical = %f,
|
||||
min_ff_event = %d
|
||||
WHERE id_agente_modulo = %d", $form_description, $form_id_module_group, $form_name, $form_maxvalue, $form_minvalue, $form_interval, $form_tcp_port, $form_tcp_send, $form_tcp_rcv,
|
||||
$form_snmp_community, $form_snmp_oid, $form_ip_target, $form_flag, $form_id_modulo, $form_disabled, $form_id_export, $form_plugin_user, $form_plugin_pass,
|
||||
$form_plugin_parameter, $form_id_plugin, $form_post_process, $form_prediction_module, $form_max_timeout, $form_custom_id, $id_agente_modulo);
|
||||
$form_plugin_parameter, $form_id_plugin, $form_post_process, $form_prediction_module, $form_max_timeout, $form_custom_id, $form_history_data, $form_min_warning, $form_max_warning, $form_min_critical, $form_max_critical, $form_ff_event, $id_agente_modulo);
|
||||
$result = process_sql ($sql);
|
||||
|
||||
if ($result === false) {
|
||||
|
@ -795,32 +810,20 @@ if (((!isset ($_POST["nc"]) OR ($_POST["nc"] == -1))) && (!isset ($_POST["oid"])
|
|||
(id_agente, id_tipo_modulo, nombre, descripcion, max, min, snmp_oid, snmp_community,
|
||||
id_module_group, module_interval, ip_target, tcp_port, tcp_rcv, tcp_send, id_export,
|
||||
plugin_user, plugin_pass, plugin_parameter, id_plugin, post_process, prediction_module,
|
||||
max_timeout, disabled, id_modulo, custom_id)
|
||||
VALUES (%d,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%d,'%s','%s',%d,'%s','%s','%s',%d,%d,%d,%d,%d,%d,'%s')",
|
||||
max_timeout, disabled, id_modulo, custom_id, history_data, min_warning, max_warning, min_critical, max_critical, min_ff_event)
|
||||
VALUES (%d,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%d,'%s','%s',%d,'%s','%s','%s',%d,%d,%d,%d,%d,%d,'%s', %d, %f, %f, %f, %f, %d)",
|
||||
$id_agente, $form_id_tipo_modulo, $form_name, $form_description, $form_maxvalue, $form_minvalue, $form_snmp_oid, $form_snmp_community,
|
||||
$form_id_module_group, $form_interval, $form_ip_target, $form_tcp_port, $form_tcp_rcv, $form_tcp_send, $form_id_export, $form_plugin_user, $form_plugin_pass,
|
||||
$form_plugin_parameter, $form_id_plugin, $form_post_process, $form_prediction_module, $form_max_timeout, $form_disabled, $form_id_modulo, $form_custom_id);
|
||||
$form_plugin_parameter, $form_id_plugin, $form_post_process, $form_id_prediction_module, $form_max_timeout, $form_disabled, $form_id_modulo, $form_custom_id, $form_history_data, $form_min_warning, $form_max_warning, $form_min_critical, $form_max_critical, $form_ff_event);
|
||||
$id_agente_modulo = process_sql ($sql, 'insert_id');
|
||||
|
||||
if ($id_agente_modulo === false){
|
||||
echo '<h3 class="error">'.__('There was a problem adding module').'</h3>';
|
||||
} else {
|
||||
// Create with different estado if proc type or data type
|
||||
if (($form_id_tipo_modulo == 2) || // data_proc
|
||||
($form_id_tipo_modulo == 6) || // icmp_proc
|
||||
($form_id_tipo_modulo == 9) || // tcp_proc
|
||||
($form_id_tipo_modulo == 18) || //snmp proc
|
||||
($form_id_tipo_modulo == 21) || // async proc
|
||||
($form_id_tipo_modulo == 100) // Keepalive
|
||||
) {
|
||||
$sql = sprintf ("INSERT INTO tagente_estado
|
||||
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
|
||||
VALUES (%d, 0,'0000-00-00 00:00:00',0,0,%d,0)",$id_agente_modulo,$id_agente);
|
||||
} else {
|
||||
$sql = sprintf ("INSERT INTO tagente_estado
|
||||
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
|
||||
VALUES (%d, 0,'0000-00-00 00:00:00',0,100,%d,0)",$id_agente_modulo,$id_agente);
|
||||
}
|
||||
$sql = sprintf ("INSERT INTO tagente_estado
|
||||
(id_agente_modulo,datos,timestamp,estado,id_agente, utimestamp, status_changes, last_status)
|
||||
VALUES (%d, 0,'0000-00-00 00:00:00',0,%d,0,0,0)",$id_agente_modulo,$id_agente);
|
||||
|
||||
$result = process_sql ($sql);
|
||||
if ($result !== false) {
|
||||
echo '<h3 class="suc">'.__('Module added successfully').'</h3>';
|
||||
|
@ -857,21 +860,12 @@ if (isset ($_GET["delete_module"])){ // DELETE agent module !
|
|||
|
||||
// First delete from tagente_modulo -> if not successful, increment
|
||||
// error
|
||||
if (process_sql ("DELETE FROM tagente_modulo WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||
if (process_sql ("UPDATE tagente_modulo SET disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||
$error++;
|
||||
|
||||
if (process_sql ("DELETE FROM tagente_estado WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||
$error++;
|
||||
|
||||
if (process_sql ("DELETE FROM tagente_datos WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||
$error++;
|
||||
|
||||
if (process_sql ("DELETE FROM tagente_datos_string WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||
$error++;
|
||||
|
||||
if (process_sql ("DELETE FROM tagente_datos_inc WHERE id_agente_modulo = ".$id_borrar_modulo) === false)
|
||||
$error++;
|
||||
|
||||
|
||||
//Check for errors
|
||||
if ($error != 0) {
|
||||
echo '<h3 class="error">'.__('There was a problem deleting the module').'</h3>';
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -25,11 +27,9 @@ check_login ();
|
|||
$offset = get_parameter ("offset", 0);
|
||||
$group_id = get_parameter ("group_id", 0);
|
||||
$ag_group = get_parameter ("ag_group", -1);
|
||||
|
||||
if (($ag_group == -1) && ($group_id != 0)) {
|
||||
$ag_group = $group_id;
|
||||
}
|
||||
|
||||
if (isset ($_GET["ag_group_refresh"])){
|
||||
$ag_group = get_parameter_get ("ag_group_refresh", -1);
|
||||
}
|
||||
|
@ -39,86 +39,10 @@ if (isset ($_GET["borrar_agente"])) { // if delete agent
|
|||
$id_agente = get_parameter_get ("borrar_agente");
|
||||
$agent_name = get_agent_name ($id_agente);
|
||||
$id_grupo = dame_id_grupo ($id_agente);
|
||||
$modules = array_keys (get_agent_modules ($id_agente));
|
||||
if (give_acl ($config["id_user"], $id_grupo, "AW")==1) {
|
||||
//Start transaction - this improves consistency
|
||||
process_sql ("SET AUTOCOMMIT=0;");
|
||||
process_sql ("START TRANSACTION;");
|
||||
$del_error = 0; //Delete error count. At the end it will be used to rollback or commit
|
||||
|
||||
// Firts delete from agents table
|
||||
$sql_delete = "DELETE FROM tagente WHERE id_agente = ".$id_agente;
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++; //in case process_sql returns false, increase error count
|
||||
|
||||
// Delete agent access table
|
||||
$sql_delete = "DELETE FROM tagent_access WHERE id_agent = ".$id_agente;
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++;
|
||||
|
||||
if (!empty ($modules) {
|
||||
// Delete tagente_datos data
|
||||
$sql_delete = "DELETE FROM tagente_datos WHERE id_agente_modulo IN (".implode (",",$modules).")";
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++;
|
||||
|
||||
// Delete tagente_datos_string data
|
||||
$sql_delete = "DELETE FROM tagente_datos_string WHERE id_agente_modulo IN (".implode (",",$modules).")";
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++;
|
||||
|
||||
// Delete from tagente_datos - relies on id_agente_modulo
|
||||
$sql_delete = "DELETE FROM tagente_datos_inc WHERE id_agente_modulo IN (".implode (",",$modules).")";
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++;
|
||||
|
||||
// Delete alerts from talerta_agente_modulo - relies on
|
||||
// id_agente_modulo
|
||||
$sql_delete = "DELETE FROM talerta_agente_modulo WHERE id_agente_modulo IN (".implode (",",$modules).")";
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++;
|
||||
}
|
||||
// Delete from tagente_modulo
|
||||
$sql_delete ="DELETE FROM tagente_modulo WHERE id_agente = ".$id_agente;
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++;
|
||||
|
||||
// Delete from tagente_estado
|
||||
$sql_delete ="DELETE FROM tagente_estado WHERE id_agente = ".$id_agente;
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++;
|
||||
|
||||
// Delete IP's from taddress table using taddress_agent
|
||||
$sql_delete = "DELETE FROM taddress WHERE
|
||||
id_a = ANY(SELECT id_a FROM taddress_agent WHERE id_agent = ".$id_agente.")";
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++;
|
||||
|
||||
// Delete IPs from taddress_agent table
|
||||
$sql_delete = "DELETE FROM taddress_agent WHERE id_agent = ".$id_agente;
|
||||
if (process_sql ($sql_delete) === false)
|
||||
$del_error++;
|
||||
|
||||
if ($del_error > 0) {
|
||||
process_sql ("ROLLBACK;");
|
||||
echo "<h3 class='error'>".__('There was a problem deleting agent')."</h3>";
|
||||
} else {
|
||||
process_sql ("COMMIT;");
|
||||
echo "<h3 class='suc'>".__('Agent deleted successfully')."</h3>";
|
||||
}
|
||||
unset ($sql_delete, $del_error); //Clean up
|
||||
process_sql ("SET AUTOCOMMIT=1;");
|
||||
audit_db($config["id_user"],$REMOTE_ADDR, "Agent \'$agent_name\' deleted", "Agent Management");
|
||||
|
||||
// Delete remote configuration
|
||||
$agent_md5 = md5($agent_name, FALSE);
|
||||
if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")) {
|
||||
// Agent remote configuration editor
|
||||
$file_name = $config["remote_config"] . "/" . $agent_md5 . ".conf";
|
||||
unlink ($file_name);
|
||||
$file_name = $config["remote_config"] . "/" . $agent_md5 . ".md5";
|
||||
unlink ($file_name);
|
||||
}
|
||||
$id_agentes[0] = $id_agente;
|
||||
if (delete_agent ($id_agentes))
|
||||
audit_db($config["id_user"],$REMOTE_ADDR, "Agent \'$agent_name\' deleted", "Agent Management");
|
||||
} else { // NO permissions.
|
||||
audit_db ($config["id_user"],$REMOTE_ADDR, "ACL Violation",
|
||||
"Trying to delete agent \'$agent_name\'");
|
||||
|
@ -230,49 +154,46 @@ if (mysql_num_rows($result)){
|
|||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
if (! give_acl($config["id_user"], $id_grupo, "AW"))
|
||||
continue;
|
||||
|
||||
// Agent name
|
||||
echo "<tr class='$tdcolor' >";
|
||||
echo "<td>";
|
||||
if ($row["disabled"] == 1){
|
||||
echo "<i>";
|
||||
}
|
||||
echo "<b><a href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=main&
|
||||
id_agente=".$row["id_agente"]."'>".substr(strtoupper($row["nombre"]),0,20)."</a></b>";
|
||||
if ($row["disabled"] == 1){
|
||||
echo "<i>";
|
||||
}
|
||||
echo "</td>";
|
||||
if (give_acl($config["id_user"], $id_grupo, "AW")==1){
|
||||
// Agent name
|
||||
echo "<tr><td class='$tdcolor'>";
|
||||
if ($row["disabled"] == 1){
|
||||
echo "<i>";
|
||||
}
|
||||
echo "<b><a href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=main&
|
||||
id_agente=".$row["id_agente"]."'>".substr(strtoupper($row["nombre"]),0,20)."</a></b>";
|
||||
if ($row["disabled"] == 1){
|
||||
echo "<i>";
|
||||
}
|
||||
echo "</td>";
|
||||
|
||||
echo "<td align='center'>";
|
||||
// Has remote configuration ?
|
||||
$agent_md5 = md5 ($row["nombre"], false);
|
||||
if (file_exists ($config["remote_config"]."/".$agent_md5.".md5")) {
|
||||
echo "<td align='center' class='$tdcolor'>";
|
||||
// Has remote configuration ?
|
||||
$agent_md5 = md5($row["nombre"], FALSE);
|
||||
if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")){
|
||||
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=".$row["id_agente"]."&disk_conf=" . $agent_md5 . "'>";
|
||||
echo "<img src='images/application_edit.png' border='0' align='middle' title='".__('Edit remote config')."'>";
|
||||
echo "</A>";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=".$row["id_agente"]."&disk_conf=" . $agent_md5 . "'>";
|
||||
echo "<img src='images/application_edit.png' border='0' align='middle' title='".__('Edit remote config')."'>";
|
||||
echo "</A>";
|
||||
}
|
||||
echo "</td>";
|
||||
|
||||
|
||||
// Operating System icon
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
print_os_icon ($row["id_os"], false);
|
||||
echo "</td>";
|
||||
// Group icon and name
|
||||
echo "<td class='$tdcolor' align='center'>".print_group_icon ($id_grupo, true)."</td>";
|
||||
// Description
|
||||
echo "<td class='".$tdcolor."f9'>".$row["comentarios"]."</td>";
|
||||
// Action
|
||||
echo "<td class='$tdcolor' align='center'><a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
borrar_agente=".$row["id_agente"]."'";
|
||||
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
echo "<img border='0' src='images/cross.png'></a></td>";
|
||||
}
|
||||
echo "</td>";
|
||||
|
||||
// Operating System icon
|
||||
echo "<td align='center'>";
|
||||
print_os_icon ($row["id_os"], false);
|
||||
echo "</td>";
|
||||
// Group icon and name
|
||||
echo "<td>";
|
||||
print_group_icon ($id_grupo);
|
||||
echo " ".get_group_name ($id_grupo)."</td>";
|
||||
// Description
|
||||
echo "<td class='".$tdcolor."f9'>".$row["comentarios"]."</td>";
|
||||
// Action
|
||||
echo "<td align='center'><a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
borrar_agente=".$row["id_agente"]."'";
|
||||
echo ' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
echo "<img src='images/cross.png'></a></td>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<table width='750'><tr><td align='right'>";
|
||||
|
@ -281,10 +202,10 @@ if (mysql_num_rows($result)){
|
|||
echo " </td></tr><tr><td>";
|
||||
}
|
||||
|
||||
// Create agent button
|
||||
echo "<form method='post' action='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&create_agent=1'>";
|
||||
echo "<input type='submit' class='sub next' name='crt'
|
||||
value='".__('Create agent')."'>";
|
||||
echo "</form></td></tr></table>";
|
||||
// Create agent button
|
||||
echo "<form method='post' action='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&create_agent=1'>";
|
||||
echo "<input type='submit' class='sub next' name='crt'
|
||||
value='".__('Create agent')."'>";
|
||||
echo "</form></td></tr></table>";
|
||||
?>
|
||||
|
|
|
@ -68,7 +68,7 @@ echo "</table>";
|
|||
// ==========================
|
||||
|
||||
echo "<h3>".__('Assigned modules')."</h3>";
|
||||
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = "'.$id_agente.'"
|
||||
$sql1='SELECT * FROM tagente_modulo WHERE delete_pending = 0 AND id_agente = "'.$id_agente.'"
|
||||
ORDER BY id_module_group, nombre ';
|
||||
$result=mysql_query($sql1);
|
||||
if ($row=mysql_num_rows($result)){
|
||||
|
|
|
@ -115,6 +115,12 @@ if (($form_moduletype == "networkserver" || $form_moduletype == "wmiserver") &&
|
|||
$form_plugin_pass = "";
|
||||
$form_plugin_parameter = "";
|
||||
$form_custom_id = "";
|
||||
$form_history_data = 1;
|
||||
$form_min_warning = 0;
|
||||
$form_max_warning = 0;
|
||||
$form_min_critical = 0;
|
||||
$form_max_critical = 0;
|
||||
$form_ff_event = 0;
|
||||
}
|
||||
|
||||
switch ($form_moduletype) {
|
||||
|
|
|
@ -70,7 +70,12 @@ if ($update_module_id != NULL){
|
|||
$form_prediction_module = $row['prediction_module'];
|
||||
$form_max_timeout = $row['max_timeout'];
|
||||
$form_custom_id = $row['custom_id'];
|
||||
|
||||
$form_history_data = $row['history_data'];
|
||||
$form_min_warning = $row['min_warning'];
|
||||
$form_max_warning = $row['max_warning'];
|
||||
$form_min_critical = $row['min_critical'];
|
||||
$form_max_critical = $row['max_critical'];
|
||||
$form_ff_event = $row['min_ff_event'];
|
||||
if ($tbl_disabled == 1){
|
||||
$disabled_status = 'checked="ckecked"';
|
||||
} else {
|
||||
|
@ -241,6 +246,28 @@ echo '<td class="datos2">'.__('Max. Value')."</td>";
|
|||
echo '<td class="datos2"><input type="text" name="form_maxvalue" size="5" value="'.$form_maxvalue.'"></td>';
|
||||
echo '</tr>';
|
||||
|
||||
// Warning value threshold
|
||||
echo '<tr>';
|
||||
echo '<td class="datos2">'.__('Warning status')."</td>";
|
||||
echo '<td class="datos2">'.__("Min").' <input type="text" name="form_min_warning" size="5" value="'.$form_min_warning.'">';
|
||||
echo ' '.__("Max").' <input type="text" name="form_max_warning" size="5" value="'.$form_max_warning.'"></td>';
|
||||
|
||||
// Critical value threshold
|
||||
echo '<td class="datos2">'.__('Critical status')."</td>";
|
||||
echo '<td class="datos2">'.__("Min").' <input type="text" name="form_min_critical" size="5" value="'.$form_min_critical.'">';
|
||||
echo ' '.__("Max").' <input type="text" name="form_max_critical" size="5" value="'.$form_max_critical.'"></td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo "<tr>";
|
||||
echo '<td class="datos2">'.__('Historical data')."</td>";
|
||||
echo '<td class="datos2">';
|
||||
print_checkbox ("form_history_data", 1, $form_history_data, false);
|
||||
|
||||
echo '<td class="datos">'.__('FF Threshold');
|
||||
pandora_help ("ff_threshold");
|
||||
echo '</td>';
|
||||
echo '<td class="datos"><input type="text" name="form_ff_event" size="5" value="'.$form_ff_event.'"></td>';
|
||||
|
||||
// Post process / Export server
|
||||
echo '<tr>';
|
||||
echo '<td class="datos">'.__('Post process');
|
||||
|
@ -268,14 +295,14 @@ echo '<td class="datos2" valign="top">'.__('TCP send');
|
|||
pandora_help ("tcp_send");
|
||||
echo "</td>";
|
||||
|
||||
// SNMP module, tcp_send contains the SNMP version
|
||||
if ($form_id_tipo_modulo >= 15 && $form_id_tipo_modulo <= 18) {
|
||||
echo '<td class="datos2"><textarea cols=20 style="height:55px;" name="form_tcp_send_void"></textarea>';
|
||||
echo '<td class="datos2" colspan=3 ><textarea cols=65 style="height:55px;" name="form_tcp_send_void"></textarea>';
|
||||
} else {
|
||||
echo '<td class="datos2"><textarea cols=20 style="height:55px;" name="form_tcp_send">'.$form_tcp_send.'</textarea>';
|
||||
echo '<td class="datos2" colspan=3 ><textarea cols=65 style="height:55px;" name="form_tcp_send">'.$form_tcp_send.'</textarea>';
|
||||
}
|
||||
echo '<tr>';
|
||||
echo '<td class="datos2" valign="top">'.__('TCP receive')."</td>";
|
||||
echo '<td class="datos2"><textarea cols=20 style="height:55px;" name="form_tcp_rcv">'.$form_tcp_rcv.'</textarea>';
|
||||
echo '<td class="datos2" colspan=3><textarea cols=65 style="height:55px;" name="form_tcp_rcv">'.$form_tcp_rcv.'</textarea>';
|
||||
echo '</tr>';
|
||||
|
||||
// Description
|
||||
|
|
|
@ -41,8 +41,6 @@ if ($update_settings) {
|
|||
$config["days_purge"] = (int) get_parameter ('days_purge', $config["days_purge"]);
|
||||
$config["graph_res"] = (int) get_parameter ('graph_res', $config["graph_res"]);
|
||||
$config["step_compact"] = (int) get_parameter ('step_compact', $config["step_compact"]);
|
||||
$config["show_unknown"] = (int) get_parameter ('show_unknown', $config["show_unknown"]);
|
||||
$config["show_lastalerts"] = (int) get_parameter ('show_lastalerts', $config["show_lastalerts"]);
|
||||
$config["style"] = (string) get_parameter ('style', $config["style"]);
|
||||
$config["remote_config"] = (string) get_parameter ('remote_config', $config["remote_config"]);
|
||||
$config["graph_color1"] = (string) get_parameter ('graph_color1', $config["graph_color1"]);
|
||||
|
@ -54,7 +52,7 @@ if ($update_settings) {
|
|||
$config["autoupdate"] = (string) get_parameter ('autoupdate', $config["autoupdate"]);
|
||||
$config["prominent_time"] = (string) get_parameter ('prominent_time', $config["prominent_time"]);
|
||||
$config["timesource"] = (string) get_parameter ('timesource', $config["timesource"]);
|
||||
|
||||
$config["event_view_hr"] = (int) get_parameter ('event_view_hr', $config["event_view_hr"]);
|
||||
$config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4);
|
||||
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE token = 'remote_config'");
|
||||
|
@ -64,8 +62,6 @@ if ($update_settings) {
|
|||
process_sql ("UPDATE tconfig SET VALUE='".$config["days_compact"]." ' WHERE token = 'days_compact'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["graph_res"]."' WHERE token = 'graph_res'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["step_compact"]."' WHERE token = 'step_compact'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["show_unknown"]."' WHERE token = 'show_unknown'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["show_lastalerts"]."' WHERE token = 'show_lastalerts'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["style"]."' WHERE token = 'style'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color1"]."' WHERE token = 'graph_color1'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color2"]."' WHERE token = 'graph_color2'");
|
||||
|
@ -76,6 +72,7 @@ if ($update_settings) {
|
|||
process_sql ("UPDATE tconfig SET VALUE='".$config["autoupdate"]."' WHERE token = 'autoupdate'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["prominent_time"]."' WHERE token = 'prominent_time'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["timesource"]."' WHERE token = 'timesource'");
|
||||
process_sql ("UPDATE tconfig SET VALUE='".$config["event_view_hr"]."' WHERE token = 'event_view_hr'");
|
||||
}
|
||||
|
||||
echo "<h2>".__('Pandora Setup')." > ";
|
||||
|
@ -118,18 +115,15 @@ $table->data[9][1] = print_input_text ('graph_res', $config["graph_res"], '', 5,
|
|||
$table->data[10][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
|
||||
$table->data[10][1] = print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true);
|
||||
|
||||
$table->data[11][0] = __('Show unknown modules in global view');
|
||||
$table->data[11][1] = print_checkbox ('show_unknown', 1, $config["show_unknown"], true);
|
||||
|
||||
$table->data[12][0] = __('Show last fired alerts in global view');
|
||||
$table->data[12][1] = print_checkbox ('show_lastalerts', 1, $config["show_lastalerts"], true);
|
||||
|
||||
$table->data[13][0] = __('Style template');
|
||||
$table->data[13][1] = print_select ($file_styles, 'style', $config["style"], '', '', '', true);
|
||||
|
||||
$table->data[14][0] = __('Block size for pagination');
|
||||
$table->data[14][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true);
|
||||
|
||||
$table->data[14][0] = __('Default hours for event view');
|
||||
$table->data[14][1] = print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true);
|
||||
|
||||
$table->data[15][0] = __('Timestamp or time comparation');
|
||||
$table->data[15][1] = __('Comparation in rollover').' ';
|
||||
$table->data[15][1] .= print_radio_button ('prominent_time', "timestamp", '', $config["prominent_time"], true);
|
||||
|
|
After Width: | Height: | Size: 477 B |
After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 872 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 891 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 807 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 805 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 817 B After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 785 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 834 B After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 844 B After Width: | Height: | Size: 1008 B |
Before Width: | Height: | Size: 846 B After Width: | Height: | Size: 1.1 KiB |
|
@ -119,6 +119,11 @@ if (!isset ($config['date_format'])) {
|
|||
process_sql ("INSERT INTO tconfig (token,value) VALUES ('date_format', '".$config['date_format']."')");
|
||||
}
|
||||
|
||||
if (!isset($config["event_view_hr"])){
|
||||
$config["event_view_hr"] = 8;
|
||||
process_sql ("INSERT INTO tconfig (token,value) VALUES ('event_view_hr', ".$config["event_view_hr"].")");
|
||||
}
|
||||
|
||||
if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') {
|
||||
$config['homeurl'] = '/'.$config['homeurl'];
|
||||
}
|
||||
|
|
|
@ -431,9 +431,7 @@ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands
|
|||
$number = $number/1000;
|
||||
}
|
||||
|
||||
$number = $number . $shorts[$pos];
|
||||
|
||||
return format_numeric ($number, $decimals); //This will actually do the rounding and the decimals
|
||||
return format_numeric ($number, $decimals). $shorts[$pos]; //This will actually do the rounding and the decimals
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -819,6 +819,7 @@ function dame_id_grupo ($id_agent) {
|
|||
return get_agent_group ($id_agent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of pandora data packets in the database.
|
||||
*
|
||||
|
@ -1153,6 +1154,31 @@ function show_server_type ($id){
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a module category name
|
||||
*
|
||||
* @param id_category Id category
|
||||
*
|
||||
* @return Name of the given category
|
||||
*/
|
||||
function give_modulecategory_name ($id_category) {
|
||||
switch ($id_category) {
|
||||
case 0:
|
||||
return __('Software agent data');
|
||||
break;
|
||||
case 1:
|
||||
return __('Software agent monitor');
|
||||
break;
|
||||
case 2:
|
||||
return __('Network agent data');
|
||||
break;
|
||||
case 3:
|
||||
return __('Network agent monitor');
|
||||
break;
|
||||
}
|
||||
return __('Unknown');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a network component group name
|
||||
*
|
||||
|
@ -2028,7 +2054,7 @@ function delete_agent ($id_agents) {
|
|||
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$id_agent = (int) $id_agent; //Cast as integer
|
||||
|
||||
$agent_name = get_agent_name ($id_agent);
|
||||
if ($id_agent < 1)
|
||||
continue; //If an agent is not an integer or invalid, don't process it
|
||||
|
||||
|
@ -2040,20 +2066,17 @@ function delete_agent ($id_agents) {
|
|||
$sql = sprintf ("SELECT id_ag FROM taddress_agent, taddress WHERE taddress_agent.id_a = taddress.id_a AND id_agent = %d", $id_agent);
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($result)
|
||||
foreach ($result as $row) {
|
||||
temp_sql_delete ("taddress_agent", "id_ag", $row["id_ag"]);
|
||||
}
|
||||
|
||||
//Standard data
|
||||
temp_sql_delete ("tagente_datos", "id_agente_modulo", $tmodbase);
|
||||
|
||||
//Incremental Data
|
||||
temp_sql_delete ("tagente_datos_inc", "id_agente_modulo", $tmodbase);
|
||||
|
||||
//String data
|
||||
temp_sql_delete ("tagente_datos_string", "id_agente_modulo", $tmodbase);
|
||||
|
||||
//Alert
|
||||
// We cannot delete tagente_datos and tagente_datos_string here
|
||||
// because it's a huge ammount of time. tagente_module has a special
|
||||
// field to mark for delete each module of agent deleted and in
|
||||
// daily maintance process, all data for that modules are deleted
|
||||
|
||||
//Alert
|
||||
temp_sql_delete ("tcompound_alert", "id_aam", "ANY(SELECT id_aam FROM talerta_agente_modulo WHERE id_agent = ".$id_agent.")");
|
||||
temp_sql_delete ("talerta_agente_modulo", "id_agente_modulo", $tmodbase);
|
||||
temp_sql_delete ("talerta_agente_modulo", "id_agent", $id_agent);
|
||||
|
@ -2076,11 +2099,23 @@ function delete_agent ($id_agents) {
|
|||
//tagente_modulo after this
|
||||
temp_sql_delete ("tagente_modulo", "id_agente", $id_agent);
|
||||
|
||||
process_sql ('UPDATE tagente_modulo SET delete_pending = 1, disabled = 1 WHERE id_agente = '. $id_agent);
|
||||
|
||||
//Access entries
|
||||
temp_sql_delete ("tagent_access", "id_agent", $id_agent);
|
||||
|
||||
//And at long last, the agent
|
||||
temp_sql_delete ("tagente", "id_agente", $id_agent);
|
||||
|
||||
// Delete remote configuration
|
||||
$agent_md5 = md5($agent_name, FALSE);
|
||||
if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")) {
|
||||
// Agent remote configuration editor
|
||||
$file_name = $config["remote_config"] . "/" . $agent_md5 . ".conf";
|
||||
unlink ($file_name);
|
||||
$file_name = $config["remote_config"] . "/" . $agent_md5 . ".md5";
|
||||
unlink ($file_name);
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors > 0) {
|
||||
|
@ -2187,6 +2222,7 @@ function get_agent_modules_count ($id_agent = 0) {
|
|||
$id_agent = safe_int ($id_agent, 1); //Make sure we're all int's and filter out bad stuff
|
||||
|
||||
if (empty ($id_agent)) {
|
||||
//If the array proved empty or the agent is less than 1 (eg. -1)
|
||||
$filter = '';
|
||||
} else {
|
||||
$filter = sprintf (" WHERE id_agente IN (%s)", implode (",", (array) $id_agent));
|
||||
|
@ -2228,7 +2264,6 @@ function get_agent_group ($id_agent) {
|
|||
function get_group_name ($id_group) {
|
||||
return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates an alert id or an array of alert id's
|
||||
*
|
||||
|
@ -2306,4 +2341,4 @@ function get_modulegroups () {
|
|||
function get_modulegroup_name ($modulegroup_id) {
|
||||
return (string) get_db_value ('name', 'tmodule_group', 'id_mg', (int) $modulegroup_id);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -152,7 +152,7 @@ function get_group_stats ($id_group) {
|
|||
$data["data_alerts_fired"] = 0;
|
||||
$data["data_alerts_fire_count"] = 0;
|
||||
|
||||
|
||||
|
||||
$cur_time = get_system_time ();
|
||||
|
||||
foreach ($result as $row) {
|
||||
|
|
|
@ -353,6 +353,7 @@ td.datos_id {
|
|||
.red, .redb, .redi, .error {
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
.sep {
|
||||
margin-left: 30px;
|
||||
border-bottom: 1px solid #708090;
|
||||
|
@ -361,6 +362,9 @@ td.datos_id {
|
|||
.green {
|
||||
color: #5a8629;
|
||||
}
|
||||
.yellow {
|
||||
color: #F3C500;
|
||||
}
|
||||
.greenb {
|
||||
color: #00aa00;
|
||||
}
|
||||
|
|
|
@ -383,6 +383,9 @@ td.datos_jus, td.datos2_jus {
|
|||
.green {
|
||||
color: #5a8629;
|
||||
}
|
||||
.yellow {
|
||||
color: #F3C500;
|
||||
}
|
||||
.greenb {
|
||||
color: #00aa00;
|
||||
}
|
||||
|
|
|
@ -374,6 +374,9 @@ td.datos_jus, td.datos2_jus {
|
|||
.green {
|
||||
color: #5a8629;
|
||||
}
|
||||
.yellow {
|
||||
color: #F3C500;
|
||||
}
|
||||
.greenb {
|
||||
color: #00aa00;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,9 @@ a.info_table:hover span{
|
|||
a.info:hover span {
|
||||
top: 45px;
|
||||
left: 20px;
|
||||
width: 100px;
|
||||
width: 120px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #aaaaaa;
|
||||
}
|
||||
a.info2:hover span {
|
||||
top: 8px;
|
||||
|
|
|
@ -44,10 +44,10 @@ if (isset ($_GET["delete"])) {
|
|||
|
||||
// Different query for string data type
|
||||
if (preg_match ("/string/", get_moduletype_name (get_agentmodule_type ($module_id)))) {
|
||||
$sql = sprintf ("SELECT * FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, get_system_time () - $period);
|
||||
$sql = sprintf ("SELECT * FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period);
|
||||
$string_type = 1;
|
||||
} else {
|
||||
$sql = sprintf ("SELECT * FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, get_system_time () - $period);
|
||||
$sql = sprintf ("SELECT * FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period);
|
||||
$string_type = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -182,25 +182,22 @@ if ($agents !== false) {
|
|||
$modules = get_db_all_rows_sql ($sql);
|
||||
if ($modules === false)
|
||||
$modules = array ();
|
||||
$estado_general = 0;
|
||||
$numero_modulos = 0;
|
||||
$numero_monitor = 0;
|
||||
$est_timestamp = "";
|
||||
$monitor_bad = 0;
|
||||
$monitor_ok = 0;
|
||||
$monitor_normal = 0;
|
||||
$monitor_warning = 0;
|
||||
$monitor_critical = 0;
|
||||
$monitor_down = 0;
|
||||
$numero_datamodules = 0;
|
||||
$estado_cambio = 0;
|
||||
$agent_down = 0;
|
||||
$now = get_system_time ();
|
||||
|
||||
// Calculate module/monitor totals for this agent
|
||||
foreach ($modules as $module) {
|
||||
$est_modulo = $module["estado"];
|
||||
$numero_modulos ++;
|
||||
$ultimo_contacto_modulo = $module["timestamp"];
|
||||
$module_interval = $module["module_interval"];
|
||||
$module_type = $module["id_tipo_modulo"];
|
||||
|
||||
|
||||
if ($module_interval > $biginterval)
|
||||
$biginterval = $module_interval;
|
||||
if ($module_interval != 0)
|
||||
|
@ -219,22 +216,16 @@ if ($agents !== false) {
|
|||
// Defines if Agent is down (interval x 2 > time last contact
|
||||
if ($seconds >= ($intervalo_comp * 2)) { // If (intervalx2) secs. ago we don't get anything, show alert
|
||||
$agent_down = 1;
|
||||
if ($est_modulo != 100)
|
||||
$numero_monitor++;
|
||||
if ($async == 0)
|
||||
$monitor_down++;
|
||||
} elseif ($est_modulo != 100) { // estado=100 are data modules
|
||||
$estado_general = $estado_general + $est_modulo;
|
||||
$estado_cambio = $estado_cambio + $module["cambio"];
|
||||
$numero_monitor ++;
|
||||
if ($est_modulo != 0)
|
||||
$monitor_bad++;
|
||||
else
|
||||
$monitor_ok++;
|
||||
} elseif ($est_modulo == 100) { // Data modules
|
||||
$numero_datamodules++;
|
||||
} else{
|
||||
if ($module["estado"] == 2)
|
||||
$monitor_warning ++;
|
||||
elseif ($module["estado"]== 1)
|
||||
$monitor_critical ++;
|
||||
else
|
||||
$monitor_normal ++;
|
||||
}
|
||||
$numero_modulos++;
|
||||
}
|
||||
// Color change for each line (1.2 beta2)
|
||||
if ($color == 1){
|
||||
|
@ -271,44 +262,41 @@ if ($agents !== false) {
|
|||
|
||||
// Show GROUP icon
|
||||
echo '<td class="'.$tdcolor.'" align="center">';
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=$id_grupo'>";
|
||||
echo print_group_icon ($id_grupo);
|
||||
//echo ' (<b>';
|
||||
//echo get_group_name ($id_grupo);
|
||||
//echo "</b>)";
|
||||
echo "</A>";
|
||||
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id=$id_grupo'>";
|
||||
print_group_icon ($id_grupo);
|
||||
|
||||
echo "<td class='$tdcolor'> ".
|
||||
$numero_modulos." <b>/</b> ".$numero_monitor;
|
||||
if ($monitor_bad != 0) {
|
||||
echo " <b>/</b> <span class='red'>".$monitor_bad."</span>";
|
||||
}
|
||||
if ($monitor_down != 0){
|
||||
echo " <b>/</b> <span class='grey'>".$monitor_down."</span>";
|
||||
}
|
||||
echo "<td class='$tdcolor'><b>".$numero_modulos." : ";
|
||||
if ($monitor_normal > 0)
|
||||
echo " <span class='green'>".$monitor_normal."</span>";
|
||||
if ($monitor_warning > 0)
|
||||
echo " <span class='yellow'>".$monitor_warning."</span>";
|
||||
if ($monitor_critical > 0)
|
||||
echo " <span class='red'>".$monitor_critical."</span>";
|
||||
if ($monitor_down > 0)
|
||||
echo " <span class='grey'>".$monitor_down."</span>";
|
||||
echo "</td>";
|
||||
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
if ($numero_monitor != 0){
|
||||
if ($estado_general != 0){
|
||||
if ($estado_cambio == 0){
|
||||
echo '<img src="images/pixel_red.png" width="40" height="18" title="'.__('At least one monitor fails').'" />';
|
||||
} else {
|
||||
echo '<img src="images/pixel_yellow.png" width="40" height="18" title="'.__('Change between Green/Red state').'" />';
|
||||
}
|
||||
} elseif ($monitor_ok > 0) {
|
||||
echo '<img src="images/pixel_green.png" width="40" height="18" title="'.__('All Monitors OK').'" />';
|
||||
} elseif ($monitor_down > 0) {
|
||||
if ($numero_modulos > 0){
|
||||
if ($agent_down > 0) {
|
||||
echo '<img src="images/pixel_fucsia.png" width="40" height="18" title="'.__('Agent down').'" />';
|
||||
} elseif ($numero_datamodules == 0) {
|
||||
echo '<img src="images/pixel_blue.png" width="40" height="18" title="'.__('Agent without data').'" />';
|
||||
}
|
||||
} else {
|
||||
if ($agent_down && $numero_datamodules == 0) {
|
||||
echo '<img src="images/pixel_fucsia.png" width="40" height="18" title="'.__('Agent down').'" />';
|
||||
} elseif ($numero_datamodules == 0) {
|
||||
echo '<img src="images/pixel_blue.png" width="40" height="18" title="'.__('Agent without data').'" />';
|
||||
elseif ($monitor_critical > 0){
|
||||
echo '<img src="images/pixel_red.png" width="40" height="18" title="'.__('At least one module in CRITICAL status').'" />';
|
||||
} elseif ($monitor_warning > 0) {
|
||||
echo '<img src="images/pixel_yellow.png" width="40" height="18" title="'.__('At least one module in WARNING status').'" />';
|
||||
} else {
|
||||
echo '<img src="images/pixel_gray.png" width="40" height="18" title="'.__('Agent without monitors').'" />';
|
||||
}
|
||||
echo '<img src="images/pixel_green.png" width="40" height="18" title="'.__('All Monitors OK').'" />';
|
||||
}
|
||||
} else {
|
||||
echo '<img src="images/pixel_blue.png" width="40" height="18" title="'.__('Agent without data').'" />';
|
||||
}
|
||||
|
||||
// checks if an alert was fired recently
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
if (give_disabled_group ($id_grupo)) {
|
||||
|
|
|
@ -46,7 +46,7 @@ echo '<div style="height: 10px"> </div>';
|
|||
//Floating div
|
||||
echo '<div style="float:right; width:300px; padding-top:16px;">';
|
||||
echo '<b>'.__('Agent access rate (24h)').'</b><br /><br />';
|
||||
echo '<img border="1" src="reporting/fgraph.php?id='.$id_agente.'&tipo=agentaccess&periodo=86400&height=70&width=280" />';
|
||||
echo '<img border="1" src="reporting/fgraph.php?id='.$id_agente.'&tipo=agentaccess&periodo=1440&height=70&width=280" />';
|
||||
echo '<div style="height:25px"> </div>';
|
||||
echo '<b>'.__('Events generated -by module-').'</b><br /><br />';
|
||||
echo '<img border="1" src="reporting/fgraph.php?tipo=event_module&width=250&height=180&id_agent='.$id_agente.'" />';
|
||||
|
@ -85,17 +85,15 @@ echo '<td class="datos2" colspan="2">'.$agent["comentarios"].'</td></tr>';
|
|||
// Group
|
||||
echo '<tr><td class="datos"><b>'.__('Group').'</b></td>';
|
||||
echo '<td class="datos" colspan="2">';
|
||||
print_group_icon ($agent["id_grupo"]);
|
||||
echo '</td></tr>';
|
||||
echo print_group_icon ($agent["id_grupo"]);
|
||||
echo ' (<b>';
|
||||
echo get_group_name ($agent["id_grupo"]);
|
||||
echo '</b>)</td></tr>';
|
||||
|
||||
// Agent version
|
||||
echo '<tr><td class="datos2"><b>'.__('Agent Version'). '</b></td>';
|
||||
echo '<td class="datos2" colspan="2">'.$agent["agent_version"].'</td></tr>';
|
||||
|
||||
// Total packets
|
||||
echo '<tr><td class="datos"><b>'. __('Total packets'). '</b></td>';
|
||||
echo '<td class="datos" colspan=2>'.get_agent_modules_data_count ($id_agente).'</td></tr>';
|
||||
|
||||
// Last contact
|
||||
echo '<tr><td class="datos2"><b>'.__('Last contact')." / ".__('Remote').'</b></td><td class="datos2 f9" colspan="2">';
|
||||
print_timestamp ($agent["ultimo_contacto"]);
|
||||
|
@ -129,4 +127,4 @@ echo '<td class="datos f9" colspan="2"><img src="reporting/fgraph.php?tipo=progr
|
|||
|
||||
//End of table
|
||||
echo '</table></div>';
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -48,6 +48,7 @@ if (isset ($_GET["update_netgroup"])) {
|
|||
|
||||
// Get group list that user has access
|
||||
$groups = get_user_groups ($config['id_user']);
|
||||
|
||||
$groups_info = array ();
|
||||
$total_agents = 0;
|
||||
$now = get_system_time ();
|
||||
|
@ -64,8 +65,9 @@ foreach ($groups as $id_group => $group_name) {
|
|||
|
||||
$total_agents += $agents;
|
||||
$group_info = array ('agent' => $agents,
|
||||
'ok' => 0,
|
||||
'bad' => 0,
|
||||
'normal' => 0,
|
||||
'critical' => 0,
|
||||
'warning' => 0,
|
||||
'alerts' => 0,
|
||||
'down' => 0,
|
||||
'icon' => dame_grupo_icono ($id_group),
|
||||
|
@ -73,13 +75,12 @@ foreach ($groups as $id_group => $group_name) {
|
|||
'name' => $group_name);
|
||||
|
||||
// SQL Join to get monitor status for agents belong this group
|
||||
$sql = sprintf ("SELECT tagente_estado.datos, tagente_estado.current_interval,
|
||||
$sql = sprintf ("SELECT tagente_estado.estado, tagente_estado.current_interval,
|
||||
tagente_estado.utimestamp
|
||||
FROM tagente, tagente_estado, tagente_modulo
|
||||
WHERE tagente.disabled = 0
|
||||
AND tagente.id_grupo = %d
|
||||
AND tagente.id_agente = tagente_estado.id_agente
|
||||
AND tagente_estado.estado != 100
|
||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.utimestamp != 0",
|
||||
|
@ -88,18 +89,15 @@ foreach ($groups as $id_group => $group_name) {
|
|||
if ($modules === false)
|
||||
$modules = array ();
|
||||
foreach ($modules as $module) {
|
||||
//if ($config["show_unknown"] > 0) {
|
||||
//this needs to be filled out somehow, but this was a serious bug. If that config var is set, it would short circuit both ok++ and bad++ returning empty for everything
|
||||
//}
|
||||
$seconds = $now - $module['utimestamp'];
|
||||
// Down = module/agent down (as in it didn't monitor in time)
|
||||
// Bad = module bad (as in it did monitor but it returned 0)
|
||||
if ($seconds >= ($module['current_interval'] * 2)) {
|
||||
$group_info["down"]++;
|
||||
} elseif ($module['datos'] != 0) {
|
||||
$group_info["ok"]++;
|
||||
$group_info['down']++;
|
||||
} elseif ($module['estado'] == 2) {
|
||||
$group_info['warning']++;
|
||||
} elseif ($module['estado'] == 1) {
|
||||
$group_info['critical']++;
|
||||
} else {
|
||||
$group_info["bad"]++;
|
||||
$group_info['normal']++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +111,7 @@ foreach ($groups as $id_group => $group_name) {
|
|||
AND tagente.id_agente = tagente_modulo.id_agente
|
||||
AND talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo",
|
||||
$id_group);
|
||||
$group_info["alerts"] = get_db_sql ($sql);
|
||||
$group_info["alerts"] = 0 + get_db_sql ($sql);
|
||||
}
|
||||
array_push ($groups_info, $group_info);
|
||||
}
|
||||
|
@ -160,17 +158,21 @@ for ($table = 0; $table < $ancho; $table++) {
|
|||
$group_name = $group_info["name"];
|
||||
$icono_grupo = $group_info["icon"];
|
||||
$icono_type = "";
|
||||
if ($group_info["bad"] > 0) {
|
||||
$icono_type .= '<img src="images/dot_red.png" title="'.__('Modules bad').'" />';
|
||||
if ($group_info['critical'] > 0) {
|
||||
$icono_type .= '<img src="images/dot_red.png" title="'.__('Modules critical').'" />';
|
||||
}
|
||||
|
||||
if ($group_info["ok"] > 0) {
|
||||
$icono_type .= '<img src="images/dot_green.png" title="'.__('Modules OK').'" />';
|
||||
if ($group_info["normal"] > 0) {
|
||||
$icono_type .= '<img src="images/dot_green.png" title="'.__('Modules normal').'" />';
|
||||
}
|
||||
|
||||
if ($group_info["warning"] > 0) {
|
||||
$icono_type .= '<img src="images/dot_yellow.png" title="'.__('Modules warning').'" />';
|
||||
}
|
||||
|
||||
// Show yellow light if there are recent alerts fired for this group
|
||||
if ($group_info["alerts"] > 0 ) {
|
||||
$icono_type .= '<img src="images/dot_yellow.png" title="'.__('Alerts fired').'" />';
|
||||
$icono_type .= '<img src="images/dot_magenta.png" title="'.__('Alerts fired').'" />';
|
||||
}
|
||||
|
||||
// Show grey light if there are agent down for this group
|
||||
|
@ -187,22 +189,24 @@ for ($table = 0; $table < $ancho; $table++) {
|
|||
$celda = '<td class="top" style="border: 5px solid #aeff21;" width="100">';
|
||||
|
||||
// Grey border if agent down
|
||||
if ($config["show_unknown"] > 0) {
|
||||
if ($group_info["down"] > 0)
|
||||
$celda = '<td class="top" style="border: 5px solid #aabbaa;" width="100">';
|
||||
}
|
||||
if ($group_info["down"] > 0)
|
||||
$celda = '<td class="top" style="border: 5px solid #aabbaa;" width="100">';
|
||||
|
||||
// Yellow border if agents with alerts
|
||||
// Yellow border if agents WARNING
|
||||
if ($group_info["warning"] > 0)
|
||||
$celda = '<td class="top" style="border: 5px solid #FFD800;" width="100">';
|
||||
|
||||
// Red border if agents CRITICAL
|
||||
if ($group_info["critical"] > 0)
|
||||
$celda = '<td class="top" style="border: 5px solid #FF0000;" width="100">';
|
||||
|
||||
// Magenta border if agents with alerts
|
||||
if ($group_info["alerts"] > 0)
|
||||
$celda = '<td class="top" style="border: 5px solid #ffea00;" width="100">';
|
||||
$celda = '<td class="top" style="border: 5px solid #F200FF;" width="100">';
|
||||
|
||||
// Red border if agents bad
|
||||
if ($group_info["bad"] > 0)
|
||||
$celda = '<td class="top" style="border: 5px solid #ff0000;" width="100">';
|
||||
|
||||
// Orange if alerts and down modules
|
||||
if (($group_info["bad"] > 0) && ($group_info["alerts"] > 0))
|
||||
$celda = '<td class="top" style="border: 5px solid #ffbb00;" width="100">';
|
||||
// Black if alerts and down modules
|
||||
if (($group_info["critical"] > 0) && ($group_info["alerts"] > 0))
|
||||
$celda = '<td class="top" style="border: 5px solid #000000;" width="100">';
|
||||
|
||||
$celda .= '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$group_info["id_group"].'" class="info">';
|
||||
|
||||
|
@ -210,25 +214,24 @@ for ($table = 0; $table < $ancho; $table++) {
|
|||
$celda .= '<img class="top" src="images/groups_small/'.$icono_grupo.'.png" height="32" width="32" alt="" />';
|
||||
|
||||
// Add float info table
|
||||
$celda .= '<span><table cellspacing="2" cellpadding="0" style="margin-left:2px;">
|
||||
<tr><th colspan="2" width="91">'.__('Agents').':</th></tr>
|
||||
$celda .= '<span><table cellspacing="0" cellpadding="0" style="margin-left:2px; background: #ffffff;">
|
||||
<tr><th colspan="2" width="140">'.__('Agents').':</th></tr>
|
||||
<tr><td colspan="2" class="datos" align="center"><b>'.$group_info["agent"].'</b></td></tr>
|
||||
</table>
|
||||
<table cellspacing="2" cellpadding="0" style="margin-left:2px">
|
||||
<tr><th colspan="2" width="90">'.__('Monitors').':</th></tr>
|
||||
<tr><td class="datos"><img src="images/b_green.png" align="top" alt="" />'.__('Ok').':</td>
|
||||
<td class="datos"><font class="greenb">'.$group_info["ok"].'</font></td></tr>
|
||||
<tr><td class="datos"><img src="images/b_red.png" align="top" alt="" />'.__('Fail').':</td>
|
||||
<td class="datos"><font class="redb">'.$group_info["bad"].'</font></td></tr>';
|
||||
<table cellspacing="0" cellpadding="2" style="margin-left:2px">
|
||||
|
||||
<tr><td class="datos"><img src="images/b_green.png" align="top" alt="" />'.__('Normal').'</td>
|
||||
<td class="datos"><b>'.format_for_graph ($group_info["normal"] , 1).'</b></td></tr>
|
||||
<tr><td class="datos"><img src="images/b_yellow.png" align="top" alt="" />'.__('Warning').'</td>
|
||||
<td class="datos"><b>'.format_for_graph ($group_info["warning"] , 1).'</b></td></tr>
|
||||
<tr><td class="datos"><img src="images/b_red.png" align="top" alt="" />'.__('Critical').'</td>
|
||||
<td class="datos"><b>'.format_for_graph ($group_info["critical"] , 1).'</b></td></tr>';
|
||||
|
||||
if ($config["show_unknown"] > 0) {
|
||||
$celda .= '<tr><td class="datos"><img src="images/b_white.png" align="top" alt="" />'.__('Down').':</td>
|
||||
<td class="datos"><font class="redb">'.$group_info["down"].'</font></td></tr>';
|
||||
}
|
||||
$celda .= '<tr><td class="datos"><img src="images/b_white.png" align="top" alt="" />'.__('Down').'</td>
|
||||
<td class="datos"><b>'.format_for_graph ($group_info["down"] , 1).'</b></td></tr>';
|
||||
|
||||
if ($config["show_lastalerts"] == 1)
|
||||
$celda .= '<tr><td class="datos"><img src="images/b_yellow.png" align="top" alt="" />'.__('Alerts').':</td>
|
||||
<td class="datos"><font class="grey">'.$group_info["alerts"].'</font></td></tr>';
|
||||
$celda .= '<tr><td class="datos"><img src="images/b_magenta.png" align="top" alt="" />'.__('Alerts').'</td>
|
||||
<td class="datos"><b>'.$group_info["alerts"].'</b></td></tr>';
|
||||
|
||||
$celda .= "</table></span></a>";
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ if (!isset ($id_agente)) {
|
|||
$sql = sprintf ("SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.id_agente = %d
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.delete_pending = 0
|
||||
AND tagente_estado.utimestamp != 0
|
||||
ORDER BY tagente_modulo.nombre", $id_agente);
|
||||
|
||||
|
@ -53,14 +54,6 @@ $table->head[4] = __('Status');
|
|||
$table->head[5] = __('Interval');
|
||||
$table->head[6] = __('Last contact');
|
||||
|
||||
//Since PHP's Zend optimizer references $var2 in case you do $var = $var2, objects get referenced too so we can't do $table = $table_data
|
||||
$table_data->head = $table->head; //Duplicate table for data modules
|
||||
$table_data->class = $table->class;
|
||||
$table_data->data = array ();
|
||||
$table_data->cellspacing = $table->cellspacing;
|
||||
$table_data->cellpadding = $table->cellpadding;
|
||||
$table_data->width = $table->width;
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$data = array ();
|
||||
if (($module["id_modulo"] != 1) && ($module["id_tipo_modulo"] != 100)) {
|
||||
|
@ -74,15 +67,17 @@ foreach ($modules as $module) {
|
|||
}
|
||||
|
||||
$data[1] = '<img src="images/'.show_icon_type ($module["id_tipo_modulo"]).'" border="0">';
|
||||
if (give_acl ($config['id_user'], $id_grupo, "AW"))
|
||||
$data[1] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=2505&tab=module&update_module='.$module["id_agente_modulo"].'&moduletype=2#modules"><img src="images/config.png"></a>';
|
||||
$data[2] = substr ($module["nombre"], 0, 25);
|
||||
$data[3] = substr ($module["descripcion"], 0, 35);
|
||||
|
||||
if ($module["estado"] == 1 && $module["cambio"] == 1) {
|
||||
$data[4] = '<img src="images/pixel_yellow.png" width="40" height="18" title="'.__('Change between Green/Red state').'">';
|
||||
if ($module["estado"] == 2) {
|
||||
$data[4] = '<img src="images/pixel_yellow.png" width="40" height="18" title="'.__('WARNING'). ' : '. $module["datos"].'">';
|
||||
} elseif ($module["estado"] == 1) {
|
||||
$data[4] = '<img src="images/pixel_red.png" width="40" height="18" title="'.__('At least one monitor fails').'">';
|
||||
$data[4] = '<img src="images/pixel_red.png" width="40" height="18" title="'.__('CRITICAL'). ' : '. $module["datos"].'">';
|
||||
} else {
|
||||
$data[4] = '<img src="images/pixel_green.png" width="40" height="18" title="'.__('All Monitors OK').'">';
|
||||
$data[4] = '<img src="images/pixel_green.png" width="40" height="18" title="'.__('NORMAL'). ' : '. $module["datos"].'">';
|
||||
}
|
||||
|
||||
if ($module["module_interval"] > 0) {
|
||||
|
@ -99,14 +94,7 @@ foreach ($modules as $module) {
|
|||
}
|
||||
$data[6] .= print_timestamp ($module["utimestamp"], true);
|
||||
$data[6] .= '</span>';
|
||||
|
||||
if ($module["estado"] != 100) {
|
||||
array_push ($table->data, $data);
|
||||
//Monitor modules go on $table
|
||||
} else {
|
||||
array_push ($table_data->data, $data);
|
||||
//Data modules go on $table_data
|
||||
}
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
if (empty ($table->data)) {
|
||||
|
@ -116,12 +104,6 @@ if (empty ($table->data)) {
|
|||
print_table ($table);
|
||||
}
|
||||
|
||||
if (empty ($table_data->data)) {
|
||||
echo '<div class="nf">'.__('This agent doesn\'t have any active data modules').'</div>';
|
||||
} else {
|
||||
echo "<h3>".__('Full list of Data Modules')."</h3>";
|
||||
print_table ($table_data);
|
||||
}
|
||||
unset ($table);
|
||||
unset ($table_data);
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -110,6 +110,10 @@ if (mysql_num_rows ($result3)) {
|
|||
echo salida_limpia(substr($row3["nombre"],0,15));
|
||||
echo "</td><td class='".$tdcolor."'>";
|
||||
echo "<img src='images/".show_icon_type($row3["id_tipo_modulo"])."' border=0>";
|
||||
if (give_acl ($config['id_user'], $id_grupo, "AW"))
|
||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=2505&tab=module&update_module='.$row3["id_agente_modulo"].'&moduletype=2#modules"><img src="images/config.png"></a>';
|
||||
|
||||
|
||||
echo "</td><td class='".$tdcolor."'>";
|
||||
if ($row3["module_interval"] != 0){
|
||||
echo $row3["module_interval"];
|
||||
|
@ -130,7 +134,7 @@ if (mysql_num_rows ($result3)) {
|
|||
}
|
||||
echo "</td>";
|
||||
}
|
||||
if ($row3["id_tipo_modulo"] == 100) {
|
||||
if (($row3["id_tipo_modulo"] == 100) OR ($row3['history_data'] == 0)) {
|
||||
echo "<td class='".$tdcolor."f9' colspan='2' title='".$row3["datos"]."'>";
|
||||
echo substr(salida_limpia($row3["datos"]),0,12);
|
||||
} else {
|
||||
|
@ -180,12 +184,17 @@ if (mysql_num_rows ($result3)) {
|
|||
echo '<a href="javascript:'.$link.'"><img src="images/grafica_h.png" border=0></a>';
|
||||
}
|
||||
|
||||
// RAW Table data
|
||||
echo "<td class=".$tdcolor." width=70>";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&period=2592000&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.png'></a> ";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&period=604800&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.png'></a> ";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&period=86400&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.png'></a>";
|
||||
|
||||
|
||||
if ($row3['history_data'] == 1){
|
||||
// RAW Table data
|
||||
echo "<td class=".$tdcolor." width=70>";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=2592000&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.png'></a> ";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=604800&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.png'></a> ";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=86400&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.png'></a>";
|
||||
} else {
|
||||
echo "<td class=".$tdcolor."></td>";
|
||||
}
|
||||
|
||||
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
if ($row3["timestamp"] == "0000-00-00 00:00:00"){
|
||||
|
|
|
@ -171,7 +171,7 @@ if ($flag_alert == 1 && give_acl ($config['id_user'], $id_grupo, "AW")) {
|
|||
|
||||
echo "<div id='menu_tab_frame_view'>";
|
||||
echo "<div id='menu_tab_left'><ul class='mn'><li class='view'>
|
||||
<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/bricks.png' class='top' border=0> ".substr(get_agent_name($id_agente),0,15)." - ".__('View mode')."</a>";
|
||||
<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/bricks.png' class='top' border=0> ".substr(get_agent_name($id_agente),0,21)."</a>";
|
||||
echo "</li>";
|
||||
echo "</ul></div>";
|
||||
$tab = get_parameter ("tab", "main");
|
||||
|
@ -197,7 +197,7 @@ echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=
|
|||
echo "</li>";
|
||||
|
||||
// Data
|
||||
if ($tab == "data") {
|
||||
if (($tab == "data") OR ($tab == "data_view")){
|
||||
echo "<li class='nomn_high'>";
|
||||
} else {
|
||||
echo "<li class='nomn'>";
|
||||
|
@ -223,6 +223,14 @@ if ($tab == "sla") {
|
|||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente=$id_agente'><img src='images/images.png' class='top' border=0> ".__('S.L.A')." </a>";
|
||||
echo "</li>";
|
||||
|
||||
// Group tab
|
||||
echo "<li class='nomn'>";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$id_grupo'>";
|
||||
echo "<img src='images/god4.png' class='top' border=0> ";
|
||||
echo __("Group");
|
||||
echo "</a></li>";
|
||||
|
||||
|
||||
// Inventory
|
||||
enterprise_hook ('inventory_tab');
|
||||
|
||||
|
@ -244,6 +252,9 @@ case "main":
|
|||
require "estado_alertas.php";
|
||||
require "status_events.php";
|
||||
break;
|
||||
case "data_view":
|
||||
require "datos_agente.php";
|
||||
break;
|
||||
case "data":
|
||||
require "estado_ultimopaquete.php";
|
||||
break;
|
||||
|
|
|
@ -60,6 +60,8 @@ $id_agent = (int) get_parameter ("id_agent", -1); //-1 all, 0 system
|
|||
$id_event = (int) get_parameter ("id_event", -1);
|
||||
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
||||
$groups = get_user_groups ($config["id_user"], "IR");
|
||||
$event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]);
|
||||
$id_user_ack = (int) get_parameter ("id_user_ack", 0);
|
||||
|
||||
//Group selection
|
||||
if ($ev_group > 1 && in_array ($ev_group, array_keys ($groups))) {
|
||||
|
@ -90,6 +92,11 @@ if ($id_agent != -1)
|
|||
$sql_post .= " AND id_agente = ".$id_agent;
|
||||
if ($id_event != -1)
|
||||
$sql_post .= " AND id_evento = ".$id_event;
|
||||
if ($id_user_ack != 0)
|
||||
$sql_post .= " AND id_usuario == '$id_user_ack' ";
|
||||
|
||||
$unixtime = date("U") - ($event_view_hr*60*60);
|
||||
$sql_post .= " AND utimestamp > $unixtime ";
|
||||
|
||||
$url = "index.php?sec=eventos&sec2=operation/events/events&search=$search&event_type=$event_type&severity=$severity&status=$status&ev_group=$ev_group&refr=60&id_agent=$id_agent&id_event=$id_event&pagination=$pagination";
|
||||
|
||||
|
@ -104,14 +111,12 @@ if ($config["pure"] == 1) {
|
|||
echo "</h2>";
|
||||
echo '<a href="#" id="tgl_event_control"><b>'.__('Event control filter').'</b> '.'<img src="images/wand.png" /></a>';
|
||||
|
||||
if ($config["pure"] == 1) {
|
||||
|
||||
echo '<div id="event_control" style="display:none">';
|
||||
} else {
|
||||
echo '<div id="event_control" style="display:block">'; //There is no value all to property display
|
||||
}
|
||||
|
||||
// Table for filter controls
|
||||
echo '<form method="post" action="index.php?sec=eventos&sec2=operation/events/events&refr=60&pure='.$config["pure"].'">';
|
||||
echo '<table style="width:500px; float:left;" cellpadding="4" cellspacing="4" class="databox"><tr>';
|
||||
echo '<table style="width:550px; float:left;" cellpadding="4" cellspacing="4" class="databox"><tr>';
|
||||
|
||||
// Group combo
|
||||
echo "<td>".__('Group')."</td><td>";
|
||||
|
@ -183,8 +188,21 @@ echo "<td>";
|
|||
print_select ($lpagination, "pagination", $pagination, 'javascript:this.form.submit();', __('Default'), $config["block_size"]);
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>".__('Max. hours old')."</td>";
|
||||
echo "<td>";
|
||||
print_input_text ('event_view_hr', $event_view_hr, '', 5);
|
||||
echo "</td>";
|
||||
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td>".__('User ack.')."</td>";
|
||||
echo "<td>";
|
||||
print_select_from_sql ("SELECT id_usuario, nombre_real FROM tusuario", "id_user_ack", $id_user_ack,'', __('Any'), '0', false, false, true);
|
||||
echo "</td>";
|
||||
|
||||
|
||||
//The buttons
|
||||
echo '<td colspan="2">';
|
||||
echo '<td colspan=3>';
|
||||
print_submit_button (__('Update'), '', false, 'class="sub upd"');
|
||||
|
||||
// CSV
|
||||
|
@ -198,12 +216,12 @@ echo ' <a target="_top" href="operation/events/events_rss.php?ev_group='.$e
|
|||
|
||||
|
||||
echo "</td></tr></table></form>"; //This is the internal table
|
||||
echo '<div style="width:250px; float:left;"><img src="reporting/fgraph.php?tipo=group_events&width=250&height=180&url='.rawurlencode ($sql_post).'" border="0"></div>';
|
||||
echo '<div style="width:220px; float:left;"><img src="reporting/fgraph.php?tipo=group_events&width=220&height=180&url='.rawurlencode ($sql_post).'" border="0"></div>';
|
||||
echo '</div><div style="clear:both"> </div>';
|
||||
|
||||
$sql = "SELECT * FROM tevento WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE 1=1 ".$sql_post;
|
||||
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE id_evento > 0 ".$sql_post;
|
||||
$total_events = get_db_sql ($sql);
|
||||
|
||||
if (empty ($result)) {
|
||||
|
@ -270,11 +288,10 @@ foreach ($result as $row) {
|
|||
|
||||
// Colored box
|
||||
if ($row["estado"] == 0) {
|
||||
$data[0] = '<img src="images/pixel_red.png" width="20" height="35" title="'.get_priority_name ($row["criticity"]).'" />';
|
||||
$data[0] = '<img src="images/pixel_red.png" width="20" height="20" title="'.get_priority_name ($row["criticity"]).'" />';
|
||||
} else {
|
||||
$data[0] = '<img src="images/pixel_green.png" width="20" height="35" title="'.get_priority_name ($row["criticity"]).'" />';
|
||||
$data[0] = '<img src="images/pixel_green.png" width="20" height="20" title="'.get_priority_name ($row["criticity"]).'" />';
|
||||
}
|
||||
|
||||
|
||||
switch ($row["event_type"]) {
|
||||
case "alert_recovered":
|
||||
|
@ -283,12 +300,19 @@ foreach ($result as $row) {
|
|||
case "alert_manual_validation":
|
||||
$data[1] = '<img src="images/eye.png" title="'.__('Manual Alert Validation').'" />';
|
||||
break;
|
||||
case "monitor_up":
|
||||
$data[1] = '<img src="images/lightbulb.png" title="'.__('Monitor Up').'" />';
|
||||
case "going_up_warning":
|
||||
$data[1] = '<img src="images/b_yellow.png" title="'.__('Going up Warning').'" />';
|
||||
break;
|
||||
case "monitor_down":
|
||||
$data[1] = '<img src="images/lightbulb_off.png" title="'.__('Monitor Down').'" />';
|
||||
case "going_up_critical":
|
||||
$data[1] = '<img src="images/b_red.png" title="'.__('Going up Critical').'" />';
|
||||
break;
|
||||
case "going_down_normal":
|
||||
$data[1] = '<img src="images/b_green.png" title="'.__('Going to Normal').'" />';
|
||||
break;
|
||||
case "going_down_warning":
|
||||
$data[1] = '<img src="images/b_yellow.png" title="'.__('Going down Warning').'" />';
|
||||
break;
|
||||
|
||||
case "alert_fired":
|
||||
$data[1] = '<img src="images/bell.png" title="'.__('Alert Fired').'" />';
|
||||
break;
|
||||
|
@ -343,7 +367,11 @@ foreach ($result as $row) {
|
|||
$data[5] = print_group_icon ($row["id_grupo"], true);
|
||||
|
||||
if (!empty ($row["estado"])) {
|
||||
$data[6] = '<a href="index.php?sec=usuario&sec2=operation/user/user_edit&ver='.$row["id_usuario"].'" title="'.dame_nombre_real ($row["id_usuario"]).'">'.substr ($row["id_usuario"],0,8).'</a>';
|
||||
if ($row["id_usuario"] != '0' && $row["id_usuario"] != ''){
|
||||
$data[6] = '<a href="index.php?sec=usuario&sec2=operation/user/user_edit&ver='.$row["id_usuario"].'" title="'.dame_nombre_real ($row["id_usuario"]).'">'.substr ($row["id_usuario"],0,8).'</a>';
|
||||
} else {
|
||||
$data[6]=__('System');
|
||||
}
|
||||
} else {
|
||||
$data[6] = '';
|
||||
}
|
||||
|
@ -388,20 +416,22 @@ if (!empty ($table->data)) {
|
|||
}
|
||||
unset ($table);
|
||||
|
||||
echo '<div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
|
||||
echo '<h3>'.__('Status').'</h3>';
|
||||
echo '<img src="images/dot_green.png" /> - '.__('Validated event');
|
||||
echo '<br />';
|
||||
echo '<img src="images/dot_red.png" /> - '.__('Not validated event');
|
||||
if ($config["pure"]== 0) {
|
||||
echo '<div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
|
||||
echo '<h3>'.__('Status').'</h3>';
|
||||
echo '<img src="images/dot_green.png" /> - '.__('Validated event');
|
||||
echo '<br />';
|
||||
echo '<img src="images/dot_red.png" /> - '.__('Not validated event');
|
||||
|
||||
echo '</div><div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
|
||||
echo '<h3>'.__('Action').'</h3>';
|
||||
echo '<img src="images/ok.png" /> - '.__('Validate event');
|
||||
echo '<br />';
|
||||
echo '<img src="images/cross.png" /> - '.__('Delete event');
|
||||
echo '<br />';
|
||||
echo '<img src="images/page_lightning.png" /> - '.__('Create incident');
|
||||
echo '</div><div style="clear:both;"> </div>';
|
||||
echo '</div><div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
|
||||
echo '<h3>'.__('Action').'</h3>';
|
||||
echo '<img src="images/ok.png" /> - '.__('Validate event');
|
||||
echo '<br />';
|
||||
echo '<img src="images/cross.png" /> - '.__('Delete event');
|
||||
echo '<br />';
|
||||
echo '<img src="images/page_lightning.png" /> - '.__('Create incident');
|
||||
echo '</div><div style="clear:both;"> </div>';
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript" src="include/javascript/jquery.js"></script>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Pandora FMS - the Flexible Monitoring System
|
||||
-- ============================================
|
||||
-- Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
|
||||
-- Copyright (c) 2005-2009 Artica Soluciones Tecnológicas, http://www.artica.es
|
||||
-- Please see http://pandora.sourceforge.net for full contribution list
|
||||
|
||||
-- This program is free software; you can redistribute it and/or
|
||||
|
@ -69,11 +69,8 @@ CREATE TABLE IF NOT EXISTS `tagente_datos` (
|
|||
`id_agente_datos` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` int(10) unsigned NOT NULL default '0',
|
||||
`datos` double(18,2) default NULL,
|
||||
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`id_agente` int(10) unsigned NOT NULL default '0',
|
||||
`utimestamp` bigint(20) default '0',
|
||||
PRIMARY KEY (`id_agente_datos`),
|
||||
KEY `data_index2` (`id_agente`,`id_agente_modulo`),
|
||||
KEY `data_index1` (`id_agente_modulo`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
|
||||
|
||||
|
@ -81,7 +78,6 @@ CREATE TABLE IF NOT EXISTS `tagente_datos_inc` (
|
|||
`id_adi` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` int(10) unsigned NOT NULL default '0',
|
||||
`datos` double(18,2) default NULL,
|
||||
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`utimestamp` int(20) unsigned default '0',
|
||||
PRIMARY KEY (`id_adi`),
|
||||
KEY `data_inc_index_1` (`id_agente_modulo`)
|
||||
|
@ -92,19 +88,17 @@ CREATE TABLE IF NOT EXISTS `tagente_datos_string` (
|
|||
`id_tagente_datos_string` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` int(10) unsigned NOT NULL default '0',
|
||||
`datos` text NOT NULL,
|
||||
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`id_agente` int(10) unsigned NOT NULL default '0',
|
||||
`utimestamp` int(20) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id_tagente_datos_string`),
|
||||
KEY `data_string_index_1` (`id_agente`,`id_agente_modulo`)
|
||||
KEY `data_string_index_1` (`id_agente_modulo`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- delete "cambio" not used anymore
|
||||
CREATE TABLE `tagente_estado` (
|
||||
`id_agente_estado` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` int(10) NOT NULL default '0',
|
||||
`datos` varchar(255) NOT NULL default '',
|
||||
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`cambio` int(4) NOT NULL default '0',
|
||||
`estado` int(4) NOT NULL default '0',
|
||||
`id_agente` int(10) NOT NULL default '0',
|
||||
`last_try` datetime default NULL,
|
||||
|
@ -112,6 +106,8 @@ CREATE TABLE `tagente_estado` (
|
|||
`current_interval` int(8) unsigned NOT NULL default '0',
|
||||
`running_by` smallint(4) unsigned default '0',
|
||||
`last_execution_try` bigint(20) NOT NULL default '0',
|
||||
`status_changes` tinyint(4) default 0,
|
||||
`last_status` tinyint(4) default 0,
|
||||
PRIMARY KEY (`id_agente_estado`),
|
||||
KEY `status_index_1` (`id_agente_modulo`),
|
||||
KEY `status_index_2` (`id_agente_modulo`,`estado`),
|
||||
|
@ -120,6 +116,7 @@ CREATE TABLE `tagente_estado` (
|
|||
KEY `last_execution_try` (`last_execution_try`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Probably last_execution_try index is not useful and loads more than benefits
|
||||
|
||||
-- id_modulo now uses tmodule
|
||||
-- ---------------------------
|
||||
|
@ -158,11 +155,17 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
|
|||
`prediction_module` bigint(14) default '0',
|
||||
`max_timeout` int(4) unsigned default '0',
|
||||
`custom_id` varchar(255) default '',
|
||||
`history_data` tinyint(1) unsigned default '1',
|
||||
`min_warning` double(18,2) default 0,
|
||||
`max_warning` double(18,2) default 0,
|
||||
`min_critical` double(18,2) default 0,
|
||||
`max_critical` double(18,2) default 0,
|
||||
`min_ff_event` int(4) unsigned default '0',
|
||||
`delete_pending` int(1) unsigned default 0,
|
||||
PRIMARY KEY (`id_agente_modulo`),
|
||||
KEY `main_idx` (`id_agente_modulo`,`id_agente`),
|
||||
KEY `tam_agente` (`id_agente`),
|
||||
KEY `id_tipo_modulo` (`id_tipo_modulo`),
|
||||
KEY `tam_plugin` (`id_plugin`),
|
||||
KEY `disabled` (`disabled`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -171,7 +174,6 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
|
|||
CREATE TABLE IF NOT EXISTS `tagent_access` (
|
||||
`id_ac` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_agent` int(10) unsigned NOT NULL default '0',
|
||||
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (`id_ac`),
|
||||
KEY `agent_index` (`id_agent`)
|
||||
|
@ -297,7 +299,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
|
|||
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`evento` varchar(255) NOT NULL default '',
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
`event_type` enum('unknown','monitor_up','monitor_down','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent') default 'unknown',
|
||||
`event_type` enum('unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal') default 'unknown',
|
||||
`id_agentmodule` int(10) NOT NULL default '0',
|
||||
`id_alert_am` int(10) NOT NULL default '0',
|
||||
`criticity` int(4) unsigned NOT NULL default '0',
|
||||
|
@ -307,10 +309,10 @@ CREATE TABLE IF NOT EXISTS `tevento` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Criticity: 0 - Maintance (grey)
|
||||
-- Criticity: 1 - Low (green)
|
||||
-- Criticity: 2 - Normal (blue)
|
||||
-- Criticity: 3 - Warning (yellow)
|
||||
-- Criticity: 4 - Critical (red)
|
||||
-- Criticity: 1 - Informational (blue)
|
||||
-- Criticity: 2 - Normal (green) (status 0)
|
||||
-- Criticity: 3 - Warning (yellow) (status 2)
|
||||
-- Criticity: 4 - Critical (red) (status 1)
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tgrupo` (
|
||||
`id_grupo` mediumint(4) unsigned NOT NULL auto_increment,
|
||||
|
@ -397,6 +399,12 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` (
|
|||
`plugin_pass` varchar(250) default '',
|
||||
`plugin_parameter` text,
|
||||
`max_timeout` tinyint(3) unsigned default '0',
|
||||
`history_data` tinyint(1) unsigned default '1',
|
||||
`min_warning` double(18,13) default 0,
|
||||
`max_warning` double(18,13) default 0,
|
||||
`min_critical` double(18,13) default 0,
|
||||
`max_critical` double(18,13) default 0,
|
||||
`min_ff_event` int(4) unsigned default '0',
|
||||
PRIMARY KEY (`id_nc`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
@ -47,6 +47,18 @@ function graphic_error () {
|
|||
imagePng($imgPng);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a MySQL timestamp date, formatted with actual date MINUS X minutes,
|
||||
*
|
||||
* @param int Date in unix format (timestamp)
|
||||
*
|
||||
* @return string Formatted date string (YY-MM-DD hh:mm:ss)
|
||||
*/
|
||||
function dame_fecha ($mh) {
|
||||
$mh *= 60;
|
||||
return date ("Y-m-d H:i:00", time() - $mh);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a short timestamp data, D/M h:m
|
||||
*
|
||||
|
@ -458,9 +470,9 @@ function grafico_modulo_sparse ($id_agente_modulo, $periodo, $show_event,
|
|||
$min_value = 0;
|
||||
|
||||
// Get the first data outsite (to the left---more old) of the interval given
|
||||
$sql = sprintf ('SELECT datos FROM tagente_datos
|
||||
$sql = sprintf ('SELECT datos, utimestamp FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp < %d ORDER BY utimestamp DESC', $id_agente_modulo, $fechatope);
|
||||
AND utimestamp < %d ORDER BY utimestamp DESC LIMIT 1', $id_agente, $id_agente_modulo, $fechatope);
|
||||
$previous = (float) get_db_sql ($sql);
|
||||
|
||||
$sql = sprintf ('SELECT datos,utimestamp FROM tagente_datos
|
||||
|
@ -787,9 +799,9 @@ function graphic_agentaccess ($id_agent, $periodo, $width, $height) {
|
|||
|
||||
}*/
|
||||
$intervalo = 24;
|
||||
$fechatope = get_system_time () - $periodo;
|
||||
|
||||
$horasint = $periodo / $intervalo;
|
||||
$UNIXdate = date('U');
|
||||
$fechatope = $UNIXdate - (60*24*60);
|
||||
$horasint = 86400 / $intervalo;
|
||||
|
||||
// $intervalo now stores "ideal" interval }
|
||||
// interval is the number of rows that will store data. more rows, more resolution
|
||||
|
@ -804,24 +816,25 @@ function graphic_agentaccess ($id_agent, $periodo, $width, $height) {
|
|||
for ($i = 0; $i < $intervalo; $i++) {
|
||||
$valores[$i][0] = 0; // [0] Valor (contador)
|
||||
$valores[$i][1] = 0; // [0] Valor (contador)
|
||||
$valores[$i][2] = date ("Y-m-d H:i:00", get_system_time () - ($horasint * $i)); // [2] Rango superior de fecha para ese rango
|
||||
$valores[$i][3] = date ("Y-m-d H:i:00", get_system_time () - ($horasint * ($i+1))); // [3] Rango inferior de fecha para ese rango
|
||||
$valores[$i][2] = $fechatope + ($horasint * $i); // [2] Rango superior de fecha para ese rango
|
||||
$valores[$i][3] = $fechatope + ($horasint*($i+1)); // [3] Rango inferior de fecha para ese rango
|
||||
}
|
||||
$sql1="SELECT timestamp FROM tagent_access WHERE id_agent = ".$id_agent." and timestamp > '".date ("Y-m-d H:i:00", $fechatope)."'";
|
||||
$sql1="SELECT utimestamp FROM tagent_access WHERE id_agent = ".$id_agent." and utimestamp > '".$fechatope."'";
|
||||
|
||||
$result= get_db_all_rows_sql ($sql1);
|
||||
foreach ($result as $row) {
|
||||
for ($i = 0; $i < $intervalo; $i++) {
|
||||
if (($row["timestamp"] < $valores[$i][2]) and ($row["timestamp"] >= $valores[$i][3])) {
|
||||
for ($i = 0; $i < $intervalo; $i++){
|
||||
if (($row["utimestamp"] > $valores[$i][2]) and ($row["utimestamp"] <= $valores[$i][3]) ){
|
||||
// entra en esta fila
|
||||
$valores[$i][0]++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$valor_maximo = 0;
|
||||
|
||||
for ($i = 0; $i < $intervalo; $i++) { // 30 entries in graph, one by day
|
||||
$grafica[]=$valores[$i][0];
|
||||
$grafica[]=$valores[$intervalo-$i][0];
|
||||
if ($valores[$i][0] > $valor_maximo)
|
||||
$valor_maximo = $valores[$i][0];
|
||||
}
|
||||
|
@ -889,6 +902,7 @@ function graphic_string_data ($id_agent_module, $periodo, $width, $height, $pure
|
|||
$valores[$i][3] = $fechatope + ($horasint * ($i + 1)); // [3] Botom limit
|
||||
}
|
||||
$sql1="SELECT utimestamp FROM tagente_datos_string WHERE id_agente_modulo = ".$id_agent_module." and utimestamp > '".$fechatope."'";
|
||||
|
||||
$result = get_db_all_rows_sql ($sql1);
|
||||
|
||||
foreach ($result as $row) {
|
||||
|
@ -1798,6 +1812,7 @@ function grafico_modulo_boolean ( $id_agente_modulo, $periodo, $show_event,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$last = $previous;
|
||||
// Calculate Average value for $valores[][0]
|
||||
for ($i =0; $i <= $resolution; $i++) {
|
||||
|
|