2007-06-08 Sancho Lerena <slerena@artica.es>
* include/languages/language_en.php: New strings * include/functions_reporting.php: Added generic function to parse information of all monitors / data checks for statistical usage in several sections of console. * pandoradb.sql: Updated field "timestamp" of tnews table. * operation/agentes/estado_grupo.php: Better management of unknown monitors, this should fix odd behaviour detected. * operation/agentes/tactical.php: New tactical view. * operation/menu.php: New option for group view and tactical. Default option now is tactical view. * images/backgrounds/background4.jpg: Updated background. * reporting/Image/Graph/Plot/Odo.php: Fixed warning in original code. * reporting/Image/Canvas/GD.php: Again playing with canvas options. * reporting/fgraph.php: New odo graph. * general/logon_ok.php: New welcome screen :-) * godmode/setup/news.php: New news manager. * godmode/reporting/map_builder.php: Future map/visual console editor, not ready yet. * godmode/menu.php: Updated a few options. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@498 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
d57d19c4df
commit
effc9b3c70
|
@ -1,3 +1,38 @@
|
|||
2007-06-08 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* include/languages/language_en.php: New strings
|
||||
|
||||
* include/functions_reporting.php: Added generic function to parse
|
||||
information of all monitors / data checks for statistical usage in
|
||||
several sections of console.
|
||||
|
||||
* pandoradb.sql: Updated field "timestamp" of tnews table.
|
||||
|
||||
* operation/agentes/estado_grupo.php: Better management of unknown
|
||||
monitors, this should fix odd behaviour detected.
|
||||
|
||||
* operation/agentes/tactical.php: New tactical view.
|
||||
|
||||
* operation/menu.php: New option for group view and
|
||||
tactical. Default option now is tactical view.
|
||||
|
||||
* images/backgrounds/background4.jpg: Updated background.
|
||||
|
||||
* reporting/Image/Graph/Plot/Odo.php: Fixed warning in original code.
|
||||
|
||||
* reporting/Image/Canvas/GD.php: Again playing with canvas options.
|
||||
|
||||
* reporting/fgraph.php: New odo graph.
|
||||
|
||||
* general/logon_ok.php: New welcome screen :-)
|
||||
|
||||
* godmode/setup/news.php: New news manager.
|
||||
|
||||
* godmode/reporting/map_builder.php: Future map/visual console
|
||||
editor, not ready yet.
|
||||
|
||||
* godmode/menu.php: Updated a few options.
|
||||
|
||||
2007-06-08 Raul Mateos <raulofpandora@gmail.com>
|
||||
|
||||
* include/styles/god.css: Updated god51.
|
||||
|
@ -13,9 +48,11 @@
|
|||
|
||||
* godmode/reporting/graph_builder.php: Updated text styles.
|
||||
|
||||
* operation/agentes/datos_agente.php: Updated table length and delete text.
|
||||
* operation/agentes/datos_agente.php: Updated table length and
|
||||
delete text.
|
||||
|
||||
* godmode/modules/manage_network_templates_form.php: Updated with new table style.
|
||||
* godmode/modules/manage_network_templates_form.php: Updated with
|
||||
new table style.
|
||||
|
||||
2007-06-07 Raul Mateos <raulofpandora@gmail.com>
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require("include/functions_reporting.php");
|
||||
|
||||
echo "<div class='jus'>";
|
||||
$nick = $_SESSION['id_usuario'];
|
||||
echo "<h1>" . $lang_label["welcome_title"] . "</h1>";
|
||||
|
@ -83,69 +85,74 @@
|
|||
</div>';
|
||||
}
|
||||
|
||||
echo "<table width=95%>";
|
||||
echo "<tr><td valign='top'>";
|
||||
|
||||
// Site news !
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo '<h2>' . $lang_label["site_news"] . '</h2>';
|
||||
$sql_news = "SELECT * FROM tnews ORDER by utimestamp LIMIT 3";
|
||||
$sql_news = "SELECT * FROM tnews ORDER by timestamp LIMIT 3";
|
||||
if ($result_news = mysql_query ($sql_news)){
|
||||
echo '<table cellpadding="3" cellspacing="3" width="720">';
|
||||
echo '<table cellpadding="4" cellspacing="4" width="270" class="databox">';
|
||||
while ($row = mysql_fetch_array ($result_news)) {
|
||||
echo '<tr><th align="left">';
|
||||
echo $lang_label["at"]. " <i>". $row["utimestamp"] ."</i> ".
|
||||
$lang_label["user"]. " <b>". $row["author"]."</b> ".
|
||||
$lang_label["says"]. ": \"<b>".$row["subject"]."\"</b>";
|
||||
echo '</th></tr>';
|
||||
echo '<tr>';
|
||||
echo "<th><b>".$row["subject"]."</b>";
|
||||
echo "<tr><td>".$lang_label["by"]."<b>".$row["author"]. "</b> ".$lang_label["at"]." <i>".$row["timestamp"]."</i>";
|
||||
echo '<tr><td class=datos>';
|
||||
echo clean_output_breaks($row["text"]);
|
||||
echo '<td><td class=datos3">';
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
echo "<td align='center'>";
|
||||
// Site stats
|
||||
echo '<h2 style="margin-bottom: 10px;">'. $lang_label["stat_title"].'</h2>';
|
||||
echo '<table cellpadding="2" cellspacing="2" width="500"><tr>';
|
||||
// Summary
|
||||
// ~~~~~~~~~~~~~~~
|
||||
$data = general_stats($id_user,0);
|
||||
$monitor_checks = $data[0];
|
||||
$monitor_ok = $data[1];
|
||||
$monitor_bad = $data[2];
|
||||
$monitor_unknown = $data[3];
|
||||
$monitor_alert = $data[4];
|
||||
$total_agents = $data[5];
|
||||
$data_checks = $data[6];
|
||||
$data_unknown = $data[7];
|
||||
$data_alert = $data[8];
|
||||
$data_alert_total = $data[9];
|
||||
$monitor_alert_total = $data[10];
|
||||
$total_alerts = $data_alert_total + $monitor_alert_total;
|
||||
$total_checks = $data_checks + $monitor_checks;
|
||||
|
||||
$monitor_health = format_numeric (($monitor_ok / $monitor_checks) * 100,1);
|
||||
$data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);;
|
||||
$global_health = format_numeric( ((($monitor_ok)+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1);
|
||||
echo "<h3>".$lang_label["tactical_indicator"]."</h3>";
|
||||
echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";
|
||||
|
||||
echo "<br>";
|
||||
|
||||
$query1 = "SELECT COUNT(id_usuario) FROM tusuario";
|
||||
$result = mysql_query ($query1);
|
||||
$row = mysql_fetch_array ($result);
|
||||
echo "<tr><td class=datos>";
|
||||
echo '<span class="users">';
|
||||
echo $lang_label["there_are"] ."<b>". $row[0] . '</b> ' . $lang_label["user_defined"];
|
||||
echo '</span></td></tr>';
|
||||
|
||||
echo "<tr><td class=datos>";
|
||||
$query1 = "SELECT COUNT(id_agente) FROM tagente";
|
||||
$result = mysql_query ($query1);
|
||||
$row = mysql_fetch_array ($result);
|
||||
echo '<span class="agents">';
|
||||
echo $lang_label["there_are"] . "<b>".$row[0]."</b> ". $lang_label["agent_defined"];
|
||||
echo '</span></td></tr>';
|
||||
$users_defined = $row[0];
|
||||
|
||||
echo "<tr><td class=datos>";
|
||||
$query1 = "SELECT COUNT(id_agente_datos) FROM tagente_datos";
|
||||
$result = mysql_query ($query1);
|
||||
$row = mysql_fetch_array ($result);
|
||||
echo '<span class="data">';
|
||||
echo $lang_label["there_are"] . "<b>".$row[0] . '</b> ' . $lang_label["data_harvested"];
|
||||
echo '</span></td></tr>';
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
echo "<th colspan=2>".$lang_label["Pandora_FMS_summary"]."</th>";
|
||||
echo "<tr><td class=datos2><b>"."Total agents";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$total_agents;
|
||||
echo "<tr><td class=datos2><b>"."Total checks";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$total_checks;
|
||||
echo "<tr><td class=datos2><b>"."Monitor BAD";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #ff0000;'>";
|
||||
if ($monitor_bad > 0)
|
||||
echo $monitor_bad;
|
||||
else
|
||||
echo "-";
|
||||
echo "<tr><td class=datos2><b>"."Alerts defined";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$total_alerts;
|
||||
echo "<tr><td class=datos2><b>"."Total users";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$users_defined;
|
||||
echo "</table>";
|
||||
|
||||
echo "<tr><td class=datos>";
|
||||
$query1 = "SELECT COUNT(*) FROM talerta_agente_modulo";
|
||||
$result = mysql_query ($query1);
|
||||
$row = mysql_fetch_array ($result);
|
||||
echo "<span class='alerts'>";
|
||||
echo $lang_label["there_are"] . "<b>".$row[0] .'</b> ' . $lang_label["alert_defined"];
|
||||
echo "</span></td></tr>";
|
||||
|
||||
echo "<tr><td class=datos>";
|
||||
echo '<span class="time">';
|
||||
$query1 = "SELECT timestamp FROM tagente_estado ORDER BY timestamp DESC LIMIT 1";
|
||||
$result = mysql_query($query1);
|
||||
if ($row = mysql_fetch_array($result)) { // Take the first element only
|
||||
echo $lang_label["data_timestamp"] . "<b>".$row["timestamp"]."</b>";
|
||||
} else {
|
||||
echo 'No data received yet!';
|
||||
}
|
||||
echo '</span></td></tr>';
|
||||
echo "</table>";
|
||||
echo '</div>'; // class "jus"
|
||||
?>
|
|
@ -6,10 +6,8 @@
|
|||
// 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
|
||||
// Additions to Pandora FMS 1.2 graph code
|
||||
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
|
@ -22,6 +20,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.
|
||||
|
||||
if (comprueba_login() == 0){
|
||||
$id_user = $_SESSION["id_usuario"];
|
||||
if ( (give_acl($id_user, 0, "LM")==1) OR (give_acl($id_user, 0, "AW")==1 ) OR (give_acl($id_user, 0, "PM")==1) OR (give_acl($id_user, 0, "DM")==1) OR (give_acl($id_user, 0, "UM")==1 )){
|
||||
|
@ -129,6 +128,16 @@ if (comprueba_login() == 0){
|
|||
}
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=greporting&sec2=godmode/reporting/graph_builder' class='mn'>".$lang_label["graph_builder"]."</a></li></ul></div>";
|
||||
}
|
||||
|
||||
// Custom map builder
|
||||
if (isset($_GET["sec"]) && $_GET["sec"] == "greporting"){
|
||||
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/reporting/map_builder"){
|
||||
echo "<div class='arrowgs'>";
|
||||
} else {
|
||||
echo "<div class='arrowg'>";
|
||||
}
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=greporting&sec2=godmode/reporting/map_builder' class='mn'>".$lang_label["map_builder"]."</a></li></ul></div>";
|
||||
}
|
||||
}
|
||||
|
||||
// Manage profiles
|
||||
|
@ -181,6 +190,14 @@ if (comprueba_login() == 0){
|
|||
else echo "<div class='arrowg'>";
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=gsetup&sec2=godmode/setup/links' class='mn'>".$lang_label["setup_links"]."</a></li></ul></div>";
|
||||
}
|
||||
|
||||
if (isset($_GET["sec"]) && $_GET["sec"] == "gsetup"){
|
||||
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/setup/news"){
|
||||
echo "<div class='arrowgs'>";
|
||||
}
|
||||
else echo "<div class='arrowg'>";
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=gsetup&sec2=godmode/setup/news' class='mn'>".$lang_label["site_news"]."</a></li></ul></div>";
|
||||
}
|
||||
}
|
||||
if ((give_acl($id_user, 0, "DM")==1)){
|
||||
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/db/db_main"){
|
||||
|
|
|
@ -0,0 +1,424 @@
|
|||
<?PHP
|
||||
|
||||
// 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) 2005-2007 Artica Soluciones Tecnologicas, 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; 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.
|
||||
|
||||
// Login check
|
||||
$id_user=$_SESSION["id_usuario"];
|
||||
global $REMOTE_ADDR;
|
||||
|
||||
if (comprueba_login() != 0) {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access map builder");
|
||||
include ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (give_acl($id_user, 0, "AW")!=1){
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access map builder");
|
||||
include ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$form_report_name = "";
|
||||
$form_report_private=0;
|
||||
$form_report_description = "";
|
||||
$createmode = 1;
|
||||
|
||||
if (isset($_GET["get_agent"])) {
|
||||
$id_agent = $_POST["id_agent"];
|
||||
}
|
||||
|
||||
// Delete module SQL code
|
||||
if (isset($_GET["delete"])){
|
||||
$id_content = $_GET["delete"];
|
||||
$sql = "DELETE FROM treport_content WHERE id_rc = $id_content";
|
||||
if ($res=mysql_query($sql))
|
||||
$result = "<h2 class=suc>".$lang_label["delete_ok"]."</h2>";
|
||||
else
|
||||
$result = "<h2 class=error>".$lang_label["delete_no"]."</h2>";
|
||||
echo $result;
|
||||
}
|
||||
|
||||
// Delete module SQL code
|
||||
if (isset($_GET["delete_report"])){
|
||||
$id = $_GET["delete_report"];
|
||||
$sql = "DELETE FROM treport_content WHERE id_report = $id";
|
||||
$sql2 = "DELETE FROM treport WHERE id_report = $id";
|
||||
$res=mysql_query($sql);
|
||||
$res2=mysql_query($sql2);
|
||||
if ($res AND $res2)
|
||||
$result = "<h2 class=suc>".$lang_label["delete_ok"]."</h2>";
|
||||
else
|
||||
$result = "<h2 class=error>".$lang_label["delete_no"]."</h2>";
|
||||
echo $result;
|
||||
}
|
||||
|
||||
// Create new report. First step
|
||||
if (isset($_GET["create_report"])){
|
||||
$createmode = 2;
|
||||
}
|
||||
|
||||
// Add module SQL code
|
||||
if (isset($_GET["add_module"])){
|
||||
if (isset($_POST["id_report"]))
|
||||
$id_report = $_POST["id_report"];
|
||||
else {
|
||||
audit_db($id_user,$REMOTE_ADDR, "Hack attempt","Parameter trash in report builder");
|
||||
include ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
$my_id_agent = entrada_limpia($_POST["id_agent"]);
|
||||
$my_id_module = entrada_limpia($_POST["id_module"]);
|
||||
$my_period = entrada_limpia($_POST["period"]);
|
||||
$my_type = entrada_limpia($_POST["type"]);
|
||||
$my_cg = entrada_limpia($_POST["id_custom_graph"]);
|
||||
$my_slamax = entrada_limpia($_POST["sla_max"]);
|
||||
$my_slamin = entrada_limpia($_POST["sla_min"]);
|
||||
$my_slalimit = entrada_limpia($_POST["sla_limit"]);
|
||||
|
||||
$sql = "INSERT INTO treport_content (id_report, id_gs, id_agent_module, type, sla_max, sla_min, sla_limit, period) VALUES ('$id_report', '$my_cg', '$my_id_module', '$my_type', '$my_slamax', '$my_slamin', '$my_slalimit', '$my_period')";
|
||||
if ($res=mysql_query($sql))
|
||||
$result = "<h2 class=suc>".$lang_label["create_ok"]."</h2>";
|
||||
else
|
||||
$result = "<h2 class=error>".$lang_label["create_no"]."</h2>";
|
||||
echo $result;
|
||||
}
|
||||
|
||||
// Create item SQL code
|
||||
if (isset($_POST["createmode"])){
|
||||
$createmode = $_POST["createmode"];
|
||||
$form_report_name = entrada_limpia($_POST["report_name"]);
|
||||
$form_report_description = entrada_limpia($_POST["report_description"]);
|
||||
if (isset($_POST["report_private"]))
|
||||
$form_report_private = entrada_limpia($_POST["report_private"]);
|
||||
else
|
||||
$form_report_private = 0;
|
||||
|
||||
// INSERT REPORT DATA
|
||||
if ($createmode == 1){
|
||||
$form_id_user = $id_user;
|
||||
$sql = "INSERT INTO treport (name, description, id_user, private) VALUES ('$form_report_name', '$form_report_description', '$form_id_user', '$form_report_private')";
|
||||
if ($res=mysql_query($sql))
|
||||
$result = "<h1 class=suc>".$lang_label["create_ok"]."</h1>";
|
||||
else
|
||||
$result = "<h1 class=error>".$lang_label["create_no"]."</h1>";
|
||||
$id_report = mysql_insert_id();
|
||||
// UPDATE REPORT DATA
|
||||
} else {
|
||||
$form_id_report = entrada_limpia($_POST["id_report"]);
|
||||
$id_report = $form_id_report;
|
||||
$sql = "UPDATE treport SET name = '$form_report_name', description = '$form_report_description', private = '$form_report_private' WHERE id_report = $form_id_report";
|
||||
if ($res=mysql_query($sql))
|
||||
$result = "<h2 class=suc>".$lang_label["modify_ok"]."</h2>";
|
||||
else
|
||||
$result = "<h2 class=error>".$lang_label["modify_no"]."</h2>";
|
||||
}
|
||||
echo $result;
|
||||
if ($id_report != ""){
|
||||
$_GET["id"]=$id_report;
|
||||
$createmode=0;
|
||||
}
|
||||
}
|
||||
|
||||
// GET DATA OF REPORT
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ($createmode==2 OR isset($_GET["id"]) OR (isset($_POST["id_report"]))) {
|
||||
if (isset($_GET["id"]))
|
||||
$id_report = $_GET["id"];
|
||||
elseif (isset($_POST["id_report"]))
|
||||
$id_report = $_POST["id_report"];
|
||||
else
|
||||
$id_report = -1;
|
||||
|
||||
if (isset($_POST["id_agent"]))
|
||||
$id_agent = $_POST["id_agent"];
|
||||
else
|
||||
$id_agent = 0;
|
||||
if ($createmode != 2){
|
||||
$createmode = 0;
|
||||
$sql = "SELECT * FROM treport WHERE id_report = $id_report";
|
||||
$res=mysql_query($sql);
|
||||
if ($row = mysql_fetch_array($res)){
|
||||
$form_report_name = $row["name"];
|
||||
$form_report_description = $row["description"];
|
||||
$form_report_private = $row["private"];
|
||||
$form_id_user = $row["id_user"];
|
||||
}
|
||||
} else {
|
||||
$form_report_name = "";
|
||||
$form_report_description = "";
|
||||
$form_report_private = 0;
|
||||
$form_id_user = $id_user;
|
||||
$createmode = 1;
|
||||
}
|
||||
|
||||
echo "<h1>".$lang_label["custom_reporting_builder"]."</h1>";
|
||||
echo "<form method='post' action='index.php?sec=greporting&sec2=godmode/reporting/reporting_builder'>";
|
||||
echo "<input type='hidden' name=createmode value='$createmode'>";
|
||||
if ($createmode == 0){
|
||||
echo "<input type='hidden' name=id_report value='$id_report'>";
|
||||
}
|
||||
echo "<table width=500 cellspacing=4 cellpading=4 class='databox_color'>";
|
||||
|
||||
echo "<tr><td class='datos2'>";
|
||||
echo $lang_label["report_name"];
|
||||
echo "<td class='datos2'>";
|
||||
echo "<input type=text size=35 name='report_name' value='$form_report_name'>";
|
||||
|
||||
echo "<tr><td class='datos'>";
|
||||
echo $lang_label["private"];
|
||||
echo "<td class='datos'>";
|
||||
if ($form_report_private == 1)
|
||||
echo "<input type=checkbox name='report_private' value=1 CHECKED>";
|
||||
else
|
||||
echo "<input type=checkbox name='report_private' value=1>";
|
||||
|
||||
echo "<tr><td class='datos2' valign='top'>";
|
||||
echo $lang_label["description"];
|
||||
echo "<td class='datos2'>";
|
||||
echo "<textarea name='report_description' cols=40 rows=3>";
|
||||
echo $form_report_description;
|
||||
echo "</textarea>";
|
||||
|
||||
|
||||
// Button
|
||||
echo "</table>";
|
||||
echo "<table width=500 cellspacing=4 cellpading=4'>";
|
||||
echo "<tr><td align='right'>";
|
||||
if ($createmode == 0)
|
||||
echo "<input type='submit' class='sub next' value='".$lang_label["update"]."'>";
|
||||
else
|
||||
echo "<input type='submit' class='sub wand' value='".$lang_label["create"]."'>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
if ($createmode == 0){
|
||||
// Part 2 - Add new items to report
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
echo "<h2>".$lang_label["reporting_item_add"]."</h2>";
|
||||
|
||||
// Show combo with agents
|
||||
// ----------------------
|
||||
|
||||
echo "<table width='500' cellpadding=4 cellpadding=4 class='databox_color'>";
|
||||
echo "<form method='post' action='index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&get_agent=1'>";
|
||||
echo "<input type='hidden' name=id_report value='$id_report'>";
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'><b>".$lang_label["source_agent"];
|
||||
echo "</b>";
|
||||
echo "<td class='datos' colspan=2><select name='id_agent' style='width:180px;'>";
|
||||
if ($id_agent != 0)
|
||||
echo "<option value='$id_agent'>".dame_nombre_agente($id_agent);
|
||||
$sql1='SELECT * FROM tagente order by nombre';
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ( $id_agent != $row["id_agente"])
|
||||
echo "<option value=".$row["id_agente"].">".$row["nombre"];
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
|
||||
echo "<td class='datos' colspan=1 align='right'><input type=submit name='update_agent' class='sub upd' value='".$lang_label["get_info"]."'>";
|
||||
echo "</form>";
|
||||
|
||||
// Modules combo
|
||||
// -----------------------
|
||||
echo "<form method='post' action='index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&add_module=1'>";
|
||||
echo "<input type='hidden' name=id_report value='$id_report'>";
|
||||
if (isset($id_agent))
|
||||
echo "<input type='hidden' name='id_agent' value='$id_agent'>";
|
||||
|
||||
echo "<tr><td class='datos2'>";
|
||||
echo "<b>".$lang_label["modules"]."</b>";
|
||||
echo "<td class='datos2' colspan=3>";
|
||||
echo "<select name='id_module' size=1 style='width:180px;'>";
|
||||
echo "<option value=-1> --";
|
||||
if ($id_agent != 0){
|
||||
// Populate Module/Agent combo
|
||||
$sql1="SELECT * FROM tagente_modulo WHERE id_agente = ".$id_agent. " order by nombre";
|
||||
$result = mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
echo "<option value=".$row["id_agente_modulo"].">".$row["nombre"];
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
// Component type
|
||||
echo "<tr><td class='datos'>";
|
||||
echo "<b>".$lang_label["reporting_type"]."</b>";
|
||||
echo "<td class='datos' colspan=3>";
|
||||
echo "<select name='type' size=1 style='width:180px;'>";
|
||||
echo "<option value=0>".$lang_label["simple_graph"];
|
||||
echo "<option value=1>".$lang_label["custom_graph"];
|
||||
echo "<option value=2>".$lang_label["SLA"];
|
||||
echo "<option value=3>".$lang_label["event_report"];
|
||||
echo "<option value=4>".$lang_label["alert_report"];
|
||||
echo "<option value=5>".$lang_label["monitor_report"];
|
||||
echo "<option value=6>".$lang_label["avg_value"];
|
||||
echo "<option value=7>".$lang_label["max_value"];
|
||||
echo "<option value=8>".$lang_label["min_value"];
|
||||
echo "</select>";
|
||||
|
||||
// Custom graph
|
||||
// -----------------------
|
||||
echo "<tr><td class='datos2'>";
|
||||
echo "<b>".$lang_name["custom_graph_name"]."</b>";
|
||||
echo "<td class='datos2' colspan=3>";
|
||||
echo "<select name='id_custom_graph' size=1 style='width:180px;'>";
|
||||
$sql1="SELECT * FROM tgraph";
|
||||
$result = mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
echo "<option value=".$row["id_graph"].">".$row["name"];
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
|
||||
// Period
|
||||
echo "<tr><td class='datos'>";
|
||||
echo "<b>".$lang_label["period"]."</b>";
|
||||
echo "<td class='datos' colspan=3>";
|
||||
echo "<select name='period'>";
|
||||
echo "<option value=3600>"."Hour";
|
||||
echo "<option value=7200>"."2 Hours";
|
||||
echo "<option value=10800>"."3 Hours";
|
||||
echo "<option value=21600>"."6 Hours";
|
||||
echo "<option value=43200>"."12 Hours";
|
||||
echo "<option value=86400>"."Last day";
|
||||
echo "<option value=172800>"."Two days";
|
||||
echo "<option value=604800>"."Last Week";
|
||||
echo "<option value=1296000>"."15 days";
|
||||
echo "<option value=2592000>"."Last Month";
|
||||
echo "<option value=5184000>"."Two Month";
|
||||
echo "<option value=15552000>"."Six Months";
|
||||
echo "</select>";
|
||||
|
||||
// SLA Max
|
||||
echo "<tr><td class='datos2'>";
|
||||
echo "<b>".$lang_label["sla_max"]."</b>";
|
||||
echo "<td class='datos2'>";
|
||||
echo "<input type=text size=6 name='sla_max'>";
|
||||
// SLA Min
|
||||
echo "<td class='datos2'>";
|
||||
echo "<b>".$lang_label["sla_min"]."</b>";
|
||||
echo "<td class='datos2'>";
|
||||
echo "<input type=text size=6 name='sla_min'>";
|
||||
|
||||
// SLA limit
|
||||
echo "<tr><td class='datos'>";
|
||||
echo "<b>".$lang_label["sla_limit"]."</b>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<input type=text size=6 name='sla_limit'>";
|
||||
echo "</table>";
|
||||
|
||||
echo "<table width=500 cellspacing=4 cellpading=4'>";
|
||||
echo "<tr><td align='right'>";
|
||||
echo "<input type='submit' class='sub wand' value='".$lang_label["add"]."'>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
|
||||
// Part 3 - List of already assigned report items
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
echo "<h2>".$lang_label["report_items"]."</h2>";
|
||||
echo "<table width=500 cellspacing=4 cellpadding=4 class='databox'>";
|
||||
echo "<tr><th>".$lang_label["type"]."<th>".$lang_label["agent_name"]."<th>".$lang_label["module_name"]."<th>".$lang_label["period"]."<th>".$lang_label["delete"];
|
||||
$sql = "SELECT * FROM treport_content WHERE id_report = $id_report";
|
||||
$res=mysql_query($sql);
|
||||
$color = 0;
|
||||
while ($row = mysql_fetch_array($res)){
|
||||
// Calculate table line color
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
$id_rc = $row["id_rc"];
|
||||
$type = $row["type"];
|
||||
switch ($type){
|
||||
case "0": $type_desc = "Graph"; break;
|
||||
case "1": $type_desc = "User graph"; break;
|
||||
case "2": $type_desc = "SLA"; break;
|
||||
case "3": $type_desc = "Event report"; break;
|
||||
case "4": $type_desc = "Alert report"; break;
|
||||
case "5": $type_desc = "Monitor report"; break;
|
||||
case "6": $type_desc = "Avg.Value"; break;
|
||||
case "7": $type_desc = "Max.Value"; break;
|
||||
case "8": $type_desc = "Min.Value"; break;
|
||||
}
|
||||
$period = $row["period"];
|
||||
$id_am = $row["id_agent_module"];
|
||||
$name = "N/A";
|
||||
$agent_name = "N/A";
|
||||
if ($id_am != ""){
|
||||
$agent_name = dame_nombre_agente_agentemodulo ($id_am);
|
||||
$module_name = dame_nombre_modulo_agentemodulo ($id_am);
|
||||
}
|
||||
echo "<tr>";
|
||||
echo "<td class='$tdcolor'>".$type_desc;
|
||||
echo "<td class='$tdcolor'>".$agent_name;
|
||||
echo "<td class='$tdcolor'>".$module_name;
|
||||
echo "<td class='$tdcolor'>".$period;
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
if ($form_id_user == $id_user){
|
||||
echo "<a href='index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&id=1&delete=$id_rc'><img src='images/cancel.gif'></A>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
} else {
|
||||
// Map LIST Selecteion screen
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo "<h3>".$lang_label["map_builder"]."</h3>";
|
||||
echo "<table width='500' cellpadding=4 cellpadding=4 class='databox'>";
|
||||
echo "<tr><th>".$lang_label["map_name"]."<th>".$lang_label["description"]."<th>".$lang_label["Manage"]."<th>".$lang_label["delete"];
|
||||
$color=1;
|
||||
$sql="SELECT * FROM tgraph";
|
||||
$res=mysql_query($sql);
|
||||
while ($row = mysql_fetch_array($res)){
|
||||
if (($row["private"]==0) OR ($row["id_user"] == $id_user) OR (dame_admin($id_user)==1)){
|
||||
// Calculate table line color
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr>";
|
||||
echo "<td valign='top' class='$tdcolor'>".$row["name"];
|
||||
echo "<td class='$tdcolor'>".$row["description"];
|
||||
$id_graph = $row["id_graph"];
|
||||
echo "<td valign='middle' class='$tdcolor' align='center'><a href='index.php?sec=greporting&sec2=godmode/reporting/map_builder&id=$id_graph'><img src='images/setup.png'></A>";
|
||||
echo "<td valign='middle' class='$tdcolor' align='center'><a href='index.php?sec=greporting&sec2=godmode/reporting/map_builder&delete_graph=$id_graph'><img src='images/cancel.gif'></A>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<table width=500 cellpadding=4 cellpadding=4>";
|
||||
echo "<form method=post action='index.php?sec=greporting&sec2=godmode/reporting/map_builder&create_graph=1'>";
|
||||
echo "<tr><td align='right'>";
|
||||
echo "<input type=submit class='sub wizard' value='".$lang_label["add"]."'>";
|
||||
echo "</form>";
|
||||
echo "</table>";
|
||||
}
|
||||
?>
|
|
@ -275,6 +275,7 @@ if ($createmode==2 OR isset($_GET["id"]) OR (isset($_POST["id_report"]))) {
|
|||
echo "<b>".$lang_name["custom_graph_name"]."</b>";
|
||||
echo "<td class='datos2' colspan=3>";
|
||||
echo "<select name='id_custom_graph' size=1 style='width:180px;'>";
|
||||
echo "<option value="-1">".$row["N/A"];
|
||||
$sql1="SELECT * FROM tgraph";
|
||||
$result = mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
|
@ -282,7 +283,6 @@ if ($createmode==2 OR isset($_GET["id"]) OR (isset($_POST["id_report"]))) {
|
|||
}
|
||||
echo "</select>";
|
||||
|
||||
|
||||
// Period
|
||||
echo "<tr><td class='datos'>";
|
||||
echo "<b>".$lang_label["period"]."</b>";
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
<?php
|
||||
// Pandora - The Free Monitoring System
|
||||
// This code is protected by GPL license.
|
||||
// Este codigo esta protegido por la licencia GPL.
|
||||
// Sancho Lerena <slerena@gmail.com>, 2003-2007
|
||||
// Raul Mateos <raulofpandora@gmail.com>, 2005-2007
|
||||
|
||||
// Load global vars
|
||||
if (comprueba_login() == 0)
|
||||
$id_user = $_SESSION["id_usuario"];
|
||||
if (give_acl($id_user, 0, "PM")==1) {
|
||||
|
||||
if (isset($_POST["create"])){ // If create
|
||||
$subject = entrada_limpia($_POST["subject"]);
|
||||
$text = entrada_limpia($_POST["text"]);
|
||||
$timestamp = $ahora=date("Y/m/d H:i:s");
|
||||
$author = $id_user;
|
||||
|
||||
$sql_insert="INSERT INTO tnews (subject, text, author, timestamp) VALUES ('$subject','$text', '$author', '$timestamp') ";
|
||||
$result=mysql_query($sql_insert);
|
||||
if (! $result)
|
||||
echo "<h3 class='error'>".$lang_label["create_no"]."</h3>";
|
||||
else {
|
||||
echo "<h3 class='suc'>".$lang_label["create_ok"]."</h3>";
|
||||
$id_link = mysql_insert_id();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST["update"])){ // if update
|
||||
$id_news = entrada_limpia($_POST["id_news"]);
|
||||
$subject = entrada_limpia($_POST["subject"]);
|
||||
$text = entrada_limpia($_POST["text"]);
|
||||
$timestamp = $ahora=date("Y/m/d H:i:s");
|
||||
$sql_update ="UPDATE tnews SET subject = '".$subject."', text ='".$text."', timestamp = '$timestamp' WHERE id_news = '".$id_news."'";
|
||||
$result=mysql_query($sql_update);
|
||||
if (! $result)
|
||||
echo "<h3 class='error'>".$lang_label["modify_no"]."</h3>";
|
||||
else
|
||||
echo "<h3 class='suc'>".$lang_label["modify_ok"]."</h3>";
|
||||
}
|
||||
|
||||
if (isset($_GET["borrar"])){ // if delete
|
||||
$id_news = entrada_limpia($_GET["borrar"]);
|
||||
$sql_delete= "DELETE FROM tnews WHERE id_news = ".$id_news;
|
||||
$result=mysql_query($sql_delete);
|
||||
if (! $result)
|
||||
echo "<h3 class='error'>".$lang_label["delete_no"]."</h3>";
|
||||
else
|
||||
echo "<h3 class='suc'>".$lang_label["delete_ok"]."</h3>";
|
||||
|
||||
}
|
||||
|
||||
// Main form view for Links edit
|
||||
if ((isset($_GET["form_add"])) or (isset($_GET["form_edit"]))){
|
||||
if (isset($_GET["form_edit"])){
|
||||
$creation_mode = 0;
|
||||
$id_news = entrada_limpia($_GET["id_news"]);
|
||||
$sql1='SELECT * FROM tnews WHERE id_news = '.$id_news;
|
||||
$result=mysql_query($sql1);
|
||||
if ($row=mysql_fetch_array($result)){
|
||||
$subject = $row["subject"];
|
||||
$text = $row["text"];
|
||||
$author = $row["author"];
|
||||
$timestamp = $row["timestamp"];
|
||||
}
|
||||
else echo "<h3 class='error'>".$lang_label["name_error"]."</h3>";
|
||||
} else { // form_add
|
||||
$creation_mode =1;
|
||||
$text = "";
|
||||
$subject = "";
|
||||
$author = $id_user;
|
||||
}
|
||||
|
||||
// Create news
|
||||
echo "<h2>".$lang_label["setup_screen"]." > ";
|
||||
echo $lang_label["site_news_management"]."</h2>";
|
||||
echo '<table class="databox" cellpadding="4" cellspacing="4" width="500">';
|
||||
echo '<form name="ilink" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/news">';
|
||||
if ($creation_mode == 1)
|
||||
echo "<input type='hidden' name='create' value='1'>";
|
||||
else
|
||||
echo "<input type='hidden' name='update' value='1'>";
|
||||
echo "<input type='hidden' name='id_news' value='";
|
||||
if (isset($id_news)) {
|
||||
echo $id_news;
|
||||
}
|
||||
echo "'>";
|
||||
echo '<tr>
|
||||
<td class="datos">'.$lang_label["subject"].'</td>
|
||||
<td class="datos"><input type="text" name="subject" size="35" value="'.$subject.'">';
|
||||
echo '<tr>
|
||||
<td class="datos2">'.$lang_label["text"].'</td>
|
||||
<td class="datos2">
|
||||
<textarea rows=4 cols=50 name="text" >';
|
||||
echo $text;
|
||||
echo '</textarea></td>';
|
||||
echo '</tr>';
|
||||
echo "</table>";
|
||||
echo "<table width='500px'>";
|
||||
echo "<tr><td align='right'>
|
||||
<input name='crtbutton' type='submit' class='sub upd' value='".$lang_label["update"]."'>";
|
||||
echo '</form></td></tr></table>';
|
||||
}
|
||||
|
||||
else { // Main list view for Links editor
|
||||
echo "<h2>".$lang_label["setup_screen"]." > ";
|
||||
echo $lang_label["site_news_management"]."</h3>";
|
||||
echo "<table cellpadding='4' cellspacing='4' class='databox' width=600>";
|
||||
echo "<th width='180px'>".$lang_label["subject"]."</th>";
|
||||
echo "<th width='180px'>".$lang_label["author"]."</th>";
|
||||
echo "<th width='180px'>".$lang_label["timestamp"]."</th>";
|
||||
echo "<th width='80px'>".$lang_label["delete"]."</th>";
|
||||
$sql1='SELECT * FROM tnews ORDER BY timestamp';
|
||||
$result=mysql_query($sql1);
|
||||
$color=1;
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr><td class='$tdcolor'><b><a href='index.php?sec=gsetup&sec2=godmode/setup/news&form_edit=1&id_news=".$row["id_news"]."'>".$row["subject"]."</a></b></td>";
|
||||
|
||||
echo "<td class='$tdcolor'>".$row["author"]."</b></td>";
|
||||
echo "<td class='$tdcolor'>".$row["timestamp"]."</b></td>";
|
||||
|
||||
echo '<td class="'.$tdcolor.'" align="center"><a href="index.php?sec=gsetup&sec2=godmode/setup/news&id_news='.$row["id_news"].'&borrar='.$row["id_news"].'" onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;"><img border=0 src="images/cross.png"></a></td></tr>';
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<table width='600'>";
|
||||
echo "<tr><td align='right'>";
|
||||
echo "<form method='post' action='index.php?sec=gsetup&sec2=godmode/setup/news&form_add=1'>";
|
||||
echo "<input type='submit' class='sub next' name='form_add' value='".$lang_label["add"]."'>";
|
||||
echo "</form></table>";
|
||||
} // Fin bloque else
|
||||
} else {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Link Management");
|
||||
require ("general/noaccess.php");
|
||||
}
|
||||
|
||||
?>
|
Binary file not shown.
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.6 KiB |
|
@ -40,5 +40,104 @@ function return_module_SLA ($id_agent_module, $period, $min_value, $max_value){
|
|||
return $result;
|
||||
}
|
||||
|
||||
function general_stats ( $id_user, $id_group = 0) {
|
||||
if ($id_group <= 0)
|
||||
// Get group list that user has access
|
||||
$mis_grupos = list_group2 ($id_user);
|
||||
else
|
||||
$mis_grupos[0] = $id_group;
|
||||
|
||||
$contador_grupo = 0;
|
||||
$contador_agente = 0;
|
||||
$array_index = 0;
|
||||
|
||||
$monitor_checks = 0;
|
||||
$monitor_ok = 0;
|
||||
$monitor_bad = 0;
|
||||
$monitor_unknown =0;
|
||||
$monitor_alert = 0;
|
||||
$total_agents = 0;
|
||||
$data_checks = 0;
|
||||
$data_unknown =0;
|
||||
$data_alert = 0;
|
||||
$data_alert_total = 0;
|
||||
$monitor_alert_total = 0;
|
||||
$ahora=date("Y/m/d H:i:s");
|
||||
$ahora_sec = strtotime($ahora);
|
||||
|
||||
// Prepare data to show
|
||||
// For each valid group for this user, take data from agent and modules
|
||||
foreach ($mis_grupos as $migrupo) {
|
||||
if ($migrupo != "") {
|
||||
$existen_agentes = 0;
|
||||
$sql0 = "SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $migrupo AND disabled = 0";
|
||||
$result0 = mysql_query ($sql0);
|
||||
$row0 = mysql_fetch_array ($result0);
|
||||
$total_agents = $total_agents + $row0[0];
|
||||
if ($row0[0] > 0)
|
||||
$existen_agentes = 1;
|
||||
|
||||
// SQL Join to get monitor status for agents belong this group
|
||||
$sql1 = "SELECT tagente.id_agente, tagente_estado.estado, tagente_estado.datos, tagente_estado.current_interval, tagente_estado.utimestamp, tagente_estado.id_agente_modulo FROM tagente, tagente_estado WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND tagente.id_agente = tagente_estado.id_agente";
|
||||
if ($result1 = mysql_query ($sql1)){
|
||||
while ($row1 = mysql_fetch_array ($result1)) {
|
||||
$id_agente = $row1[0];
|
||||
$estado = $row1[1];
|
||||
$datos = $row1[2];
|
||||
$module_interval = $row1[3];
|
||||
$seconds = $ahora_sec - $row1[4];
|
||||
$id_agente_modulo = $row1[5];
|
||||
if ($estado != 100){
|
||||
// Monitor check
|
||||
$monitor_checks++;
|
||||
if ($seconds >= ($module_interval*2))
|
||||
$monitor_unknown++;
|
||||
elseif ($datos != 0) {
|
||||
$monitor_ok++;
|
||||
} else {
|
||||
$monitor_bad++;
|
||||
}
|
||||
// Alert
|
||||
$sql2 = "SELECT times_fired FROM talerta_agente_modulo WHERE id_agente_modulo = $id_agente_modulo";
|
||||
if ($result2 = mysql_query ($sql2)){
|
||||
if ($row2 = mysql_fetch_array ($result2)){
|
||||
$monitor_alert_total++;
|
||||
if ($row2[0] > 0)
|
||||
$monitor_alert++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Data check
|
||||
if ($seconds >= ($module_interval*2))
|
||||
$data_unknown++;
|
||||
$data_checks++;
|
||||
// Alert
|
||||
$sql2 = "SELECT times_fired FROM talerta_agente_modulo WHERE id_agente_modulo = $id_agente_modulo";
|
||||
if ($result2 = mysql_query ($sql2)){
|
||||
if ($row2 = mysql_fetch_array ($result2)) {
|
||||
$data_alert_total++;
|
||||
if ($row2[0] > 0)
|
||||
$data_alert++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = array();
|
||||
$data[0] = $monitor_checks;
|
||||
$data[1] = $monitor_ok;
|
||||
$data[2] = $monitor_bad;
|
||||
$data[3] = $monitor_unknown;
|
||||
$data[4] = $monitor_alert;
|
||||
$data[5] = $total_agents;
|
||||
$data[6] = $data_checks;
|
||||
$data[7] = $data_unknown;
|
||||
$data[8] = $data_alert;
|
||||
$data[9] = $data_alert_total;
|
||||
$data[10] = $monitor_alert_total;
|
||||
return $data;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -733,6 +733,7 @@ $lang_label["Alerts"]="Alerts";
|
|||
$lang_label["Data"]="Data";
|
||||
$lang_label["Main"]="Main";
|
||||
$lang_label["version"]="Version";
|
||||
$lang_label["tactical_server_information"]="Tactical server information";
|
||||
|
||||
//2 Apr 2007
|
||||
$lang_label["no_rtask"]="There are no recon task configured";
|
||||
|
@ -820,7 +821,17 @@ $lang_label["sla_min"] = "SLA Min. (value)";
|
|||
$lang_label["sla_limit"] = "SLA Limit (%)";
|
||||
$lang_label["up"]="Up";
|
||||
$lang_label["down"]="Down";
|
||||
|
||||
$lang_label["map_builder"]="Map builder";
|
||||
$lang_label["map_name"]="Map name";
|
||||
$lang_label["tactical_view"]="Tactical view";
|
||||
$lang_label["tactical_indicator"]="Tactical indicator";
|
||||
$lang_label["monitor_checks"]="Monitor checks";
|
||||
$lang_label["data_checks"]="Data checks";
|
||||
$lang_label["group_view_menu"]="Group view";
|
||||
$lang_label["site_news"]="Site news";
|
||||
$lang_label["site_news_management"]="Site news management";
|
||||
$lang_label["Pandora_FMS_summary"]="Pandora FMS Overview";
|
||||
$lang_label["by"]="by";
|
||||
$lang_label["create_reporting_ok"]="Reporting successfully created";
|
||||
$lang_label["create_reporting_no"]="There was a problem creating reporting";
|
||||
$lang_label["delete_reporting_ok"]="Reporting successfully deleted";
|
||||
|
|
|
@ -6,10 +6,8 @@
|
|||
// 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
|
||||
// Additions to Pandora FMS 1.2 graph code
|
||||
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
|
@ -22,6 +20,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");
|
||||
|
||||
|
@ -61,6 +60,8 @@
|
|||
$contador_grupo = 0;
|
||||
$contador_agente = 0;
|
||||
$array_index = 0;
|
||||
$ahora=date("Y/m/d H:i:s");
|
||||
$ahora_sec = strtotime($ahora);
|
||||
// Prepare data to show
|
||||
// For each valid group for this user, take data from agent and modules
|
||||
foreach ($mis_grupos as $migrupo) {
|
||||
|
@ -83,26 +84,19 @@
|
|||
if ($row0[0] > 0)
|
||||
$existen_agentes = 1;
|
||||
|
||||
// Get timestamp status (down or not for each agent)
|
||||
$sql1 = "SELECT intervalo, ultimo_contacto FROM tagente where id_grupo = $migrupo";
|
||||
if ($result1 = mysql_query ($sql1))
|
||||
while ($row1 = mysql_fetch_array ($result1)) {
|
||||
// Check unknown contact status for whole agent
|
||||
$ultimo_contacto = $row1[1];
|
||||
$agent_interval = $row1[0];
|
||||
$ahora=date("Y/m/d H:i:s");
|
||||
$seconds = strtotime($ahora) - strtotime($ultimo_contacto);
|
||||
if ($seconds >= ($agent_interval*2))
|
||||
$grupo[$array_index]["down"]++;
|
||||
}
|
||||
// SQL Join to get monitor status for agents belong this group
|
||||
$sql1 = "SELECT tagente.id_agente, tagente_estado.estado, tagente_estado.datos FROM tagente, tagente_estado WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.estado != 100";
|
||||
$sql1 = "SELECT tagente.id_agente, tagente_estado.estado, tagente_estado.datos, tagente_estado.current_interval, tagente_estado.utimestamp, tagente_estado.id_agente_modulo FROM tagente, tagente_estado WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.estado != 100";
|
||||
if ($result1 = mysql_query ($sql1)){
|
||||
while ($row1 = mysql_fetch_array ($result1)) {
|
||||
$id_agente = $row1[0];
|
||||
$estado = $row1[1];
|
||||
$datos = $row1[2];
|
||||
if ($datos != 0) {
|
||||
$module_interval = $row1[3];
|
||||
$seconds = $ahora_sec - $row1[4];
|
||||
$id_agente_modulo = $row1[5];
|
||||
if ($seconds >= ($module_interval*2))
|
||||
$grupo[$array_index]["down"]++;
|
||||
elseif ($datos != 0) {
|
||||
$grupo[$array_index]["ok"]++;
|
||||
} else {
|
||||
$grupo[$array_index]["bad"]++;
|
||||
|
|
|
@ -0,0 +1,402 @@
|
|||
<?php
|
||||
|
||||
// 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
|
||||
//
|
||||
// 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
|
||||
// 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");
|
||||
require("include/functions_reporting.php");
|
||||
$id_user = $_SESSION["id_usuario"];
|
||||
|
||||
if (give_acl ($id_user, 0, "AR") != 1) {
|
||||
audit_db ($id_user, $REMOTE_ADDR, "ACL Violation",
|
||||
"Trying to access Agent view (Grouped)");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
echo "<h2>".$lang_label["tactical_view"]."</h2>";
|
||||
|
||||
|
||||
/*
|
||||
// Get group list that user has access
|
||||
$mis_grupos = list_group2 ($id_user);
|
||||
$contador_grupo = 0;
|
||||
$contador_agente = 0;
|
||||
$array_index = 0;
|
||||
|
||||
// Init final counters
|
||||
$monitor_checks = 0;
|
||||
$monitor_ok = 0;
|
||||
$monitor_bad = 0;
|
||||
$monitor_unknown =0;
|
||||
$monitor_alert = 0;
|
||||
$total_agents = 0;
|
||||
$data_checks = 0;
|
||||
$data_unknown =0;
|
||||
$data_alert = 0;
|
||||
$data_alert_total = 0;
|
||||
$monitor_alert_total = 0;
|
||||
|
||||
|
||||
$monitor->checks = 0;
|
||||
$monitor->ok = 0;
|
||||
$monitor->bad =0;
|
||||
$monitor->unknown = 0;
|
||||
$monitor->alert = 0;
|
||||
$monitor->alert_total = 0;
|
||||
|
||||
$total->agents = 0;
|
||||
|
||||
$data->checks = 0;
|
||||
$data->unknown = 0;
|
||||
$data->alert = 0;
|
||||
$data->alert_total= 0;
|
||||
|
||||
$ahora=date("Y/m/d H:i:s");
|
||||
$ahora_sec = strtotime($ahora);
|
||||
|
||||
// Prepare data to show
|
||||
// For each valid group for this user, take data from agent and modules
|
||||
foreach ($mis_grupos as $migrupo) {
|
||||
if ($migrupo != "") {
|
||||
$existen_agentes = 0;
|
||||
$sql0 = "SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $migrupo AND disabled = 0";
|
||||
$result0 = mysql_query ($sql0);
|
||||
$row0 = mysql_fetch_array ($result0);
|
||||
$total_agents = $total_agents + $row0[0];
|
||||
if ($row0[0] > 0)
|
||||
$existen_agentes = 1;
|
||||
|
||||
// SQL Join to get monitor status for agents belong this group
|
||||
$sql1 = "SELECT tagente.id_agente, tagente_estado.estado, tagente_estado.datos, tagente_estado.current_interval, tagente_estado.utimestamp, tagente_estado.id_agente_modulo FROM tagente, tagente_estado WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND tagente.id_agente = tagente_estado.id_agente";
|
||||
if ($result1 = mysql_query ($sql1)){
|
||||
while ($row1 = mysql_fetch_array ($result1)) {
|
||||
$id_agente = $row1[0];
|
||||
$estado = $row1[1];
|
||||
$datos = $row1[2];
|
||||
$module_interval = $row1[3];
|
||||
$seconds = $ahora_sec - $row1[4];
|
||||
$id_agente_modulo = $row1[5];
|
||||
if ($estado != 100){
|
||||
// Monitor check
|
||||
$monitor_checks++;
|
||||
if ($seconds >= ($module_interval*2))
|
||||
$monitor_unknown++;
|
||||
elseif ($datos != 0) {
|
||||
$monitor_ok++;
|
||||
} else {
|
||||
$monitor_bad++;
|
||||
}
|
||||
// Alert
|
||||
$sql2 = "SELECT times_fired FROM talerta_agente_modulo WHERE id_agente_modulo = $id_agente_modulo";
|
||||
if ($result2 = mysql_query ($sql2)){
|
||||
if ($row2 = mysql_fetch_array ($result2)){
|
||||
$monitor_alert_total++;
|
||||
if ($row2[0] > 0)
|
||||
$monitor_alert++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Data check
|
||||
if ($seconds >= ($module_interval*2))
|
||||
$data_unknown++;
|
||||
$data_checks++;
|
||||
// Alert
|
||||
$sql2 = "SELECT times_fired FROM talerta_agente_modulo WHERE id_agente_modulo = $id_agente_modulo";
|
||||
if ($result2 = mysql_query ($sql2)){
|
||||
if ($row2 = mysql_fetch_array ($result2)) {
|
||||
$data_alert_total++;
|
||||
if ($row2[0] > 0)
|
||||
$data_alert++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
$data = general_stats($id_user,0);
|
||||
$monitor_checks = $data[0];
|
||||
$monitor_ok = $data[1];
|
||||
$monitor_bad = $data[2];
|
||||
$monitor_unknown = $data[3];
|
||||
$monitor_alert = $data[4];
|
||||
$total_agents = $data[5];
|
||||
$data_checks = $data[6];
|
||||
$data_unknown = $data[7];
|
||||
$data_alert = $data[8];
|
||||
$data_alert_total = $data[9];
|
||||
$monitor_alert_total = $data[10];
|
||||
|
||||
$total_checks = $data_checks + $monitor_checks;
|
||||
|
||||
// Monitor checks
|
||||
// ~~~~~~~~~~~~~~~
|
||||
echo "<table width=700 border=0>";
|
||||
echo "<tr><td>";
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
echo "<th colspan=2>".$lang_label["monitor_checks"]."</th>";
|
||||
echo "<tr><td class=datos2><b>"."Monitor checks";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$monitor_checks;
|
||||
echo "<tr><td class=datos><b>"."Monitor OK";
|
||||
echo "<td class=datos style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$monitor_ok;
|
||||
echo "<tr><td class=datos2><b>"."Monitor BAD";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #ff0000;'>";
|
||||
if ($monitor_bad > 0)
|
||||
echo $monitor_bad;
|
||||
else
|
||||
echo "-";
|
||||
echo "<tr><td class=datos><b>"."Monitor Unknown";
|
||||
echo "<td class=datos style='font: bold 2em Arial, Sans-serif; color: #888;'>";
|
||||
if ($monitor_unknown > 0)
|
||||
echo $monitor_unknown;
|
||||
else
|
||||
echo "-";
|
||||
echo "<tr><td class=datos2><b>"."Alerts Fired";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #ff0000;'>";
|
||||
if ($monitor_alert > 0)
|
||||
echo $monitor_alert;
|
||||
else
|
||||
echo "-";
|
||||
echo "<tr><td class=datos><b>"."Alerts Total";
|
||||
echo "<td class=datos style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$monitor_alert_total;
|
||||
echo "</table>";
|
||||
|
||||
// Data checks
|
||||
// ~~~~~~~~~~~~~~~
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
echo "<th colspan=2>".$lang_label["data_checks"]."</th>";
|
||||
echo "<tr><td class=datos2><b>"."Data checks";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$data_checks;
|
||||
echo "<tr><td class=datos><b>"."Data Unknown";
|
||||
echo "<td class=datos style='font: bold 2em Arial, Sans-serif; color: #888;'>";
|
||||
if ($data_unknown > 0)
|
||||
echo $data_unknown;
|
||||
else
|
||||
echo "-";
|
||||
echo "<tr><td class=datos2><b>"."Alerts Fired";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #ff0000;'>";
|
||||
if ($data_alert > 0)
|
||||
echo $data_alert;
|
||||
else
|
||||
echo "-";
|
||||
echo "<tr><td class=datos><b>"."Alerts Total";
|
||||
echo "<td class=datos style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$data_alert_total;
|
||||
echo "</table>";
|
||||
|
||||
// Summary
|
||||
// ~~~~~~~~~~~~~~~
|
||||
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
|
||||
echo "<th colspan=2>".$lang_label["summary"]."</th>";
|
||||
echo "<tr><td class=datos2><b>"."Total agents";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$total_agents;
|
||||
echo "<tr><td class=datos2><b>"."Total checks";
|
||||
echo "<td class=datos2 style='font: bold 2em Arial, Sans-serif; color: #000000;'>".$total_checks;
|
||||
echo "</table>";
|
||||
|
||||
echo "<td>";
|
||||
|
||||
// Odometer Graph
|
||||
// ~~~~~~~~~~~~~~~
|
||||
$monitor_health = format_numeric (($monitor_ok / $monitor_checks) * 100,1);
|
||||
$data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);;
|
||||
$global_health = format_numeric( ((($monitor_ok)+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1);
|
||||
echo "<h3>".$lang_label["tactical_indicator"]."</h3>";
|
||||
echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";
|
||||
|
||||
|
||||
|
||||
// Server information
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
$sql='SELECT * FROM tserver';
|
||||
echo "<h2>".$lang_label["tactical_server_information"]."</h2>";
|
||||
// Get total modules defined (network)
|
||||
$sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4';
|
||||
$result1=mysql_query($sql1);
|
||||
$row1=mysql_fetch_array($result1);
|
||||
$total_modules = $row1[0];
|
||||
|
||||
// Get total modules defined (data)
|
||||
$sql1='SELECT COUNT(processed_by_server) FROM tagente_estado WHERE processed_by_server LIKE "%_Data" ';
|
||||
if ($result1=mysql_query($sql1)){
|
||||
$row1=mysql_fetch_array($result1);
|
||||
$total_modules_data = $row1[0];
|
||||
} else
|
||||
$total_modules_data = 0;
|
||||
|
||||
// Connect DataBase
|
||||
$result=mysql_query($sql);
|
||||
if (mysql_num_rows($result)){
|
||||
echo "<table cellpadding='4' cellspacing='4' witdh='720' class='databox'>";
|
||||
echo "<tr><th class='datos'>".$lang_label["name"]."</th>";
|
||||
echo "<th class='datos'>".$lang_label['status']."</th>";
|
||||
echo "<th class='datos'>".$lang_label['load']."</th>";
|
||||
echo "<th class='datos'>".$lang_label['modules']."</th>";
|
||||
echo "<th class='datos'>".$lang_label['lag']."</th>";
|
||||
$color=1;
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
$id_server = $row["id_server"];
|
||||
$name = $row["name"];
|
||||
$address = $row["ip_address"];
|
||||
$status = $row["status"];
|
||||
$laststart = $row["laststart"];
|
||||
$keepalive = $row["keepalive"];
|
||||
$network_server = $row["network_server"];
|
||||
$data_server = $row["data_server"];
|
||||
$snmp_server = $row["snmp_server"];
|
||||
$recon_server = $row["recon_server"];
|
||||
$master = $row["master"];
|
||||
$checksum = $row["checksum"];
|
||||
$description = $row["description"];
|
||||
$version = $row["version"];
|
||||
$modules_server = 0;
|
||||
if (($network_server == 1) OR ($data_server == 1)){
|
||||
if ($network_server == 1){
|
||||
// Get total modules defined for this server (network modules)
|
||||
$sql1='SELECT * FROM tagente where id_server = '.$row["id_server"];
|
||||
$result1=mysql_query($sql1);
|
||||
while ($row1=mysql_fetch_array($result1)){
|
||||
$sql2='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4 AND id_agente = '.$row1["id_agente"];
|
||||
$result2=mysql_query($sql2);
|
||||
$row2=mysql_fetch_array($result2);
|
||||
$modules_server = $modules_server + $row2[0];
|
||||
}
|
||||
}
|
||||
echo "<tr><td class='$tdcolor'>";
|
||||
echo "<b>$name</b>";
|
||||
echo "<td class='$tdcolor' align='middle'>";
|
||||
if ($status ==0){
|
||||
echo "<img src='images/dot_red.gif'>";
|
||||
} else {
|
||||
echo "<img src='images/dot_green.gif'>";
|
||||
}
|
||||
echo "<td class='$tdcolor' align='middle'>";
|
||||
if (($network_server == 1) OR ($data_server == 1)){
|
||||
// Progress bar calculations
|
||||
if ($network_server == 1){
|
||||
if ($total_modules == 0)
|
||||
$percentil = 0;
|
||||
if ($total_modules > 0)
|
||||
$percentil = $modules_server / ($total_modules / 100);
|
||||
else
|
||||
$percentil = 0;
|
||||
$total_modules_temp = $total_modules;
|
||||
} else {
|
||||
if ($total_modules_data == 0)
|
||||
$percentil = 0;
|
||||
else
|
||||
$percentil = $modules_server / ($total_modules_data / 100);
|
||||
$total_modules_temp = $total_modules_data;
|
||||
}
|
||||
} elseif ($recon_server == 1){
|
||||
|
||||
$sql2 = "SELECT COUNT(id_rt) FROM trecon_task WHERE id_network_server = $id_server";
|
||||
$result2=mysql_query($sql2);
|
||||
$row2=mysql_fetch_array($result2);
|
||||
$modules_server = $row2[0];
|
||||
|
||||
$sql2 = "SELECT COUNT(id_rt) FROM trecon_task";
|
||||
$result2=mysql_query($sql2);
|
||||
$row2=mysql_fetch_array($result2);
|
||||
$total_modules = $row2[0];
|
||||
if ($total_modules == 0)
|
||||
$percentil = 0;
|
||||
else
|
||||
$percentil = $modules_server / ($total_modules / 100);
|
||||
$total_modules_temp = $total_modules;
|
||||
}
|
||||
else
|
||||
echo "-";
|
||||
|
||||
if (($network_server == 1) OR ($data_server == 1) OR ($recon_server == 1))
|
||||
// Progress bar render
|
||||
echo '<img src="reporting/fgraph.php?tipo=progress&percent='.$percentil.'&height=18&width=80">';
|
||||
|
||||
// Number of modules
|
||||
echo "<td class='$tdcolor'>";
|
||||
if (($recon_server ==1) OR ($network_server == 1) OR ($data_server == 1))
|
||||
echo $modules_server . " / ". $total_modules_temp;
|
||||
else
|
||||
echo "-";
|
||||
|
||||
// LAG CHECK
|
||||
echo "<td class='$tdcolor'>";
|
||||
// Calculate lag: get oldest module of any proc_type, for this server,
|
||||
// and calculate difference in seconds
|
||||
// Get total modules defined for this server
|
||||
if (($network_server == 1) OR ($data_server == 1)){
|
||||
$sql1 = "SELECT utimestamp, current_interval FROM tagente_estado WHERE processed_by_server = '$name' AND estado < 100";
|
||||
|
||||
$nowtime = time();
|
||||
$maxlag=0;
|
||||
if ($result1=mysql_query($sql1))
|
||||
while ($row1=mysql_fetch_array($result1)){
|
||||
if (($row1["utimestamp"] + $row1["current_interval"]) < $nowtime)
|
||||
$maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["current_interval"]);
|
||||
if ($maxlag2 > $maxlag)
|
||||
$maxlag = $maxlag2;
|
||||
}
|
||||
if ($maxlag < 60)
|
||||
echo $maxlag." sec";
|
||||
elseif ($maxlag < 86400)
|
||||
echo format_numeric($maxlag/60) . " min";
|
||||
elseif ($maxlag > 86400)
|
||||
echo "+1 ".$lang_label["day"];
|
||||
} elseif ($recon_server == 1) {
|
||||
$sql1 = "SELECT * FROM trecon_task WHERE id_network_server = $id_server";
|
||||
$result1=mysql_query($sql1);
|
||||
$nowtime = time();
|
||||
$maxlag=0;$maxlag2=0;
|
||||
while ($row1=mysql_fetch_array($result1)){
|
||||
if (($row1["utimestamp"] + $row1["interval_sweep"]) < $nowtime){
|
||||
$maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["interval_sweep"]);
|
||||
if ($maxlag2 > $maxlag)
|
||||
$maxlag = $maxlag2;
|
||||
}
|
||||
}
|
||||
if ($maxlag < 60)
|
||||
echo $maxlag." sec";
|
||||
elseif ($maxlag < 86400)
|
||||
echo format_numeric($maxlag/60) . " min";
|
||||
elseif ($maxlag > 86400)
|
||||
echo "+1 ".$lang_label["day"];
|
||||
} else
|
||||
echo "--";
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
|
||||
?>
|
|
@ -30,14 +30,29 @@ if (! isset($_SESSION["id_usuario"])) {
|
|||
|
||||
// Agent read, Server read
|
||||
if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) {
|
||||
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/estado_grupo") {
|
||||
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/tactical") {
|
||||
echo '<div id="op1s">';
|
||||
} else {
|
||||
echo '<div id="op1">';
|
||||
}
|
||||
echo '<ul class="mn"><li><a href="index.php?sec=estado&sec2=operation/agentes/estado_grupo&refr=60" class="mn">'.$lang_label["view_agents"].'</a></li></ul></div>';
|
||||
echo '<ul class="mn"><li><a href="index.php?sec=estado&sec2=operation/agentes/tactical&refr=60" class="mn">'.$lang_label["view_agents"].'</a></li></ul></div>';
|
||||
|
||||
if (isset($_GET["sec"]) && $_GET["sec"] == "estado"){
|
||||
|
||||
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/tactical"){
|
||||
echo "<div class='arrows'>";
|
||||
} else {
|
||||
echo "<div class='arrow'>";
|
||||
}
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=estado&sec2=operation/agentes/tactical&refr=60' class='mn'>".$lang_label["tactical_view"]."</a></li></ul></div>";
|
||||
|
||||
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/estado_grupo"){
|
||||
echo "<div class='arrows'>";
|
||||
} else {
|
||||
echo "<div class='arrow'>";
|
||||
}
|
||||
echo "<ul class='mn'><li><a href='index.php?sec=estado&sec2=operation/agentes/estado_grupo&refr=60' class='mn'>".$lang_label["group_view_menu"]."</a></li></ul></div>";
|
||||
|
||||
if (isset($_GET["sec2"]) && ($_GET["sec2"] == "operation/agentes/estado_agente" || $_GET["sec2"] == "operation/agentes/ver_agente" || $_GET["sec2"] == "operation/agentes/datos_agente")) {
|
||||
echo "<div class='arrows'>";
|
||||
} else {
|
||||
|
|
|
@ -474,7 +474,7 @@ CREATE TABLE `tnews` (
|
|||
`author` varchar(255) NOT NULL DEFAULT '',
|
||||
`subject` varchar(255) NOT NULL DEFAULT '',
|
||||
`text` TEXT NOT NULL,
|
||||
`utimestamp` DATETIME NOT NULL DEFAULT 0,
|
||||
`timestamp` DATETIME NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id_news`)
|
||||
) ENGINE = InnoDB;
|
||||
|
||||
|
|
|
@ -87,8 +87,7 @@ class Image_Canvas_GD extends Image_Canvas_WithMap
|
|||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
// Pandora FMS: Beware of this, could be slow on old systems
|
||||
|
||||
// Pandora FMS: Beware of this, could be slow on old systems
|
||||
var $_antialias = 'driver';
|
||||
|
||||
/**
|
||||
|
|
|
@ -570,7 +570,7 @@ class Image_Graph_Plot_Odo extends Image_Graph_Plot
|
|||
* @see Image_Graph_Fill
|
||||
* @access public
|
||||
*/
|
||||
function &setRangeMarkerFillStyle(&$rangeMarkerFillStyle)
|
||||
function setRangeMarkerFillStyle(&$rangeMarkerFillStyle)
|
||||
{
|
||||
$this->_rangeFillStyle = $rangeMarkerFillStyle;
|
||||
}
|
||||
|
|
|
@ -663,7 +663,10 @@ function graphic_agentmodules($id_agent, $width, $height) {
|
|||
|
||||
if ($cx > 0){
|
||||
// create the graph
|
||||
$Graph =& Image_Graph::factory('graph', array($width, $height));
|
||||
$driver=& Image_Canvas::factory('png',array('width'=>$width,'height'=>$height,'antialias' => 'native'));
|
||||
$Graph = & Image_Graph::factory('graph', $driver);
|
||||
|
||||
//$Graph =& Image_Graph::factory('graph', array($width, $height));
|
||||
// add a TrueType font
|
||||
$Font =& $Graph->addNew('font', $config_fontpath);
|
||||
// set the font size to 7 pixels
|
||||
|
@ -1731,6 +1734,100 @@ function graphic_test ($id, $period, $interval, $label, $width, $height){
|
|||
|
||||
}
|
||||
|
||||
function odo_tactic ($value1, $value2, $value3){
|
||||
require_once 'Image/Graph.php';
|
||||
include ("../include/config.php");
|
||||
|
||||
// create the graph
|
||||
$driver=& Image_Canvas::factory('png',array('width'=>350,'height'=>260,'antialias' => 'driver'));
|
||||
$Graph = & Image_Graph::factory('graph', $driver);
|
||||
// add a TrueType font
|
||||
$Font =& $Graph->addNew('font', $config_fontpath);
|
||||
// set the font size to 11 pixels
|
||||
$Font->setSize(8);
|
||||
$Graph->setFont($Font);
|
||||
|
||||
|
||||
// create the plotarea
|
||||
$Graph->add(
|
||||
Image_Graph::vertical(
|
||||
$Plotarea = Image_Graph::factory('plotarea'),
|
||||
$Legend = Image_Graph::factory('legend'),
|
||||
80
|
||||
)
|
||||
);
|
||||
|
||||
$Legend->setPlotarea($Plotarea);
|
||||
$Legend->setAlignment(IMAGE_GRAPH_ALIGN_HORIZONTAL);
|
||||
/***************************Arrows************************/
|
||||
$Arrows = & Image_Graph::factory('dataset');
|
||||
$Arrows->addPoint('Global Health', $value1, 'GLOBAL');
|
||||
$Arrows->addPoint('Data Health', $value2, 'DATA');
|
||||
$Arrows->addPoint('Monitor Health', $value3, 'MONITOR');
|
||||
|
||||
/**************************PARAMATERS for PLOT*******************/
|
||||
|
||||
// create the plot as odo chart using the dataset
|
||||
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Odo',$Arrows);
|
||||
$Plot->setRange(0, 100);
|
||||
$Plot->setAngles(180, 180);
|
||||
$Plot->setRadiusWidth(90);
|
||||
$Plot->setLineColor('gray');//for range and outline
|
||||
|
||||
$Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_VALUE_Y);
|
||||
$Plot->setArrowMarker($Marker);
|
||||
|
||||
$Plotarea->hideAxis();
|
||||
/***************************Axis************************/
|
||||
// create a Y data value marker
|
||||
|
||||
$Marker->setFillColor('transparent');
|
||||
$Marker->setBorderColor('transparent');
|
||||
$Marker->setFontSize(7);
|
||||
$Marker->setFontColor('black');
|
||||
|
||||
// create a pin-point marker type
|
||||
$Plot->setTickLength(14);
|
||||
$Plot->setAxisTicks(5);
|
||||
/********************************color of arrows*************/
|
||||
$FillArray = & Image_Graph::factory('Image_Graph_Fill_Array');
|
||||
$FillArray->addColor('red@0.8', 'GLOBAL');
|
||||
$FillArray->addColor('black.6', 'DATA');
|
||||
$FillArray->addColor('blue@0.6', 'MONITOR');
|
||||
|
||||
// create a line array
|
||||
$LineArray =& Image_Graph::factory('Image_Graph_Line_Array');
|
||||
$LineArray->addColor('red', 'GLOBAL');
|
||||
$LineArray->addColor('black', 'DATA');
|
||||
$LineArray->addColor('blue', 'MONITOR');
|
||||
$Plot->setArrowLineStyle($LineArray);
|
||||
$Plot->setArrowFillStyle($FillArray);
|
||||
|
||||
/***************************MARKER OR ARROW************************/
|
||||
// create a Y data value marker
|
||||
$Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_VALUE_Y);
|
||||
$Marker->setFillColor('white');
|
||||
$Marker->setBorderColor('white');
|
||||
$Marker->setFontSize(7);
|
||||
$Marker->setFontColor('black');
|
||||
// create a pin-point marker type
|
||||
$PointingMarker =& $Plot->addNew('Image_Graph_Marker_Pointing_Angular', array(20, &$Marker));
|
||||
// and use the marker on the plot
|
||||
$Plot->setMarker($PointingMarker);
|
||||
/**************************RANGE*******************/
|
||||
$Plot->addRangeMarker(0, 30);
|
||||
$Plot->addRangeMarker(30, 70);
|
||||
$Plot->addRangeMarker(70, 100);
|
||||
// create a fillstyle for the ranges
|
||||
$FillRangeArray = & Image_Graph::factory('Image_Graph_Fill_Array');
|
||||
$FillRangeArray->addColor('red@0.8');
|
||||
$FillRangeArray->addColor('yellow@0.8');
|
||||
$FillRangeArray->addColor('green@0.8');
|
||||
$Plot->setRangeMarkerFillStyle($FillRangeArray);
|
||||
// output the Graph
|
||||
$Graph->done();
|
||||
}
|
||||
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
@ -1830,6 +1927,21 @@ if ( isset($_GET["draw_alerts"]))
|
|||
$draw_alerts = $_GET["draw_alerts"];
|
||||
else
|
||||
$draw_alerts = 0;
|
||||
|
||||
// Values 1 2 and 3
|
||||
if ( isset($_GET["value1"]))
|
||||
$value1 = $_GET["value1"];
|
||||
else
|
||||
$value1 = 0;
|
||||
if ( isset($_GET["value2"]))
|
||||
$value2 = $_GET["value2"];
|
||||
else
|
||||
$value2 = 0;
|
||||
if ( isset($_GET["value3"]))
|
||||
$value3 = $_GET["value3"];
|
||||
else
|
||||
$value3 = 0;
|
||||
|
||||
|
||||
// Image handler
|
||||
// *****************
|
||||
|
@ -1873,6 +1985,9 @@ if (isset($_GET["tipo"])){
|
|||
$percent= $_GET["percent"];
|
||||
progress_bar($percent,$width,$height);
|
||||
}
|
||||
elseif ( $_GET["tipo"] == "odo_tactic"){
|
||||
odo_tactic ( $value1, $value2, $value3 );
|
||||
}
|
||||
elseif ( $_GET["tipo"] =="combined"){
|
||||
// Split id to get all parameters
|
||||
$module_list = array();
|
||||
|
|
Loading…
Reference in New Issue