2008-06-18 Esteban Sanchez <estebans@artica.es>
* functions.php: Added documentation to all the functions in JavaDoc format, which is an facto-standard. Deleted unused functions. Improved the code of some functions. Tab and blankspaces style correction. Replaced old lang_label with lang_string(). Some functions to print selects were replaced with a functio to get an array with all the possible values so the caller will use print_select() with them. * godmode/agentes/agent_manager.php: Use print_select() instead of deleted function. * godmode/agentes/alert_manager_editor.php: Use print_select() instead of deleted function. Use print_checkbox(). Style correction * godmode/reporting/map_builder.php, operation/agentes/ver_agente.php, operation/messages/message.php, operation/reporting/reporting_viewer_pdf.php: Replaced deleted functions with their equivalents. * include/functions_db.php: Documented some functions, some work is still required. Added get_reports() to get all the reports a user can see. Deleted unused functions. Replaced deleted functions with their equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors when calculating average, max, min and sum values of an agent module. * include/functions_reporting.php: Fixed errors when calculating SLA. * operation/events/events.php: Tab and blankspaces correction. Replaced form_priority with print_select(). Style correction. * operation/reporting/custom_reporting.php: Show all the reports a user can see. Use Pandora functions. * operation/reporting/reporting_viewer.php: Show unknown label if SLA can not be calculated. * operation/snmpconsole/snmp_alert.php: Avoid an extra indentation level by using check_login() properly. Tab and blankspaces correction. * index.php, operation/users/user_edit.php: Adopted to renamed function. * godmode/db/db_sanity.php, reporting/fgraph.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
59e7358292
commit
788db0318b
|
@ -1,38 +1,82 @@
|
|||
2008-06-18 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* functions.php: Added documentation to all the functions in JavaDoc
|
||||
format, which is an facto-standard. Deleted unused functions. Improved
|
||||
the code of some functions. Tab and blankspaces style correction.
|
||||
Replaced old lang_label with lang_string(). Some functions to print
|
||||
selects were replaced with a functio to get an array with all the
|
||||
possible values so the caller will use print_select() with them.
|
||||
|
||||
* godmode/agentes/agent_manager.php: Use print_select() instead of
|
||||
deleted function.
|
||||
|
||||
* godmode/agentes/alert_manager_editor.php: Use print_select() instead
|
||||
of deleted function. Use print_checkbox(). Style correction
|
||||
|
||||
* godmode/reporting/map_builder.php, operation/agentes/ver_agente.php,
|
||||
operation/messages/message.php,
|
||||
operation/reporting/reporting_viewer_pdf.php:
|
||||
Replaced deleted functions with their equivalents.
|
||||
|
||||
* include/functions_db.php: Documented some functions, some work is
|
||||
still required. Added get_reports() to get all the reports a user can
|
||||
see. Deleted unused functions. Replaced deleted functions with their
|
||||
equivalents. Added get_db_row_sql(), get_previous_data(). Fixed errors
|
||||
when calculating average, max, min and sum values of an agent module.
|
||||
|
||||
* include/functions_reporting.php: Fixed errors when calculating SLA.
|
||||
|
||||
* operation/events/events.php: Tab and blankspaces correction.
|
||||
Replaced form_priority with print_select(). Style correction.
|
||||
|
||||
* operation/reporting/custom_reporting.php: Show all the reports a
|
||||
user can see. Use Pandora functions.
|
||||
|
||||
* operation/reporting/reporting_viewer.php: Show unknown label if SLA
|
||||
can not be calculated.
|
||||
|
||||
* operation/snmpconsole/snmp_alert.php: Avoid an extra indentation
|
||||
level by using check_login() properly. Tab and blankspaces correction.
|
||||
|
||||
* index.php, operation/users/user_edit.php: Adopted to renamed
|
||||
function.
|
||||
|
||||
* godmode/db/db_sanity.php, reporting/fgraph.php: Style correction.
|
||||
|
||||
2008-06-18 Sancho Lerena <slerena@gmail.com>
|
||||
|
||||
* pandoradbdata_13_to_20.sql: prototype. not functional.
|
||||
|
||||
* operation/events/export_csv.php: Event export to CSV. Support
|
||||
passed filters.
|
||||
* pandoradbdata_13_to_20.sql: prototype. not functional.
|
||||
|
||||
* images/networkmap/*.png: Updated icons for network map.
|
||||
* operation/events/export_csv.php: Event export to CSV. Support passed
|
||||
filters.
|
||||
|
||||
* godmode/menu.php,
|
||||
* godmode/db/db_sanity.php: New sanity tool for database in interactive
|
||||
mode using console (ported from pandora_db.pl).
|
||||
* images/networkmap/*.png: Updated icons for network map.
|
||||
|
||||
* reporting/fgraph.php: Added graphs for string data types. Fixed
|
||||
event by agent/module graph for system events.
|
||||
* godmode/menu.php, godmode/db/db_sanity.php: New sanity tool for
|
||||
database in interactive mode using console (ported from
|
||||
pandora_db.pl).
|
||||
|
||||
* general/logon_ok.php, tactica.php: Fixed a div0.
|
||||
* reporting/fgraph.php: Added graphs for string data types. Fixed
|
||||
event by agent/module graph for system events.
|
||||
|
||||
* godmode/agentes/manage_config.php: Several fixes, and added a new
|
||||
option to mass-deletion of agents.
|
||||
* general/logon_ok.php, tactica.php: Fixed a div0.
|
||||
|
||||
* godmode/agentes/agent_manager.php,
|
||||
godmode/agentes/modificar_agente.php: Delete of remote configuration
|
||||
when delete an agent and manually, by user.
|
||||
* godmode/agentes/manage_config.php: Several fixes, and added a new
|
||||
option to mass-deletion of agents.
|
||||
|
||||
* operation/servers/view_server_detail.php: Added refresh option and
|
||||
fixed layout.
|
||||
* godmode/agentes/agent_manager.php,
|
||||
godmode/agentes/modificar_agente.php: Delete of remote configuration
|
||||
when delete an agent and manually, by user..
|
||||
|
||||
* status_monitor.php: Added new filter by state, most code rewritten.
|
||||
Added pagination fixes, and corrected labels and legends.
|
||||
* operation/servers/view_server_detail.php: Added refresh option and
|
||||
fixed layout.
|
||||
|
||||
* operation/agentes/networkmap.php: Several fixes and modification to
|
||||
render small maps and huge (>200 agents) maps. This should be fine by
|
||||
now. Need "Group/Section" drawing /by click into section line/.
|
||||
* status_monitor.php: Added new filter by state, most code rewritten.
|
||||
Added pagination fixes, and corrected labels and legends.
|
||||
|
||||
* operation/agentes/networkmap.php: Several fixes and modification to
|
||||
render small maps and huge (>200 agents) maps. This should be fine by
|
||||
now. Need "Group/Section" drawing /by click into section line/.
|
||||
|
||||
2008-06-18 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
|
|
|
@ -70,14 +70,14 @@ echo '<td class="datos"><b>'.$lang_label["agent_name"].'</b></td>
|
|||
<td class="datos">
|
||||
<input type="text" name="agente" size=30 value="'.$nombre_agente.'">';
|
||||
|
||||
if ((isset($id_agente)) && ($id_agente != "")){
|
||||
if (isset ($id_agente) && $id_agente != "") {
|
||||
echo "
|
||||
<a href='index.php?sec=estado&
|
||||
sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'>
|
||||
<img src='images/lupa.png' border='0' align='middle' alt=''></a>";
|
||||
}
|
||||
// Remote configuration available
|
||||
if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")) {
|
||||
if (file_exists ($config["remote_config"] . "/" . $agent_md5 . ".md5")) {
|
||||
echo "
|
||||
<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=".$id_agente."&disk_conf=" . $agent_md5 . "'>
|
||||
<img src='images/application_edit.png' border='0' align='middle' alt=''></a>";
|
||||
|
@ -88,7 +88,7 @@ echo '<b>'.$lang_label["ip_address"].'</b>';
|
|||
echo '<td class="datos2">';
|
||||
echo '<input type="text" name="direccion" size="16" value="'.$direccion_agente.'">';
|
||||
|
||||
if ($create_agent != 1){
|
||||
if ($create_agent != 1) {
|
||||
echo " ";
|
||||
|
||||
echo '<select name="address_list">';
|
||||
|
@ -109,12 +109,13 @@ if ($create_agent != 1){
|
|||
|
||||
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");
|
||||
if ($create_agent != 1) {
|
||||
print_select_from_sql ('SELECT id_agente, nombre FROM tagente',
|
||||
'id_parent', $id_agente, '', '', '');
|
||||
} else {
|
||||
print_select_from_sql ('SELECT id_agente, nombre FROM tagente',
|
||||
'id_parent', 0, '', 'None', '0');
|
||||
}
|
||||
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">';
|
||||
|
@ -242,11 +243,11 @@ 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));
|
||||
echo date("F d Y H:i:s.", fileatime($filename));
|
||||
// Delete remote configuration
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente=$id_agente'><img src='images/cross.png'></A>";
|
||||
} else {
|
||||
echo '<i>'.lang_string("Not available").'</i>';
|
||||
echo '<i>'.lang_string("Not available").'</i>';
|
||||
}
|
||||
|
||||
echo '</table><table width="650"><tr><td align="right">';
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
<?PHP
|
||||
<?php
|
||||
|
||||
// Pandora FMS - the Free Monitoring System
|
||||
// ========================================
|
||||
|
@ -25,18 +24,18 @@ echo "<h3>".$lang_label["alert_asociation_form"]."</h3>";
|
|||
echo '<form name="agente" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'">';
|
||||
|
||||
if ($form_alerttype == "combined")
|
||||
echo "<input type='hidden' name='combined' value ='1'>";
|
||||
echo "<input type='hidden' name='combined' value ='1'>";
|
||||
else
|
||||
echo "<input type='hidden' name='combined' value ='0'>";
|
||||
echo "<input type='hidden' name='combined' value ='0'>";
|
||||
|
||||
if (! isset($update_alert))
|
||||
$update_alert = -1;
|
||||
|
||||
$update_alert = -1;
|
||||
|
||||
if ($update_alert != 1) {
|
||||
echo '<input type="hidden" name="insert_alert" value=1>';
|
||||
echo '<input type="hidden" name="insert_alert" value=1>';
|
||||
} else {
|
||||
echo '<input type="hidden" name="update_alert" value=1>';
|
||||
echo '<input type="hidden" name="id_aam" value="'.$alerta_id_aam.'">';
|
||||
echo '<input type="hidden" name="update_alert" value=1>';
|
||||
echo '<input type="hidden" name="id_aam" value="'.$alerta_id_aam.'">';
|
||||
}
|
||||
echo '<input type="hidden" name="id_agente" value="'.$id_agente.'">';
|
||||
|
||||
|
@ -46,48 +45,48 @@ echo '<table width=600 cellpadding="4" cellspacing="4" class="databox_color" bor
|
|||
echo '<tr><td class="datos3">'.lang_string("assigned_module");
|
||||
echo '<td class="datos3">';
|
||||
if ($form_alerttype != "combined"){
|
||||
if ($update_alert != 1) {
|
||||
echo '<select name="agente_modulo" style="width:210px;"> ';
|
||||
$sql2 = "SELECT id_agente_modulo, id_tipo_modulo, nombre FROM tagente_modulo WHERE id_agente = $id_agente ORDER BY nombre";
|
||||
$result2=mysql_query($sql2);
|
||||
while ($row2=mysql_fetch_array($result2)){
|
||||
if ($row2["id_tipo_modulo"] != -1) {
|
||||
$sql1='SELECT nombre FROM ttipo_modulo WHERE id_tipo = '.$row2["id_tipo_modulo"];
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
echo "<option value='".$row2["id_agente_modulo"]."'>".$row2["nombre"]." ( ".$row["nombre"]." )</option>";
|
||||
}
|
||||
} else // for -1, is a special module, keep alive monitor !!
|
||||
echo "<option value='".$row2["id_agente_modulo"]."'>".$row2["nombre"]."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
} else {
|
||||
$agentmodule_name = get_db_sql ("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = $alerta_id_agentemodulo");
|
||||
echo $agentmodule_name;
|
||||
}
|
||||
if ($update_alert != 1) {
|
||||
echo '<select name="agente_modulo" style="width:210px;"> ';
|
||||
$sql2 = "SELECT id_agente_modulo, id_tipo_modulo, nombre FROM tagente_modulo WHERE id_agente = $id_agente ORDER BY nombre";
|
||||
$result2=mysql_query($sql2);
|
||||
while ($row2=mysql_fetch_array($result2)){
|
||||
if ($row2["id_tipo_modulo"] != -1) {
|
||||
$sql1='SELECT nombre FROM ttipo_modulo WHERE id_tipo = '.$row2["id_tipo_modulo"];
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
echo "<option value='".$row2["id_agente_modulo"]."'>".$row2["nombre"]." ( ".$row["nombre"]." )</option>";
|
||||
}
|
||||
} else // for -1, is a special module, keep alive monitor !!
|
||||
echo "<option value='".$row2["id_agente_modulo"]."'>".$row2["nombre"]."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
} else {
|
||||
$agentmodule_name = get_db_sql ("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = $alerta_id_agentemodulo");
|
||||
echo $agentmodule_name;
|
||||
}
|
||||
} else {
|
||||
echo lang_string ("N/A");
|
||||
echo lang_string ("N/A");
|
||||
}
|
||||
echo '<td class="datos3">';
|
||||
echo lang_string ("Priority");
|
||||
echo '<td class="datos3">';
|
||||
|
||||
if (isset($alert_priority)){
|
||||
$alert_priority = 3; // Warning by default
|
||||
if (! isset($alert_priority)) {
|
||||
$alert_priority = 3; // Warning by default
|
||||
}
|
||||
echo form_priority ($alert_priority, "alert_priority");
|
||||
print_select (get_priorities (), "alert_priority", $alert_priority, '', '', '');
|
||||
|
||||
// Alert type
|
||||
echo '<tr><td class="datos">';
|
||||
echo $lang_label["alert_type"];
|
||||
echo '<td class="datos"><select name="tipo_alerta">';
|
||||
if (isset($tipo_alerta)){
|
||||
echo "<option value='".$tipo_alerta."'>".dame_nombre_alerta($tipo_alerta)."</option>";
|
||||
echo "<option value='".$tipo_alerta."'>".dame_nombre_alerta($tipo_alerta)."</option>";
|
||||
}
|
||||
$sql1 = 'SELECT id_alerta, nombre FROM talerta ORDER BY nombre';
|
||||
$result = mysql_query ($sql1);
|
||||
while ($row = mysql_fetch_array ($result)){
|
||||
echo "<option value='".$row["id_alerta"]."'>".$row["nombre"]."</option>";
|
||||
echo "<option value='".$row["id_alerta"]."'>".$row["nombre"]."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
|
@ -97,11 +96,11 @@ echo $lang_label["alert_status"];
|
|||
echo "<td class='datos'>";
|
||||
echo '<select name="disable_alert">';
|
||||
if ((isset($alerta_disable)) AND ($alerta_disable == "1")) {
|
||||
echo "<option value='1'>".$lang_label["disabled"];
|
||||
echo "<option value='0'>".$lang_label["enabled"];
|
||||
echo "<option value='1'>".$lang_label["disabled"];
|
||||
echo "<option value='0'>".$lang_label["enabled"];
|
||||
} else {
|
||||
echo "<option value='0'>".$lang_label["enabled"];
|
||||
echo "<option value='1'>".$lang_label["disabled"];
|
||||
echo "<option value='0'>".$lang_label["enabled"];
|
||||
echo "<option value='1'>".$lang_label["disabled"];
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
|
@ -111,22 +110,22 @@ echo '<td class="datos2" colspan=4><input type="text" name="descripcion" size="6
|
|||
|
||||
// Trigger values for alert
|
||||
if ($form_alerttype != "combined"){
|
||||
echo '<tr><td class="datos">'.$lang_label["min_value"];
|
||||
echo "<a href='#' class='tip'> <span>";echo $lang_label["min_valid_value_help"]."</span></a>";
|
||||
echo '<td class="datos"><input type="text" name="minimo" size="5" value="'.$alerta_dis_min.'" style="margin-right: 70px;">';
|
||||
echo '<tr><td class="datos">'.$lang_label["min_value"];
|
||||
echo "<a href='#' class='tip'> <span>";echo $lang_label["min_valid_value_help"]."</span></a>";
|
||||
echo '<td class="datos"><input type="text" name="minimo" size="5" value="'.$alerta_dis_min.'" style="margin-right: 70px;">';
|
||||
|
||||
echo "<td class='datos'>";
|
||||
echo $lang_label["max_value"];
|
||||
echo "<a href='#' class='tip'> <span>";
|
||||
echo $lang_label["max_valid_value_help"];
|
||||
echo "</span></a>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<input type='text' name='maximo' size='5' value='$alerta_dis_max'>";
|
||||
echo "<td class='datos'>";
|
||||
echo $lang_label["max_value"];
|
||||
echo "<a href='#' class='tip'> <span>";
|
||||
echo $lang_label["max_valid_value_help"];
|
||||
echo "</span></a>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<input type='text' name='maximo' size='5' value='$alerta_dis_max'>";
|
||||
|
||||
// <!-- FREE TEXT ALERT -->
|
||||
// <!-- FREE TEXT ALERT -->
|
||||
|
||||
echo '<tr><td class="datos2">'.$lang_label["alert_text"]."<a href='#' class='tip'> <span>NOTE: This field is for matching text on data. Regular Expression Supported </span></a>";
|
||||
echo '<td class="datos2" colspan=4><input type="text" name="alert_text" size="60" value ="'.$alert_text.'">';
|
||||
echo '<tr><td class="datos2">'.$lang_label["alert_text"]."<a href='#' class='tip'> <span>NOTE: This field is for matching text on data. Regular Expression Supported </span></a>";
|
||||
echo '<td class="datos2" colspan=4><input type="text" name="alert_text" size="60" value ="'.$alert_text.'">';
|
||||
}
|
||||
|
||||
// Time Threshold (TT)
|
||||
|
@ -135,7 +134,7 @@ echo "<a href='#' class='tip'> <span>".$lang_label["alert_time_threshold_he
|
|||
echo '<td class="datos">';
|
||||
echo '<select name="time_threshold" style="margin-right: 60px;">';
|
||||
if ($alerta_time_threshold != ""){
|
||||
echo "<option value='".$alerta_time_threshold."'>".human_time_description($alerta_time_threshold)."</option>";
|
||||
echo "<option value='".$alerta_time_threshold."'>".human_time_description($alerta_time_threshold)."</option>";
|
||||
}
|
||||
echo '
|
||||
<option value=300>5 Min.</option>
|
||||
|
@ -162,9 +161,9 @@ echo "<tr><td class='datos2'>".$lang_label["min_alerts"];
|
|||
echo '<td class="datos2">';
|
||||
echo '<input type="text" name="min_alerts" size="5" value="';
|
||||
if (isset($alerta_min_alerts))
|
||||
echo $alerta_min_alerts;
|
||||
echo $alerta_min_alerts;
|
||||
else
|
||||
echo 0;
|
||||
echo 0;
|
||||
echo '" style="margin-right: 10px;">';
|
||||
|
||||
echo '<td class="datos2">';
|
||||
|
@ -172,9 +171,9 @@ echo $lang_label["max_alerts"];
|
|||
echo '<td class="datos2">';
|
||||
echo '<input type="text" name="max_alerts" size="5" value="';
|
||||
if (isset($alerta_max_alerts))
|
||||
echo $alerta_max_alerts;
|
||||
echo $alerta_max_alerts;
|
||||
else
|
||||
echo 1;
|
||||
echo 1;
|
||||
echo '" style="margin-right: 10px;">';
|
||||
|
||||
// Field1
|
||||
|
@ -202,14 +201,14 @@ echo '_timestamp_<br>_data_<br></span></a>';
|
|||
echo "<tr><td class='datos2'>".$lang_label["time_from"];
|
||||
echo "<td class='datos2'><select name='time_from'>";
|
||||
if ($time_from != ""){
|
||||
echo "<option value='$time_from'>".substr($time_from,0,5);
|
||||
echo "<option value='$time_from'>".substr($time_from,0,5);
|
||||
}
|
||||
|
||||
for ($a=0; $a < 48; $a++){
|
||||
echo "<option value='";
|
||||
echo render_time ($a);
|
||||
echo "'>";
|
||||
echo render_time ($a);
|
||||
echo "<option value='";
|
||||
echo render_time ($a);
|
||||
echo "'>";
|
||||
echo render_time ($a);
|
||||
}
|
||||
echo "<option value='23:59'>23:59";
|
||||
echo "</select>";
|
||||
|
@ -217,43 +216,41 @@ echo "</select>";
|
|||
echo "<td class='datos2'>".$lang_label["time_to"];
|
||||
echo "<td class='datos2'><select name='time_to'>";
|
||||
if ($time_from != ""){
|
||||
echo "<option value='$time_to'>".substr($time_to,0,5);
|
||||
echo "<option value='$time_to'>".substr($time_to,0,5);
|
||||
}
|
||||
|
||||
for ($a=0; $a < 48; $a++){
|
||||
echo "<option value='";
|
||||
echo render_time ($a);
|
||||
echo "'>";
|
||||
echo render_time ($a);
|
||||
echo "<option value='";
|
||||
echo render_time ($a);
|
||||
echo "'>";
|
||||
echo render_time ($a);
|
||||
}
|
||||
echo "<option value='23:59'>23:59";
|
||||
echo "</select>";
|
||||
|
||||
|
||||
// Days of week
|
||||
echo "<tr><td class='datos'>".lang_string ("Days of week");
|
||||
echo "<td class='datos' colspan=4>";
|
||||
echo lang_string("Mon");
|
||||
echo form_render_check ("alert_d1", $alert_d1);
|
||||
print_checkbox ("alert_d1", 1, $alert_d1);
|
||||
echo " ";
|
||||
echo lang_string("Tue");
|
||||
echo form_render_check ("alert_d2", $alert_d2);
|
||||
print_checkbox ("alert_d2", 1, $alert_d2);
|
||||
echo " ";
|
||||
echo lang_string("Wed");
|
||||
echo form_render_check ("alert_d3", $alert_d3);
|
||||
print_checkbox ("alert_d3", 1, $alert_d3);
|
||||
echo " ";
|
||||
echo lang_string("Thu");
|
||||
echo form_render_check ("alert_d4", $alert_d4);
|
||||
print_checkbox ("alert_d4", 1, $alert_d4);
|
||||
echo " ";
|
||||
echo lang_string("Fri");
|
||||
echo form_render_check ("alert_d5", $alert_d5);
|
||||
print_checkbox ("alert_d5", 1, $alert_d5);
|
||||
echo " ";
|
||||
echo lang_string("Sat");
|
||||
echo form_render_check ("alert_d6", $alert_d6);
|
||||
print_checkbox ("alert_d6", 1, $alert_d6);
|
||||
echo " ";
|
||||
echo lang_string("Sun");
|
||||
echo form_render_check ("alert_d7", $alert_d7);
|
||||
|
||||
|
||||
print_checkbox ("alert_d7", 1, $alert_d7);
|
||||
|
||||
// Field2 Recovery
|
||||
echo '<tr><td class="datos2">'.lang_string ("Field #2 (Rec)");
|
||||
|
@ -266,11 +263,11 @@ echo lang_string ("Alert recovery");
|
|||
echo "<td class='datos2'>";
|
||||
echo '<select name="alert_recovery">';
|
||||
if ((isset($alert_recovery)) AND ($alert_recovery == "1")) {
|
||||
echo "<option value='1'>".$lang_label["enabled"];
|
||||
echo "<option value='0'>".$lang_label["disabled"];
|
||||
echo "<option value='1'>".$lang_label["enabled"];
|
||||
echo "<option value='0'>".$lang_label["disabled"];
|
||||
} else {
|
||||
echo "<option value='0'>".$lang_label["disabled"];
|
||||
echo "<option value='1'>".$lang_label["enabled"];
|
||||
echo "<option value='0'>".$lang_label["disabled"];
|
||||
echo "<option value='1'>".$lang_label["enabled"];
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
|
@ -285,56 +282,56 @@ echo '<input type="text" name="campo_3_rec" size="60" value="'.$alerta_campo3_re
|
|||
echo "</td></tr></table>";
|
||||
echo '<table width=605>';
|
||||
echo '<tr><td align="right">';
|
||||
if ($update_alert== "1"){
|
||||
echo '<input name="updbutton" type="submit" class="sub upd" value="'.$lang_label["update"].'">';
|
||||
} else {
|
||||
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.$lang_label["add"].'">';
|
||||
}
|
||||
echo '</form>';
|
||||
if ($update_alert== "1"){
|
||||
echo '<input name="updbutton" type="submit" class="sub upd" value="'.$lang_label["update"].'">';
|
||||
} else {
|
||||
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.$lang_label["add"].'">';
|
||||
}
|
||||
echo '</form>';
|
||||
echo '</td></tr></table>';
|
||||
|
||||
|
||||
if (($form_alerttype == "combined") AND ($update_alert != -1)){
|
||||
echo "<h3>".lang_string ("Combined alert components")."</h3>";
|
||||
echo '<table width=605 class="databox" border=0 cellpadding=4 cellspacing=4>';
|
||||
echo '<form method=POST action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'&update_alert='.$alerta_id_aam.'&add_component=1&form_alerttype=combined">';
|
||||
|
||||
if ($form_alerttype == "combined")
|
||||
echo "<input type='hidden' name='combined' value ='1'>";
|
||||
else
|
||||
echo "<input type='hidden' name='combined' value ='0'>";
|
||||
|
||||
echo '<input type="hidden" name="add_alert_combined" value="1">';
|
||||
echo '<input type="hidden" name="id_agente" value="'.$id_agente.'">';
|
||||
echo "<h3>".lang_string ("Combined alert components")."</h3>";
|
||||
echo '<table width=605 class="databox" border=0 cellpadding=4 cellspacing=4>';
|
||||
echo '<form method=POST action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'&update_alert='.$alerta_id_aam.'&add_component=1&form_alerttype=combined">';
|
||||
|
||||
echo "<tr><td>";
|
||||
echo lang_string ("Source Agent/Alert");
|
||||
echo "<td>";
|
||||
echo "<select name='component_item'>";
|
||||
|
||||
// Add to combo single alerts
|
||||
$result_alert = mysql_query("SELECT tagente_modulo.id_agente_modulo, tagente.nombre, tagente_modulo.nombre, id_aam, tagente.id_grupo FROM talerta_agente_modulo, tagente_modulo, tagente WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente = tagente.id_agente");
|
||||
while ($alertrow = mysql_fetch_array($result_alert)){
|
||||
if ($form_alerttype == "combined")
|
||||
echo "<input type='hidden' name='combined' value ='1'>";
|
||||
else
|
||||
echo "<input type='hidden' name='combined' value ='0'>";
|
||||
|
||||
echo '<input type="hidden" name="add_alert_combined" value="1">';
|
||||
echo '<input type="hidden" name="id_agente" value="'.$id_agente.'">';
|
||||
|
||||
echo "<tr><td>";
|
||||
echo lang_string ("Source Agent/Alert");
|
||||
echo "<td>";
|
||||
echo "<select name='component_item'>";
|
||||
|
||||
// Add to combo single alerts
|
||||
$result_alert = mysql_query("SELECT tagente_modulo.id_agente_modulo, tagente.nombre, tagente_modulo.nombre, id_aam, tagente.id_grupo FROM talerta_agente_modulo, tagente_modulo, tagente WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente = tagente.id_agente");
|
||||
while ($alertrow = mysql_fetch_array($result_alert)){
|
||||
if (give_acl ($config["id_user"], $alertrow[4], "AR") == 1)
|
||||
echo "<option value='".$alertrow[3]."'>(S) ".$alertrow[1]." - ".$alertrow[2];
|
||||
}
|
||||
echo "<option value='".$alertrow[3]."'>(S) ".$alertrow[1]." - ".$alertrow[2];
|
||||
}
|
||||
|
||||
// Add to combo combined alerts
|
||||
$result_alert = mysql_query("SELECT tagente.id_grupo, tagente.nombre, talerta_agente_modulo.id_aam, talerta_agente_modulo.descripcion FROM talerta_agente_modulo, tagente WHERE talerta_agente_modulo.id_agent = tagente.id_agente AND tagente.id_agente != '' AND tagente.id_agente > 0");
|
||||
// Add to combo combined alerts
|
||||
$result_alert = mysql_query("SELECT tagente.id_grupo, tagente.nombre, talerta_agente_modulo.id_aam, talerta_agente_modulo.descripcion FROM talerta_agente_modulo, tagente WHERE talerta_agente_modulo.id_agent = tagente.id_agente AND tagente.id_agente != '' AND tagente.id_agente > 0");
|
||||
|
||||
|
||||
while ($alertrow = mysql_fetch_array($result_alert)){
|
||||
while ($alertrow = mysql_fetch_array($result_alert)){
|
||||
if (give_acl ($config["id_user"], $alertrow[0], "AR"))
|
||||
echo "<option value='".$alertrow[2]."'>(C) ".$alertrow[1]." - ".$alertrow[3];
|
||||
}
|
||||
echo "<option value='".$alertrow[2]."'>(C) ".$alertrow[1]." - ".$alertrow[3];
|
||||
}
|
||||
|
||||
echo "</select>";
|
||||
echo "</select>";
|
||||
|
||||
|
||||
// there is any component already in this alert ?
|
||||
|
||||
$result = mysql_query ("SELECT COUNT(*) FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam");
|
||||
$row=mysql_fetch_array($result);
|
||||
$row=mysql_fetch_array($result);
|
||||
if ($row[0] > 0){
|
||||
echo "<td>";
|
||||
echo lang_string ("Operation");
|
||||
|
@ -351,60 +348,57 @@ if (($form_alerttype == "combined") AND ($update_alert != -1)){
|
|||
echo "<input type=hidden name='component_operation' value='NOP'>";
|
||||
}
|
||||
echo "<td>";
|
||||
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.$lang_label["add"].'">';
|
||||
echo "</form>";
|
||||
echo "</table>";
|
||||
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.$lang_label["add"].'">';
|
||||
echo "</form>";
|
||||
echo "</table>";
|
||||
|
||||
echo '<table width=750 cellpadding="4" cellspacing="4" class="databox" border=0>';
|
||||
echo '<tr>';
|
||||
echo '<th>'.lang_string ("agent");
|
||||
echo '<th>'.lang_string ("module");
|
||||
echo "<th>".$lang_label["type"]."</th>
|
||||
<th>".lang_string ("Oper")."</th>
|
||||
<th>".$lang_label["threshold"]."</th>
|
||||
<th>".$lang_label["min."]."</th>
|
||||
<th>".$lang_label["max."]."</th>
|
||||
<th>".$lang_label["time"]."</th>
|
||||
<th>".$lang_label["description"]."</th>
|
||||
<th>".lang_string ("info")."</th>
|
||||
<th width='50'>".$lang_label["action"]."</th></tr>";
|
||||
echo '<table width=750 cellpadding="4" cellspacing="4" class="databox" border=0>';
|
||||
echo '<tr>';
|
||||
echo '<th>'.lang_string ("agent");
|
||||
echo '<th>'.lang_string ("module");
|
||||
echo "<th>".$lang_label["type"]."</th>
|
||||
<th>".lang_string ("Oper")."</th>
|
||||
<th>".$lang_label["threshold"]."</th>
|
||||
<th>".$lang_label["min."]."</th>
|
||||
<th>".$lang_label["max."]."</th>
|
||||
<th>".$lang_label["time"]."</th>
|
||||
<th>".$lang_label["description"]."</th>
|
||||
<th>".lang_string ("info")."</th>
|
||||
<th width='50'>".$lang_label["action"]."</th></tr>";
|
||||
|
||||
$id_aam = $alerta_id_aam;
|
||||
$sql2 = "SELECT * FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam";
|
||||
$result2=mysql_query($sql2);
|
||||
$string = "";
|
||||
$color = 1;
|
||||
$id_aam = $alerta_id_aam;
|
||||
$sql2 = "SELECT * FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam";
|
||||
$result2=mysql_query($sql2);
|
||||
$string = "";
|
||||
$color = 1;
|
||||
|
||||
while ($row2=mysql_fetch_array($result2)){
|
||||
// Show data for each component of this combined alert
|
||||
if ($color == 1){
|
||||
$tdcolor="datos";
|
||||
$color =0;
|
||||
} else {
|
||||
$tdcolor="datos2";
|
||||
$color =1;
|
||||
}
|
||||
$module = get_db_row ("tagente_modulo", "id_agente_modulo", $row2["id_agente_modulo"]);
|
||||
$description = $row2["descripcion"];
|
||||
$alert_mode = $row2["operation"];
|
||||
$id_agente_name = get_db_value ("nombre", "tagente", "id_agente", $module["id_agente"]);
|
||||
while ($row2=mysql_fetch_array($result2)) {
|
||||
// Show data for each component of this combined alert
|
||||
if ($color == 1){
|
||||
$tdcolor="datos";
|
||||
$color =0;
|
||||
} else {
|
||||
$tdcolor="datos2";
|
||||
$color =1;
|
||||
}
|
||||
$module = get_db_row ("tagente_modulo", "id_agente_modulo", $row2["id_agente_modulo"]);
|
||||
$description = $row2["descripcion"];
|
||||
$alert_mode = $row2["operation"];
|
||||
$id_agente_name = get_db_value ("nombre", "tagente", "id_agente", $module["id_agente"]);
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td class='$tdcolor'>".$id_agente_name;
|
||||
echo "<td class='$tdcolor'>".$module["nombre"];
|
||||
echo show_alert_row_edit ($row2, $tdcolor, $module["id_tipo_modulo"],1);
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
$id_grupo = dame_id_grupo($id_agente);
|
||||
if (give_acl($id_user, $id_grupo, "LW")==1){
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&delete_alert_comp=".$row2["id_aam"]."'> <img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> ";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&update_alert=".$row2["id_aam"]."'>
|
||||
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></a>";
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<tr>";
|
||||
echo "<td class='$tdcolor'>".$id_agente_name;
|
||||
echo "<td class='$tdcolor'>".$module["nombre"];
|
||||
echo show_alert_row_edit ($row2, $tdcolor, $module["id_tipo_modulo"],1);
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
$id_grupo = dame_id_grupo($id_agente);
|
||||
if (give_acl($id_user, $id_grupo, "LW")==1){
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&delete_alert_comp=".$row2["id_aam"]."'> <img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> ";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&update_alert=".$row2["id_aam"]."'>
|
||||
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></a>";
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -27,13 +27,13 @@ echo "<h2>".lang_string("Database sanity tool")."</h2>";
|
|||
|
||||
$sanity = get_parameter ("sanity", 0);
|
||||
|
||||
if ($sanity == 1){
|
||||
if ($sanity == 1) {
|
||||
// Create tagente estado when missing
|
||||
// ----------------------------------
|
||||
echo "<h2>".lang_string("Checking tagente_estado table")."</h2>";
|
||||
echo "<h2>".lang_string ("Checking tagente_estado table")."</h2>";
|
||||
$sql = "SELECT * FROM tagente_modulo";
|
||||
$result=mysql_query($sql);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$result = mysql_query ($sql);
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$id_agente_modulo = $row[0];
|
||||
$id_agente = $row["id_agente"];
|
||||
// check if exist in tagente_estado and create if not
|
||||
|
@ -49,37 +49,36 @@ if ($sanity == 1){
|
|||
|
||||
echo "<h3>".lang_string("Checking database consistency")."</h2>";
|
||||
$query1 = "SELECT * FROM tagente_estado";
|
||||
$result=mysql_query($query1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$result = mysql_query($query1);
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$id_agente_modulo = $row[1];
|
||||
# check if exist in tagente_estado and create if not
|
||||
$query2 = "SELECT COUNT(*) FROM tagente_modulo WHERE id_agente_modulo = $id_agente_modulo";
|
||||
$result2=mysql_query($query2);
|
||||
$row2=mysql_fetch_array($result2);
|
||||
if ($row2[0] == 0){
|
||||
$result2 = mysql_query ($query2);
|
||||
$row2 = mysql_fetch_array ($result2);
|
||||
if ($row2[0] == 0) {
|
||||
$query3 = "DELETE FROM tagente_estado WHERE id_agente_modulo = $id_agente_modulo";
|
||||
echo "Deleting non-existing module $id_agente_modulo in state table <br>";
|
||||
mysql_query($query3);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($sanity == 2){
|
||||
} elseif ($sanity == 2) {
|
||||
echo "<h3>".lang_string("Deleting non-init data")."</h2>";
|
||||
$query1 = "SELECT * FROM tagente_estado WHERE utimestamp = 0";
|
||||
$result=mysql_query($query1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$result = mysql_query ($query1);
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$id_agente_modulo = $row[1];
|
||||
$query0 = "DELETE FROM tagente_modulo WHERE id_agente_modulo = $id_agente_modulo";
|
||||
$query1 = "DELETE FROM tagente_estado WHERE id_agente_modulo = $id_agente_modulo";
|
||||
echo "Deleting non init module $id_agente_modulo <br>";
|
||||
mysql_query($query0);
|
||||
mysql_query($query1);
|
||||
$sql = "DELETE FROM tagente_modulo WHERE id_agente_modulo = $id_agente_modulo";
|
||||
mysql_query ($sql);
|
||||
$sql = "DELETE FROM tagente_estado WHERE id_agente_modulo = $id_agente_modulo";
|
||||
mysql_query ($sql);
|
||||
}
|
||||
}
|
||||
|
||||
echo "<br>";
|
||||
echo "<div style='width:520px'>";
|
||||
echo lang_string("Pandora FMS Sanity tool is used to remove bad database structure data, created modules with missing status, or modules that cannot be initialized (and don't report any valid data) but retry each it's own interval to get data. This kind of bad modules could degrade performance of Pandora FMS. This database sanity tool is also implemented in the <b>pandora_db.pl</b> that you should be running each day or week. This console sanity DONT compact your database, only delete bad structured data.");
|
||||
echo lang_string ("Pandora FMS Sanity tool is used to remove bad database structure data, created modules with missing status, or modules that cannot be initialized (and don't report any valid data) but retry each it's own interval to get data. This kind of bad modules could degrade performance of Pandora FMS. This database sanity tool is also implemented in the <b>pandora_db.pl</b> that you should be running each day or week. This console sanity DONT compact your database, only delete bad structured data.");
|
||||
|
||||
echo "<br><br>";
|
||||
echo "<b><a href='index.php?sec=gdbman&sec2=godmode/db/db_sanity&sanity=1'>";
|
||||
|
@ -91,11 +90,11 @@ echo "</a></b>";
|
|||
echo "<br><br>";
|
||||
echo "<b><a href='index.php?sec=gdbman&sec2=godmode/db/db_sanity&sanity=2'>";
|
||||
echo "<img src='images/status_away.png'> ";
|
||||
echo lang_string("Delete non-initialized modules now");
|
||||
echo lang_string ("Delete non-initialized modules now");
|
||||
echo "</a></b>";
|
||||
|
||||
echo "</div>";
|
||||
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?PHP
|
||||
<?php
|
||||
|
||||
// Pandora FMS - the Free monitoring system
|
||||
// ========================================
|
||||
|
@ -91,12 +91,12 @@ if (isset($_GET["update_module"])){
|
|||
include ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
$pos_x = give_parameter_post ("pos_x",0);
|
||||
$pos_y = give_parameter_post ("pos_y",0);
|
||||
$my_height = give_parameter_post ("height");
|
||||
$my_width = give_parameter_post ("width");
|
||||
$my_label = give_parameter_post ("label");
|
||||
$my_image = give_parameter_post ("image");
|
||||
$pos_x = get_parameter ("pos_x",0);
|
||||
$pos_y = get_parameter ("pos_y",0);
|
||||
$my_height = get_parameter ("height");
|
||||
$my_width = get_parameter ("width");
|
||||
$my_label = get_parameter ("label");
|
||||
$my_image = get_parameter ("image");
|
||||
|
||||
$sql = "UPDATE tlayout_data SET
|
||||
pos_x = '$pos_x',
|
||||
|
@ -125,21 +125,21 @@ if (isset($_GET["add_module"])){
|
|||
include ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
$my_id_map = give_parameter_post ("id_map",0);
|
||||
$my_id_agent = give_parameter_post ("id_agent",0);
|
||||
$my_id_module = give_parameter_post ("id_module",0);
|
||||
$my_period = give_parameter_post ("period",3600);
|
||||
$my_type = give_parameter_post ("type",0);
|
||||
$my_pos_x = give_parameter_post ("pos_x",0);
|
||||
$my_pos_y = give_parameter_post ("pos_y",0);
|
||||
$my_height = give_parameter_post ("height");
|
||||
$my_width = give_parameter_post ("width");
|
||||
$my_label = give_parameter_post ("label");
|
||||
$my_image = give_parameter_post ("image");
|
||||
$my_map_linked = give_parameter_post ("map_linked");
|
||||
$my_parent_item = give_parameter_post ("parent_item");
|
||||
$my_label_color = give_parameter_post ("label_color","");
|
||||
$my_link_color = give_parameter_post ("link_color",0);
|
||||
$my_id_map = get_parameter ("id_map",0);
|
||||
$my_id_agent = get_parameter ("id_agent",0);
|
||||
$my_id_module = get_parameter ("id_module",0);
|
||||
$my_period = get_parameter ("period",3600);
|
||||
$my_type = get_parameter ("type",0);
|
||||
$my_pos_x = get_parameter ("pos_x",0);
|
||||
$my_pos_y = get_parameter ("pos_y",0);
|
||||
$my_height = get_parameter ("height");
|
||||
$my_width = get_parameter ("width");
|
||||
$my_label = get_parameter ("label");
|
||||
$my_image = get_parameter ("image");
|
||||
$my_map_linked = get_parameter ("map_linked");
|
||||
$my_parent_item = get_parameter ("parent_item");
|
||||
$my_label_color = get_parameter ("label_color","");
|
||||
$my_link_color = get_parameter ("link_color",0);
|
||||
$sql = "INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_layout_linked, parent_item, label_color, no_link_color) VALUES ('$my_id_map', '$my_pos_x', '$my_pos_y', '$my_height', '$my_width', '$my_label', '$my_image', '$my_type', '$my_period', '$my_id_module', '$my_map_linked', '$my_parent_item', '$my_label_color', '$my_link_color')";
|
||||
if ($res=mysql_query($sql))
|
||||
$result = "<h3 class=suc>".$lang_label["create_ok"]."</h3>";
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,7 +14,14 @@
|
|||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
function check_login() {
|
||||
/**
|
||||
* Check if login session variables are set.
|
||||
*
|
||||
* It will stop the execution if those variables were not set
|
||||
*
|
||||
* @return 0 on success
|
||||
*/
|
||||
function check_login () {
|
||||
global $config;
|
||||
if (!isset($config["homedir"])){
|
||||
// No exists $config. Exit inmediatly
|
||||
|
@ -28,7 +35,7 @@ function check_login() {
|
|||
$rowdup = mysql_fetch_array($resq1);
|
||||
$nombre = $rowdup[0];
|
||||
if ( $id == $nombre ){
|
||||
return 0 ;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
audit_db("N/A", getenv("REMOTE_ADDR"), "No session", "Trying to access without a valid session");
|
||||
|
@ -36,13 +43,28 @@ function check_login() {
|
|||
exit;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// give_acl ()
|
||||
// Main Function to get access to resources
|
||||
// Return 0 if no access, > 0 if access
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function give_acl($id_user, $id_group, $access){
|
||||
/**
|
||||
* Check access privileges to resources
|
||||
*
|
||||
* Access can be:
|
||||
* IR - Incident Read
|
||||
* IW - Incident Write
|
||||
* IM - Incident Management
|
||||
* AR - Agent Read
|
||||
* AW - Agent Write
|
||||
* LW - Alert Write
|
||||
* UM - User Management
|
||||
* DM - DB Management
|
||||
* LM - Alert Management
|
||||
* PM - Pandora Management
|
||||
*
|
||||
* @param id_user User id to check
|
||||
* @param id_group Agents group id to check access
|
||||
* @param access Access privilege to check
|
||||
*
|
||||
* @return 1 if the user has privileges, 0 if not.
|
||||
*/
|
||||
function give_acl ($id_user, $id_group, $access) {
|
||||
// IF user is level = 1 then always return 1
|
||||
// Access can be:
|
||||
/*
|
||||
|
@ -64,44 +86,76 @@ function give_acl($id_user, $id_group, $access){
|
|||
$res=mysql_query($query1);
|
||||
$row=mysql_fetch_array($res);
|
||||
if ($row["nivel"] == 1)
|
||||
$result = 1;
|
||||
else {
|
||||
if ($id_group == 0) // Group doesnt matter, any group, for check permission to do at least an action in a group
|
||||
$query1="SELECT * FROM tusuario_perfil WHERE id_usuario = '".$id_user."'"; // GroupID = 0, group doesnt matter (use with caution!)
|
||||
else
|
||||
$query1="SELECT * FROM tusuario_perfil WHERE id_usuario = '".$id_user."' and ( id_grupo =".$id_group." OR id_grupo = 1)"; // GroupID = 1 ALL groups
|
||||
$resq1=mysql_query($query1);
|
||||
$result = 0;
|
||||
while ($rowdup=mysql_fetch_array($resq1)){
|
||||
$id_perfil=$rowdup["id_perfil"];
|
||||
// For each profile for this pair of group and user do...
|
||||
$query2="SELECT * FROM tperfil WHERE id_perfil = ".$id_perfil;
|
||||
$resq2=mysql_query($query2);
|
||||
if ($rowq2=mysql_fetch_array($resq2)){
|
||||
switch ($access) {
|
||||
case "IR": $result = $result + $rowq2["incident_view"]; break;
|
||||
case "IW": $result = $result + $rowq2["incident_edit"]; break;
|
||||
case "IM": $result = $result + $rowq2["incident_management"]; break;
|
||||
case "AR": $result = $result + $rowq2["agent_view"]; break;
|
||||
case "AW": $result = $result + $rowq2["agent_edit"]; break;
|
||||
case "LW": $result = $result + $rowq2["alert_edit"]; break;
|
||||
case "LM": $result = $result + $rowq2["alert_management"]; break;
|
||||
case "PM": $result = $result + $rowq2["pandora_management"]; break;
|
||||
case "DM": $result = $result + $rowq2["db_management"]; break;
|
||||
case "UM": $result = $result + $rowq2["user_management"]; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // else
|
||||
return 1;
|
||||
if ($id_group == 0) // Group doesnt matter, any group, for check permission to do at least an action in a group
|
||||
$query1="SELECT * FROM tusuario_perfil WHERE id_usuario = '".$id_user."'"; // GroupID = 0, group doesnt matter (use with caution!)
|
||||
else
|
||||
$query1="SELECT * FROM tusuario_perfil WHERE id_usuario = '".$id_user."' and ( id_grupo =".$id_group." OR id_grupo = 1)"; // GroupID = 1 ALL groups
|
||||
$resq1=mysql_query($query1);
|
||||
$result = 0;
|
||||
while ($rowdup=mysql_fetch_array($resq1)){
|
||||
$id_perfil=$rowdup["id_perfil"];
|
||||
// For each profile for this pair of group and user do...
|
||||
$query2="SELECT * FROM tperfil WHERE id_perfil = ".$id_perfil;
|
||||
$resq2=mysql_query($query2);
|
||||
if ($rowq2=mysql_fetch_array($resq2)){
|
||||
switch ($access) {
|
||||
case "IR":
|
||||
$result = $result + $rowq2["incident_view"];
|
||||
|
||||
break;
|
||||
case "IW":
|
||||
$result = $result + $rowq2["incident_edit"];
|
||||
|
||||
break;
|
||||
case "IM":
|
||||
$result = $result + $rowq2["incident_management"];
|
||||
|
||||
break;
|
||||
case "AR":
|
||||
$result = $result + $rowq2["agent_view"];
|
||||
|
||||
break;
|
||||
case "AW":
|
||||
$result = $result + $rowq2["agent_edit"];
|
||||
|
||||
break;
|
||||
case "LW":
|
||||
$result = $result + $rowq2["alert_edit"];
|
||||
|
||||
break;
|
||||
case "LM":
|
||||
$result = $result + $rowq2["alert_management"];
|
||||
|
||||
break;
|
||||
case "PM":
|
||||
$result = $result + $rowq2["pandora_management"];
|
||||
|
||||
break;
|
||||
case "DM":
|
||||
$result = $result + $rowq2["db_management"];
|
||||
|
||||
break;
|
||||
case "UM":
|
||||
$result = $result + $rowq2["user_management"];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($result > 1)
|
||||
$result = 1;
|
||||
return $result;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// audit_db, update audit log
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Adds an audit log entry.
|
||||
*
|
||||
* @param id User id that makes the incident
|
||||
* @param ip Client IP who makes the incident
|
||||
* @param accion Action description
|
||||
* @param descripcion Long action description
|
||||
*/
|
||||
function audit_db ($id, $ip, $accion, $descripcion){
|
||||
require("config.php");
|
||||
$today=date('Y-m-d H:i:s');
|
||||
|
@ -110,32 +164,38 @@ function audit_db ($id, $ip, $accion, $descripcion){
|
|||
$result=mysql_query($sql1);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// logon_db, update entry in logon audit
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function logon_db($id,$ip){
|
||||
require("config.php");
|
||||
audit_db($id,$ip,"Logon","Logged in");
|
||||
/**
|
||||
* Log in a user into Pandora.
|
||||
*
|
||||
* @param id_user User id
|
||||
* @param ip Client user IP address.
|
||||
*/
|
||||
function logon_db ($id_user, $ip) {
|
||||
require ("config.php");
|
||||
audit_db ($id_user, $ip, "Logon", "Logged in");
|
||||
// Update last registry of user to get last logon
|
||||
$sql2='UPDATE tusuario fecha_registro = $today WHERE id_usuario = "$id"';
|
||||
$result=mysql_query($sql2);
|
||||
$sql = 'UPDATE tusuario fecha_registro = $today WHERE id_usuario = "$id_user"';
|
||||
$result = mysql_query ($sql);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// logoff_db, also adds audit log
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function logoff_db($id,$ip){
|
||||
require("config.php");
|
||||
audit_db($id,$ip,"Logoff","Logged out");
|
||||
/**
|
||||
* Log out a user into Pandora.
|
||||
*
|
||||
* @param id_user User id
|
||||
* @param ip Client user IP address.
|
||||
*/
|
||||
function logoff_db ($id_user, $ip) {
|
||||
require ("config.php");
|
||||
audit_db ($id_user, $ip, "Logoff", "Logged out");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns profile given ID
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get profile name from id.
|
||||
*
|
||||
* @param id_profile Id profile in tperfil
|
||||
*
|
||||
* @return Profile name of the given id
|
||||
*/
|
||||
function dame_perfil ($id_profile) {
|
||||
return (string) get_db_value ('name', 'tperfil', 'id_perfil', (int) $id_profile);
|
||||
}
|
||||
|
@ -210,107 +270,142 @@ function get_alerts_in_agent ($id_agent) {
|
|||
return array_merge ($simple_alerts, $combined_alerts);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns group given ID
|
||||
// ---------------------------------------------------------------
|
||||
/**
|
||||
* Get a list of the reports the user can view.
|
||||
*
|
||||
* A user can view a report by two ways:
|
||||
* - The user created the report (id_user field in treport)
|
||||
* - The report is not private and the user has reading privileges on
|
||||
* the group associated to the report
|
||||
*
|
||||
* @param $id_user User id to get the reports.
|
||||
*
|
||||
* @return An array with all the reports the user can view.
|
||||
*/
|
||||
function get_reports ($id_user) {
|
||||
$user_reports = array ();
|
||||
$all_reports = get_db_all_rows_in_table ('treport');
|
||||
if (sizeof ($all_reports) == 0) {
|
||||
return $user_reports;
|
||||
}
|
||||
foreach ($all_reports as $report) {
|
||||
/* The report is private and it does not belong to the user */
|
||||
if ($report['private'] && $report['id_user'] != $id_user)
|
||||
continue;
|
||||
/* Check ACL privileges on report group */
|
||||
if (! give_acl ($id_user, $report['id_group'], 'AR'))
|
||||
continue;
|
||||
array_push ($user_reports, $report);
|
||||
}
|
||||
return $user_reports;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group name from group.
|
||||
*
|
||||
* @param id_group Id group to get the name.
|
||||
*
|
||||
* @return The name of the given group
|
||||
*/
|
||||
function dame_grupo ($id_group) {
|
||||
return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_group);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns icon name given group ID
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get group icon from group.
|
||||
*
|
||||
* @param id_group Id group to get the icon
|
||||
*
|
||||
* @return Icon path of the given group
|
||||
*/
|
||||
function dame_grupo_icono ($id_group) {
|
||||
return (string) get_db_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Return agent id given name of agent
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get agent id from an agent name.
|
||||
*
|
||||
* @param agent_name Agent name to get its id.
|
||||
*
|
||||
* @return Id from the agent of the given name.
|
||||
*/
|
||||
function dame_agente_id ($agent_name) {
|
||||
return (int) get_db_value ('id_agente', 'tagente', 'nombre', $agent_name);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns userid given name an note id
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get user id of a note.
|
||||
*
|
||||
* @param id_note Note id.
|
||||
*
|
||||
* @return User id of the given note.
|
||||
*/
|
||||
function give_note_author ($id_note) {
|
||||
return (int) get_db_value ('id_usuario', 'tnota', 'id_nota', (int) $id_note);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns agent id given name of agent
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function dame_agente_modulo_id ($id_agente, $id_tipomodulo, $nombre) {
|
||||
$sql = sprintf ('SELECT id_agente_modulo FROM tagente_modulo
|
||||
WHERE id_agente = %d
|
||||
AND id_tipo_modulo = %d AND nombre = "%s"',
|
||||
$id_agent, $id_tipomodulo, $nombre);
|
||||
return get_db_sql ($sql);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns event description given it's id
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get description of an event.
|
||||
*
|
||||
* @param id_event Event id.
|
||||
*
|
||||
* @return Description of the given event.
|
||||
*/
|
||||
function return_event_description ($id_event) {
|
||||
return (string) get_db_value ('evento', 'tevento', 'id_evento', (int) $id_event);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Return ID_Group from an event given as id_event
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get group id of an event.
|
||||
*
|
||||
* @param id_event Event id
|
||||
*
|
||||
* @return Group id of the given event.
|
||||
*/
|
||||
function gime_idgroup_from_idevent ($id_event) {
|
||||
return (int) get_db_value ('id_grupo', 'tevento', 'id_evento', (int) $id_event);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Return module id given name of module type
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function dame_module_id ($nombre){
|
||||
return (int) get_db_value ('id_tipo', 'ttipo_modulo', 'nombre', $nombre);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns agent name when given its ID
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get name of an agent.
|
||||
*
|
||||
* @param id_agente Agent id.
|
||||
*
|
||||
* @return Name of the given agent.
|
||||
*/
|
||||
function dame_nombre_agente ($id_agente) {
|
||||
return (string) get_db_value ('nombre', 'tagente', 'id_agente', (int) $id_agente);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns password (HASH) given user_id
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function dame_password ($id_usuario) {
|
||||
/**
|
||||
* Get password of an user.
|
||||
*
|
||||
* @param id_usuario User id.
|
||||
*
|
||||
* @return Password of an user.
|
||||
*/
|
||||
function get_user_password ($id_usuario) {
|
||||
return (string) get_db_value ('password', 'tusuario', 'id_usuario', (int) $id_usuario);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns name of an alert given ID
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get name of an alert
|
||||
*
|
||||
* @param id_alert Alert id.
|
||||
*
|
||||
* @return Name of the alert.
|
||||
*/
|
||||
function dame_nombre_alerta ($id_alert) {
|
||||
return (string) get_db_value ('nombre', 'talerta', 'id_alerta', (int) $id_alert);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns name of a modules group
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get name of a module group.
|
||||
*
|
||||
* @param id_module_group Module group id.
|
||||
*
|
||||
* @return Name of the given module group.
|
||||
*/
|
||||
function dame_nombre_grupomodulo ($id_module_group) {
|
||||
return (string) get_db_value ('name', 'tmodule_group', 'id_mg', (int) $id_module_group);
|
||||
}
|
||||
|
@ -920,13 +1015,9 @@ function agent_belong_group($id_agent, $id_group){
|
|||
// Conexion con la base Datos
|
||||
$child[] = "";
|
||||
$child[] = $id_group;
|
||||
give_groupchild($id_group,$child);
|
||||
$id_agent_group = give_group_id($id_agent);
|
||||
if (array_in($child,$id_agent_group)==1){
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
give_groupchild ($id_group, $child);
|
||||
$id_agent_group = give_group_id ($id_agent);
|
||||
return in_array ($child, $id_agent_group);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
@ -944,10 +1035,7 @@ function group_belong_group($id_group_a, $id_groupset){
|
|||
(group_belong_group($id_group_a, $value) == 1))
|
||||
return 1;
|
||||
}
|
||||
if (array_in ($childgroup, $id_group_a) == 1)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
return in_array ($childgroup, $id_group_a);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
@ -1161,6 +1249,18 @@ function give_db_value ($field, $table, $field_search, $condition) {
|
|||
return get_db_value ($field, $table, $field_search, $condition);
|
||||
}
|
||||
|
||||
function get_db_row_sql ($sql) {
|
||||
$result = mysql_query ($sql);
|
||||
if (! $result) {
|
||||
echo '<strong>Error:</strong> get_db_row("'.$sql.'") :'. mysql_error ().'<br />';
|
||||
return NULL;
|
||||
}
|
||||
if ($row = mysql_fetch_array ($result))
|
||||
return $row;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
function get_db_row ($table, $field_search, $condition) {
|
||||
global $config;
|
||||
|
@ -1173,15 +1273,7 @@ function get_db_row ($table, $field_search, $condition) {
|
|||
$sql = sprintf ('SELECT * FROM %s WHERE %s = "%s"', $table, $field_search, $condition);
|
||||
}
|
||||
|
||||
$result = mysql_query ($sql);
|
||||
if (! $result) {
|
||||
echo '<strong>Error:</strong> get_db_row("'.$sql.'") :'. mysql_error ().'<br />';
|
||||
return NULL;
|
||||
}
|
||||
if ($row = mysql_fetch_array ($result))
|
||||
return $row;
|
||||
|
||||
return NULL;
|
||||
return get_db_row_sql ($sql);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
@ -1314,15 +1406,15 @@ function return_status_layout ($id_layout = 0){
|
|||
$sql="SELECT * FROM tlayout_data WHERE id_layout = $id_layout";
|
||||
$res=mysql_query($sql);
|
||||
while ($row = mysql_fetch_array($res)){
|
||||
$id_agentmodule = $row["id_agente_modulo"];
|
||||
$type = $row["type"];
|
||||
$parent_item = $row["parent_item"];
|
||||
$link_layout = $row["id_layout_linked"];
|
||||
$id_agentmodule = $row["id_agente_modulo"];
|
||||
$type = $row["type"];
|
||||
$parent_item = $row["parent_item"];
|
||||
$link_layout = $row["id_layout_linked"];
|
||||
if (($link_layout != 0) && ($id_agentmodule == 0)) {
|
||||
$temp_status += return_status_layout ($link_layout);
|
||||
$temp_status += return_status_layout ($link_layout);
|
||||
$temp_total++;
|
||||
} else {
|
||||
$temp_status += return_status_agent_module ($id_agentmodule);
|
||||
} else {
|
||||
$temp_status += return_status_agent_module ($id_agentmodule);
|
||||
$temp_total++;
|
||||
}
|
||||
}
|
||||
|
@ -1376,48 +1468,91 @@ function return_coordinate_y_layoutdata ($id_layoutdata){
|
|||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the previous data to the timestamp provided.
|
||||
*
|
||||
* It's useful to know the first value of a module in an interval,
|
||||
* since it will be the last value in the
|
||||
*
|
||||
* @param $id_agent_module Agent module id to look.
|
||||
* @param $utimestamp The timestamp to look backwards from and get the data.
|
||||
*
|
||||
* @return The row of tagente_datos of the last period. NULL if there were no data.
|
||||
*/
|
||||
function get_previous_data ($id_agent_module, $utimestamp) {
|
||||
$sql = sprintf ('SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp <= %d
|
||||
ORDER by utimestamp DESC LIMIT 1',
|
||||
$id_agent_module, $utimestamp);
|
||||
return get_db_row_sql ($sql);
|
||||
}
|
||||
|
||||
function return_moduledata_avg_value ($id_agent_module, $period, $date = 0) {
|
||||
if (! $date)
|
||||
$date = time ();
|
||||
$datelimit = $date - $period; // limit date
|
||||
$id_agent = get_db_value ("id_agente", "tagente_modulo", "id_agente_modulo", $id_agent_module);
|
||||
$sql = sprintf ("SELECT AVG(datos) FROM tagente_datos
|
||||
WHERE id_agente = %d AND id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d",
|
||||
$id_agent, $id_agent_module, $datelimit, $date);
|
||||
return (float) get_db_sql ($sql);
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$sql = sprintf ("SELECT SUM(datos), COUNT(*) FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d
|
||||
ORDER BY utimestamp ASC",
|
||||
$id_agent_module, $datelimit, $date);
|
||||
$values = get_db_row_sql ($sql);
|
||||
$sum = (float) $values[0];
|
||||
$total = (int) $values[1];
|
||||
|
||||
/* Get also the previous data before the selected interval. */
|
||||
$previous_data = get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data)
|
||||
return ($previous_data['datos'] + $sum) / ($total + 1);
|
||||
return $sum / $total;
|
||||
}
|
||||
|
||||
|
||||
function return_moduledata_max_value ($id_agent_module, $period, $date = 0) {
|
||||
if (! $date)
|
||||
$date = time ();
|
||||
$datelimit = $date - $period; // limit date
|
||||
$id_agent = get_db_value ("id_agente", "tagente_modulo", "id_agente_modulo", $id_agent_module);
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$sql = sprintf ("SELECT MAX(datos) FROM tagente_datos
|
||||
WHERE id_agente = %d AND id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d",
|
||||
$id_agent, $id_agent_module, $datelimit, $date);
|
||||
return (float) get_db_sql ($sql);
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d
|
||||
ORDER BY utimestamp ASC",
|
||||
$id_agent_module, $datelimit, $date);
|
||||
$max = (float) get_db_sql ($sql);
|
||||
|
||||
/* Get also the previous report before the selected interval. */
|
||||
$previous_data = get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data)
|
||||
return max ($previous_data['datos'], $max);
|
||||
|
||||
return max ($previous_data, $max);
|
||||
}
|
||||
|
||||
function return_moduledata_min_value ($id_agent_module, $period, $date = 0) {
|
||||
if (! $date)
|
||||
$date = time ();
|
||||
$datelimit = $date - $period; // limit date
|
||||
$id_agent = get_db_value ("id_agente", "tagente_modulo", "id_agente_modulo", $id_agent_module);
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$sql = sprintf ("SELECT MIN(datos) FROM tagente_datos
|
||||
WHERE id_agente = %d AND id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d",
|
||||
$id_agent, $id_agent_module, $datelimit, $date);
|
||||
return (float) get_db_sql ($sql);
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d
|
||||
ORDER BY utimestamp ASC",
|
||||
$id_agent_module, $datelimit, $date);
|
||||
$min = (float) get_db_sql ($sql);
|
||||
|
||||
/* Get also the previous data before the selected interval. */
|
||||
$previous_data = get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data)
|
||||
return min ($previous_data['datos'], $min);
|
||||
return $min;
|
||||
}
|
||||
|
||||
function return_moduledata_sum_value ($id_agent_module, $period, $date = 0) {
|
||||
if (! $date)
|
||||
$date = time ();
|
||||
$datelimit = $date - $period; // limit date
|
||||
$agent_module = get_db_row ('tagente_modulo', 'id_agente_modulo', $id_agent_module);
|
||||
$module_name = get_db_value ('nombre', 'ttipo_modulo', 'id_tipo', $agent_module['id_tipo_modulo']);
|
||||
|
||||
if (is_module_data_string ($module_name)) {
|
||||
|
@ -1427,10 +1562,17 @@ function return_moduledata_sum_value ($id_agent_module, $period, $date = 0) {
|
|||
|
||||
// Get the whole interval of data
|
||||
$sql = sprintf ('SELECT * FROM tagente_datos
|
||||
WHERE id_agente = %d AND id_agente_modulo = %d
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d',
|
||||
$agent_module['id_agente'], $id_agent_module, $datelimit, $date);
|
||||
$id_agent_module, $datelimit, $date);
|
||||
$datas = get_db_all_rows_sqlfree ($sql);
|
||||
|
||||
/* Get also the previous data before the selected interval. */
|
||||
$previous_data = get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data) {
|
||||
/* Add data to the beginning */
|
||||
array_unshift ($datas, $previous_data);
|
||||
}
|
||||
$last_data = "";
|
||||
$total_badtime = 0;
|
||||
$interval_begin = 0;
|
||||
|
@ -1491,13 +1633,13 @@ function check_server_status () {
|
|||
return $res;
|
||||
}
|
||||
|
||||
function show_alert_row_mini ($id_combined_alert){
|
||||
function show_alert_row_mini ($id_combined_alert) {
|
||||
global $config;
|
||||
global $lang_label;
|
||||
|
||||
$color=1;
|
||||
$sql_com = "SELECT talerta_agente_modulo.*, tcompound_alert.operation FROM talerta_agente_modulo, tcompound_alert WHERE tcompound_alert.id_aam = talerta_agente_modulo.id_aam AND tcompound_alert.id = ".$id_combined_alert;
|
||||
$result_com = mysql_query ($sql_com);
|
||||
$sql = "SELECT talerta_agente_modulo.*, tcompound_alert.operation FROM talerta_agente_modulo, tcompound_alert WHERE tcompound_alert.id_aam = talerta_agente_modulo.id_aam AND tcompound_alert.id = ".$id_combined_alert;
|
||||
$result = mysql_query ($sql);
|
||||
echo "<table width=400 cellpadding=2 cellspacing=2 class='databox'>";
|
||||
echo "<th>".lang_string("Name");
|
||||
echo "<th>".lang_string("Oper");
|
||||
|
@ -1509,9 +1651,9 @@ function show_alert_row_mini ($id_combined_alert){
|
|||
echo "<th>".lang_string("MinMax.Al");
|
||||
echo "<th>".lang_string("Days");
|
||||
echo "<th>".lang_string("Fired");
|
||||
while ($row2=mysql_fetch_array($result_com)){
|
||||
while ($row2 = mysql_fetch_array ($result)) {
|
||||
|
||||
if ($color == 1){
|
||||
if ($color == 1) {
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
|
@ -1599,118 +1741,116 @@ 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;
|
||||
case "new_agent":
|
||||
echo "<img src='images/wand.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>";
|
||||
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 "<th class='datos3 f9'>".lang_string ("St")."</th>";
|
||||
echo "<th class='datos3 f9'>".lang_string ("Type")."</th>";
|
||||
echo "<th class='datos3 f9'>".$lang_label["event_name"]."</th>";
|
||||
echo "<th class='datos3 f9'>".$lang_label["agent_name"]."</th>";
|
||||
echo "<th class='datos3 f9'>".$lang_label["id_user"]."</th>";
|
||||
echo "<th 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>";
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -22,37 +22,58 @@ function return_module_SLA ($id_agent_module, $period, $min_value, $max_value, $
|
|||
$date = time ();
|
||||
$datelimit = $date - $period; // limit date
|
||||
$id_agent = give_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
|
||||
// Get the whole interval of data
|
||||
/* Get all the data in the interval */
|
||||
$sql = sprintf ('SELECT * FROM tagente_datos
|
||||
WHERE id_agente = %d AND id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d',
|
||||
AND utimestamp > %d AND utimestamp <= %d
|
||||
ORDER BY utimestamp ASC',
|
||||
$id_agent, $id_agent_module, $datelimit, $date);
|
||||
$result = mysql_query ($sql);
|
||||
$datas = get_db_all_rows_sqlfree ($sql);
|
||||
$last_data = "";
|
||||
$total_badtime = 0;
|
||||
$interval_begin = 0;
|
||||
$interval_last = 0;
|
||||
|
||||
if (! $result) {
|
||||
return 100;
|
||||
$interval_last = $date;
|
||||
$previous_data_timestamp = 0;
|
||||
|
||||
/* Get also the previous data before the selected interval. */
|
||||
$previous_data = get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data) {
|
||||
/* Add data to the beginning */
|
||||
array_unshift ($datas, $previous_data);
|
||||
$previous_data_timestamp = $previous_data['utimestamp'];
|
||||
}
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
if ( ($row["datos"] > $max_value) || ($row["datos"] < $min_value)) {
|
||||
if (sizeof ($datas) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($datas as $data) {
|
||||
if ($data["datos"] > $max_value || $data["datos"] < $min_value) {
|
||||
if ($interval_begin == 0) {
|
||||
$interval_begin = $row["utimestamp"];
|
||||
$interval_begin = $data["utimestamp"];
|
||||
}
|
||||
} elseif ($interval_begin != 0){
|
||||
} elseif ($interval_begin != 0) {
|
||||
// Here ends interval with data outside valid values,
|
||||
// Need to add this time to counter
|
||||
$interval_last = $row["utimestamp"];
|
||||
$interval_last = $data["utimestamp"];
|
||||
$temp_time = $interval_last - $interval_begin;
|
||||
$total_badtime = $total_badtime + $temp_time;
|
||||
$total_badtime += $temp_time;
|
||||
$interval_begin = 0;
|
||||
$interval_last = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check the last interval, if any */
|
||||
if ($interval_begin != 0) {
|
||||
/* The last time was the time of the previous data in the
|
||||
interval. That means that in all the interval, the data was
|
||||
not between the expected values, so the SLA is zero. */
|
||||
if ($interval_begin = $previous_data_timestamp)
|
||||
return 0;
|
||||
$total_badtime += $interval_last - $interval_begin;
|
||||
}
|
||||
|
||||
$result = 100 - ($total_badtime / $period) * 100;
|
||||
return $result;
|
||||
return max ($result, 0);
|
||||
}
|
||||
|
||||
function general_stats ( $id_user, $id_group = 0) {
|
||||
|
@ -192,10 +213,10 @@ function event_reporting ($id_agent, $period, $date = 0, $return = false) {
|
|||
$sql2="SELECT * FROM tevento WHERE id_agente = $id_agent AND utimestamp > '$mytimestamp'";
|
||||
|
||||
// Make query for data (all data, not only distinct).
|
||||
$result2=mysql_query($sql2);
|
||||
while ($row2=mysql_fetch_array($result2)){
|
||||
$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($id_user, $id_grupo, "IR") == 1) { // Only incident read access to view data !
|
||||
$id_group = $row2["id_grupo"];
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
|
|
|
@ -193,13 +193,15 @@ require "include/functions_db.php";
|
|||
}
|
||||
$pagina = "";
|
||||
if (isset ($_GET["sec2"])){
|
||||
$sec2 = parametro_limpio ($_GET["sec2"]);
|
||||
$sec2 = get_parameter_get ('sec2');
|
||||
$sec2 = parameter_extra_clean ($sec2);
|
||||
$pagina = $sec2;
|
||||
} else
|
||||
$sec2 = "";
|
||||
|
||||
if (isset ($_GET["sec"])){
|
||||
$sec = parametro_limpio ($_GET["sec"]);
|
||||
$sec = get_parameter_get ('sec');
|
||||
$sec = parameter_extra_clean ($sec);
|
||||
$pagina = $sec2;
|
||||
}
|
||||
else
|
||||
|
@ -254,4 +256,4 @@ require "include/functions_db.php";
|
|||
|
||||
echo '</body></html>';
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -53,7 +53,7 @@ if (comprueba_login() == 0) {
|
|||
if (give_acl($id_usuario, $id_grupo, "AR")==1){
|
||||
|
||||
// Check for validate alert request
|
||||
$validate_alert = give_parameter_get ("validate_alert");
|
||||
$validate_alert = get_parameter ("validate_alert");
|
||||
if ($validate_alert != ""){
|
||||
if (give_acl($id_usuario, $id_grupo, "AW")==1){
|
||||
$alert_row = get_db_row ("talerta_agente_modulo", "id_aam", $validate_alert);
|
||||
|
|
|
@ -18,40 +18,36 @@
|
|||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
<!--
|
||||
function CheckAll()
|
||||
{
|
||||
for (var i=0;i<document.eventtable.elements.length;i++)
|
||||
{
|
||||
var e = document.eventtable.elements[i];
|
||||
if (e.type == 'checkbox' && e.name != 'allbox')
|
||||
e.checked = 1;
|
||||
}
|
||||
function CheckAll () {
|
||||
for (var i = 0; i < document.eventtable.elements.length; i++) {
|
||||
var e = document.eventtable.elements[i];
|
||||
if (e.type == 'checkbox' && e.name != 'allbox')
|
||||
e.checked = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function OpConfirm(text, conf)
|
||||
{
|
||||
for (var i=0;i<document.pageform.elements.length;i++)
|
||||
{
|
||||
var e = document.pageform.elements[i];
|
||||
if (e.type == 'checkbox' && e.name != 'allbox' && e.checked == 1 ) {
|
||||
if (conf) {
|
||||
return confirm(text);
|
||||
} else {
|
||||
return 1;
|
||||
function OpConfirm (text, conf) {
|
||||
for (var i = 0; i < document.pageform.elements.length; i++) {
|
||||
var e = document.pageform.elements[i];
|
||||
if (e.type == 'checkbox' && e.name != 'allbox' && e.checked == 1) {
|
||||
if (conf) {
|
||||
return confirm (text);
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
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';
|
||||
}
|
||||
}
|
||||
/* 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>
|
||||
|
||||
|
@ -164,36 +160,36 @@ $id_agent = get_parameter ("id_agent", -1);
|
|||
|
||||
$sql_post = "";
|
||||
if ($ev_group > 1)
|
||||
$sql_post .= " AND id_grupo = $ev_group";
|
||||
$sql_post .= " AND id_grupo = $ev_group";
|
||||
if ($status == 1)
|
||||
$sql_post .= " AND estado = 1";
|
||||
$sql_post .= " AND estado = 1";
|
||||
if ($status == 0)
|
||||
$sql_post .= " AND estado = 0";
|
||||
$sql_post .= " AND estado = 0";
|
||||
if ($search != "")
|
||||
$sql_post .= " AND evento LIKE '%$search%'";
|
||||
$sql_post .= " AND evento LIKE '%$search%'";
|
||||
if ($event_type != "")
|
||||
$sql_post .= " AND event_type = '$event_type'";
|
||||
$sql_post .= " AND event_type = '$event_type'";
|
||||
if ($severity != -1)
|
||||
$sql_post .= " AND criticity >= $severity";
|
||||
$sql_post .= " AND criticity >= $severity";
|
||||
if ($id_agent != -1)
|
||||
$sql_post .= " AND id_agente = $id_agent";
|
||||
$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";
|
||||
|
||||
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>";
|
||||
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 "<a target='_top' href='$url&pure=1'><img src='images/monitor.png' title='".lang_string("Full screen")."'></a>";
|
||||
echo "</h2>";
|
||||
|
||||
echo "<a href=\"javascript:;\" onmousedown=\"toggleDiv('event_control');\">";
|
||||
echo "<b>".lang_string("Event control filter")." ".'<img src="images/wand.png"></A></b>';
|
||||
|
||||
if ($config["pure"] == 1)
|
||||
echo "<div id='event_control' style='display:none'>";
|
||||
echo "<div id='event_control' style='display:none'>";
|
||||
else
|
||||
echo "<div id='event_control' style='display:all'>";
|
||||
echo "<div id='event_control' style='display:all'>";
|
||||
|
||||
// Table who separate control and graph
|
||||
echo "<table width=99% cellpadding=0 cellspacing=2 border=0>";
|
||||
|
@ -224,24 +220,25 @@ echo "<tr>";
|
|||
// Severity
|
||||
echo "<td>".lang_string ("Severity")."</td>";
|
||||
echo "<td>";
|
||||
echo form_priority ($severity, "severity", 1);
|
||||
|
||||
print_select (get_priorities (), "severity", $severity, '', 'all', '-1');
|
||||
|
||||
// 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");
|
||||
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");
|
||||
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 "<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>";
|
||||
|
@ -275,23 +272,23 @@ $total_events = $row3[0];
|
|||
// Show pagination header
|
||||
if ($total_events > 0){
|
||||
|
||||
$offset = get_parameter ( "offset",0);
|
||||
$offset = get_parameter ( "offset",0);
|
||||
pagination ($total_events, $url."&pure=".$config["pure"], $offset);
|
||||
// Show data.
|
||||
|
||||
echo "<br>";
|
||||
echo "<br>";
|
||||
if ($config["pure"] == 0)
|
||||
echo "<table cellpadding='4' cellspacing='4' width='765' class='databox'>";
|
||||
else
|
||||
echo "<table cellpadding='4' cellspacing='4' 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 class=f9>".lang_string ("St")."</th>";
|
||||
echo "<th class=f9>".lang_string ("Type")."</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["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>";
|
||||
|
@ -309,121 +306,121 @@ if ($total_events > 0){
|
|||
if (give_acl($config["id_user"], $id_grupo, "AR") == 1){ // Only incident read access to view data !
|
||||
$id_group = $row2["id_grupo"];
|
||||
|
||||
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>";
|
||||
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;
|
||||
case "new_agent";
|
||||
echo "<img src='images/wand.png'>";
|
||||
break;
|
||||
}
|
||||
// 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;
|
||||
case "new_agent";
|
||||
echo "<img src='images/wand.png'>";
|
||||
break;
|
||||
}
|
||||
|
||||
// Event description
|
||||
$event_title = safe_input ($row2["evento"]);
|
||||
echo "<td class='".$tdclass."f9' title='$event_title'>";
|
||||
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>";
|
||||
// Event description
|
||||
$event_title = safe_input ($row2["evento"]);
|
||||
echo "<td class='".$tdclass."f9' title='$event_title'>";
|
||||
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>";
|
||||
// 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
|
||||
// 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";
|
||||
}
|
||||
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'>";
|
||||
// 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
|
||||
|
||||
// Timestamp
|
||||
echo "<td class='".$tdclass."f9' title='".$row2["timestamp"]."'>";
|
||||
echo human_time_comparation($row2["timestamp"]);
|
||||
|
||||
// Several options grouped here
|
||||
echo human_time_comparation($row2["timestamp"]);
|
||||
|
||||
// Several options grouped here
|
||||
echo "<td class='$tdclass' align='right'>";
|
||||
// Validate event
|
||||
// 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
|
||||
// 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
|
||||
// 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>";
|
||||
// Checbox
|
||||
// Checbox
|
||||
echo "<td class='$tdclass' align='center'>";
|
||||
echo "<input type='checkbox' class='chk' name='eventid".$offset_counter."' value='".$row2["id_evento"]."'>";
|
||||
echo "</td></tr>";
|
||||
|
@ -438,21 +435,21 @@ if ($total_events > 0){
|
|||
echo "<input class='sub delete' type='submit' name='deletebt' value='".$lang_label["delete"]."'>";
|
||||
}
|
||||
echo "</form></table>";
|
||||
echo "<table>";
|
||||
echo "<tr>";
|
||||
echo "<td rowspan='4' class='f9' style='padding-left: 30px; line-height: 17px; vertical-align: top;'>";
|
||||
echo "<h3>".$lang_label["status"]."</h3>";
|
||||
echo "<img src='images/dot_green.png'> - ".$lang_label["validated_event"];
|
||||
echo "<br>";
|
||||
echo "<img src='images/dot_red.png'> - ".$lang_label["not_validated_event"];
|
||||
echo "</td>";
|
||||
echo "<td rowspan='4' class='f9' style='padding-left: 30px; line-height: 17px; vertical-align: top;'>";
|
||||
echo "<h3>".$lang_label["action"]."</h3>";
|
||||
echo "<img src='images/ok.png'> - ".$lang_label["validate_event"];
|
||||
echo "<br>";
|
||||
echo "<img src='images/cross.png'> - ".$lang_label["delete_event"];
|
||||
echo "<br>";
|
||||
echo "<img src='images/page_lightning.png'> - ".$lang_label["create_incident"];
|
||||
echo "</td></tr></table>";
|
||||
echo "<table>";
|
||||
echo "<tr>";
|
||||
echo "<td rowspan='4' class='f9' style='padding-left: 30px; line-height: 17px; vertical-align: top;'>";
|
||||
echo "<h3>".$lang_label["status"]."</h3>";
|
||||
echo "<img src='images/dot_green.png'> - ".$lang_label["validated_event"];
|
||||
echo "<br>";
|
||||
echo "<img src='images/dot_red.png'> - ".$lang_label["not_validated_event"];
|
||||
echo "</td>";
|
||||
echo "<td rowspan='4' class='f9' style='padding-left: 30px; line-height: 17px; vertical-align: top;'>";
|
||||
echo "<h3>".$lang_label["action"]."</h3>";
|
||||
echo "<img src='images/ok.png'> - ".$lang_label["validate_event"];
|
||||
echo "<br>";
|
||||
echo "<img src='images/cross.png'> - ".$lang_label["delete_event"];
|
||||
echo "<br>";
|
||||
echo "<img src='images/page_lightning.png'> - ".$lang_label["create_incident"];
|
||||
echo "</td></tr></table>";
|
||||
} // no events to show
|
||||
?>
|
||||
|
|
|
@ -60,17 +60,17 @@ $resultado3=mysql_query($sql3);
|
|||
|
||||
if (isset($_GET["nuevo_mensaje"])){
|
||||
// Create message
|
||||
$usuario_destino = give_parameter_post ("u_destino");
|
||||
$subject = give_parameter_post ("subject");
|
||||
$mensaje = give_parameter_post ("mensaje");
|
||||
$usuario_destino = get_parameter ("u_destino");
|
||||
$subject = get_parameter ("subject");
|
||||
$mensaje = get_parameter ("mensaje");
|
||||
create_message($iduser, $usuario_destino, $subject, $mensaje);
|
||||
}
|
||||
|
||||
if (isset($_GET["nuevo_mensaje_g"])){
|
||||
// Create message to groups
|
||||
$grupo_destino = give_parameter_post ("g_destino");
|
||||
$subject = give_parameter_post ("subject");
|
||||
$mensaje = give_parameter_post ("mensaje");
|
||||
$grupo_destino = get_parameter ("g_destino");
|
||||
$subject = get_parameter ("subject");
|
||||
$mensaje = get_parameter ("mensaje");
|
||||
$sql= 'SELECT id_usuario FROM tusuario_perfil WHERE id_grupo ='. $grupo_destino;
|
||||
$result = mysql_query($sql);
|
||||
|
||||
|
@ -284,4 +284,4 @@ if (isset($_GET["nuevo"]) || isset($_GET["nuevo_g"])){
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -29,48 +29,38 @@ if (comprueba_login() != 0) {
|
|||
|
||||
//echo "SLA for Tato: %".return_module_SLA (50, 604800, 1, 1);
|
||||
|
||||
echo "<h2>".$lang_label["reporting"]." > ";
|
||||
echo $lang_label["custom_reporting"]."</h2>";
|
||||
echo "<h2>".lang_string ('reporting')." > ";
|
||||
echo lang_string ('custom_reporting')."</h2>";
|
||||
|
||||
$color=1;
|
||||
$sql="SELECT * FROM treport";
|
||||
$res=mysql_query($sql);
|
||||
if (mysql_num_rows($res)) {
|
||||
echo "<table width='580' cellpadding=4 cellpadding=4 class='databox'>";
|
||||
echo "<tr>
|
||||
<th>".$lang_label["report_name"]."</th>
|
||||
<th>".$lang_label["description"]."</th>
|
||||
<th>HTML</th>
|
||||
<th>PDF</th>
|
||||
</tr>";
|
||||
$reports = get_reports ($config['id_user']);
|
||||
|
||||
while ($row = mysql_fetch_array($res)){
|
||||
if (($row["private"]==0) || ($row["id_user"] == $id_user)){
|
||||
// Calculate table line color
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr>";
|
||||
echo "<td valign='top' class='$tdcolor'>".$row["name"]."</td>";
|
||||
echo "<td class='$tdcolor'>".$row["description"]."</td>";
|
||||
$id_report = $row["id_report"];
|
||||
echo "<td valign='middle' class='$tdcolor' align='center'>
|
||||
<a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report'>
|
||||
<img src='images/reporting.png'></a>
|
||||
</td>";
|
||||
|
||||
echo "<td valign='middle' class='$tdcolor' align='center'><a target='_new' href='operation/reporting/reporting_viewer_pdf.php?id=$id_report&rtype=general'><img src='images/pdf.png'></a></td>'";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
} else {
|
||||
if (sizeof ($reports) == 0) {
|
||||
echo "<div class='nf'>".$lang_label["no_reporting_def"]."</div>";
|
||||
return;
|
||||
}
|
||||
|
||||
$table->width = '580px';
|
||||
$table->head = array ();
|
||||
$table->head[0] = lang_string ('report_name');
|
||||
$table->head[1] = lang_string ('description');
|
||||
$table->head[2] = lang_string ('HTML');
|
||||
$table->head[3] = lang_string ('PDF');
|
||||
$table->align = array ();
|
||||
$table->align[2] = 'center';
|
||||
$table->align[3] = 'center';
|
||||
$table->data = array ();
|
||||
|
||||
foreach ($reports as $report) {
|
||||
$data = array ();
|
||||
|
||||
$data[0] = $report['name'];
|
||||
$data[1] = $report['description'];
|
||||
$data[2] = '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'">
|
||||
<img src="images/reporting.png"></a>';
|
||||
$data[3] = '<a href="operation/reporting/reporting_viewer_pdf.php?id='.$report['id_report'].'&rtype=general"
|
||||
target="_new"><img src="images/pdf.png"></a>';
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
print_table ($table);
|
||||
?>
|
||||
|
|
|
@ -184,7 +184,8 @@ foreach ($contents as $content) {
|
|||
$n = array_push ($table->data, $data);
|
||||
$table->rowclass[$n - 1] = 'datos3';
|
||||
|
||||
$slas = get_db_all_rows_field_filter ('treport_content_sla_combined', 'id_report_content', $content['id_rc']);
|
||||
$slas = get_db_all_rows_field_filter ('treport_content_sla_combined',
|
||||
'id_report_content', $content['id_rc']);
|
||||
if (sizeof ($slas) == 0) {
|
||||
$data = array ();
|
||||
$table->colspan[$n][0] = 3;
|
||||
|
@ -193,21 +194,28 @@ foreach ($contents as $content) {
|
|||
}
|
||||
foreach ($slas as $sla) {
|
||||
$data = array ();
|
||||
$sla_result = format_numeric (return_module_SLA ($sla['id_agent_module'], $content['period'],
|
||||
$sla['sla_min'], $sla['sla_max'], $datetime));
|
||||
$table->colspan[$n][0] = 2;
|
||||
$table->data[0] = '<span style="font-size: 0.6em">';
|
||||
$table->data[0] .= lang_string ('sla_max')." : ".$sla['sla_max']."<br>";
|
||||
$table->data[0] .= lang_string ('sla_min')." : ".$sla['sla_min']."<br>";
|
||||
$table->data[0] .= lang_string ('sla_limit')." : ".$sla['sla_limit']."<br>";
|
||||
$table->data[0] .= "</span>";
|
||||
|
||||
if ($sla_result >= $sla['sla_limit'])
|
||||
$table->data[1] = "<span style='font: bold 3em Arial, Sans-serif; color: #000000;'>";
|
||||
else
|
||||
$table->data[1] = "<span style='font: bold 3em Arial, Sans-serif; color: #ff0000;'>";
|
||||
$table->data[1] .= $sla_result. " %";
|
||||
$table->data[1] .= "</span>";
|
||||
$table->colspan[$n][0] = 2;
|
||||
$data[0] = '<span style="font-size: 0.6em">';
|
||||
$data[0] .= lang_string ('sla_max')." : ".$sla['sla_max']."<br>";
|
||||
$data[0] .= lang_string ('sla_min')." : ".$sla['sla_min']."<br>";
|
||||
$data[0] .= lang_string ('sla_limit')." : ".$sla['sla_limit']."<br>";
|
||||
$data[0] .= "</span>";
|
||||
|
||||
$sla_value = return_module_SLA ($sla['id_agent_module'], $content['period'],
|
||||
$sla['sla_min'], $sla['sla_max'], $datetime);
|
||||
if ($sla_value === false) {
|
||||
$data[1] = '<span style="font: bold 3em Arial, Sans-serif; color: #0000FF;">';
|
||||
$data[1] .= lang_string ('unknown');
|
||||
} else {
|
||||
if ($sla_value >= $sla['sla_limit'])
|
||||
$data[1] = '<span style="font: bold 3em Arial, Sans-serif; color: #000000;">';
|
||||
else
|
||||
$data[1] = '<span style="font: bold 3em Arial, Sans-serif; color: #ff0000;">';
|
||||
$data[1] .= format_numeric ($sla_value). " %";
|
||||
}
|
||||
$data[1] .= "</span>";
|
||||
|
||||
$n = array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ if ((give_acl($id_user,0,"AR") != 1 ) AND (dame_admin($id_user)!=1)) {
|
|||
}
|
||||
|
||||
|
||||
$id_report = give_parameter_get ( 'id', $default = "");
|
||||
$id_report = get_parameter ('id');
|
||||
if ($id_report == ""){
|
||||
audit_db($id_user,$REMOTE_ADDR, "HACK Attempt","Trying to access graph viewer withoud ID");
|
||||
include ("general/noaccess.php");
|
||||
|
|
|
@ -20,86 +20,261 @@
|
|||
// Load global vars
|
||||
require("include/config.php");
|
||||
|
||||
if (give_acl($id_user, 0, "LW")==1) {
|
||||
// Variable init
|
||||
$view_alert=1;
|
||||
$alert_add = 0;
|
||||
$alert_update=0;
|
||||
$alert_submit=0;
|
||||
if (! give_acl($id_user, 0, "LW")) {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access SNMP Alert Management");
|
||||
require ("general/noaccess.php");
|
||||
}
|
||||
// Variable init
|
||||
$view_alert=1;
|
||||
$alert_add = 0;
|
||||
$alert_update=0;
|
||||
$alert_submit=0;
|
||||
|
||||
$id_as = "";
|
||||
$id_alert = "";
|
||||
$nombre_alerta = "";
|
||||
$alert_type = "";
|
||||
$agent = "";
|
||||
$description = "";
|
||||
$oid = "";
|
||||
$custom_oid = "";
|
||||
$time_threshold = "";
|
||||
$al_field1 = "";
|
||||
$al_field2 = "";
|
||||
$al_field3 = "";
|
||||
$last_fired = "";
|
||||
$max_alerts = "";
|
||||
$min_alerts = "";
|
||||
$priority = "";
|
||||
$id_as = "";
|
||||
$id_alert = "";
|
||||
$nombre_alerta = "";
|
||||
$alert_type = "";
|
||||
$agent = "";
|
||||
$description = "";
|
||||
$oid = "";
|
||||
$custom_oid = "";
|
||||
$time_threshold = "";
|
||||
$al_field1 = "";
|
||||
$al_field2 = "";
|
||||
$al_field3 = "";
|
||||
$last_fired = "";
|
||||
$max_alerts = "";
|
||||
$min_alerts = "";
|
||||
$priority = "";
|
||||
|
||||
// Alert Delete
|
||||
// =============
|
||||
if (isset($_GET["delete_alert"])){ // Delete alert
|
||||
$alert_delete = $_GET["delete_alert"];
|
||||
$sql1='DELETE FROM talert_snmp WHERE id_as = '.$alert_delete;
|
||||
$result=mysql_query($sql1);
|
||||
// Alert Delete
|
||||
// =============
|
||||
if (isset($_GET["delete_alert"])){ // Delete alert
|
||||
$alert_delete = $_GET["delete_alert"];
|
||||
$sql1='DELETE FROM talert_snmp WHERE id_as = '.$alert_delete;
|
||||
$result=mysql_query($sql1);
|
||||
if (!$result)
|
||||
echo "<h3 class='error'>".$lang_label["delete_alert_no"]."</h3>";
|
||||
else
|
||||
echo "<h3 class='suc'>".$lang_label["delete_alert_ok"]."</h3>";
|
||||
}
|
||||
// Alert submit (for insert or update)
|
||||
if (isset($_GET["submit"])){
|
||||
$alert_submit=1;
|
||||
$create = entrada_limpia($_POST["create"]);
|
||||
$update = entrada_limpia($_POST["update"]);
|
||||
$id_as = entrada_limpia($_POST["id_as"]);
|
||||
$max = entrada_limpia($_POST["max"]);
|
||||
$min = entrada_limpia($_POST["min"]);
|
||||
$time = entrada_limpia($_POST["time"]);
|
||||
$description = entrada_limpia($_POST["description"]);
|
||||
$oid = entrada_limpia($_POST["oid"]);
|
||||
$agent = entrada_limpia($_POST["agent"]);
|
||||
$custom = entrada_limpia($_POST["custom"]);
|
||||
$alert_id = entrada_limpia($_POST["alert_id"]);
|
||||
$alert_type = entrada_limpia($_POST["alert_type"]);
|
||||
$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, 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["delete_alert_no"]."</h3>";
|
||||
echo "<h3 class='error'>".$lang_label["create_alert_no"]."</h3>";
|
||||
else
|
||||
echo "<h3 class='suc'>".$lang_label["delete_alert_ok"]."</h3>";
|
||||
echo "<h3 class='suc'>".$lang_label["create_alert_ok"]."</h3>";
|
||||
} else {
|
||||
$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>";
|
||||
else
|
||||
echo "<h3 class='suc'>".$lang_label["create_alert_ok"]."</h3>";
|
||||
}
|
||||
// Alert submit (for insert or update)
|
||||
if (isset($_GET["submit"])){
|
||||
$alert_submit=1;
|
||||
$create = entrada_limpia($_POST["create"]);
|
||||
$update = entrada_limpia($_POST["update"]);
|
||||
$id_as = entrada_limpia($_POST["id_as"]);
|
||||
$max = entrada_limpia($_POST["max"]);
|
||||
$min = entrada_limpia($_POST["min"]);
|
||||
$time = entrada_limpia($_POST["time"]);
|
||||
$description = entrada_limpia($_POST["description"]);
|
||||
$oid = entrada_limpia($_POST["oid"]);
|
||||
$agent = entrada_limpia($_POST["agent"]);
|
||||
$custom = entrada_limpia($_POST["custom"]);
|
||||
$alert_id = entrada_limpia($_POST["alert_id"]);
|
||||
$alert_type = entrada_limpia($_POST["alert_type"]);
|
||||
$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, 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 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>";
|
||||
else
|
||||
echo "<h3 class='suc'>".$lang_label["create_alert_ok"]."</h3>";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// Alert update: (first, load data used in form), later use insert/add form
|
||||
// ============
|
||||
if (isset($_GET["update_alert"])){
|
||||
$alert_update = $_GET["update_alert"];
|
||||
$sql1='SELECT * FROM talert_snmp WHERE id_as = '.$alert_update;
|
||||
$result=mysql_query($sql1);
|
||||
if ($row=mysql_fetch_array($result)){
|
||||
$id_as = $row["id_as"];
|
||||
$id_alert = $row["id_alert"];
|
||||
$nombre_alerta = dame_nombre_alerta($id_alert);
|
||||
$alert_type = $row["alert_type"];
|
||||
$agent = $row["agent"];
|
||||
$description = $row["description"];
|
||||
$oid = $row["oid"];
|
||||
$custom_oid = $row["custom_oid"];
|
||||
$time_threshold = $row["time_threshold"];
|
||||
$al_field1 = $row["al_field1"];
|
||||
$al_field2 = $row["al_field2"];
|
||||
$al_field3 = $row["al_field3"];
|
||||
$last_fired = $row["last_fired"];
|
||||
$max_alerts = $row["max_alerts"];
|
||||
$min_alerts = $row["min_alerts"];
|
||||
$priority = $row["priority"];
|
||||
}
|
||||
// Alert update: (first, load data used in form), later use insert/add form
|
||||
// ============
|
||||
if (isset($_GET["update_alert"])){
|
||||
$alert_update = $_GET["update_alert"];
|
||||
$sql1='SELECT * FROM talert_snmp WHERE id_as = '.$alert_update;
|
||||
$result=mysql_query($sql1);
|
||||
if ($row=mysql_fetch_array($result)){
|
||||
}
|
||||
if (isset($_POST["add_alert"])){
|
||||
$alert_add = 1;
|
||||
}
|
||||
echo "<h2>Pandora SNMP > ";
|
||||
// Add alert form
|
||||
if (($alert_update != 0) || ($alert_add == 1)) {
|
||||
|
||||
if ($alert_update != 0) {
|
||||
echo $lang_label["update_alert"]."</h2>";
|
||||
} else {
|
||||
echo $lang_label["create_alert"]."</h2>";
|
||||
}
|
||||
echo '<form name="agente" method="post" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert&submit=1">';
|
||||
echo '<input type="hidden" name="id_as" value="'.$id_as.'">'; // if known, if add will be undetermined (0).
|
||||
echo '<table cellpadding="4" cellspacing="4" width="650" class="databox_color">';
|
||||
// Alert
|
||||
echo '<tr><td class=datos>'.$lang_label["alert"].'<td class=datos><select name="alert_id">';
|
||||
if ($alert_update != 0) { // calculate first item
|
||||
$sql0='SELECT * FROM talerta WHERE id_alerta = '.$id_alert;
|
||||
$result0=mysql_query($sql0);
|
||||
$row0=mysql_fetch_array($result0);
|
||||
echo "<option value='".$row0["id_alerta"]."'>".$row0["nombre"]."</option>";
|
||||
}
|
||||
$sql1='SELECT * FROM talerta';
|
||||
$result1=mysql_query($sql1);
|
||||
while ($row1=mysql_fetch_array($result1)){
|
||||
echo "<option value='".$row1["id_alerta"]."'>".$row1["nombre"]."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
// Alert type
|
||||
echo '<tr><td class="datos2">'.$lang_label["alert_type"];
|
||||
echo '<td class="datos2"><select name="alert_type">';
|
||||
if ($alert_type == 0) {
|
||||
echo '
|
||||
<option value=0>OID</option>
|
||||
<option value=1>CustomOID/Value</option>
|
||||
<option value=2>SNMPAgent</option>';
|
||||
|
||||
} elseif ($alert_type == 1) {
|
||||
echo '
|
||||
<option value=1>CustomOID/Value</option>
|
||||
<option value=0>OID</option>
|
||||
<option value=2>SNMPAgent</option>';
|
||||
} else {
|
||||
echo '
|
||||
<option value=2>SNMPAgent</option>
|
||||
<option value=0>OID</option>
|
||||
<option value=1>CustomOID/Value</option>';
|
||||
}
|
||||
echo '</select></td></tr>';
|
||||
// Description
|
||||
echo '<tr><td class=datos>'.$lang_label["description"].'</td>';
|
||||
echo '<td class=datos><input type="text" size=60 name="description" value="'.$description.'">';
|
||||
|
||||
// OID
|
||||
echo '<tr><td class="datos2">'.$lang_label["OID"].'</td>';
|
||||
echo '<td class="datos2"><input type="text" size=30 name="oid" value="'.$oid.'">';
|
||||
|
||||
// OID Custom
|
||||
echo '<tr><td class=datos>'.$lang_label["customvalue"].'</td>';
|
||||
echo '<td class=datos><input type="text" size=30 name="custom" value="'.$custom_oid.'">';
|
||||
|
||||
// SNMP Agent
|
||||
echo '<tr><td class="datos2">'.$lang_label["SNMP_agent"].' IP</td>';
|
||||
echo '<td class="datos2"><input type="text" size=30 name="agent" value="'.$agent.'">';
|
||||
|
||||
// Alert fields
|
||||
echo '<tr><td class=datos>'.$lang_label["field1"].'</td>';
|
||||
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 valign="top">'.$lang_label["field3"];
|
||||
echo '<td class=datos><textarea rows=4 style="width:400px" name="field3">'.$al_field3.'</textarea>';
|
||||
|
||||
// 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">';
|
||||
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">';
|
||||
// Update or Add button
|
||||
if ($alert_update != 0) {
|
||||
echo '<input name="uptbutton" type="submit" class="sub upd" value="'.$lang_label["update"].'">';
|
||||
echo "<input type='hidden' name='update' value='1'>";
|
||||
echo "<input type='hidden' name='create' value='0'>";
|
||||
} else {
|
||||
echo '<input name="createbutton" type="submit" class="sub next" value="'.$lang_label["create"].'">';
|
||||
echo "<input type='hidden' name='update' value='0'>";
|
||||
echo "<input type='hidden' name='create' value='1'>";
|
||||
}
|
||||
// Endtable
|
||||
echo "</td></tr></table>";
|
||||
$view_alert =0; // Do not show alert list
|
||||
}
|
||||
|
||||
if ($view_alert == 1) { // View alerts defined on SNMP traps
|
||||
|
||||
$sql1='SELECT * FROM talert_snmp';
|
||||
$result=mysql_query($sql1);
|
||||
|
||||
echo $lang_label["snmp_assigned_alerts"]."</h2>";
|
||||
if (mysql_num_rows($result)){
|
||||
|
||||
echo '<table cellpadding="4" cellspacing="4" width="750" class="databox">';
|
||||
echo '<tr><th>'.$lang_label["alert"]."</th>";
|
||||
echo '<th width=75>'.$lang_label["alert_type"]."</th>";
|
||||
echo '<th>'.$lang_label["SNMP_agent"]."</th>";
|
||||
echo '<th>'.$lang_label["OID"]."</th>";
|
||||
echo '<th>'.$lang_label["customvalue"]."</th>";
|
||||
echo '<th>'.$lang_label["description"]."</th>";
|
||||
echo '<th>'.$lang_label["times_fired"]."</th>";
|
||||
echo '<th>'.$lang_label["last_fired"]."</th>";
|
||||
echo '<th width="50">'.$lang_label["action"]."</th>";
|
||||
$color=1;
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
$id_as = $row["id_as"];
|
||||
$id_alert = $row["id_alert"];
|
||||
$nombre_alerta = dame_nombre_alerta($id_alert);
|
||||
|
@ -113,253 +288,75 @@ if (give_acl($id_user, 0, "LW")==1) {
|
|||
$al_field2 = $row["al_field2"];
|
||||
$al_field3 = $row["al_field3"];
|
||||
$last_fired = $row["last_fired"];
|
||||
$times_fired = $row["times_fired"];
|
||||
$max_alerts = $row["max_alerts"];
|
||||
$min_alerts = $row["min_alerts"];
|
||||
$priority = $row["priority"];
|
||||
}
|
||||
}
|
||||
if (isset($_POST["add_alert"])){
|
||||
$alert_add = 1;
|
||||
}
|
||||
echo "<h2>Pandora SNMP > ";
|
||||
// Add alert form
|
||||
if (($alert_update != 0) || ($alert_add == 1)) {
|
||||
|
||||
if ($alert_update != 0) {
|
||||
echo $lang_label["update_alert"]."</h2>";
|
||||
} else {
|
||||
echo $lang_label["create_alert"]."</h2>";
|
||||
}
|
||||
echo '<form name="agente" method="post" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert&submit=1">';
|
||||
echo '<input type="hidden" name="id_as" value="'.$id_as.'">'; // if known, if add will be undetermined (0).
|
||||
echo '<table cellpadding="4" cellspacing="4" width="650" class="databox_color">';
|
||||
// Alert
|
||||
echo '<tr><td class=datos>'.$lang_label["alert"].'<td class=datos><select name="alert_id">';
|
||||
if ($alert_update != 0) { // calculate first item
|
||||
$sql0='SELECT * FROM talerta WHERE id_alerta = '.$id_alert;
|
||||
$result0=mysql_query($sql0);
|
||||
$row0=mysql_fetch_array($result0);
|
||||
echo "<option value='".$row0["id_alerta"]."'>".$row0["nombre"]."</option>";
|
||||
}
|
||||
$sql1='SELECT * FROM talerta';
|
||||
$result1=mysql_query($sql1);
|
||||
while ($row1=mysql_fetch_array($result1)){
|
||||
echo "<option value='".$row1["id_alerta"]."'>".$row1["nombre"]."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
// Alert type
|
||||
echo '<tr><td class="datos2">'.$lang_label["alert_type"];
|
||||
echo '<td class="datos2"><select name="alert_type">';
|
||||
if ($alert_type == 0) {
|
||||
echo '
|
||||
<option value=0>OID</option>
|
||||
<option value=1>CustomOID/Value</option>
|
||||
<option value=2>SNMPAgent</option>';
|
||||
|
||||
} elseif ($alert_type == 1) {
|
||||
echo '
|
||||
<option value=1>CustomOID/Value</option>
|
||||
<option value=0>OID</option>
|
||||
<option value=2>SNMPAgent</option>';
|
||||
} else {
|
||||
echo '
|
||||
<option value=2>SNMPAgent</option>
|
||||
<option value=0>OID</option>
|
||||
<option value=1>CustomOID/Value</option>';
|
||||
}
|
||||
echo '</select></td></tr>';
|
||||
// Description
|
||||
echo '<tr><td class=datos>'.$lang_label["description"].'</td>';
|
||||
echo '<td class=datos><input type="text" size=60 name="description" value="'.$description.'">';
|
||||
|
||||
// OID
|
||||
echo '<tr><td class="datos2">'.$lang_label["OID"].'</td>';
|
||||
echo '<td class="datos2"><input type="text" size=30 name="oid" value="'.$oid.'">';
|
||||
|
||||
// OID Custom
|
||||
echo '<tr><td class=datos>'.$lang_label["customvalue"].'</td>';
|
||||
echo '<td class=datos><input type="text" size=30 name="custom" value="'.$custom_oid.'">';
|
||||
|
||||
// SNMP Agent
|
||||
echo '<tr><td class="datos2">'.$lang_label["SNMP_agent"].' IP</td>';
|
||||
echo '<td class="datos2"><input type="text" size=30 name="agent" value="'.$agent.'">';
|
||||
|
||||
// Alert fields
|
||||
echo '<tr><td class=datos>'.$lang_label["field1"].'</td>';
|
||||
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 valign="top">'.$lang_label["field3"];
|
||||
echo '<td class=datos><textarea rows=4 style="width:400px" name="field3">'.$al_field3.'</textarea>';
|
||||
|
||||
// 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">';
|
||||
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">';
|
||||
// Update or Add button
|
||||
if ($alert_update != 0) {
|
||||
echo '<input name="uptbutton" type="submit" class="sub upd" value="'.$lang_label["update"].'">';
|
||||
echo "<input type='hidden' name='update' value='1'>";
|
||||
echo "<input type='hidden' name='create' value='0'>";
|
||||
} else {
|
||||
echo '<input name="createbutton" type="submit" class="sub next" value="'.$lang_label["create"].'">';
|
||||
echo "<input type='hidden' name='update' value='0'>";
|
||||
echo "<input type='hidden' name='create' value='1'>";
|
||||
}
|
||||
// Endtable
|
||||
echo "</td></tr></table>";
|
||||
$view_alert =0; // Do not show alert list
|
||||
}
|
||||
|
||||
if ($view_alert == 1) { // View alerts defined on SNMP traps
|
||||
|
||||
$sql1='SELECT * FROM talert_snmp';
|
||||
$result=mysql_query($sql1);
|
||||
|
||||
echo $lang_label["snmp_assigned_alerts"]."</h2>";
|
||||
if (mysql_num_rows($result)){
|
||||
|
||||
echo '<table cellpadding="4" cellspacing="4" width="750" class="databox">';
|
||||
echo '<tr><th>'.$lang_label["alert"]."</th>";
|
||||
echo '<th width=75>'.$lang_label["alert_type"]."</th>";
|
||||
echo '<th>'.$lang_label["SNMP_agent"]."</th>";
|
||||
echo '<th>'.$lang_label["OID"]."</th>";
|
||||
echo '<th>'.$lang_label["customvalue"]."</th>";
|
||||
echo '<th>'.$lang_label["description"]."</th>";
|
||||
echo '<th>'.$lang_label["times_fired"]."</th>";
|
||||
echo '<th>'.$lang_label["last_fired"]."</th>";
|
||||
echo '<th width="50">'.$lang_label["action"]."</th>";
|
||||
$color=1;
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
$id_as = $row["id_as"];
|
||||
$id_alert = $row["id_alert"];
|
||||
$nombre_alerta = dame_nombre_alerta($id_alert);
|
||||
$alert_type = $row["alert_type"];
|
||||
$agent = $row["agent"];
|
||||
$description = $row["description"];
|
||||
$oid = $row["oid"];
|
||||
$custom_oid = $row["custom_oid"];
|
||||
$time_threshold = $row["time_threshold"];
|
||||
$al_field1 = $row["al_field1"];
|
||||
$al_field2 = $row["al_field2"];
|
||||
$al_field3 = $row["al_field3"];
|
||||
$last_fired = $row["last_fired"];
|
||||
$times_fired = $row["times_fired"];
|
||||
$max_alerts = $row["max_alerts"];
|
||||
$min_alerts = $row["min_alerts"];
|
||||
|
||||
echo "<tr><td class='$tdcolor'>";
|
||||
echo $nombre_alerta;
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($alert_type == 0) {
|
||||
$tipo_alerta = $lang_label["OID"];
|
||||
} elseif ($alert_type == 1) {
|
||||
$tipo_alerta = $lang_label["customvalue"];
|
||||
} elseif ($alert_type == 2) {
|
||||
$tipo_alerta = $lang_label["SNMP_agent"];
|
||||
} else {
|
||||
$tipo_alerta = "N/A";
|
||||
}
|
||||
echo $tipo_alerta;
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($alert_type == 2) {
|
||||
echo $agent;
|
||||
} else {
|
||||
echo "N/A";
|
||||
}
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($alert_type == 0) {
|
||||
echo $oid;
|
||||
} else {
|
||||
echo "N/A";
|
||||
}
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($alert_type == 1) {
|
||||
echo $custom_oid;
|
||||
} else {
|
||||
echo "N/A";
|
||||
}
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo $description;
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo $times_fired;
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($last_fired != "0000-00-00 00:00:00")
|
||||
echo $last_fired;
|
||||
else
|
||||
echo $lang_label["never"];
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo "<a href='index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert&delete_alert=".$id_as."'>
|
||||
<img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></b></a> ";
|
||||
echo "<a href='index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert&update_alert=".$id_as."'>
|
||||
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></b></a></td></tr>";
|
||||
|
||||
echo "<tr><td class='$tdcolor'>";
|
||||
echo $nombre_alerta;
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($alert_type == 0) {
|
||||
$tipo_alerta = $lang_label["OID"];
|
||||
} elseif ($alert_type == 1) {
|
||||
$tipo_alerta = $lang_label["customvalue"];
|
||||
} elseif ($alert_type == 2) {
|
||||
$tipo_alerta = $lang_label["SNMP_agent"];
|
||||
} else {
|
||||
$tipo_alerta = "N/A";
|
||||
}
|
||||
echo $tipo_alerta;
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($alert_type == 2) {
|
||||
echo $agent;
|
||||
} else {
|
||||
echo "N/A";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<table width='750px'>";
|
||||
echo "<tr><td align='right'>";
|
||||
echo '<form name="agente" method="post" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert">';
|
||||
echo '<input name="add_alert" type="submit" class="sub next" value="'.$lang_label["create"].'">';
|
||||
echo "</form>";
|
||||
echo "</td></tr></table>";
|
||||
} else {
|
||||
echo "<div class='nf'>".$lang_label["no_snmp_alert"]."</div>";
|
||||
echo "<br>";
|
||||
echo '<form name="agente" method="post" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert">';
|
||||
echo '<input name="add_alert" type="submit" class="sub next" value="'.$lang_label["create"].'">';
|
||||
echo "</form>";
|
||||
} // End of view snmp alert
|
||||
}
|
||||
} else {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access SNMP Alert Management");
|
||||
require ("general/noaccess.php");
|
||||
}
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($alert_type == 0) {
|
||||
echo $oid;
|
||||
} else {
|
||||
echo "N/A";
|
||||
}
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($alert_type == 1) {
|
||||
echo $custom_oid;
|
||||
} else {
|
||||
echo "N/A";
|
||||
}
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo $description;
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo $times_fired;
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($last_fired != "0000-00-00 00:00:00")
|
||||
echo $last_fired;
|
||||
else
|
||||
echo $lang_label["never"];
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo "<a href='index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert&delete_alert=".$id_as."'>
|
||||
<img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></b></a> ";
|
||||
echo "<a href='index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert&update_alert=".$id_as."'>
|
||||
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></b></a></td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<table width='750px'>";
|
||||
echo "<tr><td align='right'>";
|
||||
echo '<form name="agente" method="post" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert">';
|
||||
echo '<input name="add_alert" type="submit" class="sub next" value="'.$lang_label["create"].'">';
|
||||
echo "</form>";
|
||||
echo "</td></tr></table>";
|
||||
} else {
|
||||
echo "<div class='nf'>".$lang_label["no_snmp_alert"]."</div>";
|
||||
echo "<br>";
|
||||
echo '<form name="agente" method="post" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_alert">';
|
||||
echo '<input name="add_alert" type="submit" class="sub next" value="'.$lang_label["create"].'">';
|
||||
echo "</form>";
|
||||
} // End of view snmp alert
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
</table>
|
||||
</table>
|
||||
|
|
|
@ -61,7 +61,7 @@ if (comprueba_login() == 0) {
|
|||
//echo "<br>DEBUG for ".$nombre;
|
||||
//echo "<br>Comments:".$comentarios;
|
||||
$comentarios = entrada_limpia($_POST["comentarios"]);
|
||||
if (dame_password($nombre)!=$pass1){
|
||||
if (get_user_password($nombre)!=$pass1){
|
||||
// Only when change password
|
||||
$pass1=md5($pass1);
|
||||
$sql = "UPDATE tusuario SET nombre_real = '".$nombre_real."', password = '".$pass1."', telefono ='".$telefono."', direccion ='".$direccion." ', comentarios = '".$comentarios."' WHERE id_usuario = '".$nombre."'";
|
||||
|
@ -165,4 +165,4 @@ if (comprueba_login() == 0) {
|
|||
echo '</table>';
|
||||
} // fin pagina
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -1363,7 +1363,6 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$max_items = 6;
|
||||
// Take only the first x items
|
||||
if (sizeof($data) >= $max_items) {
|
||||
|
|
Loading…
Reference in New Issue