2008-04-03 Sancho Lerena <slerena@gmail.com>

* pandoradb_data.sql: IA to prediction in description.

    * pandoradb.sql: Added priority to alert and custom recovery fields.

    * include/styles/tip.css, include/styles/pandora.css: New styles
    for tooltip info (combined and alerts) and some changes in frames for
    agent management / view.

    * include/functions_db.php: Added check_server_status() function to check
    from console server status. If in 15 minutes there is no updated keepalive
    from any server, they will be marked as down. And function return down. 
    This function is now called on each page. Added funtions to display alert
    status in a tooltip.

    * include/languages/language_en.php: More strings.

    * include/functions.php: Added several funtions to simplify alert report.

    * operation/agentes/estado_alertas.php: Updated. Shows also combined 
    alerts and give a lot of information in different tooltips.

    * operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL.

    * operation/agentes/estado_monitores.php: now is possible to force a
    module refresh from main view.

    * operation/agentes/ver_agente.php: Tab has been upgraded.

    * images/mod_data.png,
      images/mod_data_inc.png
      images/mod_proc.png
      images/mod_keepalive.png
      images/mod_string.png: Added new type icons and updated old ones.

    * general/header.php: Global check for servers and autorefresh control.

    * godmode/agentes/alert_manager.php: New alert management for combined
    alerts, visualization, etc.

    * godmode/agentes/configurar_agente.php: Included new alert management.

    * godmode/agentes/alert_manager_editor.php: New alert management editor.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@791 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-04-03 15:43:34 +00:00
parent b5408583c7
commit bfe9e0db18
22 changed files with 1303 additions and 514 deletions

View File

@ -1,3 +1,48 @@
2008-04-03 Sancho Lerena <slerena@gmail.com>
* pandoradb_data.sql: IA to prediction in description.
* pandoradb.sql: Added priority to alert and custom recovery fields.
* include/styles/tip.css, include/styles/pandora.css: New styles
for tooltip info (combined and alerts) and some changes in frames for
agent management / view.
* include/functions_db.php: Added check_server_status() function to check
from console server status. If in 15 minutes there is no updated keepalive
from any server, they will be marked as down. And function return down.
This function is now called on each page. Added funtions to display alert
status in a tooltip.
* include/languages/language_en.php: More strings.
* include/functions.php: Added several funtions to simplify alert report.
* operation/agentes/estado_alertas.php: Updated. Shows also combined
alerts and give a lot of information in different tooltips.
* operation/agentes/estado_ultimopaquete.php: Clean blank spaces in URL.
* operation/agentes/estado_monitores.php: now is possible to force a
module refresh from main view.
* operation/agentes/ver_agente.php: Tab has been upgraded.
* images/mod_data.png,
images/mod_data_inc.png
images/mod_proc.png
images/mod_keepalive.png
images/mod_string.png: Added new type icons and updated old ones.
* general/header.php: Global check for servers and autorefresh control.
* godmode/agentes/alert_manager.php: New alert management for combined
alerts, visualization, etc.
* godmode/agentes/configurar_agente.php: Included new alert management.
* godmode/agentes/alert_manager_editor.php: New alert management editor.
2008-04-01 Sancho Lerena <slerena@gmail.com>
* pandoradb_data.sql: Alert type 0 is not 1. 1-3 are reserved. Removed

View File

@ -25,11 +25,12 @@ echo '
';
echo "<div id='head_m'>";
echo "<table width=550 border='0'>
echo "<table width=520 border='0' cellpadding=3>
<tr>";
if (isset ($_SESSION["id_usuario"])){
echo "<td width=40%>";
// Fist column
echo "<td width=30%>";
$id_usuario = entrada_limpia ($_SESSION["id_usuario"]);
if (dame_admin($_SESSION["id_usuario"])==1)
echo "<img src='images/user_suit.png' class='bot'> ";
@ -37,12 +38,36 @@ if (isset ($_SESSION["id_usuario"])){
echo "<img src='images/user_green.png' class='bot'> ";
echo "<a class='white'>".$lang_label["has_connected"]. '
[<b>'. $id_usuario. '</b>]</a>';
echo "<br>";
echo "<a class='white_bold' href='index.php?bye=bye'><img src='images/lock.png' class='bot'> ". $lang_label["logout"]."</a>";
echo "</td><td width='25'> </td><td>";
// Second column
echo "<td>";
echo "<a class='white_bold' href='index.php?sec=main'><img src='images/information.png' class='bot'> ". $lang_label["information"]."</a>";
echo "<br>";
echo "<a class='white_bold' href='help/en/toc.php'><img src='images/help.png' class='bot'> ". $lang_label["help"]."</a>";
// Third column
echo "<td>";
// Autorefresh
if ((isset($_GET["refr"])) OR (isset($_POST["refr"]))) {
echo "<a class='white_grey_bold' href='".$_SERVER['REQUEST_URI']."&refr=0'><img src='images/page_lightning.png' class='bot'> ". lang_string("Autorefresh")."</a>";
} else {
echo "<a class='white_bold' href='".$_SERVER['REQUEST_URI']."&refr=5'><img src='images/page_lightning.png' class='bot'> ". lang_string("Autorefresh")."</a>";
}
echo "<tr><td>";
echo "<a class='white_bold' href='index.php?bye=bye'><img src='images/lock.png' class='bot'> ". $lang_label["logout"]."</a>";
echo "<td>";
$server_status = check_server_status ();
if ($server_status == 0)
echo "<a class='white_bold' href='index.php?sec=estado_server&sec2=operation/servers/view_server&refr=60'><img src='images/error.png' class='bot'> ". lang_string("Server status: DOWN")."</a>";
else
echo "<a class='white_bold' href='index.php?sec=estado_server&sec2=operation/servers/view_server&refr=60'><img src='images/ok.png' class='bot'> ". lang_string("System ready")."</a>";
echo "<td>";
// Event - refresh
echo "<a class='white_bold' href='index.php?sec=eventos&sec2=operation/events/events&refr=5'><img src='images/lightning_go.png' class='bot'> ". lang_string("events")."</a>";
}
echo "</tr></table>";
echo "</div>";

View File

@ -1,20 +1,13 @@
<?php
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP additions
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// Javascript Active Console code.
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -22,7 +15,6 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// ====================================================================================
// VIEW ALERTS
// ====================================================================================
@ -38,9 +30,7 @@ if (give_acl($config["id_user"], 0, "AW")!=1) {
exit;
};
echo "<h2>".$lang_label["agent_conf"]." &gt; ".$lang_label["modules"]."</h2>";
echo "<h2>".$lang_label["agent_conf"]." &gt; ".$lang_label["alerts"]."</h2>";
// ==========================
// Create module/type combo
// ==========================
@ -58,14 +48,15 @@ echo '<input align="right" name="updbutton" type="submit" class="sub wand" value
echo "</form>";
echo "</table>";
echo "<h2>".$lang_label["agent_conf"]." &gt; ".$lang_label["alerts"]."</h2>";
// ==========================
// Simple alerts view
// ==========================
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = "'.$id_agente.'"';
$result=mysql_query($sql1);
if ($row=mysql_num_rows($result)){
echo "<h3>".$lang_label["assigned_alerts"]."</h3>";
echo "<h3>".lang_string ("Simple alerts")."</h3>";
$color=1;
$string='';
@ -94,48 +85,7 @@ $result=mysql_query($sql1);
$nombre_alerta = $row4["nombre"];
$string = $string."<tr style='color: #666;'><td class='$tdcolor'>".$nombre_modulo;
if ($row3["disable"] == 1){
$string .= "<td class='$tdcolor'><b><i>".$lang_label["disabled"]."</b></i>";
} else {
if ($id_tipo > 0) {
$string .= "<td class='$tdcolor'><img src='images/".show_icon_type($id_tipo)."' border=0>";
} else
$string .= "<td class='$tdcolor'><img src='images/".show_icon_type(2)."' border=0>";
}
$string = $string."<td class=$tdcolor>".$nombre_alerta;
$string = $string."<td class='$tdcolor'>".human_time_description($row3["time_threshold"]);
$mytempdata = fmod($row3["dis_min"], 1);
if ($mytempdata == 0)
$mymin = intval($row3["dis_min"]);
else
$mymin = $row3["dis_min"];
$mymin = format_for_graph($mymin );
$mytempdata = fmod($row3["dis_max"], 1);
if ($mytempdata == 0)
$mymax = intval($row3["dis_max"]);
else
$mymax = $row3["dis_max"];
$mymax = format_for_graph($mymax );
// We have alert text ?
if ($row3["alert_text"] != "")
$string = $string."<td colspan=2 class='$tdcolor'>".$lang_label["text"]."</td>";
else {
$string = $string."<td class='$tdcolor'>".$mymin."</td>";
$string = $string."<td class='$tdcolor'>".$mymax."</td>";
}
$time_from_table =$row3["time_from"];
$time_to_table =$row3["time_to"];
$string = $string."<td class='$tdcolor'>";
if ($time_to_table == $time_from_table)
$string .= $lang_label["N/A"];
else
$string .= substr($time_from_table,0,5)." - ".substr($time_to_table,0,5);
$string = $string."</td><td class='$tdcolor'>".salida_limpia($row3["descripcion"]);
$string .= show_alert_row_edit ($row3, $tdcolor, $row["id_tipo_modulo"],0);
$string = $string."</td><td class='$tdcolor'>";
$id_grupo = dame_id_grupo($id_agente);
if (give_acl($id_user, $id_grupo, "LW")==1){
@ -145,7 +95,7 @@ $result=mysql_query($sql1);
<img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> &nbsp; ";
$string = $string."<a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=alert&
id_agente=".$id_agente."&update_alert=".$row3["id_aam"]."#alerts'>
id_agente=".$id_agente."&update_alert=".$row3["id_aam"]."'>
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></a>";
}
$string = $string."</td>";
@ -161,6 +111,7 @@ $result=mysql_query($sql1);
<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 $string;
echo "</table>";
@ -171,22 +122,33 @@ $result=mysql_query($sql1);
echo "<div class='nf'>".$lang_label["no_modules"]."</div>";
}
// Combined alerts
// ==========================
// Combined alerts view
// ==========================
echo "<h3>".lang_string("combined alerts")."</h3>";
$sql1='SELECT * FROM talerta_agente_modulo WHERE id_agent = '.$id_agente;
$result=mysql_query($sql1);
if ($row=mysql_num_rows($result)){
$color=1;
$string='';
$color = 1;
$string = '';
while ($row=mysql_fetch_array($result)){ // All modules of this agent
// Show data for this combined alert
$string = "<tr><td class='datos3'>";
$string .= lang_string("Combined")." #".$row["id_aam"];
$string .= show_alert_row_edit ($row, "datos3", 0, 1);
$string .= '<td class="datos3">'; // action
if (give_acl($id_user, $id_grupo, "LW")==1){
$string .= "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&delete_alert=".$row["id_aam"]."'> <img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> &nbsp; ";
$string .= "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$id_agente."&form_alerttype=combined&update_alert=".$row["id_aam"]."'>
<img src='images/config.png' border=0 alt='".$lang_label["update"]."'></a>";
}
$id_aam = $row["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);
while ($row2=mysql_fetch_array($result2)){ // All modules of this agent
while ($row2=mysql_fetch_array($result2)){
// Show data for each component of this combined alert
if ($color == 1){
$tdcolor="datos";
$color =0;
@ -195,61 +157,18 @@ $result=mysql_query($sql1);
$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"]);
$string = $string."<tr style='color: #666;'><td class='$tdcolor'>".$module["nombre"]."/".$id_agente_name;
$string = $string."<tr style='color: #666;'><td class='$tdcolor'><a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=".$module["id_agente"]."'><b>".$id_agente_name." </b>- ".substr($module["nombre"],0,15)."</A>";
if ($row2["disable"] == 1){
$string .= "<td class='$tdcolor'><b><i>".$lang_label["disabled"]."</b></i>";
} else {
$string .= "<td class='$tdcolor'><img src='images/".show_icon_type($module["id_tipo_modulo"])."' border=0>";
}
$string = $string."<td class=$tdcolor>".$row2["operation"];
$string = $string."<td class='$tdcolor'>".human_time_description($module["time_threshold"]);
$mytempdata = fmod($module["dis_min"], 1);
if ($mytempdata == 0)
$mymin = intval($module["dis_min"]);
else
$mymin = $module["dis_min"];
$mymin = format_for_graph($mymin );
$string .= show_alert_row_edit ($row2, $tdcolor, $module["id_tipo_modulo"],1);
$mytempdata = fmod($module["dis_max"], 1);
if ($mytempdata == 0)
$mymax = intval($module["dis_max"]);
else
$mymax = $module["dis_max"];
$mymax = format_for_graph($mymax );
// We have alert text ?
if ($module["alert_text"] != "")
$string = $string."<td colspan=2 class='$tdcolor'>".$lang_label["text"]."</td>";
else {
$string = $string."<td class='$tdcolor'>".$mymin."</td>";
$string = $string."<td class='$tdcolor'>".$mymax."</td>";
}
$time_from_table =$$module["time_from"];
$time_to_table =$module["time_to"];
$string = $string."<td class='$tdcolor'>";
if ($time_to_table == $time_from_table)
$string .= $lang_label["N/A"];
else
$string .= substr($time_from_table,0,5)." - ".substr($time_to_table,0,5);
$string = $string."</td><td class='$tdcolor'>".salida_limpia ($module["descripcion"]);
$string = $string."</td><td class='$tdcolor'>";
$id_grupo = dame_id_grupo($id_agente);
if (give_acl($id_user, $id_grupo, "LW")==1){
$string = $string."<a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=alert&
id_agente=".$id_agente."&delete_alert=".$row3["id_aam"]."'>
<img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> &nbsp; ";
$string = $string."<a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=alert&
id_agente=".$id_agente."&update_alert=".$row3["id_aam"]."#alerts'>
$string = $string."<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> &nbsp; ";
$string = $string."<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>";
}
$string = $string."</td>";
@ -259,12 +178,13 @@ $result=mysql_query($sql1);
echo "<table cellpadding='4' cellspacing='4' width='750' class='databox'>
<tr><th>".$lang_label["name"]."</th>
<th>".$lang_label["type"]."</th>
<th>".$lang_label["alert"]."</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 $string;
echo "</table>";

View File

@ -1,11 +1,32 @@
<h3><?php echo $lang_label["alert_asociation_form"] ?></h3>
<?PHP
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
$add_component = get_parameter ("add_component",0);
echo "<h3>".$lang_label["alert_asociation_form"]."</h3>";
<?php
// ==================================================================================
// Add alerts
// ==================================================================================
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'>";
else
echo "<input type='hidden' name='combined' value ='0'>";
if (! isset($update_alert))
$update_alert = -1;
@ -15,187 +36,16 @@ if ($update_alert != 1) {
echo '<input type="hidden" name="update_alert" value=1>';
echo '<input type="hidden" name="id_aam" value="'.$alerta_id_aam.'">';
}
?>
<input type="hidden" name="id_agente" value="<?php echo $id_agente ?>">
<a name="alerts"> <!-- Don't Delete !! -->
echo '<input type="hidden" name="id_agente" value="'.$id_agente.'">';
<table width=600 cellpadding="4" cellspacing="4" class="databox_color" border=0>
<tr>
<td class="datos"><?php echo $lang_label["alert_type"]?>
<td class="datos">
<select name="tipo_alerta">
<?php
echo '<table width=600 cellpadding="4" cellspacing="4" class="databox_color" border=0>';
if (isset($tipo_alerta)){
echo "<option value='".$tipo_alerta."'>".dame_nombre_alerta($tipo_alerta)."</option>";
}
if ($form_alerttype == "combined"){
$sql1 = 'SELECT id_alerta, nombre FROM talerta WHERE id_alerta = 0';
} else {
$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 "</select>";
echo "<td class='datos'>";
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"];
} else {
echo "<option value='0'>".$lang_label["enabled"];
echo "<option value='1'>".$lang_label["disabled"];
}
echo "</select>";
// Trigger values for alert
// AgentModule association
echo '<tr><td class="datos3">'.lang_string("assigned_module");
echo '<td class="datos3">';
if ($form_alerttype != "combined"){
echo '<tr><td class="datos2">'.$lang_label["min_value"];
echo "<a href='#' class='tip'>&nbsp;<span>";echo $lang_label["min_valid_value_help"]."</span></a>";
echo '<td class="datos2"><input type="text" name="minimo" size="5" value="'.$alerta_dis_min.'" style="margin-right: 70px;">';
echo "<td class='datos2'>";
echo $lang_label["max_value"];
echo "<a href='#' class='tip'>&nbsp;<span>";
echo $lang_label["max_valid_value_help"];
echo "</span></a>";
echo "<td class='datos2'>";
echo "<input type='text' name='maximo' size='5' value='$alerta_dis_max'>";
// <!-- FREE TEXT ALERT -->
echo '<tr><td class="datos">'.$lang_label["alert_text"]."<a href='#' class='tip'>&nbsp;<span>Regular Expression Supported </span></a>";
echo '<td class="datos" colspan=4><input type="text" name="alert_text" size="60" value ="'.$alert_text.'">';
}
echo '<tr><td class="datos2">'.$lang_label["description"];
echo '<td class="datos2" colspan=4><input type="text" name="descripcion" size="60" value ="'.$alerta_descripcion.'">';
?>
<tr><td class="datos"><?php echo $lang_label["field1"] ?>
<td class="datos" colspan=4><input type="text" name="campo_1" size="39" value="<?php echo $alerta_campo1 ?>">
<a href='#' class='tip'><span>
<b>Macros:</b><br>
_agent_<br>
_timestamp_<br>
_data_<br>
</span></a>
<tr><td class="datos2"><?php echo $lang_label["field2"] ?>
<td class="datos2" colspan=4><input type="text" name="campo_2" size="39" value="<?php echo $alerta_campo2 ?>">
<a href='#' class='tip'><span>
<b>Macros:</b><br>
_agent_<br>
_timestamp_<br>
_data_<br>
</span></a>
<tr><td class="datos"><?php echo $lang_label["field3"] ?>
<td class="datos" colspan=4><textarea name="campo_3" style='height:85px;' cols="36" rows="4"><?php echo $alerta_campo3 ?></textarea>
<a href='#' class='tip'><span>
<b>Macros:</b><br>
_agent_<br>
_timestamp_<br>
_data_<br>
</span></a>
<?PHP
if ($form_alerttype != "combined"){
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);
}
for ($a=0; $a < 48; $a++){
echo "<option value='";
echo render_time ($a);
echo "'>";
echo render_time ($a);
}
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);
}
for ($a=0; $a < 48; $a++){
echo "<option value='";
echo render_time ($a);
echo "'>";
echo render_time ($a);
}
echo "</select>";
?>
<tr><td class="datos"><?php echo $lang_label["time_threshold"] ?>
<a href='#' class='tip'>&nbsp;<span><?PHP echo $lang_label["alert_time_threshold_help"]; ?></span></a>
<td class="datos">
<select name="time_threshold" style="margin-right: 60px;">
<?php
if ($alerta_time_threshold != ""){
echo "<option value='".$alerta_time_threshold."'>".human_time_description($alerta_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>';
echo '<td class="datos">';
echo $lang_label["other"];
echo '<td class="datos">';
echo '<input type="text" name="other" size="5">';
// Max / Min alerts
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;
else
echo 0;
echo '" style="margin-right: 10px;">';
echo '<td class="datos2">';
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;
else
echo 1;
echo '" style="margin-right: 10px;">';
}
if ($form_alerttype != "combined"){
echo '<tr><td class="datos">'.lang_string("assigned_module");
echo '<td class="datos" colspan="4">';
if ($update_alert != 1) {
echo '<select name="agente_modulo"> ';
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)){
@ -211,9 +61,225 @@ if ($form_alerttype != "combined"){
echo "</select>";
} else {
$agentmodule_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $alerta_id_agentemodulo);
echo "DEBUG $alerta_id_agentemodulo";
echo $agentmodule_name;
}
} else {
echo lang_string ("N/A");
}
echo '<td class="datos3">';
echo lang_string ("Priority");
echo '<td class="datos3"><select name="alert_priority">';
if (isset($alert_priority)){
echo "<option value='".$alert_priority."'>".get_alert_priority ($alert_priority)."</option>";
} else {
$alert_priority = 0;
}
for ($i=0; $i<5; $i++){
if ($i != $alert_priority)
echo "<option value='".$i."'>".get_alert_priority ($i)."</option>";
}
// Alert 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>";
}
$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 "</select>";
// Alert disable / enable
echo "<td class='datos'>";
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"];
} else {
echo "<option value='0'>".$lang_label["enabled"];
echo "<option value='1'>".$lang_label["disabled"];
}
echo "</select>";
// Descripcion
echo '<tr><td class="datos2">'.$lang_label["description"];
echo '<td class="datos2" colspan=4><input type="text" name="descripcion" size="60" value ="'.$alerta_descripcion.'">';
// Trigger values for alert
if ($form_alerttype != "combined"){
echo '<tr><td class="datos">'.$lang_label["min_value"];
echo "<a href='#' class='tip'>&nbsp;<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'>&nbsp;<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 -->
echo '<tr><td class="datos2">'.$lang_label["alert_text"]."<a href='#' class='tip'>&nbsp;<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)
echo '<tr><td class="datos">'.$lang_label["time_threshold"];
echo "<a href='#' class='tip'>&nbsp;<span>".$lang_label["alert_time_threshold_help"]."</span></a>";
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=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>';
// Other TT
echo '<td class="datos">';
echo $lang_label["other"];
echo '<td class="datos">';
echo '<input type="text" name="other" size="5">';
// Max / Min alerts
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;
else
echo 0;
echo '" style="margin-right: 10px;">';
echo '<td class="datos2">';
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;
else
echo 1;
echo '" style="margin-right: 10px;">';
// Field1
echo '<tr><td class="datos">'.lang_string ("field1");
echo '<td class="datos" colspan=4><input type="text" name="campo_1" size="39" value="'.$alerta_campo1.'">';
echo "<a href='#' class='tip'><span><b>Macros:</b><br>_agent_<br>";
echo '_timestamp_<br>_data_<br></span></a>';
// Field2
echo '<tr><td class="datos2">'.$lang_label["field2"];
echo '<td class="datos2" colspan=4>';
echo '<input type="text" name="campo_2" size="39" value="'.$alerta_campo2.'">';
echo "<a href='#' class='tip'><span>";
echo '<b>Macros:</b><br>_agent_<br>_timestamp_<br>_data_<br></span></a>';
//Field3
echo '<tr><td class="datos">'.lang_string ("field3");
echo '<td class="datos" colspan=4>';
echo '<textarea name="campo_3" style="height:85px;" cols="36" rows="4">';
echo $alerta_campo3;
echo '</textarea><a href="#" class="tip"><span><b>Macros:</b><br>_agent_<br>';
echo '_timestamp_<br>_data_<br></span></a>';
// Time for alerting
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);
}
for ($a=0; $a < 48; $a++){
echo "<option value='";
echo render_time ($a);
echo "'>";
echo render_time ($a);
}
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);
}
for ($a=0; $a < 48; $a++){
echo "<option value='";
echo render_time ($a);
echo "'>";
echo render_time ($a);
}
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);
echo "&nbsp;&nbsp;";
echo lang_string("Tue");
echo form_render_check ("alert_d2", $alert_d2);
echo "&nbsp;&nbsp;";
echo lang_string("Wed");
echo form_render_check ("alert_d3", $alert_d3);
echo "&nbsp;&nbsp;";
echo lang_string("Thu");
echo form_render_check ("alert_d4", $alert_d4);
echo "&nbsp;&nbsp;";
echo lang_string("Fri");
echo form_render_check ("alert_d5", $alert_d5);
echo "&nbsp;&nbsp;";
echo lang_string("Sat");
echo form_render_check ("alert_d6", $alert_d6);
echo "&nbsp;&nbsp;";
echo lang_string("Sun");
echo form_render_check ("alert_d7", $alert_d7);
// Field2 Recovery
echo '<tr><td class="datos2">'.lang_string ("Field #2 (Rec)");
echo '<td class="datos2">';
echo '<input type="text" name="campo_2_rec" size="20" value="'.$alerta_campo2_rec.'">';
// Alert recovery disable / enable
echo "<td class='datos2'>";
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["disabled"];
echo "<option value='0'>".$lang_label["enabled"];
} else {
echo "<option value='0'>".$lang_label["enabled"];
echo "<option value='1'>".$lang_label["disabled"];
}
echo "</select>";
//Field3 - Recovery
echo '<tr><td class="datos">'.lang_string ("Field #3 (Rec)");
echo '<td class="datos" colspan=4>';
echo '<input type="text" name="campo_3_rec" size="60" value="'.$alerta_campo3_rec.'">';
// End block only if $creacion_agente != 1;
@ -228,19 +294,101 @@ echo '<tr><td align="right">';
echo '</form>';
echo '</td></tr></table>';
if ($form_alerttype == "combined"){
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 "<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 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)){
echo "<option value='".$alertrow[3]."'>(S) ".$alertrow[1]." - ".$alertrow[2];
}
// Add to combo combined alerts
$result_alert = mysql_query("SELECT * FROM talerta_agente_modulo WHERE id_agent != '' OR id_agent >0");
while ($alertrow = mysql_fetch_array($result_alert)){
echo "<option value='".$alertrow["id_aam"]."'>(C) ".get_db_sql("SELECT nombre from tagente where id_agente = ".$alertrow["id_agent"])." - ".substr($alertrow["descripcion"],0,20);
}
echo "</select>";
echo "<td>";
echo lang_string ("Operation");
echo "<td>";
echo "<select name='component_operation'>";
echo "<option>NOP";
echo "<option>OR";
echo "<option>AND";
echo "<option>NOT";
echo "<option>XOR";
echo "<option>XAND";
echo "</select>";
echo "<td>";
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><th>'.lang_string ("operation");
echo '<tr>';
echo '<th>'.lang_string ("agent");
echo '<th>'.lang_string ("module");
echo '<th>'.lang_string ("max_value");
echo '<th>'.lang_string ("min_value");
echo '<th>'.lang_string ("tt");
echo '<th>'.lang_string ("min_alerts");
echo '<th>'.lang_string ("max_alerts");
echo '<th>'.lang_string ("delete");
echo "<tr><td class='datos'>";
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;
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> &nbsp; ";
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>";
}

View File

@ -35,7 +35,7 @@ else {
// Get passed variables
$tab = get_parameter_get("tab","main");
$form_moduletype = get_parameter_post ("form_moduletype");
$form_alerttype = get_parameter_post ("form_alerttype");
$form_alerttype = get_parameter ("form_alerttype");
// Init vars
$descripcion = "";
@ -82,6 +82,18 @@ $create_agent = 0;
$alert_text = "";
$time_from= "";
$time_to = "";
$alerta_campo2_rec = "";
$alerta_campo3_rec = "";
$alert_id_agent = "";
$alert_d1 = "1";
$alert_d2 = "1";
$alert_d3 = "1";
$alert_d4 = "1";
$alert_d5 = "1";
$alert_d6 = "1";
$alert_d7 = "1";
$alert_recovery = "0";
$alert_priority = "0";
// ================================
// Create AGENT
@ -232,31 +244,60 @@ if (isset($_GET["delete_alert"])){ // if modified some parameter
}
// Delete Alert component (from a combined)
// ==========================================
if (isset($_GET["delete_alert_comp"])){ // if modified some parameter
$id_borrar_modulo = $_GET["delete_alert_comp"];
// get info about agent
$sql1='DELETE FROM tcompound_alert WHERE id_aam = '.$id_borrar_modulo;
$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>";
}
// Create alert
// =============
if (isset($_POST["insert_alert"])){ // if created alert
//$id_agente = $_POST["id_agente"];
$id_agente_modulo = entrada_limpia($_POST["agente_modulo"]);
$descripcion= entrada_limpia($_POST["descripcion"]);
$campo_1 = entrada_limpia($_POST["campo_1"]);
$campo_2 = entrada_limpia($_POST["campo_2"]);
$campo_3 = entrada_limpia($_POST["campo_3"]);
$maximo = entrada_limpia($_POST["maximo"]);
$minimo = entrada_limpia($_POST["minimo"]);
$tipo_alerta = entrada_limpia($_POST["tipo_alerta"]);
$alert_text = entrada_limpia($_POST["alert_text"]);
$time_threshold = entrada_limpia($_POST["time_threshold"]);
$max_alerts = entrada_limpia($_POST["max_alerts"]);
$min_alerts = entrada_limpia($_POST["min_alerts"]);
$time_from = entrada_limpia($_POST["time_from"]);
$time_to= entrada_limpia($_POST["time_to"]);
$other = entrada_limpia($_POST["other"]);
$disable_alert = entrada_limpia($_POST["disable_alert"]);
$id_agente_modulo = get_parameter ("agente_modulo",0);
$maximo = get_parameter ("maximo",0);
$minimo = get_parameter ("minimo",0);
$descripcion= get_parameter ('descripcion', '');
$campo_1 = get_parameter ('campo_1', '');
$campo_2 = get_parameter ('campo_2', '');
$campo_3 = get_parameter ('campo_3', '');
$tipo_alerta = get_parameter ("tipo_alerta",3);
$alert_text = get_parameter ("alert_text",'');
$time_threshold = get_parameter ("time_threshold",900);
$max_alerts = get_parameter ("max_alerts",1);
$min_alerts = get_parameter ("min_alerts",0);
$time_from = get_parameter ("time_from");
$time_to= get_parameter ("time_to");
$other = get_parameter ("other",0);
$disable_alert = get_parameter ("disable_alert");
$alert_d1 = get_parameter("alert_d1",0);
$alert_d2 = get_parameter("alert_d2",0);
$alert_d3 = get_parameter("alert_d3",0);
$alert_d4 = get_parameter("alert_d4",0);
$alert_d5 = get_parameter("alert_d5",0);
$alert_d6 = get_parameter("alert_d6",0);
$alert_d7 = get_parameter("alert_d7",0);
$alert_recovery = get_parameter("alert_recovery", 1);
$alert_priority = get_parameter("alert_priority", 0);
$campo2_rec = get_parameter ("campo_2_rec","");
$campo3_rec = get_parameter ("campo_3_rec","");
if ((isset($combined)) AND ($combined == 1))
$alert_id_agent = $id_agente;
else
$alert_id_agent = 0;
if ($time_threshold == -1) {
$time_threshold = $other;
}
$sql_insert="INSERT INTO talerta_agente_modulo
(id_agente_modulo,id_alerta,al_campo1,al_campo2,al_campo3,descripcion,dis_max,dis_min,time_threshold,max_alerts, min_alerts, alert_text, disable, time_from, time_to) VALUES
(id_agente_modulo,id_alerta,al_campo1,al_campo2,al_campo3,descripcion,dis_max,dis_min,time_threshold,max_alerts, min_alerts, alert_text, disable, time_from, time_to, id_agent, monday, tuesday, wednesday, thursday, friday, saturday, sunday, recovery_notify, priority, al_f2_recovery, al_f3_recovery) VALUES
('$id_agente_modulo',
'$tipo_alerta',
'$campo_1',
@ -271,7 +312,19 @@ if (isset($_POST["insert_alert"])){ // if created alert
'$alert_text',
'$disable_alert',
'$time_from',
'$time_to' )";
'$time_to',
$alert_id_agent,
$alert_d1,
$alert_d2,
$alert_d3,
$alert_d4,
$alert_d5,
$alert_d6,
$alert_d7,
$alert_recovery,
$alert_priority,
'$campo2_rec',
'$campo2_rec' )";
$result=mysql_query($sql_insert);
if (! $result) {
echo "<h3 class='error'>".$lang_label["create_alert_no"]."</h3>";
@ -281,28 +334,66 @@ if (isset($_POST["insert_alert"])){ // if created alert
}
}
// Combined ALERT - Add component
// ================================
if (isset($_POST["add_alert_combined"])){ // Update an existing alert
$alerta_id_aam = get_parameter ("update_alert",-1);
$component_item = get_parameter ("component_item",-1);
$component_operation = get_parameter ("component_operation","AND");
$sql_insert = "INSERT INTO tcompound_alert (id, id_aam, operation)
VALUES ($alerta_id_aam, $component_item, '$component_operation')";
$result=mysql_query($sql_insert);
if (! $result) {
echo "<h3 class='error'>".lang_string ("Problem adding component alert")."</h3>";
} else {
echo "<h3 class='suc'>".lang_string ("Alert component added ok")."</h3>";
}
}
// Update ALERT
// =============
if (isset($_POST["update_alert"])){ // Update an existing alert
$id_aam = entrada_limpia($_POST["id_aam"]);
$tipo_alerta = entrada_limpia($_POST["tipo_alerta"]);
if (isset($_POST["agente_modulo"])) {
$id_agente_modulo = entrada_limpia($_POST["agente_modulo"]);
}
$descripcion= entrada_limpia($_POST["descripcion"]);
$campo_1 = entrada_limpia($_POST["campo_1"]);
$campo_2 = entrada_limpia($_POST["campo_2"]);
$campo_3 = entrada_limpia($_POST["campo_3"]);
$maximo = entrada_limpia($_POST["maximo"]);
$minimo = entrada_limpia($_POST["minimo"]);
$time_threshold = entrada_limpia($_POST["time_threshold"]);
$max_alerts = entrada_limpia($_POST["max_alerts"]);
$min_alerts = entrada_limpia($_POST["min_alerts"]);
$other = entrada_limpia($_POST["other"]);
$alert_text = entrada_limpia($_POST["alert_text"]);
$time_from = entrada_limpia($_POST["time_from"]);
$time_to= entrada_limpia($_POST["time_to"]);
$disable_alert = entrada_limpia($_POST["disable_alert"]);
$id_agente_modulo = get_parameter ("agente_modulo",0);
$id_aam = get_parameter ("id_aam",0);
$maximo = get_parameter ("maximo",0);
$minimo = get_parameter ("minimo",0);
$descripcion= get_parameter ('descripcion', '');
$campo_1 = get_parameter ('campo_1', '');
$campo_2 = get_parameter ('campo_2', '');
$campo_3 = get_parameter ('campo_3', '');
$tipo_alerta = get_parameter ("tipo_alerta",3);
$alert_text = get_parameter ("alert_text",'');
$time_threshold = get_parameter ("time_threshold",900);
$max_alerts = get_parameter ("max_alerts",1);
$min_alerts = get_parameter ("min_alerts",0);
$time_from = get_parameter ("time_from");
$time_to= get_parameter ("time_to");
$other = get_parameter ("other",0);
$disable_alert = get_parameter ("disable_alert");
$alert_d1 = get_parameter("alert_d1",0);
$alert_d2 = get_parameter("alert_d2",0);
$alert_d3 = get_parameter("alert_d3",0);
$alert_d4 = get_parameter("alert_d4",0);
$alert_d5 = get_parameter("alert_d5",0);
$alert_d6 = get_parameter("alert_d6",0);
$alert_d7 = get_parameter("alert_d7",0);
$alert_recovery = get_parameter("alert_recovery", 1);
$alert_priority = get_parameter("alert_priority", 0);
$campo2_rec = get_parameter ("campo_2_rec","");
$campo3_rec = get_parameter ("campo_3_rec","");
$alert_d1 = get_parameter("alert_d1",0);
$alert_d2 = get_parameter("alert_d2",0);
$alert_d3 = get_parameter("alert_d3",0);
$alert_d4 = get_parameter("alert_d4",0);
$alert_d5 = get_parameter("alert_d5",0);
$alert_d6 = get_parameter("alert_d6",0);
$alert_d7 = get_parameter("alert_d7",0);
$alert_recovery = get_parameter("alert_recovery", 1);
$alert_priority = get_parameter("alert_priority", 0);
$campo2_rec = get_parameter ("campo_2_rec","");
$campo3_rec = get_parameter ("campo_3_rec","");
if ($time_threshold == -1) {
$time_threshold = $other;
}
@ -321,7 +412,19 @@ if (isset($_POST["update_alert"])){ // Update an existing alert
alert_text = '$alert_text',
time_to = '$time_to',
time_from = '$time_from',
disable = '$disable_alert'
disable = '$disable_alert',
monday = '$alert_d1',
tuesday = '$alert_d2',
wednesday = '$alert_d3',
thursday = '$alert_d4',
friday = '$alert_d5',
saturday = '$alert_d6',
sunday = '$alert_d7',
recovery_notify = $alert_recovery,
priority = $alert_priority,
al_f2_recovery = '$campo2_rec',
al_f3_recovery = '$campo3_rec',
id_alerta = $tipo_alerta
WHERE id_aam = ".$id_aam;
$result=mysql_query($sql_insert);
if (! $result) {
@ -446,7 +549,9 @@ if ((isset($_GET["update_module"])) && (!isset($_POST["oid"])) && (!isset($_POST
$modulo_min ="N/A";
}
}
// Read alert data if editing alert
// Read ALERT data if editing alert
// ==================================
if (isset($_GET["update_alert"])){
$id_grupo = dame_id_grupo($id_agente);
if (give_acl($id_user, $id_grupo, "LW")==0){
@ -465,6 +570,8 @@ if (isset($_GET["update_alert"])){
$alerta_campo1 = $row["al_campo1"];
$alerta_campo2 = $row["al_campo2"];
$alerta_campo3 = $row["al_campo3"];
$alerta_campo2_rec = $row["al_f2_recovery"];
$alerta_campo3_rec = $row["al_f3_recovery"];
$alerta_dis_max = $row["dis_max"];
$alerta_dis_min = $row["dis_min"];
$tipo_alerta = $row["id_alerta"];
@ -477,8 +584,17 @@ if (isset($_GET["update_alert"])){
$time_from = $row["time_from"];
$time_to = $row["time_to"];
$alerta_id_agentemodulo = $row["id_agente_modulo"]; // Only to show, cannot be changed
}
$alert_id_agent = $row["id_agent"];
$alert_d1 = $row["monday"];
$alert_d2 = $row["tuesday"];
$alert_d3 = $row["wednesday"];
$alert_d4 = $row["thursday"];
$alert_d5 = $row["friday"];
$alert_d6 = $row["saturday"];
$alert_d7 = $row["sunday"];
$alert_recovery = $row["recovery_notify"];
$alert_priority = $row["priority"];
}
}
// GET DATA for MODULE UPDATE OR MODULE INSERT
@ -680,7 +796,7 @@ case "module":
require "module_manager_editor.php";
break;
case "alert":
if ($form_alerttype == "")
if (($form_alerttype == "") AND (!isset($_GET["update_alert"])))
require "alert_manager.php";
else
require "alert_manager_editor.php";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

After

Width:  |  Height:  |  Size: 869 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 B

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 794 B

View File

@ -600,8 +600,307 @@ function get_parameter_post ( $name, $default = "" ){
return $default;
}
function get_alert_priority ( $prio ){
$priority = "NORMAL";
switch ($prio){
case 0:
$priority = "NORMAL";
break;
case 1:
$priority = "WARNING";
break;
case 2:
$priority = "MINOR";
break;
case 3:
$priority = "MAJOR";
break;
case 4:
$priority = "CRITICAL";
break;
}
return $priority;
}
function get_alert_days ( $row ){
global $config;
global $lang_label;
$days_output = "";
$check = $row["monday"] + $row["tuesday"] + $row["wednesday"] + $row["thursday"]+ $row["friday"] + $row["saturday"] + $row["sunday"];
if ($row["monday"] != 0)
$days_output .= "Mo";
if ($row["tuesday"] != 0)
$days_output .= "Tu";
if ($row["wednesday"] != 0)
$days_output .= "We";
if ($row["thursday"] != 0)
$days_output .= "Th";
if ($row["friday"] != 0)
$days_output .= "Fr";
if ($row["saturday"] != 0)
$days_output .= "Sa";
if ($row["sunday"] != 0)
$days_output .= "Su";
if ($days_output == "")
$days_output = lang_string ("none");
if ($check == 7)
$days_output = lang_string ("all");
return $days_output;
}
function get_alert_times ($row2){
global $config;
global $lang_label;
if ($row2["time_from"]){
$time_from_table = $row2["time_from"];
} else {
$time_from_table = lang_string("N/A");
}
if ($row2["time_to"]){
$time_to_table = $row2["time_to"];
} else {
$time_to_table = lang_string("N/A");
}
$string = "";
if ($time_to_table == $time_from_table)
$string .= $lang_label["N/A"];
else
$string .= substr($time_from_table,0,5)." - ".substr($time_to_table,0,5);
return $string;
}
function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $combined = 0){
global $config;
global $lang_label;
$string = "";
if ($row2["disable"] == 1){
$string .= "<td class='$tdcolor'><b><i>".$lang_label["disabled"]."</b></i>";
} elseif ($id_tipo_modulo != 0) {
$string .= "<td class='$tdcolor'><img src='images/".show_icon_type($id_tipo_modulo)."' border=0>";
} else {
$string .= "<td class='$tdcolor'>--";
}
if (isset($row2["operation"])){
$string = $string."<td class=$tdcolor>".$row2["operation"];
} else {
$string = $string."<td class=$tdcolor>".get_db_sql("SELECT nombre FROM talerta WHERE id_alerta = ".$row2["id_alerta"]);
}
$string = $string."<td class='$tdcolor'>".human_time_description($row2["time_threshold"]);
if ($row2["dis_min"]!=0){
$mytempdata = fmod($row2["dis_min"], 1);
if ($mytempdata == 0)
$mymin = intval($row2["dis_min"]);
else
$mymin = $row2["dis_min"];
$mymin = format_for_graph($mymin );
} else {
$mymin = 0;
}
if ($row2["dis_max"]!=0){
$mytempdata = fmod($row2["dis_max"], 1);
if ($mytempdata == 0)
$mymax = intval($row2["dis_max"]);
else
$mymax = $row2["dis_max"];
$mymax = format_for_graph($mymax );
} else {
$mymax = 0;
}
if (($mymin == 0) && ($mymax == 0)){
$mymin = lang_string ("N/A");
$mymax = $mymin;
}
// We have alert text ?
if ($row2["alert_text"]!= "") {
$string = $string."<td colspan=2 class='$tdcolor'>".$lang_label["text"]."</td>";
} else {
$string = $string."<td class='$tdcolor'>".$mymin."</td>";
$string = $string."<td class='$tdcolor'>".$mymax."</td>";
}
// Alert times
$string = $string."<td class='$tdcolor'>";
$string .= get_alert_times ($row2);
// Description
$string = $string."</td><td class='$tdcolor'>".salida_limpia ($row2["descripcion"]);
// Has recovery notify activated ?
if ($row2["recovery_notify"] > 0)
$recovery_notify = lang_string("Yes");
else
$recovery_notify = lang_string("No");
// calculate priority
$priority = get_alert_priority ($row2["priority"]);
// calculare firing conditions
if ($row2["alert_text"] != ""){
$firing_cond = lang_string("text")."(".substr($row2["alert_text"],0,8).")";
} else {
$firing_cond = $row2["min_alerts"]." / ".$row2["max_alerts"];
}
// calculate days
$firing_days = get_alert_days ( $row2 );
// More details EYE tooltip
$string = $string."<td class='$tdcolor'>";
$string.= "<a href=# class=info><img class='top'
src='images/eye.png' alt=''>";
// Add float info table
$string.= "
<span>
<table cellspacing='2' cellpadding='0'
style='margin-left:2px;'>
<tr><th colspan='2' width='91'>".
lang_string("Recovery")."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>$recovery_notify</b></td></tr>
<tr><th colspan='2' width='91'>".
lang_string("Priority")."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>$priority</b></td></tr>
<tr><th colspan='2' width='91'>".
lang_string("Alert Ctrl.")."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>".$firing_cond."</b></td></tr>
<tr><th colspan='2' width='91'>".
lang_string("Firing days")."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>".$firing_days."</b></td></tr>
</table></span></A>";
return $string;
}
function show_alert_show_view ($data, $tdcolor = "datos", $combined = 0){
global $config;
global $lang_label;
if ($combined == 0){
$module_name = get_db_sql ("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$data["id_agente_modulo"]);
$agent_name = get_db_sql ("SELECT tagente.nombre FROM tagente_modulo, tagente WHERE tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.id_agente_modulo = ".$data["id_agente_modulo"]);
$id_agente = get_db_sql ("SELECT id_agente FROM tagente_modulo WHERE id_agente_modulo = ".$data["id_agente_modulo"]);
} else {
$agent_name = get_db_sql ("SELECT nombre FROM tagente WHERE id_agente =".$data["id_agent"]);
$id_agente = $data["id_agent"];
}
$alert_name = get_db_sql ("SELECT nombre FROM talerta WHERE id_alerta = ".$data["id_alerta"]);
echo "<td class='".$tdcolor."'>".$alert_name."</td>";
if ($combined == 0){
echo "<td class='".$tdcolor."'>".substr($module_name,0,21)."</td>";
} else {
echo "<td class='".$tdcolor."'>";
// More details EYE tooltip (combined)
echo " <a href='#' class='info_table'><img class='top' src='images/eye.png' alt=''><span>";
echo show_alert_row_mini ($data["id_aam"]);
echo "</span></a> ";
echo substr($agent_name,0,21)."</td>";
}
// Description
echo "<td class='".$tdcolor."'>".$data["descripcion"]."</td>";
// Extended info
echo "<td class='".$tdcolor."'>";
// Has recovery notify activated ?
if ($data["recovery_notify"] > 0)
$recovery_notify = lang_string("Yes");
else
$recovery_notify = lang_string("No");
// calculate priority
$priority = get_alert_priority ($data["priority"]);
// calculare firing conditions
if ($data["alert_text"] != ""){
$firing_cond = lang_string("text")."(".substr($data["alert_text"],0,8).")";
} else {
$firing_cond = $data["min_alerts"]." / ".$data["max_alerts"];
}
// calculate days
$firing_days = get_alert_days ($data);
// More details EYE tooltip
echo "<a href='#' class='info'><img class='top'
src='images/eye.png' alt=''>";
// Add float info table
echo "
<span>
<table cellspacing='2' cellpadding='0'
style='margin-left:2px;'>
<tr><th colspan='2' width='91'>".
lang_string("Recovery")."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>$recovery_notify</b></td></tr>
<tr><th colspan='2' width='91'>".
lang_string("Priority")."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>$priority</b></td></tr>
<tr><th colspan='2' width='91'>".
lang_string("Alert Ctrl.")."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>".$firing_cond."</b></td></tr>
<tr><th colspan='2' width='91'>".
lang_string("Firing days")."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>".$firing_days."</b></td></tr>
</table></span></A>";
$mytempdata = fmod($data["dis_min"], 1);
if ($mytempdata == 0)
$mymin = intval($data["dis_min"]);
else
$mymin = $data["dis_min"];
$mymin = format_for_graph($mymin );
$mytempdata = fmod($data["dis_max"], 1);
if ($mytempdata == 0)
$mymax = intval($data["dis_max"]);
else
$mymax = $data["dis_max"];
$mymax = format_for_graph($mymax );
// Text alert ?
if ($data["alert_text"] != "")
echo "<td class='".$tdcolor."' colspan=2>".$lang_label["text"]."</td>";
else {
echo "<td class='".$tdcolor."'>".$mymin."</td>";
echo "<td class='".$tdcolor."'>".$mymax."</td>";
}
echo "<td align='center' class='".$tdcolor."'>".human_time_description($data["time_threshold"]);
if ($data["last_fired"] == "0000-00-00 00:00:00") {
echo "<td align='center' class='".$tdcolor."f9'>".$lang_label["never"]."</td>";
}
else {
echo "<td align='center' class='".$tdcolor."f9'>".human_time_comparation ($data["last_fired"])."</td>";
}
echo "<td align='center' class='".$tdcolor."'>".$data["times_fired"]."</td>";
if ($data["times_fired"] <> 0){
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_red.png' title='".$lang_label["fired"]."'>";
echo "</td>";
$id_grupo_alerta = get_db_value ("id_grupo", "tagente", "id_agente", $id_agente);
if (give_acl($config["id_user"], $id_grupo_alerta, "AW") == 1) {
echo "<td align='center' class='".$tdcolor."'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&validate_alert=".$data["id_aam"]."'><img src='images/ok.png'></a>";
echo "</td>";
}
} else
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_green.png' title='".$lang_label["not_fired"]."'></td>";
}
function form_render_check ($name_form, $value_form = 1){
echo "<input name='$name_form' type='checkbox' ";
if ($value_form != 0){
echo "checked='1' ";
}
echo "value=1>";
}
?>

View File

@ -1289,4 +1289,126 @@ function lang_string ($string){
else
return "[".$string."]";
}
function check_server_status (){
global $config;
// This check assumes that server_keepalive should be AT LEAST 15 MIN
$sql = "SELECT COUNT(id_server) FROM tserver WHERE status = 1 AND keepalive > NOW() - INTERVAL 15 MINUTE";
$res = get_db_sql ($sql);
// Set servers to down
if ($res == 0){
$res2 = mysql_query("UPDATE tserver SET status = 0");
}
return $res;
}
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);
echo "<table width=400 cellpadding=2 cellspacing=2 class='databox'>";
echo "<th>".lang_string("Name");
echo "<th>".lang_string("Oper");
echo "<th>".lang_string("Tt");
echo "<th>".lang_string("Firing");
echo "<th>".lang_string("Time");
echo "<th>".lang_string("Desc");
echo "<th>".lang_string("Recovery");
echo "<th>".lang_string("MinMax.Al");
echo "<th>".lang_string("Days");
echo "<th>".lang_string("Fired");
while ($row2=mysql_fetch_array($result_com)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr>";
if ($row2["disable"] == 1){
$tdcolor = "datos3";
}
echo "<td class=$tdcolor>".get_db_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo =".$row2["id_agente_modulo"]);
echo "<td class=$tdcolor>".$row2["operation"];
echo "<td class='$tdcolor'>".human_time_description($row2["time_threshold"]);
if ($row2["dis_min"]!=0){
$mytempdata = fmod($row2["dis_min"], 1);
if ($mytempdata == 0)
$mymin = intval($row2["dis_min"]);
else
$mymin = $row2["dis_min"];
$mymin = format_for_graph($mymin );
} else {
$mymin = 0;
}
if ($row2["dis_max"]!=0){
$mytempdata = fmod($row2["dis_max"], 1);
if ($mytempdata == 0)
$mymax = intval($row2["dis_max"]);
else
$mymax = $row2["dis_max"];
$mymax = format_for_graph($mymax );
} else {
$mymax = 0;
}
if (($mymin == 0) && ($mymax == 0)){
$mymin = lang_string ("N/A");
$mymax = $mymin;
}
// We have alert text ?
if ($row2["alert_text"]!= "") {
echo "<td colspan=2 class='$tdcolor'>".$lang_label["text"]."</td>";
} else {
echo "<td class='$tdcolor'>".$mymin."/".$mymax."</td>";
}
// Alert times
echo "<td class='$tdcolor'>";
echo get_alert_times ($row2);
// Description
echo "</td><td class='$tdcolor'>".substr($row2["descripcion"],0,20);
// Has recovery notify activated ?
if ($row2["recovery_notify"] > 0)
$recovery_notify = lang_string("Yes");
else
$recovery_notify = lang_string("No");
echo "</td><td class='$tdcolor'>".$recovery_notify;
// calculare firing conditions
if ($row2["alert_text"] != ""){
$firing_cond = lang_string("text")."(".substr($row2["alert_text"],0,8).")";
} else {
$firing_cond = $row2["min_alerts"]." / ".$row2["max_alerts"];
}
echo "</td><td class='$tdcolor'>".$firing_cond;
// calculate days
$firing_days = get_alert_days ( $row2 );
echo "</td><td class='$tdcolor'>".$firing_days;
// Fired ?
if ($row2["times_fired"]>0)
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_red.png' title='".lang_string("fired")."'></td>";
else
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_green.png' title='".$lang_label["not_fired"]."'></td>";
}
echo "</table>";
}
?>

View File

@ -155,7 +155,7 @@ $lang_label["log_filter"]="Log type filter";
$lang_label["not_connected"]="You're not connected";
$lang_label["administrator"]="Administrator";
$lang_label["normal_user"]="Standard user";
$lang_label["has_connected"]="You are connected as";
$lang_label["has_connected"]="You are ";
$lang_label["logged_out"]="Logged Out";
$lang_label["logout_msg"]="Your session is over. Please close your browser window to close session on Pandora.<br><br>";
$lang_label["user_last_activity"]="This is your last activity in Pandora FMS console";
@ -895,6 +895,31 @@ $lang_label["post_process"]="Post process";
$lang_label["max_timeout"]="Max. timeout";
$lang_label["snmp_walk"]="SNMP walk";
$lang_label["System ready"]="Sytem ready";
$lang_label["System ready"]="Sytem ready";
$lang_label["Server status: DOWN"]="Server status: DOWN";
$lang_label["Autorefresh"]="Autorefresh";
$lang_label["Autorefresh active"]="Autorefresh active";
$lang_label["Mon"]="Mon";
$lang_label["Tue"]="Tue";
$lang_label["Wed"]="Wed";
$lang_label["Thu"]="Thu";
$lang_label["Fri"]="Fri";
$lang_label["Sat"]="Sat";
$lang_label["Sun"]="Sun";
$lang_label["Days of week"] = "Days of week";
$lang_label["Alert recovery"]="Alert recovery";
$lang_label["Priority"]="Priority";
$lang_label["Field #2 (Rec)"]="Field #2 (Rec)";
$lang_label["Field #3 (Rec)"]="Field #3 (Rec)";
$lang_label["Simple alerts"]="Simple alerts";
$lang_label["Combined alerts"]="Combined alerts";
$lang_label["Oper"]="Oper";
$lang_label["info"]="info";
$lang_label["Operation"]="Operation";
$lang_label["Source Agent/Alert"]="Source Agent/Alert";
global $lang_label;
global $help_label;

View File

@ -102,6 +102,13 @@ a.white_bold {
text-decoration: none;
font-weight: bold;
}
a.white_grey_bold {
color: #999;
text-decoration: none;
font-weight: bold;
}
a.white {
color: #eee;
text-decoration: none;
@ -439,6 +446,17 @@ div.title_line {
float:left;
border-bottom: 1px solid #778866;
}
#menu_tab_frame_view {
background: #66AA44;
width: 805px;
min-height: 22px;
padding-left: 0x;
margin-left: -25px;
float:left;
border-bottom: 1px solid #778866;
}
#menu_tab .mn, #menu_tab ul, #menu_tab .mn ul {
padding: 0px;
list-style: none;
@ -601,8 +619,8 @@ span.rmess, span.nrmess {
}
#head_m {
position: absolute;
padding-top: 7px;
padding-left: 210px;
padding-top: 6px;
padding-left: 200px;
}
span#logo_text1 {
font: bolder 3em Arial, Sans-serif;

View File

@ -18,10 +18,17 @@ a.help {
a.info {
padding: 25px 0px 0px 0px;
}
a.info_table {
padding: 25px 0px 0px 0px;
margin: -50px 0px 0px 0px;
}
a.info2 {
padding: 2px 0px 0px 0px;
}
a.tip, a.tip2, a.tipp, a.help , a.info, a.info2 {
a.tip, a.tip2, a.tipp, a.help , a.info, a.info2, a.info_table {
position: relative;
text-decoration: none;
}
@ -38,14 +45,14 @@ a.tipp:hover {
text-decoration: none;
background-color: #778866;
}
a.info:hover, a.info2:hover, a.help:hover {
a.info:hover, a.info2:hover, a.help:hover, a.info_table:hover {
text-decoration: none;
}
a.tip span, a.tip2 span, a.tipp span, a.info span, a.info2 span, a.help span {
a.tip span, a.tip2 span, a.tipp span, a.info span, a.info2 span, a.help span, a.info_table span {
display: none;
}
a.tip:hover span, a.tip2:hover span,a.tipp:hover span, a.info:hover span,
a.info2:hover span, a.help:hover span {
a.info2:hover span, a.help:hover span, a.info_table:hover span {
display: block;
text-decoration: none;
position: absolute;
@ -58,6 +65,16 @@ a.info2:hover span, a.help:hover span {
color: #000;
padding: 2px;
}
a.info_table:hover span{
width: 1px;
height: 1px;
left: -140px;
top: 50px;
background-color: #fff;
border: 0px solid #fff;
}
a.info:hover span {
top: 45px;
left: 20px;

View File

@ -1,13 +1,12 @@
<?php
// Pandora - the Free monitoring system
// ====================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L, info@artica.es
// Copyright (c) 2004-2008 Raul Mateos Martin, raulofpandora@gmail.com
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -54,7 +53,7 @@ if (isset($_GET["id_agente"])){
echo "<h2>".$lang_label["ag_title"]." &gt; ".$lang_label["alert_listing"]."</h2>";
}
$query_gen='SELECT talerta_agente_modulo.alert_text, talerta_agente_modulo.id_alerta, talerta_agente_modulo.descripcion, talerta_agente_modulo.last_fired, talerta_agente_modulo.times_fired, tagente_modulo.nombre, talerta_agente_modulo.dis_max, talerta_agente_modulo.dis_min, talerta_agente_modulo.max_alerts, talerta_agente_modulo.time_threshold, talerta_agente_modulo.min_alerts, talerta_agente_modulo.id_agente_modulo, tagente_modulo.id_agente_modulo, talerta_agente_modulo.id_aam FROM tagente_modulo, talerta_agente_modulo WHERE tagente_modulo.id_agente = '.$id_agente.' AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.disable = 0 ORDER BY tagente_modulo.nombre';
$query_gen='SELECT talerta_agente_modulo.* FROM talerta_agente_modulo, tagente_modulo WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente ='.$id_agente;
$result_gen=mysql_query($query_gen);
if (mysql_num_rows ($result_gen)) {
@ -66,6 +65,7 @@ if (isset($_GET["id_agente"])){
echo "<tr>
<th>".$lang_label["type"]."<th>".$lang_label["name"]."</th>
<th>".$lang_label["description"]."</th>
<th>".lang_string ("info")."</th>
<th>".$lang_label["min."]."</th>
<th>".$lang_label["max."]."</th>
<th>".$lang_label["time_threshold"]."</th>
@ -84,52 +84,25 @@ if (isset($_GET["id_agente"])){
$color = 1;
}
echo "<tr>";
echo "<td class='".$tdcolor."'>".dame_nombre_alerta($data["id_alerta"])."</td>";
echo "<td class='".$tdcolor."'>".substr($data["nombre"],0,21)."</td>";
echo "<td class='".$tdcolor."'>".$data["descripcion"]."</td>";
$mytempdata = fmod($data["dis_min"], 1);
if ($mytempdata == 0)
$mymin = intval($data["dis_min"]);
else
$mymin = $data["dis_min"];
$mymin = format_for_graph($mymin );
$mytempdata = fmod($data["dis_max"], 1);
if ($mytempdata == 0)
$mymax = intval($data["dis_max"]);
else
$mymax = $data["dis_max"];
$mymax = format_for_graph($mymax );
// Text alert ?
if ($data["alert_text"] != "")
echo "<td class='".$tdcolor."' colspan=2>".$lang_label["text"]."</td>";
else {
echo "<td class='".$tdcolor."'>".$mymin."</td>";
echo "<td class='".$tdcolor."'>".$mymax."</td>";
}
echo "<td align='center' class='".$tdcolor."'>".human_time_description($data["time_threshold"]);
if ($data["last_fired"] == "0000-00-00 00:00:00") {
echo "<td align='center' class='".$tdcolor."f9'>".$lang_label["never"]."</td>";
}
else {
echo "<td align='center' class='".$tdcolor."f9'>".human_time_comparation ($data["last_fired"])."</td>";
}
echo "<td align='center' class='".$tdcolor."'>".$data["times_fired"]."</td>";
if ($data["times_fired"] <> 0){
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_red.png' title='".$lang_label["fired"]."'>";
echo "</td>";
$id_grupo_alerta = get_db_value ("id_grupo", "tagente", "id_agente", $id_agente);
if (give_acl($id_user, $id_grupo_alerta, "AW") == 1) {
echo "<td align='center' class='".$tdcolor."'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&validate_alert=".$data["id_aam"]."'><img src='images/ok.png'></a>";
echo "</td>";
}
} else
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_green.png' title='".$lang_label["not_fired"]."'></td>";
show_alert_show_view ($data, $tdcolor, 0);
}
echo "<tr><td colspan=11 class='datos3'><center>".lang_string("Combined alerts")."</center>";
// Show combined alerts for this agent
$result_com = mysql_query("SELECT * FROM talerta_agente_modulo WHERE id_agent = $id_agente");
while ($data_com=mysql_fetch_array($result_com)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr>";
show_alert_show_view ($data_com, $tdcolor, 1);
}
echo '</table>';
} else {
@ -176,8 +149,9 @@ if (isset($_GET["id_agente"])){
<noscript>
<input name='uptbutton' type='submit' class='sub' value='".$lang_label["show"]."'>
</noscript></td></form>";
// Show only selected groups
// Display single alerts
// =======================
if ($ag_group > 1)
$sql='SELECT id_agente, nombre, disabled FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre';
else
@ -245,35 +219,101 @@ if (isset($_GET["id_agente"])){
unset($string);
} //end result
} //end disabled=0
} //end while
if (isset($string)) {
echo "<td class='f9' style='padding-left: 30px;'>";
echo "<img src='images/pixel_red.png' width=18 height=18> ".$lang_label["fired"]."</td>";
echo "<td class='f9' style='padding-left: 30px;'>";
echo "<img src='images/pixel_green.png' width=18 height=18> ".$lang_label["not_fired"];
echo "</td></tr></table>";
echo "<br>";
echo "<table cellpadding='4' cellspacing='4' width='700' class='databox'>";
echo "<tr>
<th>".$lang_label["agent"]."</th>
<th>".$lang_label["status"]."</th>
<th>".$lang_label["type"]."</th>
<th>".$lang_label["description"]."</th>
<th>".$lang_label["last_fired"]."</th>
<th>".$lang_label["times_fired"]."</th>";
echo $string; //built table of alerts
echo "</table>";
}
else {
echo "</table><br><div class='nf'>".
$lang_label["no_alert"]."</div>";
}
} else {
echo "</table><br><div class='nf'>".
$lang_label["no_agent"].$lang_label["no_agent_alert"]."</div>";
}
}
}
// Display combined alerts
// =======================
if ($ag_group > 1)
$sql='SELECT id_agente, nombre, disabled FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre';
else
$sql='SELECT id_agente, nombre, disabled FROM tagente ORDER BY id_grupo, nombre';
$result=mysql_query($sql);
if (mysql_num_rows($result)){
$color=1;
while ($row=mysql_fetch_array($result)){ //while there are agents
if ($row["disabled"] == 0) {
$id_agente = $row['id_agente'];
$nombre_agente = strtoupper($row["nombre"]);
$query_gen='SELECT talerta_agente_modulo.id_alerta,
talerta_agente_modulo.descripcion,
talerta_agente_modulo.last_fired,
talerta_agente_modulo.times_fired,
talerta_agente_modulo.id_agent
FROM talerta_agente_modulo
WHERE talerta_agente_modulo.id_agent = '.$id_agente.' AND talerta_agente_modulo.disable = 0 ';
$result_gen=mysql_query($query_gen);
if (mysql_num_rows ($result_gen)) {
while ($data=mysql_fetch_array($result_gen)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
if (!isset($string)) {
$string='';
}
$string = $string."<tr><td class='".$tdcolor."'>
<a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&
id_agente=".$id_agente."'>
<b>".$nombre_agente."</b> (*)";
$string .= "<td class='$tdcolor' align='center'>";
if ($data["times_fired"] <> 0)
$string .= "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["fired"]."'>";
else
$string .= "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["not_fired"]."'>";
$string = $string."<td class='".$tdcolor."'>"
.dame_nombre_alerta($data["id_alerta"])."</td>";
$string=$string."<td class='".$tdcolor."'>".
$data["descripcion"]."</td>";
if ($data["last_fired"] == "0000-00-00 00:00:00") {
$string=$string."<td class='".$tdcolor."'>".
$lang_label["never"]."</td>";
} else {
$string=$string."<td class='".$tdcolor."'>".
human_time_comparation($data["last_fired"])."</td>";
}
$string=$string."<td class='".$tdcolor."'>".
$data["times_fired"]."</td>";
}
}
else if($ag_group>1) {
unset($string);
} //end result
} //end disabled=0
} //end while
} // if rows..
if (isset($string)) {
echo "<td class='f9' style='padding-left: 30px;'>";
echo "<img src='images/pixel_red.png' width=18 height=18> ".$lang_label["fired"]."</td>";
echo "<td class='f9' style='padding-left: 30px;'>";
echo "<img src='images/pixel_green.png' width=18 height=18> ".$lang_label["not_fired"];
echo "</td><td class='f9' valign='bottom' style='padding-left: 10px;'>(*) ".lang_string("Combined alert")."</tr></table>";
echo "<br>";
echo "<table cellpadding='4' cellspacing='4' width='700' class='databox'>";
echo "<tr>
<th>".$lang_label["agent"]."</th>
<th>".$lang_label["status"]."</th>
<th>".$lang_label["type"]."</th>
<th>".$lang_label["description"]."</th>
<th>".$lang_label["last_fired"]."</th>
<th>".$lang_label["times_fired"]."</th>";
echo $string; //built table of alerts
echo "</table>";
}
else {
echo "</table><br><div class='nf'>".
$lang_label["no_alert"]."</div>";
}
} // Main alert view
?>

View File

@ -29,7 +29,8 @@ if (comprueba_login() == 0) {
if (mysql_num_rows ($result_t)) {
echo "<h3>".$lang_label["monitor_listing"]."</h3>";
echo "<table width='750' cellpadding=4 cellspacing=4 class='databox'>";
echo "<tr><th>".$lang_label["type"]."</th>
echo "<tr><th>X</th>";
echo "<th>".$lang_label["type"]."</th>
<th>".$lang_label["module_name"]."</th>
<th>".$lang_label["description"]."</th>
<th>".$lang_label["status"]."</th>
@ -67,8 +68,19 @@ if (comprueba_login() == 0) {
else
$agent_down = 0;
echo "<tr><td class='".$tdcolor."'>";
if (($row_t["id_modulo"] != 1) AND ($row_t["id_tipo_modulo"] < 100)) {
if ($row_t["flag"] == 0){
echo "<a href='index.php?sec=estado& sec2=operation/agentes/ver_agente& id_agente=".$id_agente."&id_agente_modulo=".$row_t["id_agente_modulo"]."&flag=1& tab=main&refr=60'><img src='images/target.png' border='0'></a>";
} else {
echo "<a href='index.php?sec=estado& sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$row_t["id_agente_modulo"]."&tab=main&refr=60'><img src='images/refresh.png' border='0'></a>";
}
}
echo "<td class='".$tdcolor."'>";
echo "<img src='images/".show_icon_type($row_t["id_tipo_modulo"])."' border=0>";
echo "<td class='".$tdcolor."'>".$est_modulo."</td>";
echo "<td class='".$tdcolor."f9'>"

View File

@ -78,23 +78,11 @@ if (comprueba_login() == 0) {
$id_grupo = $row_t["id_grupo"];
$id_usuario=$_SESSION["id_usuario"];
if (give_acl($id_usuario, $id_grupo, "AW")==1){
if ($row3["id_tipo_modulo"] > 4 AND ($row3["id_tipo_modulo"] < 100)){
if (($row3["id_modulo"] != 1) AND ($row3["id_tipo_modulo"] < 100)) {
if ($row3["flag"] == 0){
echo "<a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&
id_agente=".$id_agente."&
id_agente_modulo=".$row3["id_agente_modulo"]."&
flag=1&
tab=data&
refr=60'>
<img src='images/target.png' border='0'></a>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$row3["id_agente_modulo"]."&flag=1&tab=data&refr=60'><img src='images/target.png' border='0'></a>";
} else {
echo "<a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&
id_agente=".$id_agente."&
id_agente_modulo=".$row3["id_agente_modulo"]."&
tab=data&refr=60'>
<img src='images/refresh.png' border='0'></a>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$row3["id_agente_modulo"]."&tab=data&refr=60'><img src='images/refresh.png' border='0'></a>";
}
}
}

View File

@ -1,19 +1,12 @@
<?php
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP additions
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// Javascript Active Console code.
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -21,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
require("include/config.php");
@ -56,7 +50,7 @@ if (comprueba_login() == 0) {
}
}
if (give_acl($id_usuario,$id_grupo, "AR") == 1){
echo "<div id='menu_tab_frame_view'>";
echo "<div id='menu_tab_left'>
<ul class='mn'>
<li class='view'>
@ -71,22 +65,35 @@ if (comprueba_login() == 0) {
$tab = "main";
echo "<div id='menu_tab'><ul class='mn'>";
if (give_acl($id_usuario,$id_grupo, "AW") == 1){
if ($tab == "manage")
echo "<li class='nomn_high'>";
else
echo "<li class='nomn'>";
// Manage agent
echo "<li class='nomn'><a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente'><img src='images/setup.png' width='16' class='top' border=0> ".$lang_label["Manage"]." </a>";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente'><img src='images/setup.png' width='16' class='top' border=0> ".$lang_label["Manage"]." </a>";
echo "</li>";
}
// Main view
echo "<li class='nomn'>";
if ($tab == "main")
echo "<li class='nomn_high'>";
else
echo "<li class='nomn'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/monitor.png' class='top' border=0> ".$lang_label["Main"]." </a>";
echo "</li>";
// Data
echo "<li class='nomn'>";
if ($tab == "data")
echo "<li class='nomn_high'>";
else
echo "<li class='nomn'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data'><img src='images/lightbulb.png' class='top' border=0> ".$lang_label["Data"]." </a>";
echo "</li>";
// Alerts
echo "<li class='nomn'>";
if ($tab == "alert")
echo "<li class='nomn_high'>";
else
echo "<li class='nomn'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=alert'><img src='images/bell.png' class='top' border=0> ".$lang_label["Alerts"]." </a>";
echo "</li>";
@ -97,22 +104,27 @@ if (comprueba_login() == 0) {
echo "</ul>";
echo "</div>";
echo "</div>";
echo "<div style='height: 25px'> </div>";
switch ($tab) {
/* http://pandora.localhost/index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=600 */
case "manage": require "estado_generalagente.php";
break;
case "manage":
require "estado_generalagente.php";
break;
case "main": require "estado_generalagente.php";
require "estado_monitores.php";
require "estado_alertas.php";
break;
case "main":
require "estado_generalagente.php";
require "estado_monitores.php";
require "estado_alertas.php";
break;
case "data": require "estado_ultimopaquete.php";
break;
case "data":
require "estado_ultimopaquete.php";
break;
case "alert": require "estado_alertas.php";
break;
case "alert":
require "estado_alertas.php";
break;
}
} else {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to read data from agent ".dame_nombre_agente($id_agente));

View File

@ -2,12 +2,20 @@
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, project architecture and management.
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP code additions
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
require("include/config.php");

View File

@ -218,26 +218,20 @@ CREATE TABLE `talerta_agente_modulo` (
`time_from` TIME default '00:00:00',
`time_to` TIME default '00:00:00',
`id_agent` int(11) default NULL,
`monday` tinyint(3) default '0',
`tuesday` tinyint(3) default '0',
`wednesday` tinyint(3) default '0',
`thursday` tinyint(3) default '0',
`friday` tinyint(3) default '0',
`saturday` tinyint(3) default '0',
`sunday` tinyint(3) default '0',
`monday` tinyint(3) default '1',
`tuesday` tinyint(3) default '1',
`wednesday` tinyint(3) default '1',
`thursday` tinyint(3) default '1',
`friday` tinyint(3) default '1',
`saturday` tinyint(3) default '1',
`sunday` tinyint(3) default '1',
`recovery_notify` tinyint(3) default '0',
`priority` tinyint(4) default '0',
`al_f2_recovery` varchar(255) NOT NULL default '',
`al_f3_recovery` mediumtext NOT NULL default '',
PRIMARY KEY (`id_aam`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/* next changes planned for talerta_agente_modulo
`al_f2_recovery` varchar(255) default '',
`al_f3_recovery` mediumtext NOT NULL,
`priority tinyint(4) default '0',
Implementation of priority for alerts, and different fields for recovery notification
*/
CREATE TABLE `tattachment` (
`id_attachment` bigint(20) unsigned NOT NULL auto_increment,

View File

@ -153,7 +153,7 @@ INSERT INTO `tnews` VALUES (1,'admin','Welcome to Pandora FMS 2.0!','This is the
INSERT INTO tmodule VALUES (1,'Agent module');
INSERT INTO tmodule VALUES (2,'Network module');
INSERT INTO tmodule VALUES (4,'Plugin module');
INSERT INTO tmodule VALUES (5,'IA module');
INSERT INTO tmodule VALUES (5,'Prediction module');
INSERT INTO tmodule VALUES (6,'WMI module');
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (1,'OS Total process','Total process in Operating System (UNIX MIB)',13,15,0,0,180,0,'','','public','HOST-RESOURCES-MIB::hrSystemProcesses.0 ',4);