2006-03-27 05:37:27 +02:00
|
|
|
<?php
|
|
|
|
|
2006-07-12 15:43:41 +02:00
|
|
|
// Pandora - the Free monitoring system
|
|
|
|
// ====================================
|
2007-03-28 18:07:29 +02:00
|
|
|
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
2006-07-12 15:43:41 +02:00
|
|
|
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L, info@artica.es
|
2007-03-28 18:07:29 +02:00
|
|
|
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
|
2006-07-12 15:43:41 +02:00
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2007-03-28 18:07:29 +02:00
|
|
|
// as published by the Free Software Foundation; version 2
|
2006-07-12 15:43:41 +02:00
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
// Load global vars
|
2006-03-27 05:37:27 +02:00
|
|
|
require("include/config.php");
|
|
|
|
|
|
|
|
function datos_raw($id_agente_modulo, $periodo){
|
|
|
|
require("include/config.php");
|
|
|
|
require("include/languages/language_".$language_code.".php");
|
|
|
|
switch ($periodo) {
|
|
|
|
case "mes":
|
2007-03-28 18:07:29 +02:00
|
|
|
$periodo = 86400*30;
|
2006-03-27 05:37:27 +02:00
|
|
|
$et=$lang_label["last_month"];
|
|
|
|
break;
|
|
|
|
case "semana":
|
2007-03-28 18:07:29 +02:00
|
|
|
$periodo = 86400*7;
|
2006-03-27 05:37:27 +02:00
|
|
|
$et=$lang_label["last_week"];
|
|
|
|
break;
|
|
|
|
case "dia":
|
2007-03-28 18:07:29 +02:00
|
|
|
$periodo = 86400;
|
2006-03-27 05:37:27 +02:00
|
|
|
$et=$lang_label["last_24"];
|
|
|
|
break;
|
|
|
|
}
|
2007-03-28 18:07:29 +02:00
|
|
|
$periodo = time() - $periodo;
|
|
|
|
$id_agent = give_agent_id_from_module_id ($id_agente_modulo);
|
2006-03-27 05:37:27 +02:00
|
|
|
// Different query for string data type
|
|
|
|
$id_tipo_modulo = dame_id_tipo_modulo_agentemodulo($id_agente_modulo);
|
|
|
|
if ( (dame_nombre_tipo_modulo($id_tipo_modulo) == "generic_data_string" ) OR
|
|
|
|
(dame_nombre_tipo_modulo($id_tipo_modulo) == "remote_tcp_string" ) OR
|
|
|
|
(dame_nombre_tipo_modulo($id_tipo_modulo) == "remote_snmp_string" )) {
|
2006-12-15 23:44:11 +01:00
|
|
|
$sql1="SELECT * FROM tagente_datos_string WHERE id_agente_modulo = ".
|
2007-03-28 18:07:29 +02:00
|
|
|
$id_agente_modulo." AND id_agente = $id_agent AND utimestamp > '".$periodo."'
|
2006-12-15 23:44:11 +01:00
|
|
|
ORDER BY timestamp DESC";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
else {
|
2006-12-15 23:44:11 +01:00
|
|
|
$sql1="SELECT * FROM tagente_datos WHERE id_agente_modulo = ".
|
2007-03-28 18:07:29 +02:00
|
|
|
$id_agente_modulo." AND id_agente = $id_agent AND utimestamp > '".$periodo."'
|
2006-12-15 23:44:11 +01:00
|
|
|
ORDER BY timestamp DESC";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$result=mysql_query($sql1);
|
|
|
|
$nombre_agente = dame_nombre_agente_agentemodulo($id_agente_modulo);
|
|
|
|
$nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo);
|
|
|
|
|
2006-12-15 23:44:11 +01:00
|
|
|
echo "<h2>".$lang_label["data_received"]."
|
|
|
|
'$nombre_agente' / '$nombre_modulo' </h2>";
|
|
|
|
echo "<h3> $et <a href='help/".$help_code."/chap3.php#3322' target='_help'
|
|
|
|
class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
2006-03-27 05:37:27 +02:00
|
|
|
if (mysql_num_rows($result)){
|
2006-12-15 23:44:11 +01:00
|
|
|
echo "<table cellpadding='3' cellspacing='3' width='600'>";
|
2006-07-12 15:43:41 +02:00
|
|
|
$color=1;
|
2006-03-27 05:37:27 +02:00
|
|
|
echo "<th>".$lang_label["timestamp"]."</th>";
|
|
|
|
echo "<th>".$lang_label["data"]."</th>";
|
|
|
|
while ($row=mysql_fetch_array($result)){
|
2006-07-12 15:43:41 +02:00
|
|
|
if ($color == 1){
|
|
|
|
$tdcolor = "datos";
|
|
|
|
$color = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$tdcolor = "datos2";
|
|
|
|
$color = 1;
|
|
|
|
}
|
2006-03-27 05:37:27 +02:00
|
|
|
echo "<tr>";
|
2007-03-28 18:07:29 +02:00
|
|
|
echo "<td class='".$tdcolor."' style='width:150px'>".$row["timestamp"];
|
2006-11-23 13:45:27 +01:00
|
|
|
echo "<td class='".$tdcolor."'>";
|
2007-04-18 11:58:26 +02:00
|
|
|
if (is_numeric($row["datos"])) {
|
|
|
|
$mytempdata = fmod($row["datos"], 1);
|
|
|
|
if ($mytempdata == 0)
|
|
|
|
$myvalue = intval($row["datos"]);
|
|
|
|
else
|
|
|
|
$myvalue = $row["datos"];
|
|
|
|
echo format_for_graph($myvalue );
|
2006-11-23 13:45:27 +01:00
|
|
|
} else
|
2007-04-19 20:50:07 +02:00
|
|
|
echo salida_limpia($row["datos"]);
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2006-07-12 15:43:41 +02:00
|
|
|
echo "<tr><td colspan='3'><div class='raya'></div></td></tr>";
|
2006-03-27 05:37:27 +02:00
|
|
|
echo "</table>";
|
|
|
|
}
|
|
|
|
else {
|
2006-12-15 23:44:11 +01:00
|
|
|
echo "<div class='nf'>no_data</div>";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-28 18:07:29 +02:00
|
|
|
// ---------------
|
|
|
|
// Page begin
|
|
|
|
// ---------------
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2007-03-28 18:07:29 +02:00
|
|
|
$id_user = "";
|
|
|
|
if (comprueba_login() == 0)
|
|
|
|
$id_user = $_SESSION["id_usuario"];
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2007-03-28 18:07:29 +02:00
|
|
|
if (give_acl($id_user, 0, "AR")!=1) {
|
|
|
|
audit_db ($id_user, $REMOTE_ADDR, "ACL Violation",
|
|
|
|
"Trying to access Agent Data view");
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET["tipo"]) AND isset($_GET["id"])) {
|
|
|
|
$id =entrada_limpia($_GET["id"]);
|
|
|
|
$tipo= entrada_limpia($_GET["tipo"]);
|
|
|
|
} else {
|
|
|
|
echo "<h3 class='error'>".$lang_label["graf_error"]."</h3>";
|
|
|
|
exit;
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2007-03-28 18:07:29 +02:00
|
|
|
|
|
|
|
datos_raw($id,$tipo);
|
|
|
|
|
2006-11-23 13:45:27 +01:00
|
|
|
?>
|