2008-06-13 Sancho Lerena <slerena@gmail.com>
* index.php: Added pure (Fullscreen). HTML code cleanup and user session. * pandoradb.sql: talert_snmp: Added priority field. * pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo and some links. * header.php: Fixed some user session management. * logon_ok.php: New design for welcome screen, odometer is over. * menu.php, godmode/menu.php: Some ACL improvements. * agent_disk_conf_editor.php: Minor fix in view link. * configurar_agente.php, agent_manager.php: Added parent combo and better ACL checks. New remote configuration control for get timestamp info of config file. * modify_alert.php: Changes to use new internal Mail alert. * config.php: Some items moved to config_process. (font, attachment and default style). * functions.php: Added form_agent_combo(), form_event_type_combo(), form_priority() and return_priority() functions. * functions_db.php: Added smal_event_table() to render a variable table with latest events (filtered). * pandora.css. Added pure and priority colors. * estado_alertas.php: Fixed ACL problems. * stado_generalagente.php: Graph of modules now represents modules that has generated events. Old graph is not used anymore. Also display parent. * estado_grupo.php: Border of boxes is now thicker. * tactical.php: New screen, almost all code changed. Odometer is not used anymore, added some new items, like module LAG meter, module sanity, and other general metrics. * ver_agente.php: Now renders also event for each agent view. Alert manual validation generate a new event. * events.php: New event system. 90% new code. A LOT of new features, including full screen, coloured (by priority) and filters by six fields. * snmp_alert.php: Added support for alert priority. * operation/users/user.php: No longer a user with UM privileges could see any other user. * render_view.php: Added fullscreen support for visual maps. * fgraph.php: Added support for session checking in graphs (at least!). New graphics for events (some changed it's function like events by group), and feature added to progress GD implementation. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
cd102f5db1
commit
ad93a46f0f
|
@ -1,10 +1,72 @@
|
|||
2008-06-13 Sancho Lerena <slerena@gmail.com>
|
||||
|
||||
* index.php: Added pure (Fullscreen). HTML code cleanup and user session.
|
||||
|
||||
* pandoradb.sql: talert_snmp: Added priority field.
|
||||
|
||||
* pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo
|
||||
and some links.
|
||||
|
||||
* header.php: Fixed some user session management.
|
||||
|
||||
* logon_ok.php: New design for welcome screen, odometer is over.
|
||||
|
||||
* menu.php, godmode/menu.php: Some ACL improvements.
|
||||
|
||||
* agent_disk_conf_editor.php: Minor fix in view link.
|
||||
|
||||
* configurar_agente.php, agent_manager.php: Added parent combo and better
|
||||
ACL checks. New remote configuration control for get timestamp info of
|
||||
config file.
|
||||
|
||||
* modify_alert.php: Changes to use new internal Mail alert.
|
||||
|
||||
* config.php: Some items moved to config_process. (font, attachment and
|
||||
default style).
|
||||
|
||||
* functions.php: Added form_agent_combo(), form_event_type_combo(),
|
||||
form_priority() and return_priority() functions.
|
||||
|
||||
* functions_db.php: Added smal_event_table() to render a variable table
|
||||
with latest events (filtered).
|
||||
|
||||
* pandora.css. Added pure and priority colors.
|
||||
|
||||
* estado_alertas.php: Fixed ACL problems.
|
||||
|
||||
* stado_generalagente.php: Graph of modules now represents modules that
|
||||
has generated events. Old graph is not used anymore. Also display parent.
|
||||
|
||||
* estado_grupo.php: Border of boxes is now thicker.
|
||||
|
||||
* tactical.php: New screen, almost all code changed. Odometer is not used
|
||||
anymore, added some new items, like module LAG meter, module sanity, and
|
||||
other general metrics.
|
||||
|
||||
* ver_agente.php: Now renders also event for each agent view. Alert manual
|
||||
validation generate a new event.
|
||||
|
||||
* events.php: New event system. 90% new code. A LOT of new features,
|
||||
including full screen, coloured (by priority) and filters by six fields.
|
||||
|
||||
* snmp_alert.php: Added support for alert priority.
|
||||
|
||||
* operation/users/user.php: No longer a user with UM privileges could
|
||||
see any other user.
|
||||
|
||||
* render_view.php: Added fullscreen support for visual maps.
|
||||
|
||||
* fgraph.php: Added support for session checking in graphs (at least!).
|
||||
New graphics for events (some changed it's function like events by group),
|
||||
and feature added to progress GD implementation.
|
||||
|
||||
2008-06-09 Sancho Lerena <slerena@gmail.com>
|
||||
|
||||
* operation/agentes/status_monitor.php,
|
||||
operation/agentes/estado_agente.php: Data was presented for users with
|
||||
access to specific groups (fixed also in 1.3.1 branch).
|
||||
* operation/agentes/status_monitor.php,
|
||||
operation/agentes/estado_agente.php: Data was presented for users with
|
||||
access to specific groups (fixed also in 1.3.1 branch).
|
||||
|
||||
* godmode/users/configure_user.php: Better management of password.
|
||||
* godmode/users/configure_user.php: Better management of password.
|
||||
|
||||
2008-06-09 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
|
|
|
@ -29,16 +29,14 @@ echo "<div id='head_m'>";
|
|||
echo "<table width=520 border='0' cellpadding=3>
|
||||
<tr>";
|
||||
if (isset ($_SESSION["id_usuario"])){
|
||||
|
||||
// Fist column
|
||||
echo "<td width=30%>";
|
||||
$id_usuario = entrada_limpia ($_SESSION["id_usuario"]);
|
||||
if (dame_admin($_SESSION["id_usuario"])==1)
|
||||
echo "<img src='images/user_suit.png' class='bot'> ";
|
||||
else
|
||||
echo "<img src='images/user_green.png' class='bot'> ";
|
||||
echo "<a class='white'>".$lang_label["has_connected"]. '
|
||||
[<b>'. $id_usuario. '</b>]</a>';
|
||||
[<b>'. $_SESSION["id_usuario"]. '</b>]</a>';
|
||||
|
||||
// Second column
|
||||
echo "<td>";
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
// Pandora - the Free monitoring system
|
||||
// Pandora FMS
|
||||
// ====================================
|
||||
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas, info@artica.es
|
||||
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas, info@artica.es
|
||||
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
|
@ -73,26 +73,53 @@
|
|||
$data_alert = $data[8];
|
||||
$data_alert_total = $data[9];
|
||||
$monitor_alert_total = $data[10];
|
||||
$total_alerts = $data_alert_total + $monitor_alert_total;
|
||||
$total_checks = $data_checks + $monitor_checks;
|
||||
$data_not_init = $data[11];
|
||||
$monitor_not_init = $data[12];
|
||||
// Calculate global indicators
|
||||
|
||||
$total_checks = $data_checks + $monitor_checks;
|
||||
$notinit_percentage = (($data_not_init + $monitor_not_init) / ($total_checks / 100));
|
||||
$module_sanity = format_numeric (100 - $notinit_percentage);
|
||||
$total_alerts = $data_alert + $monitor_alert;
|
||||
$total_fired_alerts = $monitor_alert_total+$data_alert_total;
|
||||
$alert_level = format_numeric (100 - ($total_alerts / ($total_fired_alerts / 100)));
|
||||
|
||||
if ($monitor_checks > 0){
|
||||
$monitor_health = format_numeric ( 100- (($monitor_bad + $monitor_unknown) / ($monitor_checks/100)) , 1);
|
||||
} else
|
||||
$monitor_health = 100;
|
||||
if ($data_checks > 0){
|
||||
$data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);;
|
||||
} else
|
||||
$data_health = 100;
|
||||
if (($data_checks != 0) OR ($data_checks != 0)){
|
||||
$global_health = format_numeric ((($data_health * $data_checks) + ($monitor_health * $monitor_checks)) / $total_checks);
|
||||
} else
|
||||
$global_health = 100;
|
||||
|
||||
if ($monitor_checks > 0){
|
||||
$monitor_health = format_numeric ((($monitor_ok - $monitor_alert - $monitor_unknown)/ $monitor_checks) * 100,1);
|
||||
} else
|
||||
$monitor_health = 100;
|
||||
if ($data_checks > 0){
|
||||
$data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);;
|
||||
} else
|
||||
$data_health = 100;
|
||||
if (($data_checks != 0) OR ($data_checks != 0)){
|
||||
$global_health = format_numeric( ((($monitor_ok -$monitor_alert - $monitor_unknown )+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1);
|
||||
} else
|
||||
$global_health = 100;
|
||||
|
||||
echo "<h2>".$lang_label["tactical_indicator"]."</h2>";
|
||||
echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
|
||||
//echo "<h2>".$lang_label["tactical_indicator"]."</h2>";
|
||||
//echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";
|
||||
|
||||
echo "<tr><td colspan='2'>".lang_string("Monitor health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$monitor_health' title='$monitor_health % ".lang_string("of monitors UP")."'>";
|
||||
|
||||
echo "<br>";
|
||||
echo "<tr><td colspan='2'>".lang_string("Data health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$data_health' title='$data_health % ".lang_string("of modules with updated data")."'>";
|
||||
|
||||
echo "<tr><td colspan='2'>".lang_string("Global health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$global_health' title='$global_health % ".lang_string("of modules with good data")."'>";
|
||||
|
||||
echo "<tr><td colspan='2'>".lang_string("Module sanity")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$module_sanity ' title='$module_sanity % ".lang_string("of well initialized modules")."'>";
|
||||
|
||||
|
||||
echo "<tr><td colspan='2'>".lang_string("Alert level")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$alert_level' title='$alert_level % ".lang_string("of non-fired alerts")."'>";
|
||||
|
||||
echo "</table>";
|
||||
|
||||
$query1 = "SELECT COUNT(id_usuario) FROM tusuario";
|
||||
$result = mysql_query ($query1);
|
||||
|
|
|
@ -37,7 +37,7 @@ function display_config () {
|
|||
echo '<td class="datos"><b>' . $lang_label["agent_name"] . '</b></td>';
|
||||
echo '<td class="datos">';
|
||||
echo '<input disabled type="text" name="agente" size=30 value="' . $nombre_agente . '">';
|
||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="' . $id_agente . '">';
|
||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente . '">';
|
||||
echo '<img src="images/lupa.png" border="0" align="middle" alt="">';
|
||||
echo '</a>';
|
||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=' . $id_agente . '">';
|
||||
|
|
|
@ -77,7 +77,7 @@ if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")) {
|
|||
echo '<tr><td class="datos2">';
|
||||
echo '<b>'.$lang_label["ip_address"].'</b>';
|
||||
echo '<td class="datos2">';
|
||||
echo '<input type="text" name="direccion" size="12" value="'.$direccion_agente.'">';
|
||||
echo '<input type="text" name="direccion" size="16" value="'.$direccion_agente.'">';
|
||||
|
||||
if ($create_agent != 1){
|
||||
echo " ";
|
||||
|
@ -96,34 +96,39 @@ if ($create_agent != 1){
|
|||
echo "</td>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo '<tr><td class="datos"><b>'.lang_string ("Parent").'</b>';
|
||||
echo '<td class="datos">';
|
||||
if ($create_agent != 1){
|
||||
form_agent_combo ($id_parent, "id_parent");
|
||||
}
|
||||
else
|
||||
form_agent_combo (0, "id_parent");
|
||||
|
||||
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["group"].'</b>';
|
||||
echo '<td class="datos"><select name="grupo" class="w130">';
|
||||
|
||||
if (isset($grupo)){
|
||||
echo "<option value='".$grupo."'>".dame_grupo($grupo)."</option>";
|
||||
}
|
||||
$sql1='SELECT id_grupo, nombre FROM tgrupo ORDER BY nombre';
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
// Group ALL cannot be selected
|
||||
if ($row["id_grupo"] != 1){
|
||||
echo "<option value='".$row["id_grupo"]."'>".$row["nombre"]."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<tr><td class="datos2"><b><?php echo $lang_label["interval"]?></b></td>
|
||||
<td class="datos2">
|
||||
<input type="text" name="intervalo" size="15" value="
|
||||
<?php echo $intervalo?>"></td>
|
||||
<tr><td class="datos"><b><?php echo $lang_label["os"]?></b></td>
|
||||
<td class="datos">
|
||||
<select name="id_os" class="w130">
|
||||
<?php
|
||||
list_group ($id_user);
|
||||
echo "</select>";
|
||||
|
||||
echo "<tr><td class='datos2'>";
|
||||
echo "<b>".lang_string("interval")."</b></td>";
|
||||
echo '<td class="datos2">';
|
||||
|
||||
echo '<input type="text" name="intervalo" size="15" value="'.$intervalo.'"></td>';
|
||||
echo '<tr><td class="datos"><b>'.lang_string("os").'</b></td>';
|
||||
echo '<td class="datos">';
|
||||
echo '<select name="id_os" class="w130">';
|
||||
|
||||
if (isset($id_os)){
|
||||
echo "<option value='".$id_os."'>".dame_so_name($id_os)."</option>";
|
||||
}
|
||||
$sql1='SELECT id_os, name FROM tconfig_os ORDER BY name';
|
||||
$sql1='SELECT id_os, name FROM tconfig_os';
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
echo "<option value='".$row["id_os"]."'>".$row["name"]."</option>";
|
||||
|
@ -208,20 +213,31 @@ if ($modo == "1"){
|
|||
<input type="radio" name="modo" class="chk" value="0" checked>';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr><td class="datos2"><b><?php echo $lang_label["status"]?></b>
|
||||
<td class="datos2">
|
||||
<?php if ($disabled == "1"){
|
||||
echo $lang_label["disabled"].'
|
||||
<input type="radio" class="chk" name="disabled" value="1" style="margin-right: 40px;" checked>';
|
||||
echo $lang_label["active"].'
|
||||
<input class="chk" type="radio" name="disabled" value="0">';
|
||||
} else {
|
||||
echo $lang_label["disabled"].'
|
||||
<input type="radio" class="chk" name="disabled" value="1" style="margin-right: 40px;">';
|
||||
echo $lang_label["active"].'
|
||||
<input type="radio" name="disabled" class="chk" value="0" checked>';
|
||||
}
|
||||
|
||||
// Status (Disabled / Enabled)
|
||||
echo '<tr><td class="datos2"><b>'.lang_string("status").'</b>';
|
||||
echo '<td class="datos2">';
|
||||
if ($disabled == "1"){
|
||||
echo $lang_label["disabled"].'
|
||||
<input type="radio" class="chk" name="disabled" value="1" style="margin-right: 40px;" checked>';
|
||||
echo $lang_label["active"].'
|
||||
<input class="chk" type="radio" name="disabled" value="0">';
|
||||
} else {
|
||||
echo $lang_label["disabled"].'
|
||||
<input type="radio" class="chk" name="disabled" value="1" style="margin-right: 40px;">';
|
||||
echo $lang_label["active"].'
|
||||
<input type="radio" name="disabled" class="chk" value="0" checked>';
|
||||
}
|
||||
|
||||
// Remote configuration
|
||||
echo '<tr><td class="datos"><b>'.lang_string("Remote configuration").'</b>';
|
||||
echo '<td class="datos">';
|
||||
$filename = $config["remote_config"] . "/" . $agent_md5 . ".md5";
|
||||
if (file_exists($filename)){
|
||||
echo date("F d Y H:i:s.", fileatime($filename));
|
||||
} else {
|
||||
echo '<i>'.lang_string("Not available").'</i>';
|
||||
}
|
||||
|
||||
echo '</table><table width="650"><tr><td align="right">';
|
||||
if ($create_agent == 1){
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
// Pandora FMS - the Free Monitoring System
|
||||
// ========================================
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
|
||||
// Copyright (c) 2008 Sancho Lerena <slerena@gmail.com>
|
||||
|
||||
// Please see http://pandora.sourceforge.net for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
|
@ -68,16 +70,12 @@ if ($form_alerttype != "combined"){
|
|||
}
|
||||
echo '<td class="datos3">';
|
||||
echo lang_string ("Priority");
|
||||
echo '<td class="datos3"><select name="alert_priority">';
|
||||
echo '<td class="datos3">';
|
||||
|
||||
if (isset($alert_priority)){
|
||||
echo "<option value='".$alert_priority."'>".get_alert_priority ($alert_priority)."</option>";
|
||||
} else {
|
||||
$alert_priority = 0;
|
||||
}
|
||||
for ($i=0; $i<5; $i++){
|
||||
if ($i != $alert_priority)
|
||||
echo "<option value='".$i."'>".get_alert_priority ($i)."</option>";
|
||||
$alert_priority = 3; // Warning by default
|
||||
}
|
||||
echo form_priority ($alert_priority, "alert_priority");
|
||||
|
||||
// Alert type
|
||||
echo '<tr><td class="datos">';
|
||||
|
@ -195,7 +193,7 @@ echo '<b>Macros:</b><br>_agent_<br>_timestamp_<br>_data_<br></span></a>';
|
|||
//Field3
|
||||
echo '<tr><td class="datos">'.lang_string ("field3");
|
||||
echo '<td class="datos" colspan=4>';
|
||||
echo '<textarea name="campo_3" style="height:85px;" cols="36" rows="4">';
|
||||
echo '<textarea name="campo_3" style="height:85px; width: 380px" rows="4">';
|
||||
echo $alerta_campo3;
|
||||
echo '</textarea><a href="#" class="tip"><span><b>Macros:</b><br>_agent_<br>';
|
||||
echo '_timestamp_<br>_data_<br></span></a>';
|
||||
|
@ -213,6 +211,7 @@ for ($a=0; $a < 48; $a++){
|
|||
echo "'>";
|
||||
echo render_time ($a);
|
||||
}
|
||||
echo "<option value='23:59'>23:59";
|
||||
echo "</select>";
|
||||
|
||||
echo "<td class='datos2'>".$lang_label["time_to"];
|
||||
|
@ -227,6 +226,7 @@ for ($a=0; $a < 48; $a++){
|
|||
echo "'>";
|
||||
echo render_time ($a);
|
||||
}
|
||||
echo "<option value='23:59'>23:59";
|
||||
echo "</select>";
|
||||
|
||||
// Days of week
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// ========================================
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
|
||||
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
|
||||
// Copyright (c) 2008 Sancho Lerena <sancho.lerena@artica.es>
|
||||
// Please see http://pandora.sourceforge.net for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
|
@ -69,6 +70,7 @@ $alerta_max_alerts = "1";
|
|||
$alerta_time_threshold = "";
|
||||
$alerta_descripcion = "";
|
||||
$disabled="";
|
||||
$id_parent="0";
|
||||
$modulo_max="";
|
||||
$modulo_min='';
|
||||
$module_interval = "";
|
||||
|
@ -109,7 +111,7 @@ if ( isset ($_POST["create_agent"])) { // Create a new and shining agent
|
|||
$intervalo = entrada_limpia ($_POST["intervalo"]);
|
||||
$comentarios = entrada_limpia ($_POST["comentarios"]);
|
||||
$modo = entrada_limpia ($_POST["modo"]);
|
||||
|
||||
$id_parent = get_parameter_post ("id_parent", 0);
|
||||
$id_network_server = get_parameter_post ("network_server", 0);
|
||||
$id_plugin_server = get_parameter_post ("plugin_server", 0);
|
||||
$id_prediction_server = get_parameter_post ("prediction_server", 0);
|
||||
|
@ -125,7 +127,7 @@ if ( isset ($_POST["create_agent"])) { // Create a new and shining agent
|
|||
$agent_creation_error = lang_string("agent_exists");
|
||||
$agent_created_ok = 0;
|
||||
} else {
|
||||
$sql_insert ="INSERT INTO tagente (nombre, direccion, id_grupo, intervalo, comentarios,modo, id_os, disabled, id_network_server, id_plugin_server, id_wmi_server, id_prediction_server) VALUES ('$nombre_agente', '$direccion_agente', $grupo , $intervalo , '$comentarios',$modo, $id_os, $disabled, $id_network_server, $id_plugin_server, $id_wmi_server, $id_prediction_server)";
|
||||
$sql_insert ="INSERT INTO tagente (nombre, direccion, id_grupo, intervalo, comentarios,modo, id_os, disabled, id_network_server, id_plugin_server, id_wmi_server, id_prediction_server, id_parent) VALUES ('$nombre_agente', '$direccion_agente', $grupo , $intervalo , '$comentarios',$modo, $id_os, $disabled, $id_network_server, $id_plugin_server, $id_wmi_server, $id_prediction_server, $id_parent)";
|
||||
$result = mysql_query($sql_insert);
|
||||
if ($result) {
|
||||
$agent_created_ok = 1;
|
||||
|
@ -456,13 +458,14 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
|||
$id_network_server = get_parameter ("network_server", 0);
|
||||
$id_plugin_server = get_parameter ("plugin_server", 0);
|
||||
$id_wmi_server = get_parameter ("wmi_server", 0);
|
||||
$id_prediction_server = get_parameter ("prediction_server", 0);
|
||||
$id_prediction_server = get_parameter_post ("prediction_server", 0);
|
||||
$id_parent = get_parameter_post ("id_parent", 0);
|
||||
|
||||
if ($direccion_agente != $old_agent_address){
|
||||
agent_add_address ($id_agente, $direccion_agente);
|
||||
}
|
||||
$sql_update ="UPDATE tagente
|
||||
SET disabled = ".$disabled." , id_os = ".$id_os." , modo = ".$modo." , nombre = '".$nombre_agente."', direccion = '".$direccion_agente."', id_grupo = '".$grupo."', intervalo = '".$intervalo."', comentarios = '".$comentarios."', id_network_server = '$id_network_server', id_plugin_server = $id_plugin_server, id_wmi_server = $id_wmi_server,
|
||||
SET disabled = ".$disabled.", id_parent = $id_parent, id_os = ".$id_os." , modo = ".$modo." , nombre = '".$nombre_agente."', direccion = '".$direccion_agente."', id_grupo = '".$grupo."', intervalo = '".$intervalo."', comentarios = '".$comentarios."', id_network_server = '$id_network_server', id_plugin_server = $id_plugin_server, id_wmi_server = $id_wmi_server,
|
||||
id_prediction_server = $id_prediction_server
|
||||
WHERE id_agente = '".$id_agente."'";
|
||||
|
||||
|
@ -506,6 +509,7 @@ if (isset($_GET["id_agente"])) {
|
|||
$modo = $row["modo"];
|
||||
$id_os = $row["id_os"];
|
||||
$disabled=$row["disabled"];
|
||||
$id_parent = $row["id_parent"];
|
||||
} else {
|
||||
echo "<h3 class='error'>".$lang_label["agent_error"]."</h3>";
|
||||
echo "</table>";
|
||||
|
|
|
@ -11,6 +11,10 @@ require("include/config.php");
|
|||
if ( (give_acl($id_user, 0, "LM")==1)){
|
||||
if (isset($_POST["update_alerta"])){ // if modified any parameter
|
||||
$id_alerta = entrada_limpia($_POST["id_alerta"]);
|
||||
if ($id_alerta < 4){
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Alert Management");
|
||||
require ("general/noaccess.php");
|
||||
}
|
||||
$nombre = entrada_limpia($_POST["nombre"]);
|
||||
$comando = entrada_limpia($_POST["comando"]);
|
||||
$descripcion= entrada_limpia($_POST["descripcion"]);
|
||||
|
@ -37,6 +41,10 @@ if ( (give_acl($id_user, 0, "LM")==1)){
|
|||
|
||||
if (isset($_GET["borrar_alerta"])){ // if delete alert
|
||||
$id_alerta = entrada_limpia($_GET["borrar_alerta"]);
|
||||
if ($id_alerta < 4){
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Alert Management");
|
||||
require ("general/noaccess.php");
|
||||
}
|
||||
$sql_delete= "DELETE FROM talerta WHERE id_alerta = ".$id_alerta;
|
||||
$result=mysql_query($sql_delete);
|
||||
if (! $result)
|
||||
|
@ -55,7 +63,7 @@ if ( (give_acl($id_user, 0, "LM")==1)){
|
|||
echo "<th>".$lang_label["description"]."</th>";
|
||||
echo "<th>".$lang_label["delete"]."</th>";
|
||||
$color=1;
|
||||
$sql1='SELECT * FROM talerta ORDER BY nombre';
|
||||
$sql1='SELECT * FROM talerta';
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($color == 1){
|
||||
|
@ -66,7 +74,7 @@ if ( (give_acl($id_user, 0, "LM")==1)){
|
|||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
if ($row[0] > 3){
|
||||
if ($row[0] > 4){
|
||||
echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=galertas&sec2=godmode/alerts/configure_alert&id_alerta=".$row["id_alerta"]."'>".$row["nombre"]."</a></b></td>";
|
||||
echo "<td class='$tdcolor'>".$row["descripcion"]."</td>";
|
||||
echo "<td class='$tdcolor' align='center'><a href='index.php?sec=gagente&sec2=godmode/alerts/modify_alert&borrar_alerta=".$row["id_alerta"]."' onClick='if (!confirm(\' ".$lang_label["are_you_sure"]."\')) return false;'><img border='0' src='images/cross.png'></a></td>";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - the Free monitoring system
|
||||
// ========================================
|
||||
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
|
||||
// Main PHP/SQL code development and project architecture and management
|
||||
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
// CSS and some PHP additions
|
||||
|
@ -46,16 +46,20 @@ if (comprueba_login() == 0){
|
|||
else echo "<div class='arrowg'>";
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=gagente&sec2=godmode/agentes/manage_config' class='mn'>".$lang_label["manage_config"]."</a></li></ul></div>";
|
||||
|
||||
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/groups/group_list" || $_GET["sec2"] == "godmode/groups/configure_group")){
|
||||
echo "<div class='arrowgs'>";
|
||||
}
|
||||
else
|
||||
echo "<div class='arrowg'>";
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=gagente&sec2=godmode/groups/group_list' class='mn'>".$lang_label["manage_groups"]."</a></li></ul></div>";
|
||||
}
|
||||
}
|
||||
|
||||
if ((give_acl($id_user, 0, "AW")==1)){
|
||||
// Manage groups
|
||||
if ((give_acl($id_user, 0, "PM")==1)){
|
||||
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "godmode/groups/group_list" || $_GET["sec2"] == "godmode/groups/configure_group")){
|
||||
echo "<div class='arrowgs'>";
|
||||
}
|
||||
else
|
||||
echo "<div class='arrowg'>";
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=gagente&sec2=godmode/groups/group_list' class='mn'>".$lang_label["manage_groups"]."</a></li></ul></div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((give_acl($id_user, 0, "PM")==1)){
|
||||
if (isset($_GET["sec"]) && ($_GET["sec"] == "gmodules"))
|
||||
echo '<div id="god_module_sel">';
|
||||
else
|
||||
|
@ -113,7 +117,7 @@ if (comprueba_login() == 0){
|
|||
}
|
||||
// Reporting
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ((give_acl($id_user, 0, "AW")==1)){
|
||||
if ((give_acl($id_user, 0, "PM")==1)){
|
||||
|
||||
echo '<div id="god51">';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Begin of automatic config file
|
||||
$config["dbname"]="pandora"; // MySQL DataBase name
|
||||
$config["dbuser"]="pandora"; // DB User
|
||||
$config["dbpass"]="swfvnldt"; // DB Password
|
||||
$config["dbpass"]="pandora"; // DB Password
|
||||
$config["dbhost"]="localhost"; // DB Host
|
||||
$config["homedir"]="/var/www/pandora_console/"; // Config homedir
|
||||
$config["homeurl"]="http://localhost/pandora_console"; // Base URL
|
||||
|
@ -42,17 +42,7 @@ $config["homeurl"]="http://localhost/pandora_console"; // Base URL
|
|||
// Display ALL errors
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// This is directory where placed "/attachment" directory, to upload files stores.
|
||||
// This MUST be writtable by http server user, and should be in pandora root.
|
||||
// By default, Pandora adds /attachment to this, so by default is the pandora console home dir
|
||||
|
||||
$config["attachment_store"]=$config["homedir"];
|
||||
|
||||
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
|
||||
$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf";
|
||||
|
||||
// Style (pandora by default)
|
||||
$config["style"] = "pandora";
|
||||
|
||||
include ("config_process.php");
|
||||
?>
|
||||
|
|
|
@ -22,6 +22,18 @@ if (!isset($build_version))
|
|||
if (!isset($pandora_version))
|
||||
$pandora_version="v2.0-dev";
|
||||
|
||||
// This is directory where placed "/attachment" directory, to upload files stores.
|
||||
// This MUST be writtable by http server user, and should be in pandora root.
|
||||
// By default, Pandora adds /attachment to this, so by default is the pandora console home dir
|
||||
|
||||
$config["attachment_store"]=$config["homedir"];
|
||||
|
||||
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
|
||||
$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf";
|
||||
|
||||
// Style (pandora by default)
|
||||
$config["style"] = "pandora";
|
||||
|
||||
// Read remaining config tokens from DB
|
||||
if (! mysql_connect($config["dbhost"],$config["dbuser"],$config["dbpass"])){
|
||||
|
||||
|
|
|
@ -600,23 +600,23 @@ function get_parameter_post ( $name, $default = "" ){
|
|||
return $default;
|
||||
}
|
||||
|
||||
function get_alert_priority ( $prio ){
|
||||
$priority = "NORMAL";
|
||||
function get_alert_priority ( $prio = 0){
|
||||
global $config;
|
||||
switch ($prio){
|
||||
case 0:
|
||||
$priority = "NORMAL";
|
||||
$priority = lang_string("Maintenance");
|
||||
break;
|
||||
case 1:
|
||||
$priority = "WARNING";
|
||||
$priority = lang_string("Informational");
|
||||
break;
|
||||
case 2:
|
||||
$priority = "MINOR";
|
||||
$priority = lang_string("Normal");
|
||||
break;
|
||||
case 3:
|
||||
$priority = "MAJOR";
|
||||
$priority = lang_string("Warning");
|
||||
break;
|
||||
case 4:
|
||||
$priority = "CRITICAL";
|
||||
$priority = lang_string("Critical");
|
||||
break;
|
||||
}
|
||||
return $priority;
|
||||
|
@ -903,4 +903,116 @@ function form_render_check ($name_form, $value_form = 1){
|
|||
}
|
||||
|
||||
|
||||
function form_event_type_combo ($name_form, $value_form = ""){
|
||||
echo "<select name='$name_form'>";
|
||||
if ($value_form != ""){
|
||||
echo "<option>".$value_form;
|
||||
} else {
|
||||
echo "<option>all";;
|
||||
}
|
||||
echo "<option>unknown";
|
||||
echo "<option>monitor_up";
|
||||
echo "<option>monitor_down";
|
||||
echo "<option>alert_fired";
|
||||
echo "<option>alert_recovered";
|
||||
echo "<option>alert_ceased";
|
||||
echo "<option>alert_manual_validation";
|
||||
|
||||
echo "<option>recon_host_detected";
|
||||
echo "<option>system";
|
||||
echo "<option>error";
|
||||
echo "</select>";
|
||||
}
|
||||
|
||||
|
||||
function form_priority ($priority = 0, $form_name = "priority", $show_all = 0){
|
||||
global $config;
|
||||
|
||||
echo '<select name="'.$form_name.'">';
|
||||
switch ($priority) {
|
||||
case 0:
|
||||
echo "<option value=0>".lang_string("Maintenance");
|
||||
echo "<option value=1>".lang_string("Informational");
|
||||
echo "<option value=2>".lang_string("Normal");
|
||||
echo "<option value=3>".lang_string("Warning");
|
||||
echo "<option value=4>".lang_string("Critical");
|
||||
break;
|
||||
case 1:
|
||||
echo "<option value=1>".lang_string("Informational");
|
||||
echo "<option value=0>".lang_string("Maintenance");
|
||||
echo "<option value=2>".lang_string("Normal");
|
||||
echo "<option value=3>".lang_string("Warning");
|
||||
echo "<option value=4>".lang_string("Critical");
|
||||
break;
|
||||
case 2:
|
||||
echo "<option value=2>".lang_string("Normal");
|
||||
echo "<option value=0>".lang_string("Maintenance");
|
||||
echo "<option value=1>".lang_string("Informational");
|
||||
echo "<option value=3>".lang_string("Warning");
|
||||
echo "<option value=4>".lang_string("Critical");
|
||||
break;
|
||||
case 3:
|
||||
echo "<option value=3>".lang_string("Warning");
|
||||
echo "<option value=0>".lang_string("Maintenance");
|
||||
echo "<option value=1>".lang_string("Informational");
|
||||
echo "<option value=2>".lang_string("Normal");
|
||||
echo "<option value=4>".lang_string("Critical");
|
||||
break;
|
||||
case 4:
|
||||
echo "<option value=4>".lang_string("Critical");
|
||||
echo "<option value=0>".lang_string("Maintenance");
|
||||
echo "<option value=1>".lang_string("Informational");
|
||||
echo "<option value=2>".lang_string("Normal");
|
||||
echo "<option value=3>".lang_string("Warning");
|
||||
break;
|
||||
case -1:
|
||||
echo "<option value=-1>".lang_string("All");
|
||||
echo "<option value=4>".lang_string("Critical");
|
||||
echo "<option value=0>".lang_string("Maintenance");
|
||||
echo "<option value=1>".lang_string("Informational");
|
||||
echo "<option value=2>".lang_string("Normal");
|
||||
echo "<option value=3>".lang_string("Warning");
|
||||
break;
|
||||
}
|
||||
if ($show_all == 1)
|
||||
echo "<option value=-1>".lang_string("All");
|
||||
echo "</select>";
|
||||
}
|
||||
|
||||
|
||||
function return_priority ($priority){
|
||||
global $config;
|
||||
|
||||
switch ($priority) {
|
||||
case 0:
|
||||
return lang_string("Maintenance");
|
||||
case 1:
|
||||
return lang_string("Informational");
|
||||
case 2:
|
||||
return lang_string("Normal");
|
||||
case 3:
|
||||
return lang_string("Warning");
|
||||
case 4:
|
||||
return lang_string("Critical");
|
||||
case -1:
|
||||
return lang_string("All");
|
||||
}
|
||||
}
|
||||
|
||||
// Show combo with agents
|
||||
function form_agent_combo ($id_agent = 0, $form_name = "id_agent"){
|
||||
global $config;
|
||||
echo '<select name="'.$form_name.'" style="width:120px">';
|
||||
if ($id_agent != 0)
|
||||
echo "<option value='".$id_agent."'>".dame_nombre_agente($id_agent)."</option>";
|
||||
else
|
||||
echo "<option value='0'>".lang_string("None")."</option>";
|
||||
$sql1='SELECT * FROM tagente';
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
// if (give_acl($config["id_user"], $row["id_grupo"], "AR")==1)
|
||||
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -756,15 +756,16 @@ function existe($id){
|
|||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// event_insert - Insert event in eventable, using Id_grupo, Id_agente and Evento
|
||||
// event_insert - Insert generic event in eventable
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function event_insert($evento, $id_grupo, $id_agente, $status=0, $id_usuario=''){
|
||||
function event_insert($evento, $id_grupo, $id_agente, $status=0, $id_usuario='', $event_type = "unknown", $priority = 0, $id_agent_module, $id_aam){
|
||||
require("config.php");
|
||||
$today=date('Y-m-d H:i:s');
|
||||
$utimestamp = time();
|
||||
|
||||
$sql1='INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, id_usuario) VALUES ('.$id_agente.','.$id_grupo.',"'.$evento.'","'.$today.'",'.$status.', '.$utimestamp.', "'.$id_usuario.'")';
|
||||
|
||||
$sql1='INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, id_usuario, event_type, criticity, id_agentmodule, id_alert_am) VALUES ('.$id_agente.','.$id_grupo.',"'.$evento.'","'.$today.'",'.$status.', '.$utimestamp.', "'.$id_usuario.'", "'.$event_type.'", '.$priority.', '.$id_agent_module.', '.$id_aam.')';
|
||||
|
||||
$result=mysql_query($sql1);
|
||||
|
||||
}
|
||||
|
@ -1453,4 +1454,115 @@ function show_alert_row_mini ($id_combined_alert){
|
|||
}
|
||||
echo "</table>";
|
||||
}
|
||||
function smal_event_table ($filter = "", $limit = 10, $width=440){
|
||||
global $config;
|
||||
global $lang_label;
|
||||
|
||||
$sql2 = "SELECT * FROM tevento $filter ORDER BY timestamp DESC LIMIT $limit";
|
||||
echo "<table cellpadding='4' cellspacing='4' width='$width' border=0 class='databox'>";
|
||||
echo "<tr>";
|
||||
echo "<th colspan=6>".lang_string("Latest events");
|
||||
echo "<tr>";
|
||||
echo "<td class='datos3 f9'>".lang_string ("St")."</th>";
|
||||
echo "<td class='datos3 f9'>".lang_string ("Type")."</th>";
|
||||
echo "<td class='datos3 f9'>".$lang_label["event_name"]."</th>";
|
||||
echo "<td class='datos3 f9'>".$lang_label["agent_name"]."</th>";
|
||||
echo "<td class='datos3 f9'>".$lang_label["id_user"]."</th>";
|
||||
echo "<td class='datos3 f9'>".$lang_label["timestamp"]."</th>";
|
||||
$result2=mysql_query($sql2);
|
||||
while ($row2=mysql_fetch_array($result2)){
|
||||
$id_grupo = $row2["id_grupo"];
|
||||
if (give_acl($config["id_user"], $id_grupo, "AR") == 1){ // Only incident read access to view data !
|
||||
switch ($row2["criticity"]) {
|
||||
case 0:
|
||||
$tdclass = "datos_blue";
|
||||
break;
|
||||
case 1:
|
||||
$tdclass = "datos_grey";
|
||||
break;
|
||||
case 2:
|
||||
$tdclass = "datos_green";
|
||||
break;
|
||||
case 3:
|
||||
$tdclass = "datos_yellow";
|
||||
break;
|
||||
case 4:
|
||||
$tdclass = "datos_red";
|
||||
break;
|
||||
default:
|
||||
$tdclass = "datos_grey";
|
||||
}
|
||||
$criticity_label = return_priority ($row2["criticity"]);
|
||||
// Colored box
|
||||
echo "<tr><td class='$tdclass' title='$criticity_label' align='center'>";
|
||||
if ($row2["estado"] == 0)
|
||||
echo "<img src='images/pixel_red.png' width=20 height=20>";
|
||||
else
|
||||
echo "<img src='images/pixel_green.png' width=20 height=20>";
|
||||
|
||||
// Event type
|
||||
echo "<td class='".$tdclass."' title='".$row2["event_type"]."'>";
|
||||
switch ($row2["event_type"]){
|
||||
case "unknown":
|
||||
echo "<img src='images/err.png'>";
|
||||
break;
|
||||
case "alert_recovered":
|
||||
echo "<img src='images/error.png'>";
|
||||
break;
|
||||
case "alert_manual_validation":
|
||||
echo "<img src='images/eye.png'>";
|
||||
break;
|
||||
case "monitor_up":
|
||||
echo "<img src='images/lightbulb.png'>";
|
||||
break;
|
||||
case "monitor_down":
|
||||
echo "<img src='images/lightbulb_off.png'>";
|
||||
break;
|
||||
case "alert_fired":
|
||||
echo "<img src='images/bell.png'>";
|
||||
break;
|
||||
case "system";
|
||||
echo "<img src='images/cog.png'>";
|
||||
break;
|
||||
case "recon_host_detected";
|
||||
echo "<img src='images/network.png'>";
|
||||
break;
|
||||
}
|
||||
|
||||
// Event description
|
||||
echo "<td class='".$tdclass."f9' title='".$row2["evento"]."'>";
|
||||
echo substr($row2["evento"],0,45);
|
||||
if (strlen($row2["evento"]) > 45)
|
||||
echo "..";
|
||||
if ($row2["id_agente"] > 0){
|
||||
// Agent name
|
||||
$agent_name = dame_nombre_agente($row2["id_agente"]);
|
||||
echo "<td class='".$tdclass."f9' title='$agent_name'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$row2["id_agente"]."'><b>";
|
||||
echo substr($agent_name, 0, 14);
|
||||
if (strlen($agent_name) > 14)
|
||||
echo "..";
|
||||
echo "</b></a>";
|
||||
|
||||
// for System or SNMP generated alerts
|
||||
} else {
|
||||
if ($row2["event_type"] == "system"){
|
||||
echo "<td class='$tdclass'>".lang_string("System");
|
||||
} else {
|
||||
echo "<td class='$tdclass'>".$lang_label["alert"]."SNMP";
|
||||
}
|
||||
}
|
||||
|
||||
// User who validated event
|
||||
echo "<td class='$tdclass'>";
|
||||
if ($row2["estado"] <> 0)
|
||||
echo "<a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$row2["id_usuario"]."'>".substr($row2["id_usuario"],0,8)."<a href='#' class='tip'> <span>".dame_nombre_real($row2["id_usuario"])."</span></a></a>";
|
||||
|
||||
// Timestamp
|
||||
echo "<td class='".$tdclass."f9' title='".$row2["timestamp"]."'>";
|
||||
echo human_time_comparation($row2["timestamp"]);
|
||||
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -204,6 +204,7 @@ div#main {
|
|||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
div#menu {
|
||||
width: 155px;
|
||||
float: left;
|
||||
|
@ -646,3 +647,42 @@ span#logo_text2 {
|
|||
.bt0 {
|
||||
border-top: 0px;
|
||||
}
|
||||
|
||||
|
||||
td.datos_green, td.datos_greenf9 {
|
||||
background-color: #C7EAD5;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_red, td.datos_redf9 {
|
||||
background-color: #FFC0B5;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_yellow, td.datos_yellowf9 {
|
||||
background-color: #F4FFBF;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_blue, td.datos_bluef9 {
|
||||
background-color: #CDE2EA;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_grey, td.datos_greyf9 {
|
||||
background-color: #DCDCDC;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_greyf9, td.datos_bluef9, td.datos_greenf9, td.datos_redf9, td.datos_yellowf9 {
|
||||
font-size: 6.5pt;
|
||||
}
|
||||
|
||||
div#main_pure {
|
||||
background-color: #fefefe;
|
||||
text-align: left;
|
||||
margin-bottom: 25px;
|
||||
margin-top: 10px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
|
|
@ -581,3 +581,43 @@ span#logo_text2 {
|
|||
letter-spacing: -2px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
|
||||
|
||||
td.datos_green, td.datos_greenf9 {
|
||||
background-color: #C7EAD5;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_red, td.datos_redf9 {
|
||||
background-color: #FFC0B5;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_yellow, td.datos_yellowf9 {
|
||||
background-color: #F4FFBF;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_blue, td.datos_bluef9 {
|
||||
background-color: #CDE2EA;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_grey, td.datos_greyf9 {
|
||||
background-color: #DCDCDC;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
td.datos_greyf9, td.datos_bluef9, td.datos_greenf9, td.datos_redf9, td.datos_yellowf9 {
|
||||
font-size: 6.5pt;
|
||||
}
|
||||
|
||||
div#main_pure {
|
||||
background-color: #fefefe;
|
||||
text-align: left;
|
||||
margin-bottom: 25px;
|
||||
margin-top: 10px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
|
|
@ -70,12 +70,11 @@ require "include/functions_db.php";
|
|||
<html>
|
||||
<head>
|
||||
<?php
|
||||
// Refresh page
|
||||
if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
|
||||
if (isset ($_GET["refr"]))
|
||||
$intervalo = entrada_limpia ($_GET["refr"]);
|
||||
if (isset ($_POST["refr"]))
|
||||
$intervalo = entrada_limpia ($_POST["refr"]);
|
||||
// Pure mode (without menu, header and footer).
|
||||
$config["pure"] = get_parameter("pure",0);
|
||||
|
||||
// Auto Refresh page
|
||||
$intervalo = get_parameter ("refr",0);
|
||||
if ($intervalo > 0){
|
||||
// Agent selection filters and refresh
|
||||
$query = 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '') . '://' . $_SERVER['SERVER_NAME'];
|
||||
|
@ -94,7 +93,7 @@ if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
|
|||
} else
|
||||
echo '<meta http-equiv="refresh" content="' . $intervalo . '; URL=' . $query . '">';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<title>Pandora FMS - <?php echo lang_string("header_title"); ?></title>
|
||||
<meta http-equiv="expires" content="0">
|
||||
|
@ -117,7 +116,11 @@ if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
|
|||
|
||||
<?php
|
||||
// Show custom background
|
||||
echo '<body bgcolor="#555555">';
|
||||
if ($config["pure"] == 0)
|
||||
echo '<body bgcolor="#555555">';
|
||||
else
|
||||
echo '<body bgcolor="#FFFFFF">';
|
||||
|
||||
$REMOTE_ADDR = getenv ("REMOTE_ADDR");
|
||||
|
||||
// Login process
|
||||
|
@ -176,6 +179,8 @@ if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
|
|||
} else {
|
||||
// There is session for id_usuario
|
||||
$config["id_user"] = $_SESSION["id_usuario"];
|
||||
//$id_usuario = entrada_limpia ($_SESSION["id_usuario"]);
|
||||
//$id_user = entrada_limpia ($_SESSION["id_usuario"]);
|
||||
}
|
||||
|
||||
// Log off
|
||||
|
@ -202,35 +207,51 @@ if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
|
|||
// http://es2.php.net/manual/en/ref.session.php#64525
|
||||
// Session locking concurrency speedup!
|
||||
session_write_close();
|
||||
?>
|
||||
|
||||
<div id="container">
|
||||
<div id='head'>
|
||||
<?php require("general/header.php"); ?>
|
||||
</div>
|
||||
<div id="page">
|
||||
<div id="menu">
|
||||
<?php require ("general/main_menu.php"); ?>
|
||||
</div>
|
||||
<div id="main">
|
||||
<?php
|
||||
// Page loader / selector
|
||||
if ($pagina != ""){
|
||||
if (file_exists ($pagina . ".php")) {
|
||||
require ($pagina . ".php");
|
||||
} else {
|
||||
echo "<br><b class='error'>Sorry! I can't find the page!</b>";
|
||||
}
|
||||
} else
|
||||
require ("general/logon_ok.php"); //default
|
||||
?>
|
||||
</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
<div id="foot">
|
||||
<?php require("general/footer.php") ?>
|
||||
</div>
|
||||
</div>
|
||||
// Header
|
||||
if ($config["pure"] == 0){
|
||||
echo '<div id="container">';
|
||||
echo '<div id="head">';
|
||||
require("general/header.php");
|
||||
echo '</div>';
|
||||
echo '<div id="page">';
|
||||
echo ' <div id="menu">';
|
||||
require ("general/main_menu.php");
|
||||
echo ' </div>';
|
||||
} else {
|
||||
echo '<div id="main_pure">';
|
||||
}
|
||||
|
||||
// Main block of content
|
||||
if ($config["pure"] == 0){
|
||||
echo '<div id="main">';
|
||||
}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
// Page loader / selector
|
||||
if ($pagina != ""){
|
||||
if (file_exists ($pagina . ".php")) {
|
||||
require ($pagina . ".php");
|
||||
} else {
|
||||
echo "<br><b class='error'>".lang_string("Sorry! I can't find the page!")."</b>";
|
||||
}
|
||||
} else
|
||||
require ("general/logon_ok.php"); //default
|
||||
|
||||
if ($config["pure"] == 0){
|
||||
echo '</div>'; // main
|
||||
echo '<div style="clear:both"></div>';
|
||||
echo '</div>'; // page
|
||||
} else {
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
if ($config["pure"] == 0){
|
||||
echo '<div id="foot">';
|
||||
require("general/footer.php");
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</body></html>';
|
||||
|
||||
?>
|
|
@ -101,7 +101,7 @@ if (comprueba_login() == 0) {
|
|||
} else {
|
||||
// Is admin user ??
|
||||
if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id_user'", "nivel") == 1){
|
||||
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, $block_size";
|
||||
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
|
||||
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo";
|
||||
|
||||
// standard user
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
// Pandora FMS - the Free Monitoring System
|
||||
// ========================================
|
||||
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
|
||||
// Please see http://pandora.sourceforge.net for full contribution list
|
||||
|
||||
|
@ -18,7 +19,6 @@
|
|||
// Load global vars
|
||||
require("include/config.php");
|
||||
|
||||
|
||||
// Login check
|
||||
$id_usuario=$_SESSION["id_usuario"];
|
||||
global $REMOTE_ADDR;
|
||||
|
@ -29,7 +29,7 @@ if (comprueba_login() != 0) {
|
|||
exit;
|
||||
}
|
||||
|
||||
if ((give_acl($id_user, 0, "AR")!=1) AND (!give_acl($id_user,0,"AW")) AND (dame_admin($id_user)!=1)) {
|
||||
if ((give_acl($config["id_user"], 0, "AR")!=1) AND (!give_acl($config["id_user"],0,"AW")) AND (dame_admin($config["id_user"])!=1)) {
|
||||
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access alert view");
|
||||
include ("general/noaccess.php");
|
||||
exit;
|
||||
|
@ -43,8 +43,8 @@ if (isset($_GET["id_agente"])){
|
|||
$id_agente = $_GET["id_agente"];
|
||||
|
||||
$id_grupo_alerta = get_db_value ("id_grupo", "tagente", "id_agente", $id_agente);
|
||||
if (give_acl($id_user, $id_grupo_alerta, "AR") == 0) {
|
||||
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access alert view");
|
||||
if (give_acl($config["id_user"], $id_grupo_alerta, "AR") == 0) {
|
||||
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access alert view");
|
||||
include ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ if (isset($_GET["id_agente"])){
|
|||
echo "<div class='nf'>".$lang_label["no_alerts"]."</div>";
|
||||
}
|
||||
|
||||
// Show alert for no defined agent
|
||||
} else {
|
||||
// -------------------------------
|
||||
// SHOW ALL ALERTS (GENERAL PAGE)
|
||||
|
@ -119,33 +120,26 @@ if (isset($_GET["id_agente"])){
|
|||
echo "<h2>".$lang_label["ag_title"]." > ";
|
||||
echo $lang_label["alert_listing"]."</h2>";
|
||||
$iduser_temp=$_SESSION['id_usuario'];
|
||||
if (isset($_POST["ag_group"]))
|
||||
$ag_group = $_POST["ag_group"];
|
||||
elseif (isset($_GET["group_id"]))
|
||||
$ag_group = $_GET["group_id"];
|
||||
else
|
||||
$ag_group = -1;
|
||||
if (isset($_GET["ag_group_refresh"])){
|
||||
$ag_group = $_GET["ag_group_refresh"];
|
||||
}
|
||||
|
||||
if (isset($_POST["ag_group"])){
|
||||
$ag_group = $_POST["ag_group"];
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/estado_alertas&refr=60&ag_group_refresh=".$ag_group."'>";
|
||||
} else {
|
||||
$ag_group = get_parameter ("ag_group", -1);
|
||||
|
||||
if ($ag_group != -1)
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/estado_alertas&refr=60&ag_group=".$ag_group."'>";
|
||||
else
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/estado_alertas&refr=60'>";
|
||||
}
|
||||
echo "<table cellpadding='4' cellspacing='4' class='databox'><tr>";
|
||||
|
||||
echo "<table cellpadding='4' cellspacing='4' class='databox'>";
|
||||
echo "<tr>";
|
||||
echo "<td>".$lang_label["group"]."</td>";
|
||||
echo "<td valign='middle'>";
|
||||
echo "<select name='ag_group' onChange='javascript:this.form.submit();' class='w130'>";
|
||||
echo "<select name='ag_group' onChange='javascript:this.form.submit();' class='w150'>";
|
||||
|
||||
if ( $ag_group > 1 ){
|
||||
echo "<option value='".$ag_group."'>".dame_nombre_grupo($ag_group).
|
||||
"</option>";
|
||||
}
|
||||
echo "<option value=1>".dame_nombre_grupo(1)."</option>";
|
||||
list_group ($id_user);
|
||||
list_group ($config["id_user"]);
|
||||
echo "</select></td>";
|
||||
echo "<td valign='middle'>
|
||||
<noscript>
|
||||
|
@ -158,143 +152,142 @@ if (isset($_GET["id_agente"])){
|
|||
$sql='SELECT id_agente, nombre, disabled FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre';
|
||||
else
|
||||
$sql='SELECT id_agente, nombre, disabled FROM tagente ORDER BY id_grupo, nombre';
|
||||
$result=mysql_query($sql);
|
||||
if (mysql_num_rows($result)){
|
||||
$color=1;
|
||||
while ($row=mysql_fetch_array($result)){ //while there are agents
|
||||
if ($row["disabled"] == 0) {
|
||||
$id_agente = $row['id_agente'];
|
||||
$nombre_agente = strtoupper($row["nombre"]);
|
||||
$query_gen='SELECT talerta_agente_modulo.id_alerta,
|
||||
talerta_agente_modulo.descripcion,
|
||||
talerta_agente_modulo.last_fired,
|
||||
talerta_agente_modulo.times_fired,
|
||||
talerta_agente_modulo.id_agente_modulo,
|
||||
tagente_modulo.id_agente_modulo
|
||||
FROM tagente_modulo, talerta_agente_modulo
|
||||
WHERE tagente_modulo.id_agente = '.$id_agente.'
|
||||
AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo
|
||||
AND talerta_agente_modulo.disable = 0 ';
|
||||
$result_gen=mysql_query($query_gen);
|
||||
if (mysql_num_rows ($result_gen)) {
|
||||
while ($data=mysql_fetch_array($result_gen)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
if (!isset($string)) {
|
||||
$string='';
|
||||
}
|
||||
$string = $string."<tr><td class='".$tdcolor."'>
|
||||
<a href='index.php?sec=estado&
|
||||
sec2=operation/agentes/ver_agente&
|
||||
id_agente=".$id_agente."'>
|
||||
<b>".$nombre_agente."</b>";
|
||||
$string .= "<td class='$tdcolor' align='center'>";
|
||||
if ($data["times_fired"] <> 0)
|
||||
$string .= "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["fired"]."'>";
|
||||
else
|
||||
$string .= "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["not_fired"]."'>";
|
||||
|
||||
$string = $string."<td class='".$tdcolor."'>"
|
||||
.dame_nombre_alerta($data["id_alerta"])."</td>";
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$data["descripcion"]."</td>";
|
||||
if ($data["last_fired"] == "0000-00-00 00:00:00") {
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$lang_label["never"]."</td>";
|
||||
} else {
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
human_time_comparation($data["last_fired"])."</td>";
|
||||
|
||||
|
||||
}
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$data["times_fired"]."</td>";
|
||||
}
|
||||
}
|
||||
else if($ag_group>1) {
|
||||
unset($string);
|
||||
} //end result
|
||||
} //end disabled=0
|
||||
} //end while
|
||||
$sql = "SELECT id_agente, nombre, disabled FROM tagente WHERE tagente.disabled = 0 ";
|
||||
// Agent group selector
|
||||
if ($ag_group > 1)
|
||||
$sql .=" AND tagente.id_grupo = ".$ag_group;
|
||||
else {
|
||||
// User has explicit permission on group 1 ?
|
||||
$all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."' AND id_grupo = 1");
|
||||
if ($all_group == 0)
|
||||
$sql .=" AND tagente.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."')";
|
||||
}
|
||||
|
||||
$color=1; $string = '';
|
||||
$result=mysql_query($sql);
|
||||
if ($result)
|
||||
while ($row=mysql_fetch_array($result)){ //while there are agents
|
||||
$id_agente = $row['id_agente'];
|
||||
$nombre_agente = strtoupper($row["nombre"]);
|
||||
$query_gen='SELECT talerta_agente_modulo.id_alerta,
|
||||
talerta_agente_modulo.descripcion,
|
||||
talerta_agente_modulo.last_fired,
|
||||
talerta_agente_modulo.times_fired,
|
||||
talerta_agente_modulo.id_agente_modulo,
|
||||
tagente_modulo.id_agente_modulo
|
||||
FROM tagente_modulo, talerta_agente_modulo
|
||||
WHERE tagente_modulo.id_agente = '.$id_agente.'
|
||||
AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo
|
||||
AND talerta_agente_modulo.disable = 0 ';
|
||||
$result_gen=mysql_query($query_gen);
|
||||
while ($data=mysql_fetch_array($result_gen)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
$string .= "<tr><td class='".$tdcolor."'>
|
||||
<a href='index.php?sec=estado&
|
||||
sec2=operation/agentes/ver_agente&
|
||||
id_agente=".$id_agente."'>
|
||||
<b>".$nombre_agente."</b>";
|
||||
$string .= "<td class='$tdcolor' align='center'>";
|
||||
if ($data["times_fired"] <> 0)
|
||||
$string .= "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["fired"]."'>";
|
||||
else
|
||||
$string .= "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["not_fired"]."'>";
|
||||
|
||||
$string = $string."<td class='".$tdcolor."'>"
|
||||
.dame_nombre_alerta($data["id_alerta"])."</td>";
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$data["descripcion"]."</td>";
|
||||
if ($data["last_fired"] == "0000-00-00 00:00:00") {
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$lang_label["never"]."</td>";
|
||||
} else {
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
human_time_comparation($data["last_fired"])."</td>";
|
||||
}
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$data["times_fired"]."</td>";
|
||||
}
|
||||
} //end while
|
||||
|
||||
// Display combined alerts
|
||||
// =======================
|
||||
$sql = "SELECT id_agente, nombre, disabled FROM tagente WHERE tagente.disabled = 0 ";
|
||||
// Agent group selector
|
||||
if ($ag_group > 1)
|
||||
$sql='SELECT id_agente, nombre, disabled FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre';
|
||||
else
|
||||
$sql='SELECT id_agente, nombre, disabled FROM tagente ORDER BY id_grupo, nombre';
|
||||
$sql .=" AND tagente.id_grupo = ".$ag_group;
|
||||
else {
|
||||
// User has explicit permission on group 1 ?
|
||||
$all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."' AND id_grupo = 1");
|
||||
if ($all_group == 0)
|
||||
$sql .=" AND tagente.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."')";
|
||||
}
|
||||
|
||||
$result=mysql_query($sql);
|
||||
|
||||
if (mysql_num_rows($result)){
|
||||
$color=1;
|
||||
while ($row=mysql_fetch_array($result)){ //while there are agents
|
||||
if ($row["disabled"] == 0) {
|
||||
$id_agente = $row['id_agente'];
|
||||
$nombre_agente = strtoupper($row["nombre"]);
|
||||
$query_gen='SELECT talerta_agente_modulo.id_alerta,
|
||||
talerta_agente_modulo.descripcion,
|
||||
talerta_agente_modulo.last_fired,
|
||||
talerta_agente_modulo.times_fired,
|
||||
talerta_agente_modulo.id_agent
|
||||
FROM talerta_agente_modulo
|
||||
WHERE talerta_agente_modulo.id_agent = '.$id_agente.' AND talerta_agente_modulo.disable = 0 ';
|
||||
$result_gen=mysql_query($query_gen);
|
||||
if (mysql_num_rows ($result_gen)) {
|
||||
while ($data=mysql_fetch_array($result_gen)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
if (!isset($string)) {
|
||||
$string='';
|
||||
}
|
||||
$string = $string."<tr><td class='".$tdcolor."'>
|
||||
<a href='index.php?sec=estado&
|
||||
sec2=operation/agentes/ver_agente&
|
||||
id_agente=".$id_agente."'>
|
||||
<b>".$nombre_agente."</b> (*)";
|
||||
$string .= "<td class='$tdcolor' align='center'>";
|
||||
if ($data["times_fired"] <> 0)
|
||||
$string .= "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["fired"]."'>";
|
||||
else
|
||||
$string .= "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["not_fired"]."'>";
|
||||
|
||||
$string = $string."<td class='".$tdcolor."'>"
|
||||
.dame_nombre_alerta($data["id_alerta"])."</td>";
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$data["descripcion"]."</td>";
|
||||
if ($data["last_fired"] == "0000-00-00 00:00:00") {
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$lang_label["never"]."</td>";
|
||||
} else {
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
human_time_comparation($data["last_fired"])."</td>";
|
||||
|
||||
|
||||
}
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$data["times_fired"]."</td>";
|
||||
}
|
||||
$color=1;
|
||||
if ($result)
|
||||
while ($row=mysql_fetch_array($result)){ //while there are agents
|
||||
$id_agente = $row['id_agente'];
|
||||
$nombre_agente = strtoupper($row["nombre"]);
|
||||
$query_gen='SELECT talerta_agente_modulo.id_alerta,
|
||||
talerta_agente_modulo.descripcion,
|
||||
talerta_agente_modulo.last_fired,
|
||||
talerta_agente_modulo.times_fired,
|
||||
talerta_agente_modulo.id_agent
|
||||
FROM talerta_agente_modulo
|
||||
WHERE talerta_agente_modulo.id_agent = '.$id_agente.' AND talerta_agente_modulo.disable = 0 ';
|
||||
$result_gen=mysql_query($query_gen);
|
||||
if (mysql_num_rows ($result_gen)) {
|
||||
while ($data=mysql_fetch_array($result_gen)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else if($ag_group>1) {
|
||||
unset($string);
|
||||
} //end result
|
||||
} //end disabled=0
|
||||
} //end while
|
||||
} // if rows..
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
if (!isset($string)) {
|
||||
$string='';
|
||||
}
|
||||
$string = $string."<tr><td class='".$tdcolor."'>
|
||||
<a href='index.php?sec=estado&
|
||||
sec2=operation/agentes/ver_agente&
|
||||
id_agente=".$id_agente."'>
|
||||
<b>".$nombre_agente."</b> (*)";
|
||||
$string .= "<td class='$tdcolor' align='center'>";
|
||||
if ($data["times_fired"] <> 0)
|
||||
$string .= "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["fired"]."'>";
|
||||
else
|
||||
$string .= "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["not_fired"]."'>";
|
||||
|
||||
$string = $string."<td class='".$tdcolor."'>"
|
||||
.dame_nombre_alerta($data["id_alerta"])."</td>";
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$data["descripcion"]."</td>";
|
||||
if ($data["last_fired"] == "0000-00-00 00:00:00") {
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$lang_label["never"]."</td>";
|
||||
} else {
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
human_time_comparation($data["last_fired"])."</td>";
|
||||
|
||||
if (isset($string)) {
|
||||
|
||||
}
|
||||
$string=$string."<td class='".$tdcolor."'>".
|
||||
$data["times_fired"]."</td>";
|
||||
}
|
||||
}
|
||||
} //end while
|
||||
|
||||
if ($string != "") {
|
||||
echo "<td class='f9' style='padding-left: 30px;'>";
|
||||
echo "<img src='images/pixel_red.png' width=18 height=18> ".$lang_label["fired"]."</td>";
|
||||
echo "<td class='f9' style='padding-left: 30px;'>";
|
||||
|
@ -309,7 +302,6 @@ if (isset($_GET["id_agente"])){
|
|||
<th>".$lang_label["description"]."</th>
|
||||
<th>".$lang_label["last_fired"]."</th>
|
||||
<th>".$lang_label["times_fired"]."</th>";
|
||||
|
||||
echo $string; //built table of alerts
|
||||
echo "</table>";
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ if (comprueba_login() == 0) {
|
|||
$comentarios = $row["comentarios"];
|
||||
$id_grupo = $row["id_grupo"];
|
||||
$id_os= $row["id_os"];
|
||||
$id_parent= $row["id_parent"];
|
||||
$os_version = $row["os_version"];
|
||||
$agent_version = $row["agent_version"];
|
||||
$disabled= $row["disabled"];
|
||||
|
@ -42,7 +43,7 @@ if (comprueba_login() == 0) {
|
|||
echo "<h3 class='error'>".$lang_label["agent_error"]."</h3>";
|
||||
echo "</table>";
|
||||
echo "</div><div id='foot'>";
|
||||
include ("general/footer.php");
|
||||
include ("general/footer.php");
|
||||
echo "</div>";
|
||||
exit;
|
||||
}
|
||||
|
@ -102,28 +103,40 @@ if (comprueba_login() == 0) {
|
|||
}*/
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>
|
||||
<td class="datos2"><b>'.$lang_label["interval"].'</b></td>
|
||||
<td class="datos2" colspan=2>'. human_time_description_raw($intervalo).'</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>
|
||||
<td class="datos"><b>'.$lang_label["description"].'</b></td>
|
||||
<td class="datos" colspan=2>'.$comentarios.'</td>';
|
||||
|
||||
// Parent
|
||||
echo '<tr>
|
||||
<td class="datos2"><b>'.lang_string("Parent").'</b></td>
|
||||
<td class="datos2" colspan=2>';
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_parent'>";
|
||||
echo dame_nombre_agente($id_parent).'</a></td>';
|
||||
|
||||
// Agent Interval
|
||||
echo '<tr>
|
||||
<td class="datos"><b>'.$lang_label["interval"].'</b></td>
|
||||
<td class="datos" colspan=2>'. human_time_description_raw($intervalo).'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
// Comments
|
||||
echo '<tr>
|
||||
<td class="datos2"><b>'.$lang_label["description"].'</b></td>
|
||||
<td class="datos2" colspan=2>'.$comentarios.'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
// Group
|
||||
echo '<tr>
|
||||
<td class="datos2"><b>'.$lang_label["group"].'</b></td>
|
||||
<td class="datos2" colspan="2">
|
||||
<td class="datos"><b>'.$lang_label["group"].'</b></td>
|
||||
<td class="datos" colspan="2">
|
||||
<img class="bot" src="images/groups_small/'.show_icon_group($id_grupo).'.png" > '.dame_grupo($id_grupo).'</td></tr>';
|
||||
|
||||
// Agent version
|
||||
echo '<tr><td class="datos"><b>'.lang_string ("agentversion"). '</b>';
|
||||
echo '<td class="datos" colspan=2>'.salida_limpia($agent_version). '</td>';
|
||||
echo '<tr><td class="datos2"><b>'.lang_string ("agentversion"). '</b>';
|
||||
echo '<td class="datos2" colspan=2>'.salida_limpia($agent_version). '</td>';
|
||||
|
||||
// Total packets
|
||||
echo '<tr>
|
||||
<td class="datos2"><b>'. lang_string ("total_packets"). '</b></td>';
|
||||
echo '<td class="datos2" colspan=2>';
|
||||
<td class="datos"><b>'. lang_string ("total_packets"). '</b></td>';
|
||||
echo '<td class="datos" colspan=2>';
|
||||
$total_paketes= 0;
|
||||
$sql_3='SELECT COUNT(*) FROM tagente_datos WHERE id_agente = '.$id_agente;
|
||||
$result_3=mysql_query($sql_3);
|
||||
|
@ -134,10 +147,10 @@ if (comprueba_login() == 0) {
|
|||
|
||||
// Last contact
|
||||
echo '<tr>
|
||||
<td class="datos">
|
||||
<td class="datos2">
|
||||
<b>'.$lang_label["last_contact"]." / ".$lang_label["remote"].'</b>
|
||||
</td>
|
||||
<td class="datos f9" colspan="2">';
|
||||
<td class="datos2 f9" colspan="2">';
|
||||
if ($ultima_act == "0000-00-00 00:00:00"){
|
||||
echo $lang_label["never"];
|
||||
} else {
|
||||
|
@ -150,17 +163,6 @@ if (comprueba_login() == 0) {
|
|||
echo $ultima_act_remota;
|
||||
}
|
||||
|
||||
/*
|
||||
// Asigned/active server
|
||||
echo '<tr><td class="datos2"><b>'.$lang_label["server_asigned"].'</b></td>
|
||||
<td class="datos2" colspan=2">';
|
||||
if ($server == ""){
|
||||
echo "N/A";
|
||||
} else {
|
||||
echo give_server_name($server);
|
||||
}
|
||||
*/
|
||||
|
||||
// Next contact
|
||||
|
||||
$ultima = strtotime($ultima_act);
|
||||
|
@ -196,8 +198,8 @@ if (comprueba_login() == 0) {
|
|||
</td>
|
||||
</tr><tr>
|
||||
<td><div style='height:25px'> </div>
|
||||
<b>".$lang_label["agent_module_shareout"]."</b><br><br>
|
||||
<img src='reporting/fgraph.php?id=".$id_agente."&tipo=agentmodules&height=150&width=280' >
|
||||
<b>".lang_string("Events generated -by module-")."</b><br><br>
|
||||
<img src='reporting/fgraph.php?tipo=event_module&width=250&height=180&id_agent=".$id_agente."' >
|
||||
</td></tr>
|
||||
</table></td></tr>
|
||||
</table>
|
||||
|
|
|
@ -162,25 +162,25 @@
|
|||
<img src='images/flag_red.png' alt='".$lang_label["disabled"]."'>";
|
||||
|
||||
// By default green border
|
||||
$celda = "<td class='top' style='border: 3px solid #aeff21;' width='100'>";
|
||||
$celda = "<td class='top' style='border: 5px solid #aeff21;' width='100'>";
|
||||
|
||||
// Grey border if agent down
|
||||
if ($config["show_unknown"] > 0){
|
||||
if ($grupo[$real_count]["down"] > 0)
|
||||
$celda = "<td class='top' style='border: 3px solid #aabbaa;' width='100'>";
|
||||
$celda = "<td class='top' style='border: 5px solid #aabbaa;' width='100'>";
|
||||
}
|
||||
|
||||
// Yellow border if agents with alerts
|
||||
if ($grupo[$real_count]["alerts"] > 0)
|
||||
$celda = "<td class='top' style='border: 3px solid #ffea00;' width='100'>";
|
||||
$celda = "<td class='top' style='border: 5px solid #ffea00;' width='100'>";
|
||||
|
||||
// Red border if agents bad
|
||||
if ($grupo[$real_count]["bad"] > 0)
|
||||
$celda = "<td class='top' style='border: 3px solid #ff0000;' width='100'>";
|
||||
$celda = "<td class='top' style='border: 5px solid #ff0000;' width='100'>";
|
||||
|
||||
// Orange if alerts and down modules
|
||||
if (($grupo[$real_count]["bad"] > 0) && ($grupo[$real_count]["alerts"] > 0))
|
||||
$celda = "<td class='top' style='border: 3px solid #ffbb00;' width='100'>";
|
||||
$celda = "<td class='top' style='border: 5px solid #ffbb00;' width='100'>";
|
||||
|
||||
|
||||
$celda .= "<a href='index.php?sec=estado&
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
// Pandora - the Free monitoring system
|
||||
// Pandora FMS
|
||||
// ====================================
|
||||
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L, info@artica.es
|
||||
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas S.L, info@artica.es
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
echo "<h2>".$lang_label["ag_title"]." > ";
|
||||
echo $lang_label["tactical_view"]."</h2>";
|
||||
|
||||
$data = general_stats($id_user,0);
|
||||
$data = general_stats ($id_user,-1);
|
||||
$monitor_checks = $data[0];
|
||||
$monitor_ok = $data[1];
|
||||
$monitor_bad = $data[2];
|
||||
|
@ -37,14 +37,51 @@
|
|||
$data_alert_total = $data[9];
|
||||
$monitor_alert_total = $data[10];
|
||||
$data_not_init = $data[11];
|
||||
$monitor_not_init = $data[12];
|
||||
$total_checks = $data_checks + $monitor_checks;
|
||||
$monitor_not_init = $data[12];
|
||||
|
||||
// Calculate global indicators
|
||||
|
||||
$total_checks = $data_checks + $monitor_checks;
|
||||
$notinit_percentage = (($data_not_init + $monitor_not_init) / ($total_checks / 100));
|
||||
$module_sanity = format_numeric (100 - $notinit_percentage);
|
||||
$total_alerts = $data_alert + $monitor_alert;
|
||||
$total_fired_alerts = $monitor_alert_total+$data_alert_total;
|
||||
$alert_level = format_numeric (100 - ($total_alerts / ($total_fired_alerts / 100)));
|
||||
|
||||
if ($monitor_checks > 0){
|
||||
$monitor_health = format_numeric ( 100- (($monitor_bad + $monitor_unknown) / ($monitor_checks/100)) , 1);
|
||||
} else
|
||||
$monitor_health = 100;
|
||||
if ($data_checks > 0){
|
||||
$data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);;
|
||||
} else
|
||||
$data_health = 100;
|
||||
if (($data_checks != 0) OR ($data_checks != 0)){
|
||||
$global_health = format_numeric ((($data_health * $data_checks) + ($monitor_health * $monitor_checks)) / $total_checks);
|
||||
} else
|
||||
$global_health = 100;
|
||||
|
||||
// Monitor checks
|
||||
// ~~~~~~~~~~~~~~~
|
||||
echo "<table width=700 border=0>";
|
||||
echo "<table width=770 border=0>";
|
||||
echo "<tr><td>";
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
|
||||
// Summary
|
||||
|
||||
echo "<tr><td colspan='2'><b>".lang_string("Monitor health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$monitor_health' title='$monitor_health % ".lang_string("of monitors UP")."'>";
|
||||
echo "<tr><td colspan='2'><b>".lang_string("Data health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$data_health' title='$data_health % ".lang_string("of modules with updated data")."'>";
|
||||
echo "<tr><td colspan='2'><b>".lang_string("Global health")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$global_health' title='$global_health % ".lang_string("of modules with good data")."'>";
|
||||
echo "<tr><td colspan='2'><b>".lang_string("Module sanity")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$module_sanity ' title='$module_sanity % ".lang_string("of well initialized modules")."'>";
|
||||
echo "<tr><td colspan='2'><b>".lang_string("Alert level")."</th>";
|
||||
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$alert_level' title='$alert_level % ".lang_string("of non-fired alerts")."'>";
|
||||
|
||||
|
||||
echo "<tr>";
|
||||
echo "<th colspan=2>".$lang_label["monitor_checks"]."</th>";
|
||||
echo "<tr><td class=datos2><b>"."Monitor checks"."</b></td>";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000;'>".$monitor_checks."</td>";
|
||||
|
@ -64,7 +101,7 @@
|
|||
echo "-";
|
||||
|
||||
echo "</td></tr><tr><td class=datos2><b>"."Monitor Not Init"."</b></td>";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #888;'>";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #FF8C00;'>";
|
||||
if ($monitor_not_init> 0)
|
||||
echo $monitor_not_init;
|
||||
else
|
||||
|
@ -78,12 +115,12 @@
|
|||
echo "-";
|
||||
echo "<tr><td class=datos2><b>"."Alerts Total"."</b></td>";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$monitor_alert_total;
|
||||
echo "</table>";
|
||||
|
||||
|
||||
// Data checks
|
||||
// ~~~~~~~~~~~~~~~
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
echo "<th colspan=2>".$lang_label["data_checks"]."</th>";
|
||||
|
||||
echo "<tr><th colspan=2>".$lang_label["data_checks"]."</th>";
|
||||
echo "<tr><td class=datos2><b>"."Data checks"."</b></td>";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$data_checks;
|
||||
echo "<tr><td class=datos><b>"."Data Unknown"."</b></td>";
|
||||
|
@ -93,7 +130,7 @@
|
|||
else
|
||||
echo "-";
|
||||
echo "<tr><td class=datos2><b>"."Data not init"."</b></td>";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #f00;'>";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #FF8C00;'>";
|
||||
if ($data_not_init > 0)
|
||||
echo $data_not_init;
|
||||
else
|
||||
|
@ -106,55 +143,45 @@
|
|||
echo "-";
|
||||
echo "<tr><td class=datos2><b>"."Alerts Total";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000;'>".$data_alert_total;
|
||||
echo "</table>";
|
||||
|
||||
|
||||
// Summary
|
||||
// ~~~~~~~~~~~~~~~
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
echo "<th colspan='2'>".$lang_label["summary"]."</th>";
|
||||
|
||||
echo "<tr><th colspan='2'>".$lang_label["summary"]."</th>";
|
||||
echo "<tr><td class='datos2'><b>"."Total agents"."</b></td>";
|
||||
echo "<td class='datos2' style='font: bold 2em Arial, Sans-serif; color: #000;'>".$total_agents;
|
||||
echo "<tr><td class='datos'><b>"."Total checks"."</b></td>";
|
||||
echo "<td class='datos' style='font: bold 2em Arial, Sans-serif; color: #000;'>".$total_checks;
|
||||
|
||||
echo "<tr><td class='datos2'><b>"."Server sanity"."</b></td>";
|
||||
echo "<td class='datos2' style='font: bold 2em Arial, Sans-serif; color: #000;'";
|
||||
echo format_numeric($notinit_percentage);
|
||||
echo "% ".lang_string("Uninitialized modules");
|
||||
|
||||
echo "</table>";
|
||||
|
||||
echo "<td valign='top'>";
|
||||
|
||||
// Odometer Graph
|
||||
// ~~~~~~~~~~~~~~~
|
||||
if ($monitor_checks > 0){
|
||||
$monitor_health = format_numeric ((($monitor_ok - $monitor_alert - $monitor_unknown)/ $monitor_checks) * 100,1);
|
||||
} else
|
||||
$monitor_health = 100;
|
||||
if ($data_checks > 0){
|
||||
$data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);;
|
||||
} else
|
||||
$data_health = 100;
|
||||
if (($data_checks != 0) OR ($data_checks != 0)){
|
||||
$global_health = format_numeric( ((($monitor_ok -$monitor_alert - $monitor_unknown )+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1);
|
||||
} else
|
||||
$global_health = 100;
|
||||
|
||||
echo "<h2>".$lang_label["tactical_indicator"]."</h2>";
|
||||
echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";
|
||||
|
||||
// Server information
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Get total modules defined (network)
|
||||
$total_modules_network = get_db_sql ("SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4 AND id_tipo_modulo != 100");
|
||||
// Get total modules defined (data)
|
||||
$total_modules_data = get_db_sql ("SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo < 5 OR id_tipo_modulo = 100");
|
||||
echo "<h2>".$lang_label["tactical_server_information"]."</h2>";
|
||||
// Get total modules defined (network)
|
||||
$total_modules_network = get_db_sql ("SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4 AND id_tipo_modulo < 19 AND id_tipo_modulo != 100");
|
||||
|
||||
// Get total modules defined (data)
|
||||
$total_modules_data = get_db_sql ("SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo < 5 OR id_tipo_modulo = 100");
|
||||
// Connect DataBase
|
||||
$sql='SELECT * FROM tserver';
|
||||
$sql='SELECT * FROM tserver';
|
||||
$result=mysql_query($sql);
|
||||
if (mysql_num_rows($result)){
|
||||
echo "<table cellpadding='4' cellspacing='4' witdh='720' class='databox'>";
|
||||
echo "<tr><th class='datos'>".$lang_label["name"]."</th>";
|
||||
echo "<th class='datos'>".$lang_label['status']."</th>";
|
||||
echo "<th class='datos'>".$lang_label['load']."</th>";
|
||||
echo "<th class='datos'>".$lang_label['modules']."</th>";
|
||||
echo "<th class='datos'>".$lang_label['lag']."</th>";
|
||||
echo "<table cellpadding='4' cellspacing='4' witdh='440' class='databox'>";
|
||||
echo "<tr><th colspan=5>";
|
||||
echo lang_string("tactical_server_information");
|
||||
echo "<tr><td class='datos3'>".$lang_label["name"]."</th>";
|
||||
echo "<td class='datos3'>".$lang_label['status']."</th>";
|
||||
echo "<td class='datos3'>".$lang_label['load']."</th>";
|
||||
echo "<td class='datos3'>".$lang_label['modules']."</th>";
|
||||
echo "<td class='datos3'>".$lang_label['lag']."</th>";
|
||||
$color=1;
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($color == 1){
|
||||
|
@ -190,14 +217,15 @@
|
|||
echo "<b>$name</b>";
|
||||
echo "<td class='$tdcolor' align='middle'>";
|
||||
if ($status ==0){
|
||||
echo "<img src='images/dot_red.png'>";
|
||||
echo "<img src='images/pixel_red.png' width=20 height=20>";
|
||||
} else {
|
||||
echo "<img src='images/dot_green.png'>";
|
||||
echo "<img src='images/pixel_green.png' width=20 height=20>";
|
||||
}
|
||||
echo "<td class='$tdcolor' align='middle'>";
|
||||
if (($network_server == 1) OR ($data_server == 1)){
|
||||
// Progress bar calculations
|
||||
if ($network_server == 1){
|
||||
$total_modules_network_LAG = get_db_sql ("SELECT COUNT( tagente_modulo.id_agente_modulo) FROM tagente, tagente_modulo, tagente_estado WHERE id_network_server = $id_server AND tagente_modulo.id_agente = tagente.id_agente AND tagente.disabled = 0 AND tagente_modulo.id_tipo_modulo > 4 AND tagente_modulo.id_tipo_modulo < 19 AND tagente_modulo.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND (((tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP()) OR tagente_modulo.flag = 1 );");
|
||||
if ($modules_server == 0)
|
||||
$percentil = 0;
|
||||
if ($modules_server > 0)
|
||||
|
@ -206,6 +234,7 @@
|
|||
$percentil = 0;
|
||||
$total_modules_temp = $total_modules_network;
|
||||
} else {
|
||||
$total_modules_network_LAG = get_db_sql ("SELECT COUNT( tagente_modulo.id_agente_modulo) FROM tagente, tagente_modulo, tagente_estado WHERE tagente_estado.running_by = $id_server AND tagente_modulo.id_agente = tagente.id_agente AND tagente.disabled = 0 AND tagente_modulo.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND (((tagente_estado.last_execution_try + tagente_estado.current_interval) < UNIX_TIMESTAMP()) OR tagente_modulo.flag = 1 );");
|
||||
if ($total_modules_data == 0)
|
||||
$percentil = 0;
|
||||
else
|
||||
|
@ -245,6 +274,7 @@
|
|||
echo $modules_server . " / ". $total_modules_temp;
|
||||
else
|
||||
echo "-";
|
||||
|
||||
|
||||
// LAG CHECK
|
||||
echo "<td class='$tdcolor'>";
|
||||
|
@ -252,7 +282,7 @@
|
|||
// and calculate difference in seconds
|
||||
// Get total modules defined for this server
|
||||
if (($network_server == 1) OR ($data_server == 1)){
|
||||
if ($network_server == 1)
|
||||
if ($network_server == 1)
|
||||
$sql1 = "SELECT MIN(last_execution_try),current_interval FROM tagente_estado WHERE last_execution_try > 0 AND running_by=$id_server GROUP BY current_interval ORDER BY 1";
|
||||
if ($data_server == 1)
|
||||
// This only checks for agent with a last_execution_try of at
|
||||
|
@ -265,12 +295,12 @@
|
|||
while ($row1=mysql_fetch_array($result1)){
|
||||
if (($row1[0] + $row1[1]) < $nowtime){
|
||||
$maxlag2 = $nowtime - ($row1[0] + $row1[1]);
|
||||
// More than 5 times module interval is not lag, is a big
|
||||
// problem in agent, network or servers..
|
||||
if ($maxlag2 < ($row1[1]*5))
|
||||
if ($maxlag2 > $maxlag)
|
||||
$maxlag = $maxlag2;
|
||||
}
|
||||
// More than 5 times module interval is not lag, is a big
|
||||
// problem in agent, network or servers..
|
||||
if ($maxlag2 < ($row1[1]*5))
|
||||
if ($maxlag2 > $maxlag)
|
||||
$maxlag = $maxlag2;
|
||||
}
|
||||
}
|
||||
if ($maxlag < 60)
|
||||
echo $maxlag." sec";
|
||||
|
@ -278,6 +308,7 @@
|
|||
echo format_numeric($maxlag/60) . " min";
|
||||
elseif ($maxlag > 86400)
|
||||
echo "+1 ".$lang_label["day"];
|
||||
echo " - ".$total_modules_network_LAG ." ".lang_string("modules");
|
||||
} elseif ($recon_server == 1) {
|
||||
$sql1 = "SELECT * FROM trecon_task WHERE id_network_server = $id_server";
|
||||
$result1=mysql_query($sql1);
|
||||
|
@ -302,6 +333,10 @@
|
|||
}
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
// Event information
|
||||
smal_event_table ("", 10, 440);
|
||||
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
|
|
|
@ -19,22 +19,26 @@
|
|||
require("include/config.php");
|
||||
|
||||
if (comprueba_login() == 0) {
|
||||
$id_agente = give_parameter_get_numeric("id_agente");
|
||||
$id_agente = get_parameter("id_agente",-1);
|
||||
if ($id_agente != -1){
|
||||
// get group for this id_agente
|
||||
$query="SELECT * FROM tagente WHERE id_agente = ".$id_agente;
|
||||
$res=mysql_query($query);
|
||||
$row=mysql_fetch_array($res);
|
||||
$id_grupo = $row["id_grupo"];
|
||||
$id_usuario=$_SESSION["id_usuario"];
|
||||
$id_usuario=$config["id_user"];
|
||||
if (give_acl($id_usuario, $id_grupo, "AR")==1){
|
||||
|
||||
// Check for validate alert request
|
||||
$validate_alert = give_parameter_get ("validate_alert");
|
||||
if ($validate_alert != ""){
|
||||
if (give_acl($id_usuario, $id_grupo, "AW")==1){
|
||||
$alert_name = get_db_value ("descripcion", "talerta_agente_modulo", "id_aam", $validate_alert);
|
||||
event_insert ("Manual validation of alert for '$alert_name'", $id_grupo, $id_agente, 1, $id_usuario);
|
||||
$alert_row = get_db_row ("talerta_agente_modulo", "id_aam", $validate_alert);
|
||||
$am_row = get_db_row ("tagente_modulo", "id_agente_modulo", $alert_row["id_agente_modulo"]);
|
||||
$ag_row = get_db_row ("tagente", "id_agente", $am_row["id_agente"]);
|
||||
$alert_name = $alert_row["descripcion"];
|
||||
|
||||
event_insert("Manual validation of alert for '$alert_name'", $ag_row["id_grupo"], $am_row["id_agente"], 1, $id_usuario, "alert_manual_validation", 1, $alert_row["id_agente_modulo"], $validate_alert);
|
||||
$sql='UPDATE talerta_agente_modulo SET times_fired = 0, internal_counter = 0 WHERE id_aam = '.$validate_alert;
|
||||
$result=mysql_query($sql);
|
||||
}
|
||||
|
@ -116,6 +120,7 @@ if (comprueba_login() == 0) {
|
|||
require "estado_generalagente.php";
|
||||
require "estado_monitores.php";
|
||||
require "estado_alertas.php";
|
||||
require "status_events.php";
|
||||
break;
|
||||
|
||||
case "data":
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
e.checked = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function OpConfirm(text, conf)
|
||||
{
|
||||
for (var i=0;i<document.pageform.elements.length;i++)
|
||||
|
@ -42,6 +43,15 @@
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Function to hide/unhide a specific Div id */
|
||||
function toggleDiv (divid){
|
||||
if (document.getElementById(divid).style.display == 'none'){
|
||||
document.getElementById(divid).style.display = 'block';
|
||||
} else {
|
||||
document.getElementById(divid).style.display = 'none';
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
|
||||
|
@ -55,8 +65,8 @@ if (comprueba_login() != 0) {
|
|||
}
|
||||
|
||||
$accion = "";
|
||||
if (give_acl($id_user, 0, "AR")!=1) {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access event viewer");
|
||||
if (give_acl($config["id_user"], 0, "AR")!=1) {
|
||||
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to access event viewer");
|
||||
no_permission();
|
||||
}
|
||||
|
||||
|
@ -84,12 +94,12 @@ if (isset($_GET["check"])){
|
|||
$id_evento = $_GET["check"];
|
||||
// Look for event_id following parameters: id_group.
|
||||
$id_group = gime_idgroup_from_idevent($id_evento);
|
||||
if (give_acl($id_user, $id_group, "IW") ==1){
|
||||
$sql2="UPDATE tevento SET estado = 1, id_usuario = '".$id_user."' WHERE id_evento = ".$id_evento;
|
||||
if (give_acl($config["id_user"], $id_group, "IW") ==1){
|
||||
$sql2="UPDATE tevento SET estado = 1, id_usuario = '".$config["id_user"]."' WHERE id_evento = ".$id_evento;
|
||||
$result2=mysql_query($sql2);
|
||||
if ($result2) {
|
||||
echo "<h3 class='suc'>".$lang_label["validate_event_ok"]."</h3>";
|
||||
audit_db($id_user,$REMOTE_ADDR, "Event validated","Validate event: ".return_event_description ($id_evento));
|
||||
audit_db($config["id_user"],$REMOTE_ADDR, "Event validated","Validate event: ".return_event_description ($id_evento));
|
||||
} else {
|
||||
echo "<h3 class='error'>".$lang_label["validate_event_failed"]."</h3>";
|
||||
}
|
||||
|
@ -144,165 +154,269 @@ if (isset($_POST["updatebt"])){
|
|||
|
||||
// Get data
|
||||
|
||||
$offset=0;
|
||||
if (isset($_GET["offset"]))
|
||||
$offset=$_GET["offset"];
|
||||
$offset = get_parameter ( "offset",0);
|
||||
$ev_group = get_parameter ("ev_group", 0); // group
|
||||
$search = get_parameter ("search", ""); // free search
|
||||
$event_type = get_parameter ("event_type", "all"); // 0 all
|
||||
$severity = get_parameter ("severity", -1); // -1 all
|
||||
$status = get_parameter ("status", 0); // -1 all, 0 only red, 1 only green
|
||||
$id_agent = get_parameter ("id_agent", -1);
|
||||
|
||||
if (isset($_GET["group_id"]))
|
||||
$group_id = entrada_limpia($_GET["group_id"]);
|
||||
else
|
||||
$group_id = 0;
|
||||
$sql_post = "";
|
||||
if ($ev_group > 1)
|
||||
$sql_post .= " AND id_grupo = $ev_group";
|
||||
if ($status == 1)
|
||||
$sql_post .= " AND estado = 1";
|
||||
if ($status == 0)
|
||||
$sql_post .= " AND estado = 0";
|
||||
if ($search != "")
|
||||
$sql_post .= " AND evento LIKE '%$search%'";
|
||||
if ($event_type != "all")
|
||||
$sql_post .= " AND event_type = '$event_type'";
|
||||
if ($severity != -1)
|
||||
$sql_post .= " AND criticity >= $severity";
|
||||
if ($id_agent != -1)
|
||||
$sql_post .= " AND id_agente = $id_agent";
|
||||
$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";
|
||||
|
||||
if (isset($_POST["ev_group"]))
|
||||
$ev_group = $_POST["ev_group"];
|
||||
elseif (isset($_GET["group_id"]))
|
||||
$ev_group = $_GET["group_id"];
|
||||
else
|
||||
$ev_group = -1;
|
||||
echo "<h2>".$lang_label["events"]." > ".lang_string ("event_main_view"). " ";
|
||||
|
||||
if ($config["pure"] == 1)
|
||||
echo "<a target='_top' href='$url&pure=0'><img src='images/monitor.png' title='".lang_string("Normal screen")."'></a>";
|
||||
else
|
||||
echo "<a target='_top' href='$url&pure=1'><img src='images/monitor.png' title='".lang_string("Full screen")."'></a>";
|
||||
echo "</h2>";
|
||||
|
||||
$event="All";
|
||||
if (isset($_POST["event"]))
|
||||
$event = entrada_limpia($_POST["event"]);
|
||||
echo "<a href=\"javascript:;\" onmousedown=\"toggleDiv('event_control');\">";
|
||||
echo "<b>".lang_string("Event control filter")." ".'<img src="images/wand.png"></A></b>';
|
||||
|
||||
echo "<h2>".$lang_label["events"]." > ".$lang_label["event_main_view"]."</h2>";
|
||||
echo "<table width=100%>";
|
||||
if ($config["pure"] == 1)
|
||||
echo "<div id='event_control' style='display:none'>";
|
||||
else
|
||||
echo "<div id='event_control' style='display:all'>";
|
||||
|
||||
// Table who separate control and graph
|
||||
echo "<table width=99% cellpadding=0 cellspacing=2 border=0>";
|
||||
echo "<tr><td width=500>";
|
||||
|
||||
// Table for filter controls
|
||||
echo "<table width=500 cellpadding=4 cellspacing=4 class=databox>";
|
||||
echo "<tr>";
|
||||
echo "<form method='post' action='index.php?sec=eventos&sec2=operation/events/events&refr=60'>";
|
||||
echo "<td>".$lang_label["group"]."</td>";
|
||||
echo "<form method='post' action='index.php?sec=eventos&sec2=operation/events/events&refr=60&id_agent=$id_agent&pure=".$config["pure"]."'>";
|
||||
|
||||
// Group combo
|
||||
echo "<td>".lang_string ("group")."</td>";
|
||||
echo "<td>";
|
||||
echo "<select name='ev_group' onChange='javascript:this.form.submit();' class='w130'>";
|
||||
if ( $ev_group > 1 ){
|
||||
echo "<option value='".$ev_group."'>".dame_nombre_grupo($ev_group)."</option>";
|
||||
}
|
||||
echo "<option value=1>".dame_nombre_grupo(1)."</option>";
|
||||
list_group ($id_user);
|
||||
echo "</select></td></tr>";
|
||||
list_group ($config["id_user"]);
|
||||
echo "</select></td>";
|
||||
|
||||
echo "<tr><td valign='middle'>".$lang_label["events"]."</td>";
|
||||
echo "<td><form method='post' action='index.php?sec=eventos&sec2=operation/events/events&refr=60'>";
|
||||
echo "<select name='event' onChange='javascript:this.form.submit();' class='w155'>";
|
||||
echo "<option value='All'>".$lang_label["all"]."</option>";
|
||||
// Event type
|
||||
echo "<td>".lang_string ("Event type")."</td>";
|
||||
echo "<td>";
|
||||
echo form_event_type_combo ("event_type", $event_type);
|
||||
echo "<tr>";
|
||||
|
||||
// Fill event type combo (DISTINCT!)
|
||||
if (isset($ev_group) && ($ev_group > 1))
|
||||
$sql="SELECT DISTINCT evento FROM tevento WHERE id_grupo = '$ev_group'";
|
||||
else
|
||||
$sql="SELECT DISTINCT evento FROM tevento";
|
||||
$result=mysql_query($sql);
|
||||
// Make query for distinct (to fill combo)
|
||||
while ($row=mysql_fetch_array($result))
|
||||
echo "<option value='".$row["evento"]."'>".$row["evento"]."</option>";
|
||||
echo "</select>";
|
||||
echo "</form>";
|
||||
echo "<td valign='middle'>";
|
||||
echo "<noscript><input type='submit' class='sub' value='".$lang_label["show"]."'></noscript>";
|
||||
// Severity
|
||||
echo "<td>".lang_string ("Severity")."</td>";
|
||||
echo "<td>";
|
||||
echo form_priority ($severity, "severity", 1);
|
||||
|
||||
echo "</table>";
|
||||
|
||||
echo "<br>";
|
||||
|
||||
// How many events do I have in total ?
|
||||
if ($event=="All"){
|
||||
if (isset($ev_group) && ($ev_group > 1)) {
|
||||
$sql3="SELECT COUNT(id_evento) FROM tevento WHERE id_grupo = '$ev_group' ";
|
||||
} else {
|
||||
$sql3="SELECT COUNT(id_evento) FROM tevento";
|
||||
}
|
||||
} else {
|
||||
if (isset($ev_group) && ($ev_group > 1)) {
|
||||
$sql3="SELECT COUNT(id_evento) FROM tevento WHERE evento = '$event' AND id_grupo = '$ev_group'";
|
||||
} else {
|
||||
$sql3="SELECT COUNT(id_evento) FROM tevento WHERE evento = '$event' ";
|
||||
}
|
||||
// Status
|
||||
echo "<td>".lang_string ("Event status")."</td>";
|
||||
echo "<td>";
|
||||
echo "<select name='status' onChange='javascript:this.form.submit();'>";
|
||||
if ($status == 1){
|
||||
echo "<option value=1>". lang_string ("Only validated");
|
||||
echo "<option value=-1>". lang_string ("All event");
|
||||
echo "<option value=0>". lang_string ("Only pending");
|
||||
} elseif ($status == 0) {
|
||||
echo "<option value=0>". lang_string ("Only pending");
|
||||
echo "<option value=1>". lang_string ("Only validated");
|
||||
echo "<option value=-1>". lang_string ("All event");
|
||||
} elseif ($status == -1) {
|
||||
echo "<option value=-1>". lang_string ("All event");
|
||||
echo "<option value=0>". lang_string ("Only pending");
|
||||
echo "<option value=1>". lang_string ("Only validated");
|
||||
}
|
||||
echo "</select></td>";
|
||||
echo "<tr>";
|
||||
|
||||
// Free search
|
||||
echo "<td>".lang_string ("Free search")."</td>";
|
||||
echo "<td>";
|
||||
echo "<input type='text' size=15 value='".$search."' name='search'>";
|
||||
echo "<td>";
|
||||
echo "<input type=submit value='".lang_string("Update")."' class='sub upd'>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
echo "<td>";
|
||||
echo '<img src="reporting/fgraph.php?tipo=group_events&width=250&height=180&url='.$sql_post.'" border=0>';
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
$sql2 = "SELECT * FROM tevento WHERE 1=1 ";
|
||||
$sql2 .= $sql_post . " ORDER BY timestamp DESC LIMIT $offset, ".$config["block_size"];
|
||||
$sql3 = "SELECT COUNT(id_evento) FROM tevento WHERE 1=1 ";
|
||||
$sql3 .= $sql_post;
|
||||
|
||||
$result3=mysql_query($sql3);
|
||||
$row3=mysql_fetch_array($result3);
|
||||
$total_events = $row3[0];
|
||||
// Show pagination header
|
||||
|
||||
// Show pagination header
|
||||
if ($total_events > 0){
|
||||
pagination ($total_events, "index.php?sec=eventos&sec2=operation/events/events&group_id=$ev_group&refr=60", $offset);
|
||||
|
||||
$offset = get_parameter ( "offset",0);
|
||||
pagination ($total_events, $url."&pure=".$config["pure"], $offset);
|
||||
// Show data.
|
||||
|
||||
echo "<br>";
|
||||
echo "<br>";
|
||||
echo "<table cellpadding='4' cellspacing='4' width='750' class='databox'>";
|
||||
if ($config["pure"] == 0)
|
||||
echo "<table cellpadding='4' cellspacing='4' width='765' class='databox'>";
|
||||
else
|
||||
echo "<table cellpadding='4' cellspacing='4' class='databox'>";
|
||||
echo "<tr>";
|
||||
echo "<th>".$lang_label["status"]."</th>";
|
||||
echo "<th>".$lang_label["event_name"]."</th>";
|
||||
echo "<th>".$lang_label["agent_name"]."</th>";
|
||||
echo "<th>".$lang_label["group"]."</th>";
|
||||
echo "<th>".$lang_label["id_user"]."</th>";
|
||||
echo "<th width='85'>".$lang_label["timestamp"]."</th>";
|
||||
echo "<th width='80'>".$lang_label["action"]."</th>";
|
||||
echo "<th class=f9>".lang_string ("St")."</th>";
|
||||
echo "<th class=f9>".lang_string ("Type")."</th>";
|
||||
echo "<th class=f9>".$lang_label["event_name"]."</th>";
|
||||
echo "<th class=f9>".$lang_label["agent_name"]."</th>";
|
||||
echo "<th class=f9>".lang_string ("source")."</th>";
|
||||
echo "<th class=f9>".$lang_label["group"]."</th>";
|
||||
echo "<th class=f9>".$lang_label["id_user"]."</th>";
|
||||
echo "<th class=f9>".$lang_label["timestamp"]."</th>";
|
||||
echo "<th class=f9>".$lang_label["action"]."</th>";
|
||||
echo "<th class='p10'>";
|
||||
echo "<label for='checkbox' class='p21'>".$lang_label["all"]." </label>";
|
||||
echo '<input type="checkbox" class="chk" name="allbox" onclick="CheckAll();"></th>';
|
||||
echo "<form name='eventtable' method='POST' action='index.php?sec=eventos&sec2=operation/events/events&refr=60&offset=".$offset."'>";
|
||||
$color = 1;
|
||||
echo "<form name='eventtable' method='POST' action='$url&pure=".$config["pure"]."'>";
|
||||
$id_evento = 0;
|
||||
|
||||
// Prepare index for pagination. Prepare queries
|
||||
if ($event=="All"){
|
||||
if (isset($ev_group) && ($ev_group > 1)) {
|
||||
$sql2="SELECT * FROM tevento WHERE id_grupo = '$ev_group' ORDER BY timestamp DESC LIMIT $offset, ".$config["block_size"];
|
||||
} else {
|
||||
$sql2="SELECT * FROM tevento ORDER BY timestamp DESC LIMIT $offset, ".$config["block_size"];
|
||||
}
|
||||
} else {
|
||||
if (isset($ev_group) && ($ev_group > 1)) {
|
||||
$sql2="SELECT * FROM tevento WHERE evento = '$event' AND id_grupo = '$ev_group' ORDER BY timestamp DESC LIMIT $offset, ".$config["block_size"];
|
||||
} else {
|
||||
$sql2="SELECT * FROM tevento WHERE evento = '$event' ORDER BY timestamp DESC LIMIT $offset, ".$config["block_size"];
|
||||
}
|
||||
}
|
||||
|
||||
$offset_counter=0;
|
||||
// Make query for data (all data, not only distinct).
|
||||
$result2=mysql_query($sql2);
|
||||
while ($row2=mysql_fetch_array($result2)){
|
||||
$id_grupo = $row2["id_grupo"];
|
||||
if (give_acl($id_user, $id_grupo, "IR") == 1){ // Only incident read access to view data !
|
||||
if (give_acl($config["id_user"], $id_grupo, "AR") == 1){ // Only incident read access to view data !
|
||||
$id_group = $row2["id_grupo"];
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr><td class='$tdcolor' align='center'>";
|
||||
if ($row2["estado"] == 0)
|
||||
echo "<img src='images/dot_red.png'>";
|
||||
else
|
||||
echo "<img src='images/dot_green.png'>";
|
||||
echo "<td class='$tdcolor'>".$row2["evento"];
|
||||
if ($row2["id_agente"] > 0){
|
||||
echo "<td class='$tdcolor'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$row2["id_agente"]."'><b>".dame_nombre_agente($row2["id_agente"])."</b></a>";
|
||||
|
||||
echo "<td class='$tdcolor' align='center'><img src='images/groups_small/".show_icon_group($id_group).".png' class='bot'></td>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
} else { // for SNMP generated alerts
|
||||
echo "<td class='$tdcolor'>".$lang_label["alert"]." / SNMP";
|
||||
echo "<td class='$tdcolor' align='center'><img src='images/dot_white.png' class='bot'>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
switch ($row2["criticity"]) {
|
||||
case 0:
|
||||
$tdclass = "datos_blue";
|
||||
break;
|
||||
case 1:
|
||||
$tdclass = "datos_grey";
|
||||
break;
|
||||
case 2:
|
||||
$tdclass = "datos_green";
|
||||
break;
|
||||
case 3:
|
||||
$tdclass = "datos_yellow";
|
||||
break;
|
||||
case 4:
|
||||
$tdclass = "datos_red";
|
||||
break;
|
||||
default:
|
||||
$tdclass = "datos_grey";
|
||||
}
|
||||
$criticity_label = return_priority ($row2["criticity"]);
|
||||
// Colored box
|
||||
echo "<tr><td class='$tdclass' title='$criticity_label' align='center'>";
|
||||
if ($row2["estado"] == 0)
|
||||
echo "<img src='images/pixel_red.png' width=20 height=35>";
|
||||
else
|
||||
echo "<img src='images/pixel_green.png' width=20 height=35>";
|
||||
|
||||
// Event type
|
||||
echo "<td class='".$tdclass."' title='".$row2["event_type"]."'>";
|
||||
switch ($row2["event_type"]){
|
||||
case "unknown":
|
||||
echo "<img src='images/err.png'>";
|
||||
break;
|
||||
case "alert_recovered":
|
||||
echo "<img src='images/error.png'>";
|
||||
break;
|
||||
case "alert_manual_validation":
|
||||
echo "<img src='images/eye.png'>";
|
||||
break;
|
||||
case "monitor_up":
|
||||
echo "<img src='images/lightbulb.png'>";
|
||||
break;
|
||||
case "monitor_down":
|
||||
echo "<img src='images/lightbulb_off.png'>";
|
||||
break;
|
||||
case "alert_fired":
|
||||
echo "<img src='images/bell.png'>";
|
||||
break;
|
||||
case "system";
|
||||
echo "<img src='images/cog.png'>";
|
||||
break;
|
||||
case "recon_host_detected";
|
||||
echo "<img src='images/network.png'>";
|
||||
break;
|
||||
}
|
||||
|
||||
// Event description
|
||||
echo "<td class='".$tdclass."f9' title='".$row2["evento"]."'>";
|
||||
echo substr($row2["evento"],0,45);
|
||||
if (strlen($row2["evento"]) > 45)
|
||||
echo "..";
|
||||
if ($row2["id_agente"] > 0){
|
||||
// Agent name
|
||||
$agent_name = dame_nombre_agente($row2["id_agente"]);
|
||||
echo "<td class='".$tdclass."f9' title='$agent_name'><a href='$url&pure=".$config["pure"]."&id_agent=".$row2["id_agente"]."'><b>";
|
||||
echo substr($agent_name, 0, 14);
|
||||
if (strlen($agent_name) > 14)
|
||||
echo "..";
|
||||
echo "</b></a>";
|
||||
|
||||
// Module name / Alert
|
||||
echo "<td class='$tdclass'>";
|
||||
if ($row2["id_agentmodule"] != 0)
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$row2["id_agente"]."&tab=data'><img src='images/bricks.png' border=0></A>";
|
||||
echo " ";
|
||||
if ($row2["id_alert_am"] != 0)
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$row2["id_agente"]."&tab=alert'><img src='images/bell.png' border=0></a>";
|
||||
|
||||
// Group icon
|
||||
echo "<td class='$tdclass' align='center'><img src='images/groups_small/".show_icon_group($id_group).".png' class='bot'></td>";
|
||||
|
||||
// for System or SNMP generated alerts
|
||||
} else {
|
||||
if ($row2["event_type"] == "system"){
|
||||
echo "<td class='$tdclass' colspan=3>".lang_string("System");
|
||||
} else {
|
||||
echo "<td class='$tdclass' colspan=3>".$lang_label["alert"]."SNMP";
|
||||
}
|
||||
}
|
||||
|
||||
// User who validated event
|
||||
echo "<td class='$tdclass'>";
|
||||
if ($row2["estado"] <> 0)
|
||||
echo "<a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$row2["id_usuario"]."'>".substr($row2["id_usuario"],0,8)."<a href='#' class='tip'> <span>".dame_nombre_real($row2["id_usuario"])."</span></a></a>";
|
||||
echo "<td class='".$tdcolor."f9'>".$row2["timestamp"];
|
||||
echo "<td class='$tdcolor' align='right'>";
|
||||
|
||||
if (($row2["estado"] == 0) and (give_acl($id_user,$id_group,"IW") ==1))
|
||||
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&offset=".$offset."&check=".$row2["id_evento"]."'><img src='images/ok.png' border='0'></a> ";
|
||||
if (give_acl($id_user,$id_group,"IM") ==1)
|
||||
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&delete=".$row2["id_evento"]."&refr=60&offset=".$offset."'><img src='images/cross.png' border=0></a> ";
|
||||
|
||||
if (give_acl($id_user,$id_group,"IW") == 1)
|
||||
|
||||
// Timestamp
|
||||
echo "<td class='".$tdclass."f9' title='".$row2["timestamp"]."'>";
|
||||
echo human_time_comparation($row2["timestamp"]);
|
||||
|
||||
// Several options grouped here
|
||||
echo "<td class='$tdclass' align='right'>";
|
||||
// Validate event
|
||||
if (($row2["estado"] == 0) and (give_acl($config["id_user"], $id_group,"IW") ==1))
|
||||
echo "<a href='$url&check=".$row2["id_evento"]."&pure=".$config["pure"]."'><img src='images/ok.png' border='0'></a> ";
|
||||
// Delete event
|
||||
if (give_acl($config["id_user"], $id_group,"IM") ==1)
|
||||
echo "<a href='$url&delete=".$row2["id_evento"]."&pure=".$config["pure"]."'><img src='images/cross.png' border=0></a> ";
|
||||
// Create incident from this event
|
||||
if (give_acl($config["id_user"], $id_group,"IW") == 1)
|
||||
echo "<a href='index.php?sec=incidencias&sec2=operation/incidents/incident_detail&insert_form&from_event=".$row2["id_evento"]."'><img src='images/page_lightning.png' border=0></a>";
|
||||
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
// Checbox
|
||||
echo "<td class='$tdclass' align='center'>";
|
||||
echo "<input type='checkbox' class='chk' name='eventid".$offset_counter."' value='".$row2["id_evento"]."'>";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
|
@ -312,7 +426,7 @@ if ($total_events > 0){
|
|||
echo "<table width='750'><tr><td align='right'>";
|
||||
|
||||
echo "<input class='sub ok' type='submit' name='updatebt' value='".$lang_label["validate"]."'> ";
|
||||
if (give_acl($id_user, 0,"IM") ==1){
|
||||
if (give_acl($config["id_user"], 0,"IM") ==1){
|
||||
echo "<input class='sub delete' type='submit' name='deletebt' value='".$lang_label["delete"]."'>";
|
||||
}
|
||||
echo "</form></table>";
|
||||
|
|
|
@ -55,7 +55,7 @@ while($row=mysql_fetch_array($result,MYSQL_ASSOC)) {
|
|||
$rss_feed .= '<br /><br />Validated by ' . $row['validated_by'];
|
||||
}
|
||||
$rss_feed .= '</description><link>';
|
||||
$rss_feed .= $url . "/operation/events/view_event?id=" . $event_id;
|
||||
$rss_feed .= $url . "/operation/events/view_event?id=" . $row["event_id"];
|
||||
$rss_feed .= '</link>';
|
||||
//The rest is optional
|
||||
$rss_feed .= '<pubDate>' . date(DATE_RFC822, $row['unix_timestamp']) . '</pubDate>';
|
||||
|
|
|
@ -188,13 +188,15 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) {
|
|||
}
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=usuarios&sec2=operation/users/user_edit&ver=".$_SESSION["id_usuario"]."' class='mn'>".$lang_label["index_myuser"]."</a></li></ul></div>";
|
||||
|
||||
// User statistic
|
||||
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/users/user_statistics") {
|
||||
echo "<div class='arrows'>";
|
||||
} else {
|
||||
echo "<div class='arrow'>";
|
||||
}
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=usuarios&sec2=operation/users/user_statistics' class='mn'>".$lang_label["statistics"]."</a></li></ul></div>";
|
||||
// User statistics require UM
|
||||
if (give_acl($_SESSION["id_usuario"], 0, "UM")==1) {
|
||||
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/users/user_statistics") {
|
||||
echo "<div class='arrows'>";
|
||||
} else {
|
||||
echo "<div class='arrow'>";
|
||||
}
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=usuarios&sec2=operation/users/user_statistics' class='mn'>".$lang_label["statistics"]."</a></li></ul></div>";
|
||||
}
|
||||
}
|
||||
|
||||
// SNMP console
|
||||
|
|
|
@ -95,16 +95,19 @@ if (mysql_num_rows($result)){
|
|||
|
||||
// Recon server detail
|
||||
if ($recon_server == 1)
|
||||
echo "<b><a href='index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id=$id_server'>$name</a></b> ";
|
||||
if (give_acl($id_user, 0, "PM")==1)
|
||||
echo "<b><a href='index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id=$id_server'>$name</a></b> ";
|
||||
else
|
||||
echo "<b>$name</b>";
|
||||
else
|
||||
echo "<b>$name</b>";
|
||||
|
||||
// Status (bad or good)
|
||||
echo "<td class='$tdcolor' align='middle'>";
|
||||
if ($status ==0){
|
||||
echo "<img src='images/dot_red.png'>";
|
||||
echo "<img src='images/pixel_red.png' width=20 height=20>";
|
||||
} else {
|
||||
echo "<img src='images/dot_green.png'>";
|
||||
echo "<img src='images/pixel_green.png' width=20 height=20>";
|
||||
}
|
||||
|
||||
echo "<td class='$tdcolor' align='middle'>";
|
||||
|
@ -248,7 +251,8 @@ if (mysql_num_rows($result)){
|
|||
|
||||
echo "</td><td class='".$tdcolor."f9' align='middle'>";
|
||||
// if ($status ==0)
|
||||
echo substr($keepalive,0,25)."</td>";
|
||||
|
||||
echo human_date_relative($keepalive)."</td>";
|
||||
}
|
||||
echo '</tr></table>';
|
||||
echo "<table cellpadding=2 cellspacing=0>";
|
||||
|
|
|
@ -42,6 +42,7 @@ if (give_acl($id_user, 0, "LW")==1) {
|
|||
$last_fired = "";
|
||||
$max_alerts = "";
|
||||
$min_alerts = "";
|
||||
$priority = "";
|
||||
|
||||
// Alert Delete
|
||||
// =============
|
||||
|
@ -72,16 +73,17 @@ if (give_acl($id_user, 0, "LW")==1) {
|
|||
$field1 = entrada_limpia($_POST["field1"]);
|
||||
$field2 = entrada_limpia($_POST["field2"]);
|
||||
$field3 = entrada_limpia($_POST["field3"]);
|
||||
$priority = get_parameter ("priority",0);
|
||||
|
||||
if ($create == 1){
|
||||
$sql = "INSERT INTO talert_snmp (id_alert,al_field1,al_field2,al_field3,description,alert_type,agent,custom_oid,oid,time_threshold,max_alerts,min_alerts) VALUES ($alert_id,'$field1','$field2','$field3','$description', $alert_type, '$agent', '$custom', '$oid', $time, $max, $min)";
|
||||
$sql = "INSERT INTO talert_snmp (id_alert,al_field1,al_field2,al_field3,description,alert_type,agent,custom_oid,oid,time_threshold,max_alerts,min_alerts, priority) VALUES ($alert_id,'$field1','$field2','$field3','$description', $alert_type, '$agent', '$custom', '$oid', $time, $max, $min, $priority)";
|
||||
$result=mysql_query($sql);
|
||||
if (!$result)
|
||||
echo "<h3 class='error'>".$lang_label["create_alert_no"]."</h3>";
|
||||
else
|
||||
echo "<h3 class='suc'>".$lang_label["create_alert_ok"]."</h3>";
|
||||
} else {
|
||||
$sql = "UPDATE talert_snmp set id_alert= $alert_id, al_field1 = '$field1', al_field2 = '$field2', al_field3 = '$field3', description = '$description', alert_type = $alert_type, agent = '$agent', custom_oid = '$custom', oid = '$oid', time_threshold = $time, max_alerts = '$max', min_alerts = '$min' WHERE id_as = $id_as";
|
||||
$sql = "UPDATE talert_snmp set priority = $priority, id_alert= $alert_id, al_field1 = '$field1', al_field2 = '$field2', al_field3 = '$field3', description = '$description', alert_type = $alert_type, agent = '$agent', custom_oid = '$custom', oid = '$oid', time_threshold = $time, max_alerts = '$max', min_alerts = '$min' WHERE id_as = $id_as";
|
||||
$result=mysql_query($sql);
|
||||
if (!$result)
|
||||
echo "<h3 class='error'>".$lang_label["update_alert_no"]."</h3>";
|
||||
|
@ -113,6 +115,7 @@ if (give_acl($id_user, 0, "LW")==1) {
|
|||
$last_fired = $row["last_fired"];
|
||||
$max_alerts = $row["max_alerts"];
|
||||
$min_alerts = $row["min_alerts"];
|
||||
$priority = $row["priority"];
|
||||
}
|
||||
}
|
||||
if (isset($_POST["add_alert"])){
|
||||
|
@ -186,19 +189,44 @@ if (give_acl($id_user, 0, "LW")==1) {
|
|||
echo '<td class=datos><input type="text" size=30 name="field1" value="'.$al_field1.'"></td>';
|
||||
echo '<tr><td class="datos2">'.$lang_label["field2"].'</td>';
|
||||
echo '<td class="datos2"><input type="text" size=40 name="field2" value="'.$al_field2.'"></td>';
|
||||
echo '<tr><td class=datos>'.$lang_label["field3"];
|
||||
echo '<td class=datos><input type="text" size=60 name="field3" value="'.$al_field3.'"></td>';
|
||||
echo '<tr><td class=datos valign="top">'.$lang_label["field3"];
|
||||
echo '<td class=datos><textarea rows=4 style="width:400px" name="field3">'.$al_field3.'</textarea>';
|
||||
|
||||
// max & min alerts, time threshold
|
||||
// Max / Min alerts
|
||||
echo '<tr>
|
||||
<td class="datos2">'.$lang_label["min_alerts"].'</td>';
|
||||
echo '<td class="datos2"><input type="text" size=3 name="min" value="'.$min_alerts.'"></td>';
|
||||
echo '<tr>
|
||||
<td class="datos">'.$lang_label["max_alerts"].'</td>';
|
||||
echo '<td class=datos><input type="text" size=3 name="max" value="'.$max_alerts.'"></td>';
|
||||
|
||||
// Time THreshold
|
||||
echo '<tr>
|
||||
<td class="datos2">'.$lang_label["time_threshold"].'</td>';
|
||||
echo '<td class="datos2"><input type="text" size=3 name="time" value="'.$time_threshold.'"></td>';
|
||||
echo '<td class="datos2">';
|
||||
echo '<select name="time" style="margin-right: 60px;">';
|
||||
if ($time_threshold != ""){
|
||||
echo "<option value='".$time_threshold."'>".human_time_description($time_threshold)."</option>";
|
||||
}
|
||||
echo '
|
||||
<option value=300>5 Min.</option>
|
||||
<option value=600>10 Min.</option>
|
||||
<option value=900>15 Min.</option>
|
||||
<option value=1800>30 Min.</option>
|
||||
<option value=3600>1 Hour</option>
|
||||
<option value=7200>2 Hour</option>
|
||||
<option value=18000>5 Hour</option>
|
||||
<option value=43200>12 Hour</option>
|
||||
<option value=86400>1 Day</option>
|
||||
<option value=604800>1 Week</option>
|
||||
<option value=-1>Other value</option>
|
||||
</select>';
|
||||
|
||||
// Priority
|
||||
echo '<tr><td class="datos">'.lang_string("Priority");
|
||||
echo '<td class="datos">';
|
||||
echo form_priority ($priority);
|
||||
|
||||
echo '</tr></table>';
|
||||
echo '<table cellpadding="4" cellspacing="4" width="650">
|
||||
<tr><td align="right">';
|
||||
|
|
|
@ -131,14 +131,13 @@ if (comprueba_login() == 0) {
|
|||
$result2=mysql_query($sql2);
|
||||
|
||||
if (mysql_num_rows($result2)){
|
||||
|
||||
echo "<table><tr>";
|
||||
echo "<td class='f9' style='padding-left: 30px;'>";
|
||||
echo "<img src='images/dot_green.png'> - ".$lang_label["validated_event"];
|
||||
echo "<img src='images/pixel_green.png' width=20 height=20> - ".$lang_label["validated_event"];
|
||||
echo "<br>";
|
||||
echo "<img src='images/dot_red.png'> - ".$lang_label["not_validated_event"];
|
||||
echo "<br>";
|
||||
echo "<img src='images/dot_yellow.png'> - ".$lang_label["alert"];
|
||||
echo "<img src='images/pixel_red.png' width=20 height=20> - ".$lang_label["not_validated_event"];
|
||||
//echo "<br>";
|
||||
//echo "<img src='images/pixel_yellow.png' width=20 height=35> - ".$lang_label["alert"];
|
||||
echo "</td>";
|
||||
echo "<td class='f9' style='padding-left: 20px;'>";
|
||||
echo "<img src='images/ok.png'> - ".$lang_label["validate_event"];
|
||||
|
@ -219,10 +218,10 @@ if (comprueba_login() == 0) {
|
|||
echo "<tr>";
|
||||
echo "<td class='datos' align='center'>";
|
||||
if ($row["status"] == 0){
|
||||
echo "<img src='images/dot_red.png'>";
|
||||
echo "<img src='images/pixel_red.png' width=20 height=20>";
|
||||
}
|
||||
else {
|
||||
echo "<img src='images/dot_green.png'>";
|
||||
echo "<img src='images/pixel_green.png' width=20 height=20>";
|
||||
}
|
||||
echo "<td class='datos'>".$row["oid"];
|
||||
$sql="SELECT * FROM tagente WHERE direccion = '".$row["source"]."'";
|
||||
|
|
|
@ -36,7 +36,13 @@ if (comprueba_login() == 0) {
|
|||
|
||||
<?php
|
||||
$color = 1;
|
||||
$query1="SELECT * FROM tusuario";
|
||||
|
||||
|
||||
if (give_acl($config["id_user"], 0, "UM") == 1)
|
||||
$query1="SELECT * FROM tusuario";
|
||||
else
|
||||
$query1="SELECT * FROM tusuario WHERE id_usuario = '".$config["id_user"]."'";
|
||||
|
||||
$resq1=mysql_query($query1);
|
||||
while ($rowdup=mysql_fetch_array($resq1)){
|
||||
$name=$rowdup["id_usuario"];
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
|
||||
|
||||
// Login check
|
||||
$id_usuario=$_SESSION["id_usuario"];
|
||||
global $config;
|
||||
global $REMOTE_ADDR;
|
||||
|
||||
if (comprueba_login() != 0) {
|
||||
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
|
||||
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
|
||||
include ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
@ -52,10 +52,29 @@ if (isset($_GET["id"])){
|
|||
exit;
|
||||
}
|
||||
|
||||
$refr = get_parameter ("refr", 0);
|
||||
$pure_url = "&pure=".$config["pure"];
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// RENDER MAP !
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo "<h1>".$layout_name."</h1>";
|
||||
echo "<h1>".$layout_name;
|
||||
|
||||
if ($config["pure"] == 0){
|
||||
echo lang_string("Full screen mode");
|
||||
echo " ";
|
||||
echo "<a href='index.php?sec=visualc&sec2=operation/visual_console/render_view&id=$id_layout&refr=$refr&pure=1'>";
|
||||
echo "<img src='images/monitor.png' title='".lang_string("Full screen mode")."'>";
|
||||
echo "</a>";
|
||||
} else {
|
||||
echo lang_string("Back to normal mode");
|
||||
echo " ";
|
||||
echo "<a href='index.php?sec=visualc&sec2=operation/visual_console/render_view&id=$id_layout&pure=0&refr=$refr'>";
|
||||
echo "<img src='images/monitor.png' title='".lang_string("Back to normal mode")."'>";
|
||||
echo "</a>";
|
||||
}
|
||||
|
||||
echo "</h1>";
|
||||
|
||||
echo "<div id='layout_db' style='z-index: 0; position:relative; background: url(images/console/background/".$background."); width:".$bwidth."px; height:".$bheight."px;'>";
|
||||
$sql="SELECT * FROM tlayout_data WHERE id_layout = $id_layout";
|
||||
|
@ -98,7 +117,7 @@ while ($row = mysql_fetch_array($res)){
|
|||
if (($link_layout == "") OR ($link_layout == 0)){
|
||||
$link_string = "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agent&tab=data'>";
|
||||
} else {
|
||||
$link_string = "<a href='index.php?sec=visualc&sec2=operation/visual_console/render_view&id=$link_layout'>";
|
||||
$link_string = "<a href='index.php?sec=visualc&sec2=operation/visual_console/render_view$pure_url&id=$link_layout'>";
|
||||
}
|
||||
// Draw image
|
||||
echo "<div style='z-index: 1; color: #".$label_color."; position: absolute; margin-left: ".$pos_x."px; margin-top:".$pos_y."px; '>";
|
||||
|
@ -127,7 +146,7 @@ while ($row = mysql_fetch_array($res)){
|
|||
if (($link_layout == "") OR ($link_layout == 0)){
|
||||
$link_string = "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agent&tab=data'>";
|
||||
} else {
|
||||
$link_string = "<a href='http://index.php?sec=visualc&sec2=operation/visual_console/render_view&id=$link_layout'>";
|
||||
$link_string = "<a href='http://index.php?sec=visualc&sec2=operation/visual_console/render_view$pure_url&id=$link_layout'>";
|
||||
}
|
||||
// Draw image
|
||||
echo "<div style='z-index: 1; color: #".$label_color."; position: absolute; margin-left: ".$pos_x."px; margin-top:".$pos_y."px; '>";
|
||||
|
@ -194,18 +213,13 @@ echo "</div>";
|
|||
echo "<div style='height:30px'>";
|
||||
echo "</div>";
|
||||
|
||||
echo "<form method='post' action='index.php?sec=visualc&sec2=operation/visual_console/render_view&id=$id_layout'>";
|
||||
echo "<form method='post' action='index.php?sec=visualc&sec2=operation/visual_console/render_view$pure_url&id=$id_layout'>";
|
||||
echo "<table width=300 cellpadding=4 cellspacing=4 class='databox'>";
|
||||
echo "<tr><td>";
|
||||
echo $lang_label["auto_refresh_time"];
|
||||
echo "<td>";
|
||||
echo "<select name='refr'>";
|
||||
if (isset ($_POST["refr"])){
|
||||
$refr=$_POST["refr"];
|
||||
echo "<option value=$refr> $refr ".$lang_label["seconds"];
|
||||
}
|
||||
if (isset ($_GET["refr"])){
|
||||
$refr=$_GET["refr"];
|
||||
if ($refr > 0){
|
||||
echo "<option value=$refr> $refr ".$lang_label["seconds"];
|
||||
}
|
||||
|
||||
|
@ -221,4 +235,5 @@ echo "</select>";
|
|||
echo "<td>";
|
||||
echo "<input type='submit' class='sub next' value='".$lang_label["refresh"]."'>";
|
||||
echo "</table>";
|
||||
|
||||
echo "</form>";
|
||||
|
|
|
@ -196,6 +196,7 @@ CREATE TABLE `talert_snmp` (
|
|||
`max_alerts` int(11) NOT NULL default '1',
|
||||
`min_alerts` int(11) NOT NULL default '1',
|
||||
`internal_counter` int(2) unsigned NOT NULL default '0',
|
||||
`priority` tinyint(4) default '0',
|
||||
PRIMARY KEY (`id_as`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -252,6 +253,12 @@ CREATE TABLE `talerta_agente_modulo` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Priority : 0 - Maintance (grey)
|
||||
-- Priority : 1 - Low (green)
|
||||
-- Priority : 2 - Normal (blue)
|
||||
-- Priority : 3 - Warning (yellow)
|
||||
-- Priority : 4 - Critical (red)
|
||||
|
||||
CREATE TABLE `tattachment` (
|
||||
`id_attachment` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_incidencia` bigint(20) NOT NULL default '0',
|
||||
|
@ -293,12 +300,16 @@ CREATE TABLE `tevento` (
|
|||
`id_agentmodule` bigint(20) NOT NULL default '0',
|
||||
`id_alert_am` bigint(20) NOT NULL default '0',
|
||||
`criticity` int(4) unsigned NOT NULL default 0,
|
||||
|
||||
PRIMARY KEY (`id_evento`),
|
||||
KEY `indice_1` (`id_agente`,`id_evento`),
|
||||
KEY `indice_2` (`utimestamp`,`id_evento`)
|
||||
) 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)
|
||||
|
||||
CREATE TABLE `tgrupo` (
|
||||
`id_grupo` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
|
|
|
@ -26,17 +26,17 @@
|
|||
-- Dumping data for table `talerta`
|
||||
--
|
||||
|
||||
INSERT INTO `talerta` VALUES (1,'Compound only', '', 'This alert will not be executed individually');
|
||||
INSERT INTO `talerta` VALUES (2,'Pandora FMS Alertlog','echo _timestamp_ pandora _agent_ _data_ _field1_ _field2_ >> /var/log/pandora/pandora_alert.log','This is a default alert to write alerts in a standard ASCII plaintext log file in /var/log/pandora/pandora_alert.log\r\n');
|
||||
INSERT INTO `talerta` VALUES (3,'Internal Audit','','This alert save alert in Pandora interal audit system. Fields are static and only _field1_ is used.');
|
||||
INSERT INTO `talerta` VALUES (1,'Compound only', 'Internal type', 'This alert will not be executed individually');
|
||||
INSERT INTO `talerta` VALUES (2,'eMail','Internal type', 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:\r\n_field1_ as destination email address, and\r\n_field2_ as subject for message. \r\n_field3_ as text of message.');
|
||||
INSERT INTO `talerta` VALUES (3,'Internal Audit','Internal type','This alert save alert in Pandora interal audit system. Fields are static and only _field1_ is used.');
|
||||
INSERT INTO `talerta` VALUES (4,'Pandora FMS Event','Internal type','This alert create an special event into Pandora FMS event manager.');
|
||||
|
||||
INSERT INTO `talerta` VALUES (4,'eMail','echo _field3_ | sendmail -s _field2_ _field1_','Send email from Pandora Server. mail is a default command on all standard Unix systems, using:\r\n_field1_ as destination email address, and\r\n_field2_ as subject for message. \r\n_field3_ as text of message.');
|
||||
INSERT INTO `talerta` VALUES (5,'SNMP Trap','/usr/bin/snmptrap -v 1 -c trap_public 192.168.0.4 1.1.1.1.1.1.1.1 _agent_ _field1_','Send a SNMPTRAP to 192.168.0.4. Please review config and adapt to your needs, this is only a sample, not functional itself.');
|
||||
INSERT INTO `talerta` VALUES (6,'SMS Text','echo _field2_ | mail -s PANDORA_field1_ myuser@smsgateway.com','Send SMS via e-mail gateway. Use field1 for a short SMS text (35 chars) and field 2 for text message (full SMS)');
|
||||
INSERT INTO `talerta` VALUES (5,'Pandora FMS Alertlog','echo _timestamp_ pandora _agent_ _data_ _field1_ _field2_ >> /var/log/pandora/pandora_alert.log','This is a default alert to write alerts in a standard ASCII plaintext log file in /var/log/pandora/pandora_alert.log\r\n');
|
||||
INSERT INTO `talerta` VALUES (6,'SNMP Trap','/usr/bin/snmptrap -v 1 -c trap_public 192.168.0.4 1.1.1.1.1.1.1.1 _agent_ _field1_','Send a SNMPTRAP to 192.168.0.4. Please review config and adapt to your needs, this is only a sample, not functional itself.');
|
||||
INSERT INTO `talerta` VALUES (7,'Syslog','logger -p daemon.alert Pandora Alert _agent_ _data_ _field1_ _field2_','Uses field1 and field2 to generate Syslog alert in facility daemon with "alert" level.');
|
||||
INSERT INTO `talerta` VALUES (8,'Sound Alert','/usr/bin/play /usr/share/sounds/alarm.wav','');
|
||||
INSERT INTO `talerta` VALUES (9,'Jabber Alert','echo _field3_ | sendxmpp -r _field1_ --chatroom _field2_','Send jabber alert to chat room in a predefined server (configure first .sendxmpprc file). Uses field3 as text message, field1 as useralias for source message, and field2 for chatroom name');
|
||||
INSERT INTO `talerta` VALUES (10,'Synthetized Speech','flite -t _FIELD2_','Uses commandline voice synthetizer to \"speak\" text given as parameter 1 and 2');
|
||||
|
||||
|
||||
--
|
||||
-- Dumping data for table `tconfig`
|
||||
|
@ -57,7 +57,7 @@ UNLOCK TABLES;
|
|||
|
||||
/*!40000 ALTER TABLE `tconfig_os` DISABLE KEYS */;
|
||||
LOCK TABLES `tconfig_os` WRITE;
|
||||
INSERT INTO `tconfig_os` VALUES (1,'GNU/Linux','Linux: All versions','so_linux.png'),(2,'Solaris','Sun Solaris','so_solaris.png'),(3,'AIX','IBM AIX','so_aix.png'),(4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png'),(5,'HP-UX','HP-UX Unix OS','so_hpux.png'),(6,'BeOS','BeOS','so_beos.png'),(7,'Cisco','CISCO IOS','so_cisco.png'),(8,'MacOS','MAC OS','so_mac.png'),(9,'Windows','Microsoft Windows OS','so_win.png'),(10,'Other','Other SO','so_other.png'),(11,'Network','Pandora Network Agent','network.png');
|
||||
INSERT INTO `tconfig_os` VALUES (1,'Linux','Linux: All versions','so_linux.png'),(2,'Solaris','Sun Solaris','so_solaris.png'),(3,'AIX','IBM AIX','so_aix.png'),(4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png'),(5,'HP-UX','HP-UX Unix OS','so_hpux.png'),(7,'Cisco','CISCO IOS','so_cisco.png'),(8,'MacOS','MAC OS','so_mac.png'),(9,'Windows','Microsoft Windows OS','so_win.png'),(10,'Other','Other SO','so_other.png'),(11,'Network','Pandora Network Agent','network.png');
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `tconfig_os` ENABLE KEYS */;
|
||||
|
||||
|
@ -71,8 +71,8 @@ INSERT INTO `tgrupo` VALUES (2,'Servers','server_database',0,0);
|
|||
INSERT INTO `tgrupo` VALUES (3,'IDS','eye',0,0);
|
||||
INSERT INTO `tgrupo` VALUES (4,'Firewalls','firewall',0,0);
|
||||
INSERT INTO `tgrupo` VALUES (8,'Databases','database_gear',0,0);
|
||||
INSERT INTO `tgrupo` VALUES (9,'Comms','transmit',0,0);
|
||||
INSERT INTO `tgrupo` VALUES (10,'Others','house',0,0);
|
||||
INSERT INTO `tgrupo` VALUES (9,'Network','transmit',0,0);
|
||||
INSERT INTO `tgrupo` VALUES (10,'Not classified','house',0,0);
|
||||
INSERT INTO `tgrupo` VALUES (11,'Workstations','computer',0,0);
|
||||
INSERT INTO `tgrupo` VALUES (12,'Applications','applications',0,0);
|
||||
UNLOCK TABLES;
|
||||
|
@ -101,7 +101,14 @@ UNLOCK TABLES;
|
|||
|
||||
/*!40000 ALTER TABLE `tlink` DISABLE KEYS */;
|
||||
LOCK TABLES `tlink` WRITE;
|
||||
INSERT INTO `tlink` VALUES (0000000001,'GeekTools','www.geektools.com'),(0000000002,'CentralOPS','http://www.centralops.net/'),(0000000003,'Pandora Project','http://pandora.sourceforge.net'),(0000000004,'Babel Project','http://babel.sourceforge.net'),(0000000005,'Google','http://www.google.com'),(0000000006,'ArticaST','http://www.artica.es');
|
||||
INSERT INTO `tlink` VALUES
|
||||
(0000000001,'GeekTools','www.geektools.com'),
|
||||
(0000000002,'CentralOPS','http://www.centralops.net/'),
|
||||
(0000000003,'Pandora FMS','http://pandora.sourceforge.net'),
|
||||
(0000000004,'Babel Enterprise','http://babel.sourceforge.net'),
|
||||
(0000000006,'Openideas','http://www.openideas.info'),
|
||||
(0000000007,'Google','http://www.google.com'),
|
||||
(0000000008,'ArticaST','http://www.artica.es');
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `tlink` ENABLE KEYS */;
|
||||
|
||||
|
|
|
@ -21,6 +21,17 @@ include ($config["homedir"].'/include/functions.php');
|
|||
include ($config["homedir"].'/include/functions_db.php');
|
||||
require ($config["homedir"].'/include/languages/language_'.$config['language'].'.php');
|
||||
|
||||
global $config;
|
||||
|
||||
if (!isset($_SESSION["id_user"])){
|
||||
session_start();
|
||||
session_write_close();
|
||||
}
|
||||
$config ["id_user"] = $_SESSION["id_usuario"];
|
||||
|
||||
// Session check
|
||||
check_login ();
|
||||
|
||||
/**
|
||||
* Show a brief error message in a PNG graph
|
||||
*/
|
||||
|
@ -129,7 +140,7 @@ function graphic_combined_module ( $module_list, $weight_list, $periodo,
|
|||
|
||||
if ($show_event == 1){
|
||||
// If we want to show events in graphs
|
||||
$sql1="SELECT utimestamp FROM tevento WHERE id_agente = $id_agente AND utimestamp > $fechatope";
|
||||
$sql1="SELECT utimestamp FROM tevento WHERE id_agentmodule = $id_agente_modulo AND utimestamp > $fechatope";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$utimestamp = $row[0];
|
||||
|
@ -377,8 +388,19 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event,
|
|||
$id_agente = dame_agente_id($nombre_agente);
|
||||
$nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo);
|
||||
|
||||
if ($show_event == 1)
|
||||
$real_event = array();
|
||||
if ($show_event == 1){
|
||||
// If we want to show events in graphs
|
||||
$sql1="SELECT utimestamp FROM tevento WHERE id_agentmodule = $id_agente_modulo AND utimestamp > $fechatope";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$utimestamp = $row[0];
|
||||
for ($i=0; $i <= $resolution; $i++) {
|
||||
if ( ($utimestamp <= $valores[$i][3]) && ($utimestamp >= $valores[$i][2]) ){
|
||||
$real_event[$i]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($show_alert == 1){
|
||||
$alert_high = 0;
|
||||
|
@ -1139,27 +1161,48 @@ function grafico_eventos_usuario( $width=420, $height=200) {
|
|||
generic_pie_graph ($width, $height, $data, $legend);
|
||||
}
|
||||
|
||||
function grafico_eventos_total() {
|
||||
function grafico_eventos_total( $filter = "") {
|
||||
require ("../include/config.php");
|
||||
require ("../include/languages/language_".$config['language'].".php");
|
||||
|
||||
$filter = str_replace ( "\\" , "", $filter);
|
||||
$data = array();
|
||||
$legend = array();
|
||||
$total = 0;
|
||||
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE estado = 1 ";
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE criticity = 0 $filter";
|
||||
$result=mysql_query($sql1);
|
||||
$row=mysql_fetch_array($result);
|
||||
$data[] = $row[0];
|
||||
$legend[] = "Revised ( $row[0] )";
|
||||
$legend[] = lang_string("Maintenance")." ( $row[0] )";
|
||||
$total = $row[0];
|
||||
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE estado = 0 ";
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE criticity = 1 $filter";
|
||||
$result=mysql_query($sql1);
|
||||
$row=mysql_fetch_array($result);
|
||||
$data[] = $row[0];
|
||||
$total = $total + $row[0];
|
||||
$legend[] = "Not Revised ( $row[0] )";
|
||||
$legend[] = lang_string("Informational")."( $row[0] )";
|
||||
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE criticity = 2 $filter";
|
||||
$result=mysql_query($sql1);
|
||||
$row=mysql_fetch_array($result);
|
||||
$data[] = $row[0];
|
||||
$total = $total + $row[0];
|
||||
$legend[] = lang_string("Normal")." ( $row[0] )";
|
||||
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE criticity = 3 $filter";
|
||||
$result=mysql_query($sql1);
|
||||
$row=mysql_fetch_array($result);
|
||||
$data[] = $row[0];
|
||||
$total = $total + $row[0];
|
||||
$legend[] = lang_string("Warning")." ( $row[0] )";
|
||||
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE criticity = 4 $filter";
|
||||
$result=mysql_query($sql1);
|
||||
$row=mysql_fetch_array($result);
|
||||
$data[] = $row[0];
|
||||
$total = $total + $row[0];
|
||||
$legend[] = lang_string("Critical")." ( $row[0] )";
|
||||
|
||||
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
|
||||
// or much better, pay me to do a special version for you, highly optimized :-))))
|
||||
|
@ -1177,23 +1220,83 @@ function grafico_eventos_total() {
|
|||
generic_pie_graph (320, 200, $data, $legend);
|
||||
}
|
||||
|
||||
function grafico_eventos_grupo ($width = 300, $height = 200 ) {
|
||||
|
||||
|
||||
function graph_event_module ($width = 300, $height = 200, $id_agent ) {
|
||||
include ("../include/config.php");
|
||||
require ("../include/languages/language_".$config['language'].".php");
|
||||
global $config;
|
||||
|
||||
// Need ACL check
|
||||
$data = array();
|
||||
$legend = array();
|
||||
$sql1="SELECT * FROM tagente_modulo WHERE id_agente = $id_agent AND disabled = 0";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$sql1="SELECT COUNT(*) FROM tevento WHERE id_agentmodule = ".$row["id_agente_modulo"];
|
||||
if ($result2=mysql_query($sql1))
|
||||
$row2=mysql_fetch_array($result2);
|
||||
if ($row2[0] > 0){
|
||||
$data[] = $row2[0];
|
||||
$legend[] = substr($row["nombre"],0,15)." ( $row2[0] )";
|
||||
}
|
||||
}
|
||||
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
|
||||
// or much better, pay me to do a special version for you, highly optimized :-))))
|
||||
for ($a=0;$a < sizeof($data);$a++){
|
||||
for ($b=$a; $b <sizeof($data); $b++)
|
||||
if ($data[$b] > $data[$a]){
|
||||
$temp = $data[$a];
|
||||
$temp_label = $legend[$a];
|
||||
$data[$a] = $data[$b];
|
||||
$legend[$a] = $legend[$b];
|
||||
$data[$b] = $temp;
|
||||
$legend[$b] = $temp_label;
|
||||
}
|
||||
}
|
||||
$max_items = 6;
|
||||
// Take only the first x items
|
||||
if (sizeof($data) >= $max_items){
|
||||
for ($a=0;$a < $max_items;$a++){
|
||||
$legend2[]= $legend[$a];
|
||||
$data2[] = $data[$a];
|
||||
}
|
||||
generic_pie_graph ($width, $height, $data2, $legend2);
|
||||
} else
|
||||
generic_pie_graph ($width, $height, $data, $legend);
|
||||
}
|
||||
|
||||
|
||||
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "" ) {
|
||||
include ("../include/config.php");
|
||||
require ("../include/languages/language_".$config['language'].".php");
|
||||
|
||||
global $config;
|
||||
$url = str_replace ( "\\" , "", $url);
|
||||
$data = array();
|
||||
$legend = array();
|
||||
$sql1="SELECT * FROM tgrupo";
|
||||
$sql1="SELECT * FROM tagente";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$sql1="SELECT COUNT(id_evento) fROM tevento WHERE id_grupo = ".$row["id_grupo"];
|
||||
$result2=mysql_query($sql1);
|
||||
$row2=mysql_fetch_array($result2);
|
||||
if ($row2[0] > 0){
|
||||
$data[] = $row2[0];
|
||||
$legend[] = $row["nombre"]." ( $row2[0] )";
|
||||
}
|
||||
if (give_acl($config["id_user"], $row["id_grupo"], "AR") == 1){
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE 1=1 $url AND id_agente = ".$row["id_agente"];
|
||||
if ($result2=mysql_query($sql1))
|
||||
$row2=mysql_fetch_array($result2);
|
||||
if ($row2[0] > 0){
|
||||
$data[] = $row2[0];
|
||||
$legend[] = substr($row["nombre"],0,15)." ( $row2[0] )";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// System events
|
||||
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE 1=1 $url AND id_agente = 0";
|
||||
if ($result2=mysql_query($sql1))
|
||||
$row2=mysql_fetch_array($result2);
|
||||
if ($row2[0] > 0){
|
||||
$data[] = $row2[0];
|
||||
$legend[] = "SYSTEM"." ( $row2[0] )";
|
||||
}
|
||||
|
||||
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
|
||||
// or much better, pay me to do a special version for you, highly optimized :-))))
|
||||
for ($a=0;$a < sizeof($data);$a++){
|
||||
|
@ -1207,9 +1310,10 @@ function grafico_eventos_grupo ($width = 300, $height = 200 ) {
|
|||
$legend[$b] = $temp_label;
|
||||
}
|
||||
}
|
||||
// Take only the first x items
|
||||
if (sizeof($data) >= 7){
|
||||
for ($a=0;$a < 7;$a++){
|
||||
$max_items = 6;
|
||||
// Take only the first x items
|
||||
if (sizeof($data) >= $max_items){
|
||||
for ($a=0;$a < $max_items;$a++){
|
||||
$legend2[]= $legend[$a];
|
||||
$data2[] = $data[$a];
|
||||
}
|
||||
|
@ -1368,148 +1472,88 @@ function drawWarning($width,$height) {
|
|||
}
|
||||
|
||||
|
||||
function progress_bar($progress,$width,$height) {
|
||||
// Copied from the PHP manual:
|
||||
// http://us3.php.net/manual/en/function.imagefilledrectangle.php
|
||||
// With some adds from sdonie at lgc dot com
|
||||
// Get from official documentation PHP.net website. Thanks guys :-)
|
||||
// Code ripped from Babel Project :-)
|
||||
function drawRating($rating,$width,$height) {
|
||||
include ("../include/config.php");
|
||||
require ("../include/languages/language_".$config['language'].".php");
|
||||
if ($width == 0) {
|
||||
$width = 150;
|
||||
}
|
||||
if ($height == 0) {
|
||||
$height = 20;
|
||||
}
|
||||
//$rating = $_GET['rating'];
|
||||
$ratingbar = (($rating/100)*$width)-2;
|
||||
$image = imagecreate($width,$height);
|
||||
//colors
|
||||
$back = ImageColorAllocate($image,255,255,255);
|
||||
$border = ImageColorAllocate($image,0,0,0);
|
||||
$red = ImageColorAllocate($image,255,60,75);
|
||||
$fill = ImageColorAllocate($image,44,81,150);
|
||||
$rating = format_numeric ( $rating, 2);
|
||||
ImageFilledRectangle($image,0,0,$width-1,$height-1,$back);
|
||||
if ($rating > 100)
|
||||
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$red);
|
||||
else
|
||||
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$fill);
|
||||
ImageRectangle($image,0,0,$width-1,$height-1,$border);
|
||||
if ($rating > 50)
|
||||
if ($rating > 100)
|
||||
ImageTTFText($image, 8, 0, ($width/4), ($height/2)+($height/5), $back, $config['fontpath'],$lang_label["out_of_limits"]);
|
||||
else
|
||||
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $config['fontpath'], $rating."%");
|
||||
else
|
||||
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config['fontpath'], $rating."%");
|
||||
imagePNG($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
Header("Content-type: image/png");
|
||||
if ($progress > 100 || $progress < 0){
|
||||
// HACK: This report a static image... will increase render in about 200% :-) useful for
|
||||
// high number of realtime statusbar images creation (in main all agents view, for example
|
||||
$imgPng = imageCreateFromPng("../images/outof.png");
|
||||
imageAlphaBlending($imgPng, true);
|
||||
imageSaveAlpha($imgPng, true);
|
||||
imagePng($imgPng);
|
||||
} else
|
||||
drawRating($progress,$width,$height);
|
||||
// ***************************************************************************
|
||||
// Draw a dynamic progress bar using GDlib directly
|
||||
// ***************************************************************************
|
||||
|
||||
function progress_bar ($progress, $width, $height, $mode = 1) {
|
||||
// Copied from the PHP manual:
|
||||
// http://us3.php.net/manual/en/function.imagefilledrectangle.php
|
||||
// With some adds from sdonie at lgc dot com
|
||||
// Get from official documentation PHP.net website. Thanks guys :-)
|
||||
function drawRating($rating, $width, $height, $mode) {
|
||||
include ("../include/config.php");
|
||||
require ("../include/languages/language_".$config["language"].".php");
|
||||
$rating = format_numeric($rating,1);
|
||||
if ($width == 0) {
|
||||
$width = 150;
|
||||
}
|
||||
if ($height == 0) {
|
||||
$height = 20;
|
||||
}
|
||||
|
||||
//$rating = $_GET['rating'];
|
||||
$ratingbar = (($rating/100)*$width)-2;
|
||||
|
||||
$image = imagecreate($width,$height);
|
||||
//colors
|
||||
$back = ImageColorAllocate($image,255,255,255);
|
||||
$border = ImageColorAllocate($image,140,140,140);
|
||||
$textcolor = ImageColorAllocate($image,60,60,60);
|
||||
$red = ImageColorAllocate($image,255,60,75);
|
||||
|
||||
if ($mode == 0){
|
||||
if ($rating > 70)
|
||||
$fill = ImageColorAllocate($image,176,255,84); // Green
|
||||
elseif ($rating > 50)
|
||||
$fill = ImageColorAllocate($image,255,230,84); // Yellow
|
||||
elseif ($rating > 30)
|
||||
$fill = ImageColorAllocate($image,255,154,83); // Orange
|
||||
else
|
||||
$fill = ImageColorAllocate($image,255,0,0); // Red
|
||||
}
|
||||
else
|
||||
$fill = ImageColorAllocate($image,44,81,150);
|
||||
|
||||
|
||||
$grey = ImageColorAllocate($image,230,230,210);
|
||||
|
||||
if ($mode == 1){
|
||||
ImageFilledRectangle($image,0,0,$width-1,$height-1,$back);
|
||||
} else {
|
||||
ImageFilledRectangle($image,0,0,$width-1,$height-1,$grey);
|
||||
}
|
||||
if ($rating > 100)
|
||||
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$red);
|
||||
else
|
||||
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$fill);
|
||||
if ($mode == 1){
|
||||
ImageRectangle($image,0,0,$width-1,$height-1,$border);
|
||||
}
|
||||
if ($mode == 1){
|
||||
if ($rating > 50)
|
||||
if ($rating > 100)
|
||||
ImageTTFText($image, 8, 0, ($width/4), ($height/2)+($height/5), $back, $config["fontpath"], lang_string ("out_of_limits"));
|
||||
else
|
||||
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $config["fontpath"], $rating."%");
|
||||
else
|
||||
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $textcolor, $config["fontpath"], $rating."%");
|
||||
}
|
||||
imagePNG($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
Header("Content-type: image/png");
|
||||
if ($progress > 100 || $progress < 0){
|
||||
// HACK: This report a static image... will increase render in about 200% :-) useful for
|
||||
// high number of realtime statusbar images creation (in main all agents view, for example
|
||||
$imgPng = imageCreateFromPng("../images/outof.png");
|
||||
imageAlphaBlending($imgPng, true);
|
||||
imageSaveAlpha($imgPng, true);
|
||||
imagePng($imgPng);
|
||||
} else
|
||||
drawRating($progress,$width,$height,$mode);
|
||||
}
|
||||
|
||||
/*NOT USED !
|
||||
|
||||
function graphic_test ($id, $period, $interval, $label, $width, $height){
|
||||
require_once 'Image/Graph.php';
|
||||
include ("../include/config.php");
|
||||
$color ="#437722"; // Green pandora 1.1 octopus color
|
||||
|
||||
$intervalo = 500; // We want 30 slices for graph resolution.
|
||||
$now_date = dame_fecha(0);
|
||||
$horasint = $period / $intervalo;
|
||||
$top_date = dame_fecha($period);
|
||||
|
||||
// Para crear las graficas vamos a crear un array de Ax4 elementos, donde
|
||||
// A es el numero de posiciones diferentes en la grafica (30 para un mes, 7 para una semana, etc)
|
||||
// y los 4 valores en el ejeY serian los detallados a continuacion:
|
||||
// Rellenamos la tabla con un solo select, y los calculos se hacen todos sobre memoria
|
||||
// esto acelera el tiempo de calculo al maximo, aunque complica el algoritmo :-)
|
||||
|
||||
$total_items=5000;
|
||||
$factor = rand(1,10); $b=0;
|
||||
// This is my temporal data (only a simple static test by now)
|
||||
for ($a=0; $a < $total_items; $a++){
|
||||
$valor = 1 + cos(deg2rad($b));
|
||||
$b = $b + $factor/10;
|
||||
if ($b > 180){
|
||||
$b =0;
|
||||
}
|
||||
$valor = $valor * $b ;
|
||||
$valores[$a][0] = $valor;
|
||||
$valores[$a][1] = $a;
|
||||
}
|
||||
|
||||
|
||||
// Creamos la tabla (array) con los valores para el grafico. Inicializacion
|
||||
$valor_maximo = 0;
|
||||
$maxvalue=0;
|
||||
$minvalue=100000000;
|
||||
for ($i = $intervalo-1; $i >0; $i--) { // 30 entries in graph, one by day
|
||||
$grafica[]=$valores[$i][0];
|
||||
$legend[]=$valores[$i][1];
|
||||
if ($valores[$i][0] < $minvalue)
|
||||
$minvalue = $valores[$i][0];
|
||||
if ($valores[$i][0] > $maxvalue)
|
||||
$maxvalue = $valores[$i][0];
|
||||
}
|
||||
|
||||
// Create graph
|
||||
|
||||
// Create graph
|
||||
// create the graph
|
||||
$Graph =& Image_Graph::factory('graph', array($width, $height));
|
||||
// add a TrueType font
|
||||
$Font =& $Graph->addNew('font', $config['fontpath']);
|
||||
$Font->setSize(6);
|
||||
$Graph->setFont($Font);
|
||||
$Graph->add(
|
||||
Image_Graph::vertical(
|
||||
Image_Graph::factory('title', array("", 2)),
|
||||
$Plotarea = Image_Graph::factory('plotarea'),
|
||||
0)
|
||||
);
|
||||
// Create the dataset
|
||||
// Merge data into a dataset object (sancho)
|
||||
$Dataset =& Image_Graph::factory('dataset');
|
||||
for ($a=0;$a < sizeof($grafica); $a++){
|
||||
$Dataset->addPoint($legend[$a],$grafica[$a]);
|
||||
}
|
||||
// create the 1st plot as smoothed area chart using the 1st dataset
|
||||
$Plot =& $Plotarea->addNew('area', array(&$Dataset));
|
||||
// set a line color
|
||||
$Plot->setLineColor('gray');
|
||||
// set a standard fill style
|
||||
$Plot->setFillColor('green@0.4');
|
||||
// $Plotarea->hideAxis();
|
||||
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
|
||||
// $AxisX->Hide();
|
||||
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
|
||||
$AxisY->setLabelOption("showtext",true);
|
||||
$AxisY->setLabelInterval(ceil(($maxvalue-$minvalue)/4));
|
||||
$AxisX->setLabelInterval($intervalo / 5);
|
||||
$AxisY->forceMinimum($minvalue);
|
||||
$GridY2 =& $Plotarea->addNew('bar_grid', IMAGE_GRAPH_AXIS_Y_SECONDARY);
|
||||
$GridY2->setLineColor('blue');
|
||||
$GridY2->setFillColor('blue@0.1');
|
||||
$AxisY2 =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y_SECONDARY);
|
||||
$Graph->done();
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
function odo_tactic ($value1, $value2, $value3){
|
||||
require_once 'Image/Graph.php';
|
||||
include ("../include/config.php");
|
||||
|
@ -2023,10 +2067,13 @@ if ( isset($_GET["value2"]))
|
|||
else
|
||||
$value2 = 0;
|
||||
|
||||
$mode = get_parameter ("mode", 1); // Progress
|
||||
|
||||
$value3 = get_parameter("value3",0);
|
||||
$stacked = get_parameter ("stacked", 0);
|
||||
$time_reference = get_parameter ("time_reference", "");
|
||||
|
||||
$url = get_parameter ("url", "");
|
||||
$id_agent = get_parameter ("id_agent", "");
|
||||
// Image handler
|
||||
// *****************
|
||||
|
||||
|
@ -2048,11 +2095,11 @@ if (isset($_GET["tipo"])){
|
|||
elseif ($_GET["tipo"] =="db_agente_purge")
|
||||
grafico_db_agentes_purge($id, $width, $height);
|
||||
elseif ($_GET["tipo"] =="group_events")
|
||||
grafico_eventos_grupo($width, $height);
|
||||
grafico_eventos_grupo($width, $height, $url);
|
||||
elseif ($_GET["tipo"] =="user_events")
|
||||
grafico_eventos_usuario($width, $height);
|
||||
elseif ($_GET["tipo"] =="total_events")
|
||||
grafico_eventos_total();
|
||||
grafico_eventos_total($url);
|
||||
elseif ($_GET["tipo"] =="group_incident")
|
||||
graphic_incident_group();
|
||||
elseif ($_GET["tipo"] =="user_incident")
|
||||
|
@ -2070,11 +2117,14 @@ if (isset($_GET["tipo"])){
|
|||
// graphic_test ($id, $period, $intervalo, $label, $width, $height);
|
||||
elseif ( $_GET["tipo"] =="progress"){
|
||||
$percent= $_GET["percent"];
|
||||
progress_bar($percent,$width,$height);
|
||||
progress_bar($percent,$width,$height,$mode);
|
||||
}
|
||||
elseif ( $_GET["tipo"] == "odo_tactic"){
|
||||
odo_tactic ( $value1, $value2, $value3 );
|
||||
}
|
||||
elseif ( $_GET["tipo"] == "event_module"){
|
||||
graph_event_module ($width, $height, $id_agent);
|
||||
}
|
||||
elseif ( $_GET["tipo"] =="combined"){
|
||||
// Split id to get all parameters
|
||||
$module_list = array();
|
||||
|
|
Loading…
Reference in New Issue