2008-06-18 Sancho Lerena <slerena@gmail.com>

* pandoradbdata_13_to_20.sql: prototype. not functional.

    * operation/events/export_csv.php: Event export to CSV. Support
    passed filters.

    * images/networkmap/*.png: Updated icons for network map.

    * godmode/menu.php,
    * godmode/db/db_sanity.php: New sanity tool for database in interactive
    mode using console (ported from pandora_db.pl).

    * reporting/fgraph.php: Added graphs for string data types. Fixed
    event by agent/module graph for system events.

    * general/logon_ok.php, tactica.php: Fixed a div0.

    * godmode/agentes/manage_config.php: Several fixes, and added a new
    option to mass-deletion of agents.

    * godmode/agentes/agent_manager.php,
    godmode/agentes/modificar_agente.php: Delete of remote configuration
	when delete an agent and manually, by user. 

    * operation/servers/view_server_detail.php: Added refresh option and 
    fixed layout.

    * status_monitor.php: Added new filter by state, most code rewritten.
    Added pagination fixes, and corrected labels and legends.

    * operation/agentes/networkmap.php: Several fixes and modification to 
    render small maps and huge (>200 agents) maps. This should be fine by
    now. Need "Group/Section" drawing /by click into section line/.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@880 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-06-19 00:24:05 +00:00
parent a980bb32cf
commit b6e45a9d99
26 changed files with 886 additions and 224 deletions

View File

@ -1,3 +1,39 @@
2008-06-18 Sancho Lerena <slerena@gmail.com>
* pandoradbdata_13_to_20.sql: prototype. not functional.
* operation/events/export_csv.php: Event export to CSV. Support
passed filters.
* images/networkmap/*.png: Updated icons for network map.
* godmode/menu.php,
* godmode/db/db_sanity.php: New sanity tool for database in interactive
mode using console (ported from pandora_db.pl).
* reporting/fgraph.php: Added graphs for string data types. Fixed
event by agent/module graph for system events.
* general/logon_ok.php, tactica.php: Fixed a div0.
* godmode/agentes/manage_config.php: Several fixes, and added a new
option to mass-deletion of agents.
* godmode/agentes/agent_manager.php,
godmode/agentes/modificar_agente.php: Delete of remote configuration
when delete an agent and manually, by user.
* operation/servers/view_server_detail.php: Added refresh option and
fixed layout.
* status_monitor.php: Added new filter by state, most code rewritten.
Added pagination fixes, and corrected labels and legends.
* operation/agentes/networkmap.php: Several fixes and modification to
render small maps and huge (>200 agents) maps. This should be fine by
now. Need "Group/Section" drawing /by click into section line/.
2008-06-18 Esteban Sanchez <estebans@artica.es>
* include/styles/datepicker.css, include/styles/timeentry.css: Added

View File

@ -82,7 +82,10 @@
$module_sanity = format_numeric (100 - $notinit_percentage);
$total_alerts = $data_alert + $monitor_alert;
$total_fired_alerts = $monitor_alert_total+$data_alert_total;
$alert_level = format_numeric (100 - ($total_alerts / ($total_fired_alerts / 100)));
if ( $total_fired_alerts > 0)
$alert_level = format_numeric (100 - ($total_alerts / ($total_fired_alerts / 100)));
else
$alert_level = 100;
if ($monitor_checks > 0){
$monitor_health = format_numeric ( 100- (($monitor_bad + $monitor_unknown) / ($monitor_checks/100)) , 1);

View File

@ -47,6 +47,15 @@ if (isset($_GET["disk_conf"])){
exit;
}
// Agent remote configuration DELETE
if (isset($_GET["disk_conf_delete"])){
$agent_md5 = md5($nombre_agente, FALSE);
$file_name = $config["remote_config"] . "/" . $agent_md5 . ".conf";
unlink ($file_name);
$file_name = $config["remote_config"] . "/" . $agent_md5 . ".md5";
unlink ($file_name);
}
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente">';
if ($create_agent == 1) {
@ -234,6 +243,8 @@ echo '<td class="datos">';
$filename = $config["remote_config"] . "/" . $agent_md5 . ".md5";
if (file_exists($filename)){
echo date("F d Y H:i:s.", fileatime($filename));
// Delete remote configuration
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente=$id_agente'><img src='images/cross.png'></A>";
} else {
echo '<i>'.lang_string("Not available").'</i>';
}

View File

@ -148,7 +148,6 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
$o_id_plugin, '$o_plugin_parameter', '$o_plugin_user',
'$o_plugin_pass', $o_id_modulo
)";
echo "DEBUG SQL: $sql <br>";
$result2=mysql_query($sql);
if (! $result2)
echo "<h3 class=error>".lang_string("Problem updating database")."</h3>";
@ -253,7 +252,6 @@ echo "DEBUG SQL: $sql <br>";
$o_recovery_notify, $o_priority, '$o_al_f2_recovery',
'$o_al_f3_recovery' )";
$result_al=mysql_query($sql_al);
echo "DEBUG SQL: $sql_al <br>";
echo "<br>&nbsp;&nbsp;".$lang_label["copyale"]." ->".$o_descripcion;
}
} else
@ -289,11 +287,7 @@ echo "DEBUG SQL: $sql <br>";
$alertas = 1;
else
$alertas = 0;
if (($alertas + $modulos) == 0){
echo "<h3 class='error'>ERROR: ".$lang_label["del_sel_err"]."</h3>";
break;
}
if (($alertas + $modulos) >= 0)
// Delete
for ($a=0;$a <count($destino); $a++){ // for each agent
$id_agente = $destino[$a];
@ -330,7 +324,56 @@ echo "DEBUG SQL: $sql <br>";
}//if
}// for
}//delete
elseif (isset($_POST["delete_agent"])) {
echo "<h2>".lang_string("delete_agents")."</h2>";
// Initial checkings
// if selected more than 0 agents
$destino = $_POST["destino"];
if (count($destino) <= 0){
echo "<h3 class='error'>ERROR: ".$lang_label["noagents_del"]."</h3>";
break;
}
// Delete
for ($a=0;$a <count($destino); $a++){ // for each agent
$id_agente = $destino[$a];
echo "<br>".$lang_label["deleting_data"]." -> ".dame_nombre_agente($id_agente);
// Deleting data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM tagente_datos WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete2="DELETE FROM tagente_datos_inc WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete3="DELETE FROM tagente_datos_string WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result=mysql_query($sql_delete1);
$result=mysql_query($sql_delete2);
$result=mysql_query($sql_delete3);
}
// Delete conf
$sql_delete5 ="DELETE FROM tagente_modulo WHERE id_agente = ".$id_agente; // delete from table tagente_modulo
$sql_delete6 ="DELETE FROM tagente_estado WHERE id_agente = ".$id_agente; // detele from table tagente_estado
$result=mysql_query($sql_delete5);
$result=mysql_query($sql_delete6);
// delete alerts definitions
// delete data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM talerta_agente_modulo WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result = mysql_query($sql_delete1);
} // while
// delete agent
$sql1='DELETE FROM tagente WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
}// for
}//delete
// ============
// Form view
@ -415,9 +458,14 @@ echo "DEBUG SQL: $sql <br>";
echo '</select>';
// Form buttons
echo '<td align="right" class="datosb">';
echo '<td align="left" class="datosb">';
echo "<br><br>";
echo '<input type="submit" name="copy" class="sub copy" value="'.lang_string ("copy").'" onClick="if (!confirm("'.lang_string ("are_you_sure").'")) return false;>';
echo "<br><br>";
echo '<input type="submit" name="delete" class="sub delete" value="'. lang_string("delete").'" onClick="if (!confirm("'.lang_string ("are_you_sure").'")) return false;>';
echo "<br><br>";
echo '<input type="submit" name="delete_agent" class="sub delete" value="'. lang_string("Delete Agents").'" onClick="if (!confirm("'.lang_string ("are_you_sure").'")) return false;>';
echo '<tr><td colspan=2>';
echo '</div></td></tr>';
echo '</table>';

View File

@ -88,6 +88,16 @@ if (isset($_GET["borrar_agente"])){ // if delete agent
$sql = "DELETE FROM taddress_agent where id_agent = $id_agente";
$result=mysql_query($sql);
audit_db($id_user,$REMOTE_ADDR, "Agent '$agent_name' deleted", "Agent Management");
// Delete remote configuration
$agent_md5 = md5($agent_name, FALSE);
if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")){
// Agent remote configuration editor
$file_name = $config["remote_config"] . "/" . $agent_md5 . ".conf";
unlink ($file_name);
$file_name = $config["remote_config"] . "/" . $agent_md5 . ".md5";
unlink ($file_name);
}
} else { // NO permissions.
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
"Trying to delete agent '$agent_name'");
@ -183,6 +193,7 @@ echo "<div style='height: 20px'> </div>";
if (mysql_num_rows($result)){
echo "<table cellpadding='4' cellspacing='4' width='750' class='databox'>";
echo "<th>".$lang_label["agent_name"]."</th>";
echo "<th title='".lang_string("Remote agent configuration")."'>".lang_string ("R")."</th>";
echo "<th>".$lang_label["os"]."</th>";
echo "<th>".$lang_label["group"]."</th>";
echo "<th>".$lang_label["description"]."</th>";
@ -204,6 +215,16 @@ if (mysql_num_rows($result)){
<b><a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main&
id_agente=".$row["id_agente"]."'>".substr(strtoupper($row["nombre"]),0,20)."</a></b></td>";
echo "<td align='center' class='$tdcolor'>";
// Has remote configuration ?
$agent_md5 = md5($row["nombre"], FALSE);
if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")){
echo "<img src='images/application_edit.png' border='0' align='middle' alt=''>";
}
echo "</td>";
// Operating System icon
echo "<td class='$tdcolor' align='center'>
<img src='images/".dame_so_icon($row["id_os"])."'></td>";

View File

@ -0,0 +1,101 @@
<?php
// Pandora FMS
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@openideas.info
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas
// 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, U6
// Load global vars
require("include/config.php");
check_login();
if ((give_acl($config["id_user"], 0, "DM")==0) AND (dame_admin($config["id_user"])==0)) {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Database cure section");
require ("general/noaccess.php");
}
echo "<h2>".lang_string("Database sanity tool")."</h2>";
$sanity = get_parameter ("sanity", 0);
if ($sanity == 1){
// Create tagente estado when missing
// ----------------------------------
echo "<h2>".lang_string("Checking tagente_estado table")."</h2>";
$sql = "SELECT * FROM tagente_modulo";
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){
$id_agente_modulo = $row[0];
$id_agente = $row["id_agente"];
// check if exist in tagente_estado and create if not
$sql2 = "SELECT COUNT(*) FROM tagente_estado WHERE id_agente_modulo = $id_agente_modulo";
$result2=mysql_query($sql2);
$row2=mysql_fetch_array($result2);
if ($row2[0] == 0){
$sql3 = "INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, cambio, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) VALUE ($id_agente_modulo, 0, '0000-00-00 00:00:00', 0, 100, $id_agente, '0000-00-00 00:00:00', 0, 0, 0, 0)";
echo "Inserting module $id_agente_modulo in state table <br>";
mysql_query($sql3);
}
}
echo "<h3>".lang_string("Checking database consistency")."</h2>";
$query1 = "SELECT * FROM tagente_estado";
$result=mysql_query($query1);
while ($row=mysql_fetch_array($result)){
$id_agente_modulo = $row[1];
# check if exist in tagente_estado and create if not
$query2 = "SELECT COUNT(*) FROM tagente_modulo WHERE id_agente_modulo = $id_agente_modulo";
$result2=mysql_query($query2);
$row2=mysql_fetch_array($result2);
if ($row2[0] == 0){
$query3 = "DELETE FROM tagente_estado WHERE id_agente_modulo = $id_agente_modulo";
echo "Deleting non-existing module $id_agente_modulo in state table <br>";
mysql_query($query3);
}
}
}
elseif ($sanity == 2){
echo "<h3>".lang_string("Deleting non-init data")."</h2>";
$query1 = "SELECT * FROM tagente_estado WHERE utimestamp = 0";
$result=mysql_query($query1);
while ($row=mysql_fetch_array($result)){
$id_agente_modulo = $row[1];
$query0 = "DELETE FROM tagente_modulo WHERE id_agente_modulo = $id_agente_modulo";
$query1 = "DELETE FROM tagente_estado WHERE id_agente_modulo = $id_agente_modulo";
echo "Deleting non init module $id_agente_modulo <br>";
mysql_query($query0);
mysql_query($query1);
}
}
echo "<br>";
echo "<div style='width:520px'>";
echo lang_string("Pandora FMS Sanity tool is used to remove bad database structure data, created modules with missing status, or modules that cannot be initialized (and don't report any valid data) but retry each it's own interval to get data. This kind of bad modules could degrade performance of Pandora FMS. This database sanity tool is also implemented in the <b>pandora_db.pl</b> that you should be running each day or week. This console sanity DONT compact your database, only delete bad structured data.");
echo "<br><br>";
echo "<b><a href='index.php?sec=gdbman&sec2=godmode/db/db_sanity&sanity=1'>";
echo "<img src='images/status_away.png'> &nbsp;";
echo lang_string("Sanitize my database now");
echo "</a></b>";
echo "<br><br>";
echo "<b><a href='index.php?sec=gdbman&sec2=godmode/db/db_sanity&sanity=2'>";
echo "<img src='images/status_away.png'> &nbsp;";
echo lang_string("Delete non-initialized modules now");
echo "</a></b>";
echo "</div>";
?>

View File

@ -266,6 +266,12 @@ if (comprueba_login() == 0){
} else
echo "<div id='arrowgl'>";
echo "<ul class='mn'><li class='bb0'><a href='index.php?sec=gdbman&amp;sec2=godmode/db/db_event' class='mn'>".$lang_label["db_event"]."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/db/db_sanity"){
echo "<div id='arrowgls'>";
} else
echo "<div id='arrowgl'>";
echo "<ul class='mn'><li class='bb0'><a href='index.php?sec=gdbman&sec2=godmode/db/db_sanity' class='mn'>".lang_string ("Database sanity")."</a></li></ul></div>";
}
}
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -26,7 +26,7 @@ if (!isset($pandora_version))
// This MUST be writtable by http server user, and should be in pandora root.
// By default, Pandora adds /attachment to this, so by default is the pandora console home dir
$config["attachment_store"]=$config["homedir"];
$config["attachment_store"]=$config["homedir"]."/attachment";
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf";

View File

@ -217,7 +217,7 @@ function give_human_time ($int_seconds){
$build[] = $temp.' '.$key.($temp!=1?'s':null);
// set flag to false, to allow 0's in lower periods
$flag_hide_zero = false;
$flag_hide_zero = true;
}
// get the remainder of seconds
@ -1040,9 +1040,9 @@ function get_event_types () {
$types['alert_ceased'] = lang_string ('alert_ceased');
$types['alert_manual_validation'] = lang_string ('alert_manual_validation');
$types['recon_host_detected'] = lang_string ('recon_host_detected');
$types['new_agent'] = lang_string ('new_agent');
$types['system'] = lang_string ('sytem');
$types['error'] = lang_string ('error');
return $types;
}

View File

@ -1671,6 +1671,9 @@ function smal_event_table ($filter = "", $limit = 10, $width=440){
break;
case "recon_host_detected";
echo "<img src='images/network.png'>";
break;
case "new_agent":
echo "<img src='images/wand.png'>";
break;
}

View File

@ -328,6 +328,8 @@ if (comprueba_login() == 0) {
$ultima = strtotime($ultimo_contacto);
$ahora = strtotime("now");
$diferencia = $ahora - $ultima;
echo human_time_comparation($ultimo_contacto);
/*
if ($biginterval > 0){
$percentil = round($diferencia/(($biginterval*2) / 100));
} else {
@ -336,7 +338,7 @@ if (comprueba_login() == 0) {
echo "<a href='#' class='info2'>
<img src='reporting/fgraph.php?tipo=progress&amp;percent=".
$percentil."&amp;height=18&amp;width=80' border='0'>
&nbsp;<span>$ultimo_contacto</span></a>";
&nbsp;<span>$ultimo_contacto</span></a>";*/
}
} // If pertenece/belongs to group

View File

@ -15,29 +15,29 @@
// 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/config.php");
if (comprueba_login() == 0) {
check_login();
if (isset($_GET["id_agente"])){
$id_agente = $_GET["id_agente"];
}
if (isset($_GET["id_agente"])){
$id_agente = $_GET["id_agente"];
}
// View last data packet
// Get timestamp of last packet
$sql_t='SELECT * FROM tagente WHERE id_agente = '.$id_agente;
$result_t=mysql_query($sql_t);
$row_t=mysql_fetch_array($result_t);
$timestamp_ref = $row_t["ultimo_contacto_remoto"];
$timestamp_lof = $row_t["ultimo_contacto"];
$intervalo_agente = $row_t["intervalo"];
// View last data packet
// Get timestamp of last packet
$sql_t='SELECT * FROM tagente WHERE id_agente = '.$id_agente;
$result_t=mysql_query($sql_t);
$row_t=mysql_fetch_array($result_t);
$timestamp_ref = $row_t["ultimo_contacto_remoto"];
$timestamp_lof = $row_t["ultimo_contacto"];
$intervalo_agente = $row_t["intervalo"];
// Get last packet
$sql3='SELECT * FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente = '.$id_agente.' AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo ORDER BY id_module_group, nombre';
$label_group=0;
$last_label = "";
echo "<h2>".$lang_label["ag_title"]." &gt; ";
echo $lang_label["last_data_chunk"]."</h2>";
$result3=mysql_query($sql3);
if (mysql_num_rows ($result3)) {
// Get last packet
$sql3='SELECT * FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente = '.$id_agente.' AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo ORDER BY id_module_group, nombre';
$label_group=0;
$last_label = "";
echo "<h2>".$lang_label["ag_title"]." &gt; ";
echo $lang_label["last_data_chunk"]."</h2>";
$result3=mysql_query($sql3);
if (mysql_num_rows ($result3)) {
echo "<table width='750' cellpadding='3' cellspacing='3' class='databox'>";
echo "<th></th>";
echo "<th>".$lang_label["module_name"]."</th>";
@ -51,145 +51,157 @@ if (comprueba_login() == 0) {
$texto=''; $last_modulegroup = 0;
$color = 1;
while ($row3=mysql_fetch_array($result3)){
// Calculate table line color
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
if ($row3["id_module_group"] != $last_modulegroup ){
// Render module group names (fixed code)
$nombre_grupomodulo = dame_nombre_grupomodulo ($row3["id_module_group"]);
$last_modulegroup = $row3["id_module_group"];
echo "<tr><td class='datos3' align='center' colspan='9'>
<b>".$nombre_grupomodulo."</b></td></tr>";
}
// Begin to render data ...
echo "<tr><td class='$tdcolor'>";
// Render network exec module button, only when
// Agent Write for this module and group, is given
// Is a network module
// Has flag = 0
$id_grupo = $row_t["id_grupo"];
$id_usuario=$_SESSION["id_usuario"];
if (give_acl($id_usuario, $id_grupo, "AW")==1){
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>";
} 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 "</td>";
// Calculate table line color
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
if ($row3["id_module_group"] != $last_modulegroup ){
// Render module group names (fixed code)
$nombre_grupomodulo = dame_nombre_grupomodulo ($row3["id_module_group"]);
if ($nombre_grupomodulo != ""){
if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group
$label_group = -1;
$last_label = $nombre_grupomodulo;
$texto = $texto. "
<td class='$tdcolor' align='center' colspan='7'>
<b>".$nombre_grupomodulo."</b></td>";
$last_modulegroup = $row3["id_module_group"];
echo "<tr><td class='datos3' align='center' colspan='9'>
<b>".$nombre_grupomodulo."</b></td></tr>";
}
// Begin to render data ...
echo "<tr><td class='$tdcolor'>";
// Render network exec module button, only when
// Agent Write for this module and group, is given
// Is a network module
// Has flag = 0
$id_grupo = $row_t["id_grupo"];
$id_usuario=$_SESSION["id_usuario"];
if (give_acl($id_usuario, $id_grupo, "AW")==1){
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>";
} 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 "</td>";
$nombre_grupomodulo = dame_nombre_grupomodulo ($row3["id_module_group"]);
if ($nombre_grupomodulo != ""){
if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group
$label_group = -1;
$last_label = $nombre_grupomodulo;
$texto = $texto. "
<td class='$tdcolor' align='center' colspan='7'>
<b>".$nombre_grupomodulo."</b></td>";
}
$nombre_tipo_modulo = dame_nombre_tipo_modulo($row3["id_tipo_modulo"]);
echo "<td class='".$tdcolor."_id' title='".salida_limpia($row3["nombre"])."'>";
echo salida_limpia(substr($row3["nombre"],0,15));
echo "</td><td class='".$tdcolor."'>";
echo "<img src='images/".show_icon_type($row3["id_tipo_modulo"])."' border=0>";
echo "</td><td class='".$tdcolor."'>";
if ($row3["module_interval"] != 0){
echo $row3["module_interval"];
$real_interval = $row3["module_interval"];
} else {
echo $intervalo_agente;
$real_interval = $intervalo_agente;
}
//echo $nombre_tipo_modulo;
echo "</td><td class='".$tdcolor."f9' title='".salida_limpia($row3["descripcion"])."'>";
echo salida_limpia(substr($row3["descripcion"],0,32));
}
$nombre_tipo_modulo = dame_nombre_tipo_modulo($row3["id_tipo_modulo"]);
echo "<td class='".$tdcolor."_id' title='".salida_limpia($row3["nombre"])."'>";
echo salida_limpia(substr($row3["nombre"],0,15));
echo "</td><td class='".$tdcolor."'>";
echo "<img src='images/".show_icon_type($row3["id_tipo_modulo"])."' border=0>";
echo "</td><td class='".$tdcolor."'>";
if ($row3["module_interval"] != 0){
echo $row3["module_interval"];
$real_interval = $row3["module_interval"];
} else {
echo $intervalo_agente;
$real_interval = $intervalo_agente;
}
if (($row3["id_tipo_modulo"] != 3)
AND ($row3["id_tipo_modulo"] != 10)
AND ($row3["id_tipo_modulo"] != 17)
AND ($row3["id_tipo_modulo"] != 23)){
echo "</td><td class='".$tdcolor."f9' title='".salida_limpia($row3["descripcion"])."'>";
echo salida_limpia(substr($row3["descripcion"],0,32));
if (strlen($row3["descripcion"]) > 32){
echo "...";
}
echo "</td>";
// For types not string type (3 data_string, 9 tcp_string, 14 snmp_string)
if (($row3["id_tipo_modulo"] != 3)
AND ($row3["id_tipo_modulo"] != 10)
AND ($row3["id_tipo_modulo"] != 100) // Type not keepalive (1.4)
AND ($row3["id_tipo_modulo"] != 17)){
echo "</td>";
}
if ($row3["id_tipo_modulo"] == 100) {
echo "<td class='".$tdcolor."f9' colspan='2' title='".$row3["datos"]."'>";
echo substr(salida_limpia($row3["datos"]),0,12);
} else {
// String uses colspan2 and different graphtype
if (($row3["id_tipo_modulo"] == 3)
OR ($row3["id_tipo_modulo"] == 10)
OR ($row3["id_tipo_modulo"] == 17)
OR ($row3["id_tipo_modulo"] == 23)){
$graph_type = "string";
echo "<td class='".$tdcolor."f9' colspan=2 title='".salida_limpia($row3["datos"])."'>";
}
elseif (($row3["id_tipo_modulo"] == 2)
OR ($row3["id_tipo_modulo"] == 6)
OR ($row3["id_tipo_modulo"] == 21)
OR ($row3["id_tipo_modulo"] == 18)
OR ($row3["id_tipo_modulo"] == 9)) {
$graph_type = "boolean";
echo "<td class=".$tdcolor.">";
}
else {
$graph_type = "sparse";
echo "<td class=".$tdcolor.">";
if (is_numeric($row3["datos"])) {
$mytempdata = fmod($row3["datos"], 1);
if ($mytempdata == 0)
$myvalue = intval($row3["datos"]);
else
$myvalue = $row3["datos"];
echo format_for_graph($myvalue );
} else
echo substr(salida_limpia($row3["datos"]),0,12);
}
if (($row3["id_tipo_modulo"] == 2)
OR ($row3["id_tipo_modulo"] == 6)
OR ($row3["id_tipo_modulo"] == 18)
OR ($row3["id_tipo_modulo"] == 9))
$graph_type = "boolean";
// Kind of data
if (is_numeric($row3["datos"])) {
$mytempdata = fmod($row3["datos"], 1);
if ($mytempdata == 0)
$myvalue = intval($row3["datos"]);
else
$graph_type = "sparse";
$handle = "stat".$nombre_tipo_modulo."_".$row3["id_agente_modulo"];
$url = 'reporting/procesos.php?agente='.$row3["id_agente_modulo"];
$win_handle=dechex(crc32($row3["id_agente_modulo"].$row3["nombre"]));
echo "<td class=".$tdcolor." width='78'>";
$graph_label = output_clean_strict ($row3["nombre"]);
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?type=$graph_type&period=2419200&id=".$row3["id_agente_modulo"]."&label=".$graph_label."refresh=180000\", \"month_".$win_handle."\")'><img src='images/grafica_m.png' border=0></a>&nbsp;";
$link ="winopeng('reporting/stat_win.php?type=$graph_type&period=604800&id=".$row3["id_agente_modulo"]."&label=".$graph_label."&refresh=6000','week_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/grafica_w.png" border=0></a>&nbsp;';
$link ="winopeng('reporting/stat_win.php?type=$graph_type&period=86400&id=".$row3["id_agente_modulo"]."&label=".$graph_label."&refresh=600','day_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/grafica_d.png" border=0></a>&nbsp;';
$link ="winopeng('reporting/stat_win.php?type=$graph_type&period=3600&id=".$row3["id_agente_modulo"]."&label=".$graph_label."&refresh=60','hour_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/grafica_h.png" border=0></a>';
}
// STRING DATA
else { # Writing string data in different way :)
echo "<td class='".$tdcolor."f9' colspan='2' title='".$row3["datos"]."'>";
echo salida_limpia(substr($row3["datos"],0,42));
}
$myvalue = $row3["datos"];
echo format_for_graph($myvalue );
} else
echo substr(salida_limpia($row3["datos"]),0,42);
echo "<td class=".$tdcolor." width=70>";
if ($row3["id_tipo_modulo"] != 100) {
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=mes&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=semana&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=dia&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.png'></a>";
}
echo "<td class='".$tdcolor."f9'>";
if ($row3["timestamp"] == "0000-00-00 00:00:00"){
echo $lang_label["never"];
} else {
$ahora = time();
if ( ($ahora - $row3["utimestamp"]) > ($real_interval*2)) {
echo "<font color='red'>";
echo human_time_comparation($row3["timestamp"]);
echo "</font>";
} else
echo human_time_comparation($row3["timestamp"]);
}
echo "</td></tr>";
//}
}
echo '</table>';
$handle = "stat".$nombre_tipo_modulo."_".$row3["id_agente_modulo"];
$url = 'reporting/procesos.php?agente='.$row3["id_agente_modulo"];
$win_handle=dechex(crc32($row3["id_agente_modulo"].$row3["nombre"]));
echo "<td class=".$tdcolor." width='78'>";
$graph_label = output_clean_strict ($row3["nombre"]);
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?type=$graph_type&period=2419200&id=".$row3["id_agente_modulo"]."&label=".$graph_label."refresh=180000\", \"month_".$win_handle."\")'><img src='images/grafica_m.png' border=0></a>&nbsp;";
$link ="winopeng('reporting/stat_win.php?type=$graph_type&period=604800&id=".$row3["id_agente_modulo"]."&label=".$graph_label."&refresh=6000','week_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/grafica_w.png" border=0></a>&nbsp;';
$link ="winopeng('reporting/stat_win.php?type=$graph_type&period=86400&id=".$row3["id_agente_modulo"]."&label=".$graph_label."&refresh=600','day_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/grafica_d.png" border=0></a>&nbsp;';
$link ="winopeng('reporting/stat_win.php?type=$graph_type&period=3600&id=".$row3["id_agente_modulo"]."&label=".$graph_label."&refresh=60','hour_".$win_handle."')";
echo '<a href="javascript:'.$link.'"><img src="images/grafica_h.png" border=0></a>';
}
// RAW Table data
echo "<td class=".$tdcolor." width=70>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=mes&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=semana&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=dia&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.png'></a>";
echo "<td class='".$tdcolor."f9'>";
if ($row3["timestamp"] == "0000-00-00 00:00:00"){
echo $lang_label["never"];
} else {
$ahora = time();
if ( ($ahora - $row3["utimestamp"]) > ($real_interval*2)) {
echo "<font color='red'>";
echo human_time_comparation($row3["timestamp"]);
echo "</font>";
} else
echo human_time_comparation($row3["timestamp"]);
}
echo "</td></tr>";
}
echo '</table>';
}
else {
echo "<div class='nf'>".$lang_label["no_modules"]."</div>";
}
}
?>

View File

@ -20,7 +20,8 @@ require("include/config.php");
///////////////////////////////////////////////////////////////////////////////
// Generate a dot graph definition for graphviz
function generate_dot() {
function generate_dot( $simple = 0) {
global $config;
$group_id = -1;
$parents = array();
$orphans = array();
@ -31,7 +32,8 @@ function generate_dot() {
// Get agent data
$agents = mysql_query('SELECT * FROM tagente ORDER BY id_grupo');
while ($agent = mysql_fetch_array($agents)) {
if (give_acl($config["id_user"], $agent["id_grupo"], "AR") == 0)
continue;
// Save node parent information to define edges later
if ($agent['id_parent'] != "0") {
$parents[$agent['id_agente']] = $agent['id_parent'];
@ -49,10 +51,9 @@ function generate_dot() {
//$group_id = $agent['id_grupo'];
//$graph .= open_group($group_id);
//}
// Add node
$graph .= create_node($agent);
$graph .= create_node($agent , $simple);
}
// Close the last subgraph
@ -84,18 +85,18 @@ function generate_dot() {
// Returns an edge definition
function create_edge($head, $tail) {
$edge = $head . ' -- ' . $tail . '[color="grey35", headclip=false, tailclip=false];';
$edge = $head . ' -- ' . $tail . '[color="#BDBDBD", headclip=false, tailclip=false];';
return $edge;
}
// Returns a node definition
function create_node($agent) {
function create_node($agent, $simple = 0) {
$bad_modules = mysql_query('SELECT estado FROM tagente_estado AS e,
tagente_modulo AS m
WHERE m.id_agente=' . $agent['id_agente'] .
' AND m.id_tipo_modulo in (2, 6, 9, 18, 21, 100)
AND e.id_agente_modulo = m.id_agente_modulo
AND e.datos = 0');
AND e.estado = 1');
// Set node status
if (mysql_num_rows($bad_modules) > 0) {
@ -105,28 +106,38 @@ function create_node($agent) {
$status_color = '#8DFF1D';
}
// Set node icon
if (file_exists('images/networkmap/' . $agent['id_os'] . '.png')) {
$img_node = 'images/networkmap/' . $agent['id_os'] . '.png';
}
else {
$img_node = 'images/networkmap/0.png';
}
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=10, style="filled", fixedsize=true, width=0.6, height=0.6, label=<<TABLE BORDER="0">
// Short name
$name = strtolower($agent["nombre"]);
if (strlen($name) > 12)
$name = substr($name,0,12);
if ($simple == 0){
// Set node icon
if (file_exists('images/networkmap/' . $agent['id_os'] . '.png')) {
$img_node = 'images/networkmap/' . $agent['id_os'] . '.png';
}
else {
$img_node = 'images/networkmap/0.png';
}
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=9, style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR><TD><IMG SRC="' . $img_node . '"/></TD></TR>
<TR><TD BGCOLOR="white">' . $agent['nombre'] . '</TD></TR></TABLE>>,
shape="ellipse", tooltip="' . $agent['nombre'] . ' (' . $agent['direccion'] . ')", URL="'
<TR><TD color="green">' . $name . '</TD></TR></TABLE>>,
shape="ellipse", tooltip="' . $agent["nombre"] . ' (' . $agent['direccion'] . ')", URL="'
. 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='
. $agent['id_agente'] . '"];';
} else {
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=7, style="filled", fixedsize=true, width=0.20, height=0.20, label="", URL="'
. 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='
. $agent['id_agente'] . '"];';
}
return $node;
}
// Returns the definition of the central module
function create_pandora_node($name) {
$node = '0 [ color="black", fontsize=10, style="filled", fixedsize=true, width=0.8, height=0.6, label=<<TABLE BORDER="0">
$node = '0 [ color="#364D1F", fontsize=10, style="filled", fixedsize=true, width=0.8, height=0.6, label=<<TABLE BORDER="0">
<TR><TD><IMG SRC="images/networkmap/pandora_node.png"/></TD></TR>
<TR><TD BGCOLOR="white">' . $name . '</TD></TR></TABLE>>,
shape="ellipse", tooltip="' . $name . '", URL="index.php?sec=estado&sec2=operation/agentes/estado_grupo" ];';
@ -156,10 +167,10 @@ function close_group() {
// Opens a graph definition
function open_graph() {
global $config, $layout, $nooverlap, $pure, $zoom;
global $config, $layout, $nooverlap, $pure, $zoom, $ranksep;
$overlap = 'compress';
$size_x = 8;
$size_y = 6;
$size_x = 8.1;
$size_y = 6.5;
$size = '';
if ($layout == '' || $layout == 'radial') {
@ -174,11 +185,19 @@ function open_graph() {
$size_x *= $zoom;
$size_y *= $zoom;
}
$size = $size_x . ',' . $size_y;
$head = 'graph networkmap { labeljust=l; outputorder="edgesfirst"; overlap=' .
$overlap . '; ratio="fill"; root="0"; size="' . $size . '"; ';
// BEWARE: graphwiz DONT use single ('), you need double (")
$head = "graph networkmap {
labeljust=l;
margin=0;
ranksep=\"$ranksep\";
outputorder=edgesfirst;
overlap=\"$overlap\";
ratio=fill;
root=0;
size=\"$size\";
";
return $head;
}
@ -215,6 +234,8 @@ $layout = (string) get_parameter ('layout');
$nooverlap = (boolean) get_parameter ('nooverlap');
$pure = (int) get_parameter ('pure');
$zoom = (float) get_parameter ('zoom');
$ranksep = (float) get_parameter ('ranksep', 2.5);
$simple = (int) get_parameter ('simple', 0);
// Login check
$id_user = $_SESSION["id_usuario"];
@ -253,25 +274,33 @@ $layout_array = array (
echo '<form name="input" action="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=' . $pure . '" method="post">';
echo '<table cellpadding="4" cellspacing="4" class="databox">';
echo '<tr>';
echo '<td valign="top">' . lang_string('Layout') . ' &nbsp';
echo '<td valign="top">' . lang_string('Layout') . ' &nbsp;';
print_select ($layout_array, 'layout', $layout, '', '', '');
echo '</td>';
echo '<td valign="top">' . lang_string('No Overlap') . ' &nbsp;';
print_checkbox ('nooverlap', 'nooverlap', $nooverlap);
echo '</td>';
echo '<td valign="top">' . lang_string('Simple') . ' &nbsp;';
print_checkbox ('simple', '1', $simple);
echo '</td>';
if ($pure == "1") {
// Zoom
$zoom_array = array (
'1' => 'x1',
'1.5' => 'x1.5',
'2' => 'x2',
'2.5' => 'x2.5',
'3' => 'x3',
'1.2' => 'x2',
'1.6' => 'x3',
'2' => 'x4',
'2.5' => 'x5',
'5' => 'x10',
);
echo '<td valign="top">' . lang_string('Zoom') . ' &nbsp';
echo '<td valign="top">' . lang_string('Zoom') . ' &nbsp;';
print_select ($zoom_array, 'zoom', $zoom, '', '', '');
echo '</td>';
echo '<td valign="top">' . lang_string('No Overlap') . ' &nbsp';
print_checkbox ('nooverlap', 'nooverlap', $nooverlap);
echo '</td>';
}
//echo ' Display groups <input type="checkbox" name="group" value="group" class="chk"/>';
echo '<td>';
@ -285,7 +314,7 @@ echo '</form>';
$filter = set_filter();
// Generate dot file
$graph = generate_dot();
$graph = generate_dot($simple);
//DEBUG
//$fh = fopen("networkmap.dot", 'w') or die("can't open file");
@ -294,11 +323,11 @@ $graph = generate_dot();
// Generate image and map
$cmd = "echo " . escapeshellarg($graph) .
" | $filter -Tcmapx -onetworkmap.map -Tpng -onetworkmap.png";
" | $filter -Tcmapx -o".$config["attachment_store"]."/networkmap.map -Tpng -o".$config["attachment_store"]."/networkmap.png";
if (system($cmd) !== false) {
echo '<img src="networkmap.png" usemap="#networkmap"/>';
include "networkmap.map";
echo '<img src="attachment/networkmap.png" usemap="#networkmap"/>';
include $config["attachment_store"]."/networkmap.map";
}
?>

View File

@ -40,22 +40,25 @@ $ag_freestring = get_parameter ("ag_freestring", "");
$ag_modulename = get_parameter ("ag_modulename", "");
$ag_group = get_parameter ("ag_group", -1);
$offset = get_parameter ("offset", 0);
$status = get_parameter ("status", 0);
$URL = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60";
echo "<form method='post' action='";
if ($ag_group != -1)
$URL .= "&ag_group_refresh=".$ag_group;
$URL .= "&ag_group=".$ag_group;
// Module name selector
// This code thanks for an idea from Nikum, nikun_h@hotmail.com
if ($ag_modulename != "")
$URL .= "&ag_modulename=".$ag_modulename;
// Freestring selector
if ($ag_freestring != "")
$URL .= "&ag_freestring=".$ag_freestring ;
// Status selector
$URL .= "&status=$status";
echo $URL;
// End FORM TAG
@ -73,6 +76,26 @@ echo "<option value=1>".dame_nombre_grupo(1)."</option>";
list_group ($id_user);
echo "</select>";
echo "</td>";
echo "<td>";
echo lang_string ("Monitor status");
echo "<td>";
echo "<select name='status'>";
if ($status == -1){
echo "<option value=-1>".lang_string("All");
echo "<option value=0>".lang_string("Monitors down");
echo "<option value=1>".lang_string("Monitors up");
} elseif ($status == 0){
echo "<option value=0>".lang_string("Monitors down");
echo "<option value=-1>".lang_string("All");
echo "<option value=1>".lang_string("Monitors up");
} else {
echo "<option value=1>".lang_string("Monitors up");
echo "<option value=0>".lang_string("Monitors down");
echo "<option value=-1>".lang_string("All");
}
echo "</select>";
echo "</tr>";
echo "<tr>";
echo "<td valign='middle'>".$lang_label["module_name"]."</td>";
@ -84,7 +107,7 @@ if ( isset($ag_modulename)){
echo "<option>".$lang_label["all"]."</option>";
$sql='SELECT DISTINCT nombre
FROM tagente_modulo
WHERE id_tipo_modulo in (2, 9, 12, 18, 6, 100)';
WHERE id_tipo_modulo in (2, 6, 9, 18, 21, 100)';
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){
echo "<option>".$row['0']."</option>";
@ -92,8 +115,8 @@ while ($row=mysql_fetch_array($result)){
echo "</select>";
echo "<td valign='middle'>";
echo lang_string ("Free text");
echo "&nbsp;<input type=text name='ag_freestring' size=15 value='$ag_freestring'>";
echo "<td valign='middle'>";
echo "<input type=text name='ag_freestring' size=15 value='$ag_freestring'>";
echo "<td valign='middle'>";
echo "<input name='uptbutton' type='submit' class='sub' value='".$lang_label["show"]."'";
echo "</form>";
@ -105,7 +128,7 @@ $SQL_pre = "SELECT tagente_modulo.id_agente_modulo, tagente.nombre, tagente_modu
$SQL_pre_count = "SELECT count(tagente_modulo.id_agente_modulo) ";
$SQL = " FROM tagente, tagente_modulo WHERE tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo in (2, 9, 12, 18, 6, 100) ";
$SQL = " FROM tagente, tagente_modulo, tagente_estado WHERE tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo in (2, 9, 12, 18, 6, 100) AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo ";
// Agent group selector
if ($ag_group > 1)
@ -124,7 +147,15 @@ if ($ag_modulename != "")
// Freestring selector
if ($ag_freestring != "")
$SQL .= " AND ( tagente_modulo.nombre LIKE '%".$ag_freestring."%' OR tagente_modulo.descripcion LIKE '%".$ag_freestring."%') ";
$SQL .= " AND ( tagente.nombre LIKE '%".$ag_freestring."%' OR tagente_modulo.nombre LIKE '%".$ag_freestring."%' OR tagente_modulo.descripcion LIKE '%".$ag_freestring."%') ";
// Status selector
if ($status == 1)
$SQL .= " AND tagente_estado.estado = 0 ";
elseif ($status == 0)
$SQL .= " AND tagente_estado.estado = 1 ";
// Final order
$SQL .= " ORDER BY tagente.id_grupo, tagente.nombre";
// Build final SQL sentences
@ -189,9 +220,9 @@ if ($counter > 0){
$data2=mysql_fetch_array($result_gen2);
echo "<td class='$tdcolor' align='center' width=20>";
if ($data2["datos"] > 0){
echo "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["green_light"]."'>";
echo "<img src='images/pixel_green.png' width=40 height=18 title='".lang_string("Monitor up")."'>";
} else {
echo "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["red_light"]."'>";
echo "<img src='images/pixel_red.png' width=40 height=18 title='".lang_string ("Monitor down")."'>";
}
echo "<td class='".$tdcolor."f9'>";
@ -212,9 +243,9 @@ if ($counter > 0){
echo "<table width=700 border=0>";
echo "<tr>";
echo "<td class='f9'>";
echo "<img src='images/pixel_green.png' width=40 height=18>&nbsp;&nbsp;".$lang_label["green_light"]."</td>";
echo "<img src='images/pixel_green.png' width=40 height=18>&nbsp;&nbsp;".lang_string("Monitor up")."</td>";
echo "<td class='f9'";
echo "<img src='images/pixel_red.png' width=40 height=18>&nbsp;&nbsp;".$lang_label["red_light"]."</td>";
echo "<img src='images/pixel_red.png' width=40 height=18>&nbsp;&nbsp;".lang_string("Monitor down")."</td>";
echo "</table>";
?>

View File

@ -46,7 +46,10 @@
$module_sanity = format_numeric (100 - $notinit_percentage);
$total_alerts = $data_alert + $monitor_alert;
$total_fired_alerts = $monitor_alert_total+$data_alert_total;
$alert_level = format_numeric (100 - ($total_alerts / ($total_fired_alerts / 100)));
if ($total_fired_alerts > 0)
$alert_level = format_numeric (100 - ($total_alerts / ($total_fired_alerts / 100)));
else
$alert_level = 100;
if ($monitor_checks > 0){
$monitor_health = format_numeric ( 100- (($monitor_bad + $monitor_unknown) / ($monitor_checks/100)) , 1);

View File

@ -157,7 +157,7 @@ if (isset($_POST["updatebt"])){
$offset = get_parameter ( "offset",0);
$ev_group = get_parameter ("ev_group", 0); // group
$search = get_parameter ("search", ""); // free search
$event_type = get_parameter ("event_type", "all"); // 0 all
$event_type = get_parameter ("event_type", ''); // 0 all
$severity = get_parameter ("severity", -1); // -1 all
$status = get_parameter ("status", 0); // -1 all, 0 only red, 1 only green
$id_agent = get_parameter ("id_agent", -1);
@ -171,7 +171,7 @@ if ($status == 0)
$sql_post .= " AND estado = 0";
if ($search != "")
$sql_post .= " AND evento LIKE '%$search%'";
if ($event_type != "all")
if ($event_type != "")
$sql_post .= " AND event_type = '$event_type'";
if ($severity != -1)
$sql_post .= " AND criticity >= $severity";
@ -218,7 +218,7 @@ echo "</select></td>";
// Event type
echo "<td>".lang_string ("Event type")."</td>";
echo "<td>";
echo print_select (get_event_types (), 'event_type', $event_type, '', 'all', 0);
echo print_select (get_event_types (), 'event_type', $event_type, '', 'all', "");
echo "<tr>";
// Severity
@ -250,8 +250,12 @@ echo "<tr>";
echo "<td>".lang_string ("Free search")."</td>";
echo "<td>";
echo "<input type='text' size=15 value='".$search."' name='search'>";
echo "<td>";
echo "<td colspan=2>";
echo "<input type=submit value='".lang_string("Update")."' class='sub upd'>";
echo "&nbsp;&nbsp;&nbsp;";
echo "<a href='operation/events/export_csv.php?ev_group=$ev_group&event_type=$event_type&search=$search&severity=$severity&status=$status&id_agent=$id_agent'>";
echo "<img src='images/wand.png' title='Export to CSV file'></A>";
echo "</table>";
echo "</form>";
echo "<td>";
@ -358,6 +362,9 @@ if ($total_events > 0){
break;
case "recon_host_detected";
echo "<img src='images/network.png'>";
break;
case "new_agent";
echo "<img src='images/wand.png'>";
break;
}

View File

@ -0,0 +1,93 @@
<?php
// Pandora FMS
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
//
// 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.
session_start();
include ("../../include/config.php");
include ("../../include/functions.php");
include ("../../include/functions_db.php");
session_write_close();
$config["id_user"] = $_SESSION["id_usuario"];
if ( (give_acl($config["id_user"], 0, "AR")==0) AND (give_acl($config["id_user"], 0, "AW")==0) ){
require ("../../general/noaccess.php");
exit;
}
$offset = get_parameter ( "offset",0);
$ev_group = get_parameter ("ev_group", 0); // group
$search = get_parameter ("search", ""); // free search
$event_type = get_parameter ("event_type", "all"); // 0 all
$severity = get_parameter ("severity", -1); // -1 all
$status = get_parameter ("status", -1); // -1 all, 0 only red, 1 only green
$id_agent = get_parameter ("id_agent", -1);
$sql_post = "";
if ($ev_group > 1)
$sql_post .= " AND id_grupo = $ev_group";
if ($status == 1)
$sql_post .= " AND estado = 1";
if ($status == 0)
$sql_post .= " AND estado = 0";
if ($search != "")
$sql_post .= " AND evento LIKE '%$search%'";
if (($event_type != "all") AND ($event_type != 0))
$sql_post .= " AND event_type = '$event_type'";
if ($severity != -1)
$sql_post .= " AND criticity >= $severity";
if ($id_agent != -1)
$sql_post .= " AND id_agente = $id_agent";
$sql2 = "SELECT * FROM tevento WHERE 1=1 ";
$sql2 .= $sql_post . " ORDER BY timestamp DESC";
$now = date("Y-m-d");
// Show contentype header
Header("Content-type: text/txt");
header('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.txt"');
echo "timestamp, agent, group, event, status, user, event_type, severity";
echo chr(13);
$result=mysql_query($sql2);
while ($row=mysql_fetch_array($result)){
$id_grupo = $row["id_grupo"];
if (give_acl($config["id_user"], $id_grupo, "AR") == 1){ // Only incident read access to view data !
echo $row["timestamp"];
echo ", ";
echo get_db_sql("SELECT nombre FROM tagente WHERE id_agente = '".$row["id_agente"]."'");
echo ", ";
echo get_db_sql("SELECT nombre FROM tgrupo WHERE id_grupo = '".$row["id_grupo"]."'");
echo ", ";
echo $row["evento"];
echo ", ";
echo $row["estado"];
echo ", ";
echo $row["id_usuario"];
echo ", ";
echo $row["event_type"];
echo ", ";
echo $row["criticity"];
echo chr(13);
}
}
?>

View File

@ -28,21 +28,26 @@ if ((comprueba_login() == 0) AND (give_acl($id_user, 0, "AR")==1) ) {
}
}
$id_server = $_GET["server_id"];
$id_server = get_parameter ("server_id", -1);
$sql = "SELECT * FROM tserver where id_server = $id_server";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$server_name = $row["name"];
$id_server = $row[0];
echo "<h2>".$lang_label["server_detail"]." - $server_name </h2>";
echo "<h2>".$lang_label["server_detail"]." - $server_name ";
echo "&nbsp;";
echo "<a href='index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id=$id_server'>";
echo "<img src='images/refresh.png'>";
echo "</A>";
echo "</h2>";
// Show network tasks for Recon Server
if ($row["recon_server"]){
$sql = "SELECT * FROM trecon_task where id_network_server = $id_server";
// Connect DataBase
$result=mysql_query($sql);
if (mysql_num_rows($result)){
echo "<table cellpadding='4' cellspacing='4' withd='800'>";
echo "<table cellpadding='4' cellspacing='4' width='760' class='databox'>";
echo "<tr><th class='datos'><th class='datos'>".$lang_label["task_name"]."</th>";
echo "<th class='datos'>".$lang_label['interval']."</th>";
echo "<th class='datos'>".$lang_label['network']."</th>";
@ -100,7 +105,7 @@ if ((comprueba_login() == 0) AND (give_acl($id_user, 0, "AR")==1) ) {
echo "ICMP";
}
elseif ($type == 2){
echo "SNMP";
echo "TCP Port";
}
// status
echo "<td class='$tdcolor' align='center'>";

View File

@ -296,7 +296,7 @@ CREATE TABLE `tevento` (
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`evento` varchar(255) NOT NULL default '',
`utimestamp` bigint(20) unsigned NOT NULL default '0',
`event_type` ENUM('unknown', 'monitor_up', 'monitor_down', 'alert_fired', 'alert_recovered', 'alert_ceased', 'alert_manual_validation', 'recon_host_detected', 'system', 'error') default 'unknown',
`event_type` ENUM('unknown', 'monitor_up', 'monitor_down', 'alert_fired', 'alert_recovered', 'alert_ceased', 'alert_manual_validation', 'recon_host_detected', 'system', 'error', 'new_agent') default 'unknown',
`id_agentmodule` bigint(20) NOT NULL default '0',
`id_alert_am` bigint(20) NOT NULL default '0',
`criticity` int(4) unsigned NOT NULL default 0,

View File

@ -72,7 +72,17 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `tconfig_os` DISABLE KEYS */;
LOCK TABLES `tconfig_os` WRITE;
INSERT INTO `tconfig_os` VALUES (1,'Linux','Linux: All versions','so_linux.png'),(2,'Solaris','Sun Solaris','so_solaris.png'),(3,'AIX','IBM AIX','so_aix.png'),(4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png'),(5,'HP-UX','HP-UX Unix OS','so_hpux.png'),(7,'Cisco','CISCO IOS','so_cisco.png'),(8,'MacOS','MAC OS','so_mac.png'),(9,'Windows','Microsoft Windows OS','so_win.png'),(10,'Other','Other SO','so_other.png'),(11,'Network','Pandora Network Agent','network.png');
INSERT INTO `tconfig_os` VALUES
(1,'Linux','Linux: All versions','so_linux.png'),
(2,'Solaris','Sun Solaris','so_solaris.png'),
(3,'AIX','IBM AIX','so_aix.png'),
(4,'BSD','OpenBSD, FreeBSD and Others','so_bsd.png'),
(5,'HP-UX','HP-UX Unix OS','so_hpux.png'),
(7,'Cisco','CISCO IOS','so_cisco.png'),
(8,'MacOS','MAC OS','so_mac.png'),
(9,'Windows','Microsoft Windows OS','so_win.png'),
(10,'Other','Other SO','so_other.png'),
(11,'Network','Pandora Network Agent','network.png');
UNLOCK TABLES;
/*!40000 ALTER TABLE `tconfig_os` ENABLE KEYS */;
@ -134,7 +144,12 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `tmodule_group` DISABLE KEYS */;
LOCK TABLES `tmodule_group` WRITE;
INSERT INTO `tmodule_group` VALUES (1,'General'),(2,'Networking'),(3,'Application'),(4,'System'),(5,'Miscellaneous');
INSERT INTO `tmodule_group` VALUES
(1,'General'),
(2,'Networking'),
(3,'Application'),
(4,'System'),
(5,'Miscellaneous');
UNLOCK TABLES;
/*!40000 ALTER TABLE `tmodule_group` ENABLE KEYS */;

View File

@ -0,0 +1,119 @@
UPDATE tconfig SET value = '1.3' WHERE token = 'db_scheme_version';
UPDATE tconfig SET value = '1.3' WHERE token = 'db_scheme_build';
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
INSERT INTO tconfig (token, value) VALUES ('style','pandora');
UPDATE tconfig_os SET icon_name = 'so_aix.png' WHERE icon_name = 'so_aix.gif';
UPDATE tconfig_os SET icon_name = 'so_linux.png' WHERE icon_name = 'so_linux.gif';
UPDATE tconfig_os SET icon_name = 'so_solaris.png' WHERE icon_name = 'so_solaris.gif';
UPDATE tconfig_os SET icon_name = 'so_hpux.png' WHERE icon_name = 'so_hpux.gif';
UPDATE tconfig_os SET icon_name = 'so_beos.png' WHERE icon_name = 'so_beos.gif';
UPDATE tconfig_os SET icon_name = 'so_cisco.png' WHERE icon_name = 'so_cisco.gif';
UPDATE tconfig_os SET icon_name = 'so_mac.png' WHERE icon_name = 'so_mac.gif';
UPDATE tconfig_os SET icon_name = 'so_win.png' WHERE icon_name = 'so_win.gif';
UPDATE tconfig_os SET icon_name = 'so_other.png' WHERE icon_name = 'so_other.gif';
UPDATE tconfig_os SET icon_name = 'network.png' WHERE icon_name = 'network.gif';
UPDATE tgrupo SET icon = 'world', parent = 0, disabled = 0 WHERE id_grupo = 1;
UPDATE tgrupo SET icon = 'server_database', parent = 0, disabled = 0 WHERE id_grupo = 2;
UPDATE tgrupo SET icon = 'eye', parent = 0, disabled = 0 WHERE id_grupo = 3;
UPDATE tgrupo SET icon = 'firewall', parent = 0, disabled = 0 WHERE id_grupo = 4;
UPDATE tgrupo SET icon = 'database_gear', parent = 0, disabled = 0 WHERE id_grupo = 8;
UPDATE tgrupo SET icon = 'transmit', parent = 0, disabled = 0 WHERE id_grupo = 9;
UPDATE tgrupo SET icon = 'house', parent = 0, disabled = 0 WHERE id_grupo = 10;
UPDATE tgrupo SET icon = 'computer', parent = 0, disabled = 0 WHERE id_grupo = 11;
UPDATE tgrupo SET icon = 'applications', parent = 0, disabled = 0 WHERE id_grupo = 12;
INSERT INTO `tnetwork_component` VALUES (3,'Sysname','Get name of system using SNMP standard MIB',1,17,0,0,900,0,'','','public','.1.3.6.1.2.1.1.1.0',1);
INSERT INTO `tnetwork_component` VALUES (19,'Power #1','PowerSupply #1 status',6,18,0,0,300,0,'','','public',' .1.3.6.1.4.1.2334.2.1.5.8.0',4);
INSERT INTO `tnetwork_component` VALUES (20,'Power #2','PowerSupply #2 status',6,18,0,0,300,0,'','','public',' .1.3.6.1.4.1.2334.2.1.5.10.0',4);
INSERT INTO `tnetwork_component` VALUES (22,'HSRP Status','Get status of HSRP',2,18,0,0,300,0,'','','public','1.3.6.1.4.1.9.9.106.1.2.1.1.15.12.106',2);
INSERT INTO `tnetwork_component` VALUES (24,'NIC #1 status','Status of NIC#1',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.1',2);
INSERT INTO `tnetwork_component` VALUES (25,'NIC #2 status','Status of NIC #2',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.2',2);
INSERT INTO `tnetwork_component` VALUES (26,'NIC #3 status','Status of NIC #3',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.3',2);
INSERT INTO `tnetwork_component` VALUES (27,'NIC #1 outOctects','Output throughtput on Interface #1',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.16.1',2);
INSERT INTO `tnetwork_component` VALUES (28,'NIC #2 outOctects','Output troughtput on interface #2',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.16.2',1);
INSERT INTO `tnetwork_component` VALUES (29,'NIC #3 outOctects','Output troughtput on Interface #3',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.16.3',2);
INSERT INTO `tnetwork_component` VALUES (30,'NIC #1 inOctects','Input troughtput on Interface #1',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.10.1',2);
INSERT INTO `tnetwork_component` VALUES (31,'NIC #2 inOctects','Input throughtput for interface #2',10,16,0,0,180,0,'','NULL','public','.1.3.6.1.2.1.2.2.1.10.2',2);
INSERT INTO `tnetwork_component` VALUES (32,'NIC #3 inOctects','Input throught on interface #3',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.10.3',2);
INSERT INTO `tnetwork_component` VALUES (34,'Host Alive','Check if host is alive using ICMP ping check.',10,6,0,0,120,0,'','','','',2);
INSERT INTO `tnetwork_component` VALUES (36,'Host Latency','Get host network latency in miliseconds, using ICMP.',10,7,0,0,180,0,'','','','',2);
INSERT INTO `tnetwork_component` VALUES (37,'Check HTTP Server','Test APACHE2 HTTP service remotely (Protocol response, not only openport)',10,9,0,0,300,80,'GET / HTTP/1.0^M^M','HTTP/1.1 200 OK','','',3);
INSERT INTO `tnetwork_component` VALUES (38,'Check FTP Server','Check FTP protocol, not only check port.',10,9,0,0,300,21,'QUIT','221','','',3);
INSERT INTO `tnetwork_component` VALUES (39,'Check SSH Server','Checks port 22 is opened',10,9,0,0,300,22,'','','','',2);
INSERT INTO `tnetwork_component` VALUES (40,'Check Telnet server','Check telnet port',10,9,0,0,300,23,'','','','',2);
INSERT INTO `tnetwork_component` VALUES (41,'Check SMTP server','Check if SMTP port it&#039;s open',10,9,0,0,300,25,'','','','',2);
INSERT INTO `tnetwork_component` VALUES (42,'Check POP3 server','Check POP3 port.',10,9,0,0,300,110,'','','','',2);
INSERT INTO `tnetwork_component` VALUES (43,'NIC #7 outOctects','Get outcoming octects from NIC #7',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.16.7',2);
INSERT INTO `tnetwork_component` VALUES (44,'NIC #7 inOctects','Get incoming octects from NIC #7',10,16,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.10.7',2);
INSERT INTO `tnetwork_component` VALUES (45,'NIC #4 Status','Get status of NIC #4',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.4',2);
INSERT INTO `tnetwork_component` VALUES (46,'NIC #5 Status','Get status of NIC #5',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.5',2);
INSERT INTO `tnetwork_component` VALUES (47,'NIC #6 Status','Get status of NIC #6',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.6',2);
INSERT INTO `tnetwork_component` VALUES (48,'NIC #7 Status','Get status of NIC #7',10,18,0,0,180,0,'','','public','.1.3.6.1.2.1.2.2.1.8.7',2);
INSERT INTO `tnetwork_component` VALUES (49,'CPU User','Linux User CPU Usage (%)',5,15,0,0,180,0,'','','public','.1.3.6.1.4.1.2021.11.9.0',4);
INSERT INTO `tnetwork_component` VALUES (50,'CPU System','Linux System CPU usage',5,15,0,0,180,0,'','','public','.1.3.6.1.4.1.2021.11.10.0',4);
INSERT INTO `tnetwork_component` VALUES (51,'System Context Change','Linux System Context changes ',5,15,0,0,180,0,'','','public','.1.3.6.1.4.1.2021.11.8.0',4);
INSERT INTO `tnetwork_component` VALUES (52,'System Interrupts','Linux system interrupts ',5,15,0,0,180,0,'','','public','.1.3.6.1.4.1.2021.11.7.0',4);
INSERT INTO `tnetwork_component` VALUES (53,'Sytem IO Sent','Linux System IO Sent ',5,15,0,0,180,0,'','','public','.1.3.6.1.4.1.2021.11.5.0',4);
INSERT INTO `tnetwork_component` VALUES (54,'System IO Recv','Linux System IO Recv ',5,15,0,0,180,0,'','','public','.1.3.6.1.4.1.2021.11.6.0',4);
INSERT INTO `tnetwork_component` VALUES (55,'System SwapIn ','Linux System Swap In',5,15,0,0,180,0,'','','public','.1.3.6.1.4.1.2021.11.3.0',1);
INSERT INTO `tnetwork_component` VALUES (56,'System Buffer Memory','Linux System Buffer Memory (used as available memory)',5,15,0,0,180,0,'','','public','.1.3.6.1.4.1.2021.4.14.0',4);
INSERT INTO `tnetwork_component` VALUES (57,'System Cached Memory','Linux System Cached Memory (used as free memory)',5,15,0,0,180,0,'','','public','.1.3.6.1.4.1.2021.4.15.0',4);
INSERT INTO `tnetwork_component` VALUES (58,'System Processes','Total system process on any host',12,15,0,0,180,0,'','','public','.1.3.6.1.2.1.25.1.6.0',4);
INSERT INTO `tnetwork_component_group` VALUES (1,'General group',0);
INSERT INTO `tnetwork_component_group` VALUES (2,'Cisco MIBs',10);
INSERT INTO `tnetwork_component_group` VALUES (3,'Nortel MIBS',10);
INSERT INTO `tnetwork_component_group` VALUES (4,'3COM MIBs',10);
INSERT INTO `tnetwork_component_group` VALUES (5,'UNIX MIBs',12);
INSERT INTO `tnetwork_component_group` VALUES (6,'Packetshaper MIBs',10);
INSERT INTO `tnetwork_component_group` VALUES (7,'Nortel BPS 2000 MIBs',3);
INSERT INTO `tnetwork_component_group` VALUES (8,'Cisco Catalyst3750 MIBs',2);
INSERT INTO `tnetwork_component_group` VALUES (9,'Cisco AP120+',2);
INSERT INTO `tnetwork_component_group` VALUES (10,'Network Management',0);
INSERT INTO `tnetwork_component_group` VALUES (11,'Microsoft Windows MIB',12);
INSERT INTO `tnetwork_component_group` VALUES (12,'Operating Systems',0);
UPDATE ttipo_modulo SET icon = 'mod_data.png' WHERE icon = 'mod_data.gif';
UPDATE ttipo_modulo SET icon = 'mod_proc.png' WHERE icon = 'mod_proc.gif';
UPDATE ttipo_modulo SET icon = 'mod_string.png' WHERE icon = 'mod_string.gif';
UPDATE ttipo_modulo SET icon = 'mod_data_inc.png' WHERE icon = 'mod_data_inc.gif';
UPDATE ttipo_modulo SET icon = 'mod_icmp_proc.png' WHERE icon = 'mod_icmp_proc.gif';
UPDATE ttipo_modulo SET icon = 'mod_icmp_data.png' WHERE icon = 'mod_icmp_data.gif';
UPDATE ttipo_modulo SET icon = 'mod_tcp_data.png' WHERE icon = 'mod_tcp_data.gif';
UPDATE ttipo_modulo SET icon = 'mod_tcp_proc.png' WHERE icon = 'mod_tcp_proc.gif';
UPDATE ttipo_modulo SET icon = 'mod_tcp_string.png' WHERE icon = 'mod_tcp_string.gif';
UPDATE ttipo_modulo SET icon = 'mod_tcp_inc.png' WHERE icon = 'mod_tcp_inc.gif';
UPDATE ttipo_modulo SET icon = 'mod_udp_proc.png' WHERE icon = 'mod_udp_proc.gif';
UPDATE ttipo_modulo SET icon = 'mod_snmp_data.png' WHERE icon = 'mod_snmp_data.gif';
UPDATE ttipo_modulo SET icon = 'mod_snmp_inc.png' WHERE icon = 'mod_snmp_inc.gif';
UPDATE ttipo_modulo SET icon = 'mod_snmp_string.png' WHERE icon = 'mod_snmp_string.gif';
UPDATE ttipo_modulo SET icon = 'mod_snmp_proc.png' WHERE icon = 'mod_snmp_proc.gif';
INSERT INTO `tnews` VALUES (1,'admin','Welcome to Pandora FMS 1.3.1!','This is the new Pandora FMS Console. A lot of new features have been added since last version. Please read the documentation about it, and feel free to test any option.\r\n\r\nThe Pandora FMS Team.','2007-06-22 13:03:20');
INSERT INTO `tnetwork_profile` VALUES (1,'SNMP Basic management','Basic SNMP management (only first interface)');
INSERT INTO `tnetwork_profile` VALUES (2,'Basic Server','Check basic server services and network latency. This checks SSH, FTP and HTTP. Also a ICMP host alive check.');
INSERT INTO `tnetwork_profile` VALUES (3,'Linux SNMP','Linux SNMP Management');
INSERT INTO `tnetwork_profile_component` VALUES (1,24,1);
INSERT INTO `tnetwork_profile_component` VALUES (2,27,1);
INSERT INTO `tnetwork_profile_component` VALUES (3,30,1);
INSERT INTO `tnetwork_profile_component` VALUES (4,37,2);
INSERT INTO `tnetwork_profile_component` VALUES (5,38,2);
INSERT INTO `tnetwork_profile_component` VALUES (6,39,2);
INSERT INTO `tnetwork_profile_component` VALUES (7,36,2);
INSERT INTO `tnetwork_profile_component` VALUES (8,34,2);
INSERT INTO `tnetwork_profile_component` VALUES (9,51,3);
INSERT INTO `tnetwork_profile_component` VALUES (10,52,3);
INSERT INTO `tnetwork_profile_component` VALUES (11,53,3);
INSERT INTO `tnetwork_profile_component` VALUES (12,54,3);
INSERT INTO `tnetwork_profile_component` VALUES (13,55,3);
INSERT INTO `tnetwork_profile_component` VALUES (14,56,3);
INSERT INTO `tnetwork_profile_component` VALUES (15,57,3);

View File

@ -856,6 +856,109 @@ function graphic_agentaccess ($id_agent, $periodo, $width, $height) {
$Graph->done();
}
function graphic_string_data ($id_agent_module, $periodo, $width, $height, $pure = 0, $date = "") {
include ("../include/config.php");
require_once 'Image/Graph.php';
require ("../include/languages/language_".$config['language'].".php");
// $color = $config["color_graph1"]; //#437722"; // Green pandora 1.1 octopus color
$color = "#437722";
if ($date == "")
$date = time ();
$resolution = $config["graph_res"] * 5; // Number of "slices" we want in graph
$fechatope = $date - $periodo;
$horasint = $periodo / $resolution; // Each intervalo is $horasint seconds length
// Creamos la tabla (array) con los valores para el grafico. Inicializacion
for ($i = 0; $i <$resolution; $i++) {
$valores[$i][0] = 0; // [0] Valor (contador)
$valores[$i][1] = dame_fecha_grafico_timestamp ($fechatope + ($horasint * $i));
$valores[$i][2] = $fechatope + ($horasint * $i); // [2] Top limit for this range
$valores[$i][3] = $fechatope + ($horasint * ($i + 1)); // [3] Botom limit
}
$sql1="SELECT utimestamp FROM tagente_datos_string WHERE id_agente_modulo = ".$id_agent_module." and utimestamp > '".$fechatope."'";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
for ($i = 0; $i < $resolution; $i++){
if (($row[0] < $valores[$i][3]) and ($row[0] >= $valores[$i][2]) ){
// entra en esta fila
$valores[$i][0]++;
}
}
}
$valor_maximo = 0;
for ($i = 0; $i < $resolution; $i++) { // 30 entries in graph, one by day
//echo $valores[$i][2]. " - ". $valores[$i][3] ." | ". $valores[$i][1]." - ".$valores[$i][0];
//echo "<br>";
$grafica[]=$valores[$i][0];
if ($valores[$i][0] > $valor_maximo)
$valor_maximo = $valores[$i][0];
}
if ($valor_maximo <= 0) {
graphic_error ();
return;
}
$nombre_agente = dame_nombre_agente_agentemodulo ($id_agent_module);
$id_agente = dame_agente_id ($nombre_agente);
$nombre_modulo = dame_nombre_modulo_agentemodulo ($id_agent_module);
if ($pure == 0){
$Graph =& Image_Graph::factory('graph', array($width, $height));
// add a TrueType font
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(7);
$Graph->setFont($Font);
$Graph->add(
Image_Graph::vertical(
Image_Graph::vertical(
$Title = Image_Graph::factory('title', array(' Pandora FMS Graph - '.strtoupper($nombre_agente)." - ".give_human_time ($periodo), 10)),
$Subtitle = Image_Graph::factory('title', array(' '.lang_string("Data occurrence for module ").$nombre_modulo, 7)),
90
),
Image_Graph::horizontal(
$Plotarea = Image_Graph::factory('plotarea'),
$Legend = Image_Graph::factory('legend'),
100
),
15)
);
$Legend->setPlotarea($Plotarea);
$Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
$Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
} else { // Pure, without title and legends
$Graph->add($Plotarea = Image_Graph::factory('plotarea'));
}
//$Legend->setPlotarea($Plotarea);
// Create the dataset
// Merge data into a dataset object (sancho)
$Dataset1 =& Image_Graph::factory('dataset');
for ($i = 0; $i < $resolution; $i++) {
$Dataset1->addPoint($valores[$i][1], $valores[$i][0]);
}
$Plot =& $Plotarea->addNew('bar', $Dataset1);
$GridY2 =& $Plotarea->addNew('bar_grid', IMAGE_GRAPH_AXIS_Y_SECONDARY);
$GridY2->setLineColor('gray');
$GridY2->setFillColor('lightgray@0.05');
$Plot->setLineColor('gray');
$Plot->setFillColor($color."@0.70");
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
$AxisY->setLabelInterval($valor_maximo / 2);
$AxisX->setLabelInterval($resolution / 5);
$Graph->done();
}
function grafico_incidente_estados() {
include ("../include/config.php");
require ("../include/languages/language_".$config['language'].".php");
@ -1236,6 +1339,16 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
$legend[] = substr($row["nombre"],0,15)." ( $row2[0] )";
}
}
$sql1="SELECT COUNT(*) FROM tevento WHERE id_agentmodule = 0 AND id_agente = $id_agent";
if ($result2=mysql_query($sql1))
$row2=mysql_fetch_array($result2);
if ($row2[0] > 0) {
$data[] = $row2[0];
$legend[] = lang_string("System")." ( $row2[0] )";
}
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($i = 0; $i < sizeof ($data); $i++) {
@ -1249,6 +1362,8 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
$legend[$j] = $temp_label;
}
}
$max_items = 6;
// Take only the first x items
if (sizeof($data) >= $max_items) {
@ -1991,6 +2106,8 @@ $mode = get_parameter ("mode", 1);
if ($graphic_type) {
switch ($graphic_type) {
case 'string':
graphic_string_data ($id, $period, $width, $height, $date);
case 'sparse':
grafico_modulo_sparse ($id, $period, $draw_events, $width, $height , $label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
break;