2008-07-01 Sancho Lerena <slerena@gmail.com>
* include/config_process.php: Default back to 1 week. * estado_monitores.php: Removed SLA check from there. Too slow for a main view. * operation/agentes/ver_agente.php: Modified tabs to have SLA view. * operation/agentes/sla_view.php: New SLA specific view, show all automatic SLA coming from monitor data and add's individual items from a SLA report defined for any module of this agent. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@915 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
921c6c005d
commit
a55712d32a
|
@ -1,3 +1,16 @@
|
|||
2008-07-01 Sancho Lerena <slerena@gmail.com>
|
||||
|
||||
* include/config_process.php: Default back to 1 week.
|
||||
|
||||
* estado_monitores.php: Removed SLA check from there. Too slow for a
|
||||
main view.
|
||||
|
||||
* operation/agentes/ver_agente.php: Modified tabs to have SLA view.
|
||||
|
||||
* operation/agentes/sla_view.php: New SLA specific view, show all
|
||||
automatic SLA coming from monitor data and add's individual items
|
||||
from a SLA report defined for any module of this agent.
|
||||
|
||||
2008-07-01 Jorge Gonzalez <jorgegonz@artica>
|
||||
|
||||
* images/help.png: new help image.
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
// Begin of automatic config file
|
||||
$config["dbname"]="pandora"; // MySQL DataBase name
|
||||
$config["dbuser"]="pandora"; // DB User
|
||||
$config["dbpass"]="pandora"; // DB Password
|
||||
$config["dbpass"]="dstxhvec"; // DB Password
|
||||
$config["dbhost"]="localhost"; // DB Host
|
||||
$config["homedir"]="/var/www/pandora_console/"; // Config homedir
|
||||
$config["homeurl"]="http://localhost/pandora_console"; // Base URL
|
||||
$config["homedir"]="/var/www/pandora/"; // Config homedir
|
||||
$config["homeurl"]="http://192.168.50.1/pandora"; // Base URL
|
||||
|
||||
// End of automatic config file
|
||||
?><?php
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
require("include/config.php");
|
||||
if (comprueba_login() == 0) {
|
||||
|
||||
|
||||
require ("include/functions_reporting.php");
|
||||
|
||||
// $id_agente can be obtained as global variable or GET param.
|
||||
if (isset($_GET["id_agente"])){
|
||||
$id_agente = $_GET["id_agente"];
|
||||
|
@ -36,7 +33,7 @@ if (comprueba_login() == 0) {
|
|||
echo "<tr><th>X</th>";
|
||||
echo "<th>".$lang_label["type"]."</th>
|
||||
<th>".$lang_label["module_name"]."</th>
|
||||
<th>".$lang_label["SLA"]."</th>
|
||||
<th>".$lang_label["description"]."</th>
|
||||
<th>".$lang_label["status"]."</th>
|
||||
<th>".$lang_label["interval"]."</th>
|
||||
<th>".$lang_label["last_contact"]."</th>";
|
||||
|
@ -86,15 +83,9 @@ if (comprueba_login() == 0) {
|
|||
}
|
||||
echo "<td class='".$tdcolor."'>";
|
||||
echo "<img src='images/".show_icon_type($row_t["id_tipo_modulo"])."' border=0>";
|
||||
echo "<td class='".$tdcolor."' title='".$est_description."'>".$est_modulo."</td>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
|
||||
$temp = return_module_SLA ($row_t["id_agente_modulo"], $config["sla_period"], 1, 2147483647);
|
||||
if ($temp === false)
|
||||
echo lang_string("N/A");
|
||||
else
|
||||
echo "$temp %</td>";;
|
||||
|
||||
echo "<td class='".$tdcolor."'>".$est_modulo."</td>";
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
echo substr($est_description,0,35);
|
||||
echo "<td class='".$tdcolor."' align='center'>";
|
||||
if ($est_estado == 1){
|
||||
if ($est_cambio == 1)
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
<?php
|
||||
// Pandora FMS
|
||||
// ====================================
|
||||
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas S.L, info@artica.es
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
// 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
|
||||
global $config;
|
||||
$id_user = $config["id_user"];
|
||||
|
||||
|
||||
if (comprueba_login() != 0) {
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ((give_acl($id_user, 0, "AR")!=1) AND (give_acl($id_user,0,"AW")!=1)) {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
|
||||
"Trying to access SLA View");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
require ("include/functions_reporting.php");
|
||||
|
||||
|
||||
echo "<h2>".lang_string("SLA view")."</h2>";
|
||||
$id_agent = get_parameter ("id_agente", "0");
|
||||
|
||||
// Get all module from agent
|
||||
$sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_modulo.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agent.' AND tagente_estado.estado != 100 AND tagente_estado.utimestamp != 0 ORDER BY tagente_modulo.nombre';
|
||||
$result_t=mysql_query($sql_t);
|
||||
if (mysql_num_rows ($result_t)) {
|
||||
echo "<h3>".lang_string ("Automatic SLA for monitors")."</h3>";
|
||||
echo "<table width='750' cellpadding=4 cellspacing=4 class='databox'>";
|
||||
echo "<tr><th>X</th>";
|
||||
echo "<th>".$lang_label["type"]."</th>
|
||||
<th>".$lang_label["module_name"]."</th>
|
||||
<th>".$lang_label["SLA"]."</th>
|
||||
<th>".$lang_label["status"]."</th>
|
||||
<th>".$lang_label["interval"]."</th>
|
||||
<th>".$lang_label["last_contact"]."</th>";
|
||||
$color=0;
|
||||
while ($row_t=mysql_fetch_array($result_t)){
|
||||
# For evey module in the status table
|
||||
$est_modulo = substr($row_t["nombre"],0,25);
|
||||
$est_tipo = dame_nombre_tipo_modulo($row_t["id_tipo_modulo"]);
|
||||
$est_description = $row_t["descripcion"];
|
||||
$est_timestamp = $row_t["timestamp"];
|
||||
$est_estado = $row_t["estado"];
|
||||
$est_datos = $row_t["datos"];
|
||||
$est_cambio = $row_t["cambio"];
|
||||
$est_interval = $row_t["module_interval"];
|
||||
if (($est_interval != $intervalo) && ($est_interval > 0)) {
|
||||
$temp_interval = $est_interval;
|
||||
} else {
|
||||
$temp_interval = $intervalo;
|
||||
}
|
||||
if ($est_estado <>100){ # si no es un modulo de tipo datos
|
||||
# Determinamos si se ha caido el agente (tiempo de intervalo * 2 superado)
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
$seconds = time() - $row_t["utimestamp"];
|
||||
if ($seconds >= ($temp_interval*2)) // If every interval x 2 secs. we get nothing, there's and alert
|
||||
$agent_down = 1;
|
||||
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."' title='".$est_description."'>".$est_modulo."</td>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
|
||||
$temp = return_module_SLA ($row_t["id_agente_modulo"], $config["sla_period"], 1, 2147483647);
|
||||
if ($temp === false)
|
||||
echo lang_string("N/A");
|
||||
else {
|
||||
echo format_numeric($temp)." %</td>";;
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo "<td class='".$tdcolor."' align='center'>";
|
||||
if ($est_estado == 1){
|
||||
if ($est_cambio == 1)
|
||||
echo "<img src='images/pixel_yellow.png' width=40 height=18 title='".$lang_label["yellow_light"]."'>";
|
||||
else
|
||||
echo "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["red_light"]."'>";
|
||||
} else
|
||||
echo "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["green_light"]."'>";
|
||||
|
||||
echo "<td align='center' class='".$tdcolor."'>";
|
||||
if ($temp_interval != $intervalo)
|
||||
echo $temp_interval."</td>";
|
||||
else
|
||||
echo "--";
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
if ($agent_down == 1) { // If agent down, it's shown red and bold
|
||||
echo "<span class='redb'>";
|
||||
}
|
||||
else {
|
||||
echo "<span>";
|
||||
}
|
||||
if ($row_t["timestamp"]=='0000-00-00 00:00:00') {
|
||||
echo $lang_label["never"];
|
||||
} else {
|
||||
echo human_time_comparation($row_t["timestamp"]);
|
||||
}
|
||||
echo "</span></td>";
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Get all SLA report components
|
||||
$sql_t = "SELECT tagente_modulo.id_agente_modulo, sla_max, sla_min, sla_limit, tagente_modulo.id_tipo_modulo, tagente_modulo.nombre, tagente_modulo.descripcion FROM treport_content_sla_combined, tagente_modulo WHERE tagente_modulo.id_agente = $id_agent AND tagente_modulo.id_agente_modulo = treport_content_sla_combined.id_agent_module AND tagente_modulo.id_tipo_modulo IN (1,4,7,8,11,15,16,22,24)";
|
||||
|
||||
$result_t=mysql_query($sql_t);
|
||||
if (mysql_num_rows ($result_t)) {
|
||||
echo "<h3>".lang_string ("User-defined SLA items")."</h3>";
|
||||
echo "<table width='750' cellpadding=4 cellspacing=4 class='databox'>";
|
||||
echo "<tr>";
|
||||
echo "<th>".$lang_label["type"]."</th>
|
||||
<th>".$lang_label["module_name"]."</th>
|
||||
<th>".$lang_label["SLA"]."</th>
|
||||
<th>".$lang_label["status"]."</th>";
|
||||
$color=0;
|
||||
while ($row_t=mysql_fetch_array($result_t)){
|
||||
|
||||
# For evey module in the status table
|
||||
$id_agent_module = $row_t[0];
|
||||
$sla_max = $row_t[1];
|
||||
$sla_min = $row_t[2];
|
||||
$sla_limit = $row_t[3];
|
||||
$id_tipo_modulo = $row_t[4];
|
||||
$name = $row_t[5];
|
||||
$description = $row_t[6];
|
||||
$est_tipo = dame_nombre_tipo_modulo($id_tipo_modulo);
|
||||
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr>";
|
||||
echo "<td class='".$tdcolor."'>";
|
||||
echo "<img src='images/".show_icon_type($id_tipo_modulo)."' border=0>";
|
||||
echo "<td class='".$tdcolor."' title='".$description."'>".$name;
|
||||
echo " ($sla_min/$sla_max/$sla_limit) </td>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
|
||||
$temp = return_module_SLA ($row_t["id_agente_modulo"], $config["sla_period"], $sla_min, $sla_max);
|
||||
if ($temp === false){
|
||||
echo lang_string("N/A");
|
||||
echo "<td class='$tdcolor'>";
|
||||
} else {
|
||||
echo format_numeric($temp)." %</td>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
if ($temp > $sla_limit)
|
||||
echo "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["green_light"]."'>";
|
||||
else
|
||||
echo "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["red_light"]."'>";
|
||||
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
?>
|
|
@ -152,10 +152,7 @@ if (comprueba_login() == 0) {
|
|||
echo "</li>";
|
||||
echo "</ul></div>";
|
||||
|
||||
if (isset($_GET["tab"]))
|
||||
$tab = $_GET["tab"];
|
||||
else
|
||||
$tab = "main";
|
||||
$tab = get_parameter ("tab", "main");
|
||||
echo "<div id='menu_tab'><ul class='mn'>";
|
||||
if (give_acl($id_usuario,$id_grupo, "AW") == 1){
|
||||
if ($tab == "manage")
|
||||
|
@ -190,9 +187,9 @@ if (comprueba_login() == 0) {
|
|||
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>";
|
||||
|
||||
// Go to group view
|
||||
// Go to SLA view
|
||||
echo "<li class='nomn'>";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$id_grupo&refr=60'><img src='images/images.png' class='top' border=0> ".$lang_label["group_view_tab"]." </a>";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente=$id_agente'><img src='images/images.png' class='top' border=0> ".lang_string("SLA")." </a>";
|
||||
echo "</li>";
|
||||
|
||||
echo "</ul>";
|
||||
|
@ -200,11 +197,12 @@ if (comprueba_login() == 0) {
|
|||
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 "sla":
|
||||
require "sla_view.php";
|
||||
break;
|
||||
case "manage":
|
||||
require "estado_generalagente.php";
|
||||
break;
|
||||
|
||||
case "main":
|
||||
require "estado_generalagente.php";
|
||||
require "estado_monitores.php";
|
||||
|
|
Loading…
Reference in New Issue