2008-03-13 Sancho Lerena <slerena@gmail.com>
* include/functions_db.php: Added show_server_type (): Return a string containing image tag for a given target id. Updated some generic db access calls to new function names. * pandoradb.sql: Removed unused field. * operation/agentes/estado_generalagente.php: Some fixes for new schema * reporting/stat_win.php: Uses new $config hash. * godmode/agentes/module_manager.php: Some fixes. Added visualization for module type (by server type). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@748 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
daaa63e192
commit
6b0cc12795
|
@ -1,3 +1,19 @@
|
|||
2008-03-13 Sancho Lerena <slerena@gmail.com>
|
||||
|
||||
* include/functions_db.php: Added show_server_type (): Return a string
|
||||
containing image tag for a given target id. Updated some generic db
|
||||
access calls to new function names.
|
||||
|
||||
* pandoradb.sql: Removed unused field.
|
||||
|
||||
* operation/agentes/estado_generalagente.php: Some fixes for new schema
|
||||
|
||||
* reporting/stat_win.php: Uses new $config hash.
|
||||
|
||||
* godmode/agentes/module_manager.php: Some fixes. Added visualization
|
||||
for module type (by server type).
|
||||
|
||||
|
||||
2008-03-06 Sancho Lerena <slerena@gmail.com>
|
||||
|
||||
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
|
||||
|
|
|
@ -71,10 +71,10 @@ if ($row=mysql_num_rows($result)){
|
|||
echo '<table width="750" cellpadding="4" cellspacing="4" class="databox">';
|
||||
echo '<tr>';
|
||||
echo "<th>".$lang_label["module_name"]."</th>";
|
||||
echo "<th>".$lang_label["type"]."</th>";
|
||||
echo '<th>'.lang_string('S').'</th>';
|
||||
echo '<th>'.lang_string('type').'</th>';
|
||||
echo "<th>".$lang_label["interval"]."</th>";
|
||||
echo "<th>".$lang_label["description"]."</th>";
|
||||
echo "<th>".$lang_label["module_group"]."</th>";
|
||||
echo "<th>".$lang_label["max_min"]."</th>";
|
||||
echo "<th width=65>".$lang_label["action"]."</th>";
|
||||
$color=1;$last_modulegroup = "0";
|
||||
|
@ -87,6 +87,7 @@ if ($row=mysql_num_rows($result)){
|
|||
$color =1;
|
||||
}
|
||||
$id_tipo = $row["id_tipo_modulo"];
|
||||
$id_module = $row["id_modulo"];
|
||||
$nombre_modulo =$row["nombre"];
|
||||
$descripcion = $row["descripcion"];
|
||||
$module_max = $row["max"];
|
||||
|
@ -101,19 +102,30 @@ if ($row=mysql_num_rows($result)){
|
|||
}
|
||||
|
||||
echo "<tr><td class='".$tdcolor."_id'>".$nombre_modulo."</td>";
|
||||
|
||||
// Module type (by server type )
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
if ($id_module > 0) {
|
||||
echo show_server_type ($id_module);
|
||||
echo ' ';
|
||||
}
|
||||
|
||||
// Module type (by data type)
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
if ($id_tipo > 0) {
|
||||
echo "<img src='images/".show_icon_type($id_tipo)."' border=0>";
|
||||
}
|
||||
echo "</td>";
|
||||
|
||||
// Module interval
|
||||
if ($module_interval2!=0){
|
||||
echo "<td class='$tdcolor'>".$module_interval2."</td>";
|
||||
} else {
|
||||
echo "<td class='$tdcolor'> N/A </td>";
|
||||
}
|
||||
echo "<td class='$tdcolor' title='$descripcion'>".substr($descripcion,0,30)."</td>";
|
||||
echo "<td class='$tdcolor'>".
|
||||
substr(dame_nombre_grupomodulo($module_group2),0,15)."</td>";
|
||||
|
||||
// MAX / MIN values
|
||||
echo "<td class='$tdcolor'>";
|
||||
if ($module_max == $module_min) {
|
||||
$module_max = "N/A";
|
||||
|
@ -121,16 +133,18 @@ if ($row=mysql_num_rows($result)){
|
|||
}
|
||||
echo $module_max." / ".$module_min;
|
||||
echo "</td>";
|
||||
|
||||
// Delete module
|
||||
echo "<td class='$tdcolor'>";
|
||||
if ($id_tipo != -1){
|
||||
echo "<a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&delete_module=".$row["id_agente_modulo"]."'".' onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
|
||||
echo "<img src='images/cross.png' border=0 title='".$lang_label["delete"]."'>";
|
||||
echo "</b></a> ";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&tab=module&update_module=".$row["id_agente_modulo"]."#modules'>";
|
||||
echo "<img src='images/config.png' border=0 title='".$lang_label["update"]."' onLoad='type_change()'></b></a>";
|
||||
}
|
||||
// Value arithmetical media fix
|
||||
if (($id_tipo != 3) AND ($id_tipo != 10) AND ($id_tipo != 17)){
|
||||
echo "<a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&delete_module=".$row["id_agente_modulo"]."'".' onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
|
||||
echo "<img src='images/cross.png' border=0 title='".$lang_label["delete"]."'>";
|
||||
echo "</b></a> ";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&tab=module&update_module=".$row["id_agente_modulo"]."#modules'>";
|
||||
echo "<img src='images/config.png' border=0 title='".$lang_label["update"]."' onLoad='type_change()'></b></a>";
|
||||
|
||||
// Make a data normalization
|
||||
if (($id_tipo == 22 ) OR ($id_tipo == 1 ) OR ($id_tipo == 4 ) OR ($id_tipo == 7 ) OR
|
||||
($id_tipo == 8 ) OR ($id_tipo == 11 ) OR ($id_tipo == 16) OR ($id_tipo == 22 )) {
|
||||
echo " ";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&tab=module&fix_module=".$row["id_agente_modulo"]."'".' onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
|
||||
echo "<img src='images/chart_curve.png' border=0 title='Normalize'></b></a>";
|
||||
|
|
|
@ -833,6 +833,30 @@ function show_icon_type($id_tipo){
|
|||
return $pro;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string containing image tag for a given target id (server)
|
||||
*
|
||||
* @param int Server type id
|
||||
* @return string Fully formatted IMG HTML tag with icon
|
||||
*/
|
||||
|
||||
function show_server_type ($id){
|
||||
global $config;
|
||||
switch ($id) {
|
||||
case 1: return '<img src="'.$config["homeurl"].'/images/data.png" title="Pandora FMS Data server">';
|
||||
break;
|
||||
case 2: return '<img src="'.$config["homeurl"].'/images/network.png" title="Pandora FMS Network server">';
|
||||
break;
|
||||
case 4: return '<img src="'.$config["homeurl"].'/images/plugin.png" title="Pandora FMS Plugin server">';
|
||||
break;
|
||||
case 5: return '<img src="'.$config["homeurl"].'/images/chart_bar.png" title="Pandora FMS Prediction server">';
|
||||
break;
|
||||
case 6: return '<img src="'.$config["homeurl"].'/images/wmi.png" title="Pandora FMS WMI server">';
|
||||
break;
|
||||
default: return "--";
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Return all childs groups of a given id_group inside array $child
|
||||
// ---------------------------------------------------------------
|
||||
|
@ -1209,7 +1233,7 @@ function return_coordinate_y_layoutdata ($id_layoutdata){
|
|||
|
||||
function return_moduledata_avg_value ($id_agent_module, $period){
|
||||
$datelimit = time() - $period; // limit date
|
||||
$id_agent = give_db_value ("id_agente", "tagente_modulo", "id_agente_modulo", $id_agent_module);
|
||||
$id_agent = get_db_value ("id_agente", "tagente_modulo", "id_agente_modulo", $id_agent_module);
|
||||
$query1="SELECT AVG(datos) FROM tagente_datos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agent_module AND utimestamp > $datelimit";
|
||||
$resq1=mysql_query($query1);
|
||||
if ($resq1 != 0) {
|
||||
|
@ -1222,7 +1246,7 @@ function return_moduledata_avg_value ($id_agent_module, $period){
|
|||
|
||||
function return_moduledata_max_value ($id_agent_module, $period){
|
||||
$datelimit = time() - $period; // limit date
|
||||
$id_agent = give_db_value ("id_agente", "tagente_modulo", "id_agente_modulo", $id_agent_module);
|
||||
$id_agent = get_db_value ("id_agente", "tagente_modulo", "id_agente_modulo", $id_agent_module);
|
||||
$query1="SELECT MAX(datos) FROM tagente_datos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agent_module AND utimestamp > $datelimit";
|
||||
$resq1=mysql_query($query1);
|
||||
if ($resq1 != 0) {
|
||||
|
@ -1235,7 +1259,7 @@ function return_moduledata_max_value ($id_agent_module, $period){
|
|||
|
||||
function return_moduledata_min_value ($id_agent_module, $period){
|
||||
$datelimit = time() - $period; // limit date
|
||||
$id_agent = give_db_value ("id_agente", "tagente_modulo", "id_agente_modulo", $id_agent_module);
|
||||
$id_agent = get_db_value ("id_agente", "tagente_modulo", "id_agente_modulo", $id_agent_module);
|
||||
$query1="SELECT MIN(datos) FROM tagente_datos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agent_module AND utimestamp > $datelimit";
|
||||
$resq1=mysql_query($query1);
|
||||
if ($resq1 != 0) {
|
||||
|
|
|
@ -1,26 +1,14 @@
|
|||
<?php
|
||||
// Pandora FMS - the Free monitoring system
|
||||
// ========================================
|
||||
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2004-2008 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");
|
||||
|
||||
|
@ -43,8 +31,7 @@ if (comprueba_login() == 0) {
|
|||
$os_version = $row["os_version"];
|
||||
$agent_version = $row["agent_version"];
|
||||
$disabled= $row["disabled"];
|
||||
$agent_type= $row["agent_type"];
|
||||
$server = $row["id_server"];
|
||||
$network_server = $row["id_network_server"];
|
||||
} else {
|
||||
echo "<h3 class='error'>".$lang_label["agent_error"]."</h3>";
|
||||
echo "</table>";
|
||||
|
@ -122,27 +109,23 @@ if (comprueba_login() == 0) {
|
|||
<td class="datos2"><b>'.$lang_label["group"].'</b></td>
|
||||
<td class="datos2" colspan="2">
|
||||
<img class="bot" src="images/groups_small/'.show_icon_group($id_grupo).'.png" > '.dame_grupo($id_grupo).'</td></tr>';
|
||||
if ($agent_type == 0) {
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["agentversion"].'</b>
|
||||
<td class="datos" colspan=2>'.salida_limpia($agent_version).'</td>';
|
||||
} else {
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["agentversion"].'</b>
|
||||
<td class="datos" colspan=2>N/A</td>';
|
||||
}
|
||||
|
||||
|
||||
// Agent version
|
||||
echo '<tr><td class="datos"><b>'.lang_string ("agentversion"). '</b>';
|
||||
echo '<td class="datos" colspan=2>'.salida_limpia($agent_version). '</td>';
|
||||
|
||||
// Total packets
|
||||
echo '<tr>
|
||||
<td class="datos2"><b>'.$lang_label["total_packets"].'</b></td>
|
||||
<td class="datos2" colspan=2>';
|
||||
<td class="datos2"><b>'. lang_string ("total_packets"). '</b></td>';
|
||||
echo '<td class="datos2" colspan=2>';
|
||||
$total_paketes= 0;
|
||||
|
||||
$sql_3='SELECT COUNT(*) FROM tagente_datos WHERE id_agente = '.$id_agente;
|
||||
$result_3=mysql_query($sql_3);
|
||||
$row3=mysql_fetch_array($result_3);
|
||||
$total_paketes = $row3[0];
|
||||
|
||||
echo $total_paketes;
|
||||
echo '</td></tr>';
|
||||
|
||||
// Last contact
|
||||
echo '<tr>
|
||||
<td class="datos">
|
||||
|
@ -161,6 +144,7 @@ if (comprueba_login() == 0) {
|
|||
echo $ultima_act_remota;
|
||||
}
|
||||
|
||||
/*
|
||||
// Asigned/active server
|
||||
echo '<tr><td class="datos2"><b>'.$lang_label["server_asigned"].'</b></td>
|
||||
<td class="datos2" colspan=2">';
|
||||
|
@ -169,6 +153,7 @@ if (comprueba_login() == 0) {
|
|||
} else {
|
||||
echo give_server_name($server);
|
||||
}
|
||||
*/
|
||||
|
||||
// Next contact
|
||||
|
||||
|
|
|
@ -237,7 +237,6 @@ CREATE TABLE `tnotification_component` (
|
|||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`id_notification` int(11) NOT NULL default '0',
|
||||
`id_agente_modulo` int(11) NOT NULL default '0',
|
||||
`data_source` tinyint(3) unsigned default '1',
|
||||
`dis_max` double(18,2) default NULL,
|
||||
`dis_min` double(18,2) default NULL,
|
||||
`alert_text` varchar(255) default '',
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
// Global & session management
|
||||
include ("../include/config.php");
|
||||
include ('../include/config.php');
|
||||
session_start();
|
||||
|
||||
include ("../include/functions.php");
|
||||
include("../include/functions_db.php");
|
||||
include("../include/languages/language_".$language_code.".php");
|
||||
include ('../include/functions.php');
|
||||
include ('../include/functions_db.php');
|
||||
include ('../include/languages/language_'.$config['language'].'.php');
|
||||
|
||||
// Access control
|
||||
if (comprueba_login() != 0) {
|
||||
|
|
Loading…
Reference in New Issue