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

Pandora FMS 2.0 development first commit. 1.4 version is now 2.0

        * pandoradb_data.sql: Added correct tnetwork_components, fixed
        ttipo_modulo (categoria values).

        * include/styles/pandora.css: Added some server icons, tab style
        for module editor has been improved.

        * include/functions_db.php: added new functions, lang_string and
        check_login, and a first review of several functions that currently
        need change for new config session parameters in array $config[]

        * include/javascript/pandora.js: Added a new global include for
        spare javascript functions before included into a few pages.

        * include/languages/language_en.php: New tokens.

        * include/help*: New contextual help system.

        * include/config_process.php: New way to manage config.

        * include/functions.php: Added new functions to manage global

        * operation/agentes/estado_ultimopaquete.php: removed old javascript
        code from there.

        * operation/agentes/estado_agente.php: Removed references to deprecated
        field "agent_type".

        * operation/agentes/tactical.php: Some code cleanup and progressbar 
        issues merged from 1.3.1 branch. Need to add support to new server 
        types and new module types.

        * operation/servers/view_server.php: Added support to new servers, code
        cleanup.

        * reporting/fgraph.php: Code cleanup, changes to use new config method,
        and a lot of style change. 

        * general/pandora_help.php: New source for contextual help in the way 
        of moodle.

        * general/footer.php, general/noaccess.php: Code cleanup and uses of
         new config.

        * module_manager_editor: New editors for each module family. Need
         finish and implement EDITION of data, now only inserts data.

        * godmode/agentes/agent_manager.php: Implemented new server assigment
         and edition. 

        * godmode/agentes/configurar_agente.php: Small changes that affects 
        module management, visualization and agent management.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-03-07 16:22:16 +00:00
parent 5144eec92e
commit 86415f86cb
41 changed files with 2115 additions and 1244 deletions

View File

@ -1,3 +1,61 @@
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
2008-03-01 Raul Mateos <raulofpandora@gmail.com>
* include/languages/language_*.php: Updated and cleared header.

View File

@ -1,28 +1,18 @@
<?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, project architecture and management.
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
// 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 for 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.
global $config;
echo "<center>";
echo '<a class="white_bold" target="_new" href="general/license/pandora_info_'.$language_code.'.html">
echo '<a class="white_bold" target="_new" href="general/license/pandora_info_'.$config["language"].'.html">
Pandora FMS '.$pandora_version.' Build '.$build_version.'<br>'.
$lang_label["gpl_notice"].'</a><br>';
lang_string ("gpl_notice").'</a><br>';
if (isset($_SERVER['REQUEST_TIME'])) {
$time = $_SERVER['REQUEST_TIME'];
} else {

View File

@ -1,29 +1,19 @@
<?php
// Pandora - the Free monitoring system
// ====================================
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas, info@artica.es
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// as published by the Free Software Foundation, version 2.
?>
<div id="noaccess">
<div align='center'>
<h2><?php echo $lang_label["no_access_title"] ?></h2>
<h2><?php echo lang_string ("no_access_title") ?></h2>
<div>&nbsp;</div>
<img src='images/noaccess.png' alt='No access'>
<div>&nbsp;</div>
<div class="msg"><?php echo $lang_label["no_access_text"];?></div>
<div class="msg"><?php echo lang_string ("no_access_text");?></div>
</div>
</div>

View File

@ -0,0 +1,43 @@
<?PHP
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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 for version 2.
include "../include/config.php";
include "../include/languages/language_".$config["language"].".php";
echo '<link rel="stylesheet" href="../include/styles/'.$config['style'].'.css" type="text/css">';
if (isset($_GET["id"])) {
$id = $_GET["id"];
$protofile = $config["homedir"]."/include/help/".$config["language"]."/help_".$id.".php";
if (file_exists ($protofile)){
echo "<p align='left'><img src='".$config["homeurl"]."/images/pandora_logo_head.png'>";
echo "<font size=14px'><b>Pandora FMS Help System</b></font>";
echo "</p><hr width=100% size=1><div style='font-family: verdana, arial; font-size: 11px; text-align:left'>";
include $protofile;
}
else
show_help_error();
} else {
show_help_error();
}
function show_help_error(){
global $config;
global $lang_label;
echo "<div class='databox' id='login'><div id='login_f' class='databox'>";
echo '<h1 id="log_f" style="margin-top: 0px;" class="error">';
echo $lang_label['help_error'];
echo "</h1><div id='noa' style='width:120px' >";
echo "<img src='../images/help.jpg' alt='No help section'></div>";
echo "<div style='width: 350px'>";
echo '<a href="index.php"><img src="../images/pandora_logo.png" border="0"></a><br>';
echo "</div>";
echo '<div class="msg">'.$lang_label["help_error_msg"].'</div></div></div>';
}
?>

View File

@ -124,42 +124,86 @@ while ($row=mysql_fetch_array($result)){
?>
</select>
<tr><td class="datos2"><b><?php echo $lang_label["server"]?></b></td>
<td class="datos2">
<select name="id_server" class="w130">
<?php
echo "<option value='".$id_server."'>".give_server_name($id_server);
$sql1='SELECT id_server, name FROM tserver where network_server = 1
ORDER BY name';
<?PHP
// Network server
echo '<tr><td class="datos2"><b>';
echo lang_string("Network server");
echo '</b></td><td class="datos2">';
echo '<select name="network_server" class="w130">';
echo "<option value='".$id_network_server."'>".give_server_name($id_network_server);
$sql1 = 'SELECT id_server, name FROM tserver where network_server = 1 ORDER BY name';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_server"]."'>".$row["name"]."</option>";
}
echo '</select>';
// Plugin Server
echo '<tr><td class="datos"><b>';
echo lang_string("Plugin server");
echo '</b></td><td class="datos">';
echo '<select name="plugin_server" class="w130">';
echo "<option value='".$id_plugin_server."'>".give_server_name($id_plugin_server);
$sql1 = 'SELECT id_server, name FROM tserver where plugin_server = 1 ORDER BY name';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_server"]."'>".$row["name"]."</option>";
}
echo '</select>';
// WMI Server
echo '<tr><td class="datos2"><b>';
echo lang_string("WMI server");
echo '</b></td><td class="datos2">';
echo '<select name="wmi_server" class="w130">';
echo "<option value='".$id_wmi_server."'>".give_server_name($id_wmi_server);
$sql1 = 'SELECT id_server, name FROM tserver where wmi_server = 1 ORDER BY name';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_server"]."'>".$row["name"]."</option>";
}
echo '</select>';
// Prediction Server
echo '<tr><td class="datos"><b>';
echo lang_string("Prediction server");
echo '</b></td><td class="datos">';
echo '<select name="prediction_server" class="w130">';
echo "<option value='".$id_prediction_server."'>".give_server_name($id_prediction_server);
$sql1 = 'SELECT id_server, name FROM tserver where prediction_server = 1 ORDER BY name';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_server"]."'>".$row["name"]."</option>";
}
echo '</select>';
// Description
echo '<tr><td class="datos2"><b>';
echo lang_string ("description");
echo '</b><td class="datos2">';
echo '<input type="text" name="comentarios" size="55" value="'.$comentarios.'"></td>';
// Learn mode / Normal mode
echo '<tr><td class="datos"><b>';
echo lang_string ("module_definition");
echo '</b><td class="datos">';
if ($modo == "1"){
echo $lang_label["learning_mode"].'
<input type="radio" class="chk" name="modo" value="1" style="margin-right: 40px;" checked>';
echo $lang_label["normal_mode"].'
<input type="radio" class="chk" name="modo" value="0">';
} else {
echo $lang_label["learning_mode"].'
<input type="radio" class="chk" name="modo" value="1" style="margin-right: 40px;">';
echo $lang_label["normal_mode"].'
<input type="radio" name="modo" class="chk" value="0" checked>';
}
?>
</select>
<tr><td class="datos"><b><?php echo $lang_label["description"]?></b>
<td class="datos">
<input type="text" name="comentarios" size="55" value="
<?php echo $comentarios ?>"></td>
<tr><td class="datos2"><b><?php echo $lang_label["module_definition"]?></b>
<tr><td class="datos2"><b><?php echo $lang_label["status"]?></b>
<td class="datos2">
<?php if ($modo == "1"){
echo $lang_label["learning_mode"].'
<input type="radio" class="chk" name="modo" value="1" style="margin-right: 40px;" checked>';
echo $lang_label["normal_mode"].'
<input type="radio" class="chk" name="modo" value="0">';
} else {
echo $lang_label["learning_mode"].'
<input type="radio" class="chk" name="modo" value="1" style="margin-right: 40px;">';
echo $lang_label["normal_mode"].'
<input type="radio" name="modo" class="chk" value="0" checked>';
}
?>
<tr><td class="datos"><b><?php echo $lang_label["status"]?></b>
<td class="datos">
<?php if ($disabled == "1"){
echo $lang_label["disabled"].'
<input type="radio" class="chk" name="disabled" value="1" style="margin-right: 40px;" checked>';

View File

@ -24,6 +24,10 @@ else {
}
}
// Get passed variables
$tab = get_parameter_get("tab","main");
$form_moduletype = get_parameter_post ("form_moduletype");
// Init vars
$descripcion = "";
$comentarios = "";
@ -75,51 +79,57 @@ $time_to = "";
// ================================
// We need to create agent BEFORE show tabs, because we need to get agent_id
// This is not very clean, but...
if (isset($_POST["create_agent"])) { // Create a new and shining agent
$nombre_agente = entrada_limpia($_POST["agente"]);
$direccion_agente = entrada_limpia($_POST["direccion"]);
$grupo = entrada_limpia($_POST["grupo"]);
$intervalo = entrada_limpia($_POST["intervalo"]);
$comentarios = entrada_limpia($_POST["comentarios"]);
$modo = entrada_limpia($_POST["modo"]);
$id_server = entrada_limpia($_POST["id_server"]);
$id_os = entrada_limpia($_POST["id_os"]);
$disabled = entrada_limpia($_POST["disabled"]);
if ( isset ($_POST["create_agent"])) { // Create a new and shining agent
$nombre_agente = entrada_limpia ($_POST["agente"]);
$direccion_agente = entrada_limpia ($_POST["direccion"]);
$grupo = entrada_limpia ($_POST["grupo"]);
$intervalo = entrada_limpia ($_POST["intervalo"]);
$comentarios = entrada_limpia ($_POST["comentarios"]);
$modo = entrada_limpia ($_POST["modo"]);
$id_network_server = get_parameter_post ($_POST["network_server"], 0);
$id_plugin_server = get_parameter_post ($_POST["plugin_server"], 0);
$id_prediction_server = get_parameter_post ($_POST["prediction_server"], 0);
$id_wmi_server = get_parameter_post ($_POST["wmi_server"], 0);
$id_os = entrada_limpia ($_POST["id_os"]);
$disabled = entrada_limpia ($_POST["disabled"]);
// Check if agent exists (BUG WC-50518-2 )
$sql1='SELECT nombre FROM tagente WHERE nombre = "'.$nombre_agente.'"';
$result=mysql_query($sql1);
if ($row=mysql_fetch_array($result))
echo "<h3 class='error'>".$lang_label["agent_exists"]."</h3>";
else {
if ($id_server != ""){
$sql_insert ="INSERT INTO tagente (nombre, direccion, id_grupo, intervalo, comentarios,modo, id_os, disabled, id_server) VALUES ('".$nombre_agente."', '".$direccion_agente."', '".$grupo."', '".$intervalo."', '".$comentarios."',".$modo.", ".$id_os.", '".$disabled."',$id_server)";
} else {
$sql_insert ="INSERT INTO tagente (nombre, direccion, id_grupo, intervalo, comentarios,modo, id_os, disabled) VALUES ('".$nombre_agente."', '".$direccion_agente."', '".$grupo."', '".$intervalo."', '".$comentarios."',".$modo.", ".$id_os.", '".$disabled."')";
}
$result=mysql_query($sql_insert);
if ($row=mysql_fetch_array($result)){
$agent_creation_error = lang_string("agent_exists");
$agent_created_ok = 0;
} else {
$sql_insert ="INSERT INTO tagente (nombre, direccion, id_grupo, intervalo, comentarios,modo, id_os, disabled, id_network_server, id_plugin_server, id_wmi_server, id_prediction_server) VALUES ('$nombre_agente', '$direccion_agente', $grupo , $intervalo , '$comentarios',$modo, $id_os, $disabled, $id_network_server, $id_plugin_server, $id_wmi_server, $id_prediction_server)";
$result = mysql_query($sql_insert);
if ($result) {
$agent_created_ok = 1;
$id_agente = mysql_insert_id();
// Create special MODULE agent_keepalive
$sql_insert ="INSERT INTO tagente_modulo (nombre, id_agente, id_tipo_modulo, descripcion) VALUES ('agent_keepalive', ".$id_agente.",100,'Agent Keepalive monitor')";
$result=mysql_query($sql_insert);
$id_agent_module = mysql_insert_id();
// And create MODULE agent_keepalive in tagente_estado table
$sql_insert2 ="INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, cambio, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) VALUES ($id_agent_module, 1, '', 0, 0, $id_agente, 0,0,0,0,0)";
$result = mysql_query ($sql_insert2);
// Create address for this agent in taddress
agent_add_address ($id_agente, $direccion_agente);
}
}
$agent_created_ok = 1;
$agent_creation_error = "";
$id_agente = mysql_insert_id ();
// Create special MODULE agent_keepalive
$sql_insert = "INSERT INTO tagente_modulo (nombre, id_agente, id_tipo_modulo, descripcion)
VALUES ('agent_keepalive', ".$id_agente.",100,'Agent Keepalive monitor')";
$result=mysql_query($sql_insert);
$id_agent_module = mysql_insert_id();
// And create MODULE agent_keepalive in tagente_estado table
$sql_insert2 ="INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, cambio, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) VALUES ($id_agent_module, 1, '', 0, 0, $id_agente, 0,0,0,0,0)";
$result = mysql_query ($sql_insert2);
if (!$result){
$agent_created_ok = 0;
$agent_creation_error = "Problem creating record on tagente_estado table";
}
// Create address for this agent in taddress
agent_add_address ($id_agente, $direccion_agente);
} else {
$agent_created_ok = 0;
$agent_creation_error = "Cannot create agent <br><i>$sql_insert</i>";
}
}
}
// Show tabs
// -----------------
echo "<div id='menu_tab_frame'>";
echo "<div id='menu_tab_left'>
<ul class='mn'>";
echo "<li class='nomn'>";
@ -128,33 +138,43 @@ echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_a
echo "</li>";
echo "</ul></div>";
echo "<div id='menu_tab'>
<ul class='mn'>";
echo "<div id='menu_tab'><ul class='mn'>";
echo "<li class='nomn'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/zoom.png' width='16' class='top' border='0'>&nbsp;".$lang_label["view"]."</a>";
echo "</li>";
echo "<li class='nomn'>";
if ($tab == "main")
echo "<li class='nomn_high'>";
else
echo "<li class='nomn'>";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=$id_agente'><img src='images/cog.png' width='16' class='top' border='0'>&nbsp; ".$lang_label["setup_agent"]."</a>";
echo "</li>";
echo "<li class='nomn'>";
if ($tab == "module")
echo "<li class='nomn_high'>";
else
echo "<li class='nomn'>";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente=$id_agente'><img src='images/lightbulb.png' width='16' class='top' border='0'>&nbsp;".$lang_label["modules"]."</a>";
echo "</li>";
echo "<li class='nomn'>";
if ($tab == "alert")
echo "<li class='nomn_high'>";
else
echo "<li class='nomn'>";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=$id_agente'><img src='images/bell.png' width='16' class='top' border='0'>&nbsp;". $lang_label["Alerts"]."</a>";
echo "</li>";
echo "<li class='nomn'>";
if ($tab == "template")
echo "<li class='nomn_high'>";
else
echo "<li class='nomn'>";
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente=$id_agente'><img src='images/network.png' width='16' class='top' border=0>&nbsp;".$lang_label["ntemplates"]."</a>";
echo "</li>";
echo "</ul>";
echo "</div>";
echo "</div>"; // menu_tab_frame
// Make some space between tabs and title
echo "<div style='height: 25px'> </div>";
@ -162,15 +182,17 @@ echo "<div style='height: 25px'> </div>";
// Show agent creation results
if (isset($_POST["create_agent"])){
if ($agent_created_ok == 0)
if ($agent_created_ok == 0){
echo "<h3 class='error'>".$lang_label["create_agent_no"]."</h3>";
else
echo $agent_creation_error;
} else {
echo "<h3 class='suc'>".$lang_label["create_agent_ok"]."</h3>";
}
}
// Fix module data
// ===============
// Fix / Normalize module data
// ===========================
if (isset($_GET["fix_module"])){
$id_module = $_GET["fix_module"];
$id_agent = $_GET["id_agente"];
@ -315,20 +337,18 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
$modo = entrada_limpia($_POST["modo"]);
$id_os = entrada_limpia($_POST["id_os"]);
$disabled = entrada_limpia($_POST["disabled"]);
$id_server = entrada_limpia($_POST["id_server"]);
$id_network_server = get_parameter ("network_server", 0);
$id_plugin_server = get_parameter ("plugin_server", 0);
$id_wmi_server = get_parameter ("wmi_server", 0);
$id_prediction_server = get_parameter ("prediction_server", 0);
if ($direccion_agente != $old_agent_address){
agent_add_address ($id_agente, $direccion_agente);
}
if ($id_server != ""){
$sql_update ="UPDATE tagente
SET disabled = ".$disabled." , id_os = ".$id_os." , modo = ".$modo." , nombre = '".$nombre_agente."', direccion = '".$direccion_agente."', id_grupo = '".$grupo."', intervalo = '".$intervalo."', comentarios = '".$comentarios."', id_server = '".$id_server."'
$sql_update ="UPDATE tagente
SET disabled = ".$disabled." , id_os = ".$id_os." , modo = ".$modo." , nombre = '".$nombre_agente."', direccion = '".$direccion_agente."', id_grupo = '".$grupo."', intervalo = '".$intervalo."', comentarios = '".$comentarios."', id_network_server = '$id_network_server', id_plugin_server = $id_plugin_server, id_wmi_server = $id_wmi_server,
id_prediction_server = $id_prediction_server
WHERE id_agente = '".$id_agente."'";
} else {
$sql_update ="UPDATE tagente
SET disabled = ".$disabled." , id_os = ".$id_os." , modo = ".$modo." , nombre = '".$nombre_agente."', direccion = '".$direccion_agente."', id_grupo = '".$grupo."', intervalo = '".$intervalo."', comentarios = '".$comentarios."'
WHERE id_agente = '".$id_agente."'";
}
// Delete one of associateds IP's ?
if (isset($_POST["delete_ip"])) {
@ -363,7 +383,10 @@ if (isset($_GET["id_agente"])) {
$grupo = $row["id_grupo"];
$ultima_act = $row["ultimo_contacto"];
$comentarios = $row["comentarios"];
$id_server = $row["id_server"];
$id_plugin_server = $row["id_plugin_server"];
$id_network_server = $row["id_network_server"];
$id_prediction_server = $row["id_prediction_server"];
$id_wmi_server = $row["id_wmi_server"];
$modo = $row["modo"];
$id_os = $row["id_os"];
$disabled=$row["disabled"];
@ -465,48 +488,39 @@ if ((isset($_POST["update_module"])) || (isset($_POST["insert_module"]))) {
exit;
}
if (isset($_POST["tipo"]))
$id_tipo_modulo = entrada_limpia($_POST["tipo"]);
if (isset($_POST["nombre"])){
$nombre = entrada_limpia($_POST["nombre"]);
$modulo_nombre = $nombre;
}
if (isset($_POST["descripcion"])){
$descripcion = entrada_limpia($_POST["descripcion"]);
$modulo_descripcion = $descripcion;
}
if (isset($_POST["modulo_max"]))
$modulo_max = entrada_limpia($_POST["modulo_max"]);
if (isset($_POST["modulo_min"]))
$modulo_min = entrada_limpia($_POST["modulo_min"]);
// Pandora 1.2 new module data:
if (isset($_POST["tcp_send"]))
$tcp_send = entrada_limpia($_POST["tcp_send"]);
if (isset($_POST["tcp_rcv"]))
$tcp_rcv = entrada_limpia($_POST["tcp_rcv"]);
if (isset($_POST["tcp_port"]))
$tcp_port = entrada_limpia($_POST["tcp_port"]);
if (isset($_POST["ip_target"]))
$ip_target = entrada_limpia($_POST["ip_target"]);
if (isset($_POST["snmp_oid"]))
$snmp_oid = entrada_limpia($_POST["snmp_oid"]);
if (isset($_POST["snmp_community"]))
$snmp_community = entrada_limpia($_POST["snmp_community"]);
if (isset($_POST["id_module_group"]))
$id_module_group = entrada_limpia($_POST["id_module_group"]);
if (isset($_POST["module_interval"]))
$module_interval = entrada_limpia($_POST["module_interval"]);
$form_id_tipo_modulo = get_parameter ("form_id_tipo_modulo");
$form_name = get_parameter ("form_name");
$form_description = get_parameter ("form_description");
$form_id_module_group = get_parameter ("form_id_module_group",0);
$form_id_tipo_modulo = get_parameter ("form_id_tipo_modulo");
$form_post_process = get_parameter ("form_post_process",0);
$form_max_timeout = get_parameter ("form_max_timeout",0);
$form_minvalue = get_parameter_post ("form_minvalue",0);
$form_maxvalue = get_parameter ("form_maxvalue",0);
$form_interval = get_parameter ("form_interval",345345345);
$form_id_prediction_module = get_parameter ("form_id_prediction_module",0);
$form_id_plugin = get_parameter ("form_id_plugin",0);
$form_id_export = get_parameter ("form_id_export",0);
$form_disabled = get_parameter ("form_disabled",0);
$form_tcp_send = get_parameter ("form_tcp_send","");
$form_tcp_rcv = get_parameter ("form_tcp_rcv","");
$form_tcp_port = get_parameter ("form_tcp_port",0);
$form_snmp_community = get_parameter ("form_snmp_community","public");
$form_snmp_oid = get_parameter ("form_snmp_oid","");
$form_ip_target = get_parameter ("form_ip_target","");
$form_plugin_user = get_parameter ("form_plugin_user","");
$form_plugin_pass = get_parameter ("form_plugin_pass","");
$form_plugin_parameter = get_parameter ("form_plugin_parameter","");
$form_id_modulo = get_parameter ("form_id_modulo");
}
// MODULE UPDATE
// =================
if ((isset($_POST["update_module"])) && (!isset($_POST["oid"]))){ // if modified something
if (isset($_POST["combo_snmp_oid"])){
$combo_snmp_oid = entrada_limpia($_POST["combo_snmp_oid"]);
if (isset($_POST["form_combo_snmp_oid"])){
$form_combo_snmp_oid = entrada_limpia($_POST["form_combo_snmp_oid"]);
if ($snmp_oid == ""){
$snmp_oid = $combo_snmp_oid;
$snmp_oid = $form_combo_snmp_oid;
}
}
$sql_update = "UPDATE tagente_modulo
@ -550,104 +564,60 @@ if (isset($_POST["oid"])){
}
}
// =========================================================
// Network Component UPDATE button to fill module data with NC data
// This code is only applied when creating a new module (not active in update mode)
// =========================================================
if ( (isset($_POST["nc"]) && ($_POST["nc"]!=-1))){
echo "<h3 class='suc'>".$lang_label["using_network_component"]."</h3>";
$id_nc = entrada_limpia($_POST["nc"]);
$sql1="SELECT * FROM tnetwork_component WHERE id_nc = '$id_nc'";
$result=mysql_query($sql1);
$row=mysql_fetch_array($result);
$modulo_id_tipo_modulo = $row["type"];
$id_module_group = $row["id_module_group"];
$modulo_nombre = $row["name"];
$modulo_descripcion = $row["description"];
$tcp_send = $row["tcp_send"];
$tcp_rcv = $row["tcp_rcv"];
$tcp_port = $row["tcp_port"];
$snmp_community = $row["snmp_community"];
$snmp_oid = $row["snmp_oid"];
$id_module_group = $row["id_module_group"];
$module_interval = $row["module_interval"];
$modulo_max = $row["max"];
$modulo_min = $row["min"];
}
// =========================================================
// MODULE INSERT
// =========================================================
if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1)) ) &&
if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1)) ) &&
(!isset($_POST["oid"])) &&
(isset($_POST["insert_module"]))){
if (isset($_POST["combo_snmp_oid"])) {
$combo_snmp_oid = entrada_limpia($_POST["combo_snmp_oid"]);
if (isset($_POST["form_combo_snmp_oid"])) {
$combo_snmp_oid = entrada_limpia($_POST["form_combo_snmp_oid"]);
}
if ($snmp_oid == ""){
$snmp_oid = $combo_snmp_oid;
if ($form_snmp_oid == ""){
$form_snmp_oid = $combo_snmp_oid;
}
if (!isset($tcp_port) || $tcp_port== "") {
$tcp_port= "0";
}
if (!isset($modulo_max) || $modulo_max=="") {
$modulo_max= "0";
if ($form_tcp_port == "") {
$form_tcp_port= "0";
}
if (!isset($modulo_min) || $modulo_min=="") {
$modulo_min= "0";
}
$sql_insert = "INSERT INTO tagente_modulo (id_agente,id_tipo_modulo,nombre,descripcion,max,min,snmp_oid,snmp_community,id_module_group,module_interval,ip_target,tcp_port,tcp_rcv,tcp_send) VALUES (".$id_agente.",".$id_tipo_modulo.",'".$nombre."','".$descripcion."','".$modulo_max."','".$modulo_min."', '$snmp_oid', '$snmp_community', '$id_module_group', '$module_interval', '$ip_target', '$tcp_port', '$tcp_rcv', '$tcp_send')";
$sql_insert = "INSERT INTO tagente_modulo
(id_agente, id_tipo_modulo, nombre, descripcion, max, min, snmp_oid, snmp_community,
id_module_group, module_interval, ip_target, tcp_port, tcp_rcv, tcp_send, id_export,
plugin_user, plugin_pass, plugin_parameter, id_plugin, post_process, prediction_module,
max_timeout, disabled, id_modulo)
VALUES ($id_agente, $form_id_tipo_modulo, '$form_name', '$form_description', $form_maxvalue, $form_minvalue, '$form_snmp_oid', '$form_snmp_community', $form_id_module_group, $form_interval, '$form_ip_target', $form_tcp_port, '$form_tcp_rcv', '$form_tcp_send', $form_id_export, '$form_plugin_user', '$form_plugin_pass', '$form_plugin_parameter', $form_id_plugin, $form_post_process, $form_id_prediction_module, $form_max_timeout, $form_disabled, $form_id_modulo)";
$result=mysql_query($sql_insert);
$id_agente_modulo = mysql_insert_id();
// Create with different estado if proc type or data type
if (
($id_tipo_modulo == 2) ||
($id_tipo_modulo == 6) ||
($id_tipo_modulo == 9) ||
($id_tipo_modulo == 12) ||
($id_tipo_modulo == 18)
){
$sql_insert = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES (
$id_agente_modulo, 0,'0000-00-00 00:00:00',0,0,'".$id_agente."',0
)";
} else {
$sql_insert = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES (
$id_agente_modulo, 0,'0000-00-00 00:00:00',0,100,'".$id_agente."',0
)";
}
$result2=mysql_query($sql_insert);
if ((! $result) || (! $result2)) {
echo "<h3 class='error'>".$lang_label["add_module_no"]."</h3>";
} else {
echo "<h3 class='suc'>".$lang_label["add_module_ok"]."</h3>";
}
// Init vars to null to avoid trash in forms
$id_tipo_modulo = "";
$nombre = "";
$modulo_nombre = "";
$descripcion = "";
$modulo_descripcion= "";
$modulo_max = "";
$modulo_min = "";
// Pandora 1.2 new module data:
$tcp_send = "";
$tcp_rcv = "";
$tcp_port = "";
$ip_target = "";
$snmp_oid = "";
$snmp_community = "";
$id_module_group = "";
$module_interval = "";
$time_to = "";
$time_from = "";
if (! $result){
echo "<h3 class='error'>".$lang_label["add_module_no"]."</h3>";
echo "<i>DEBUG: $sql_insert</i>";
} else {
echo "<h3 class='suc'>".$lang_label["add_module_ok"]."</h3>";
$id_agente_modulo = mysql_insert_id();
// Create with different estado if proc type or data type
if (
($form_id_tipo_modulo == 2) || // data_proc
($form_id_tipo_modulo == 6) || // icmp_proc
($form_id_tipo_modulo == 9) || // tcp_proc
($form_id_tipo_modulo == 18) || //snmp proc
($form_id_tipo_modulo == 21) || // async proc
($form_id_tipo_modulo == 100) // Keepalive
){
$sql_insert2 = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES (
$id_agente_modulo, 0,'0000-00-00 00:00:00',0,0,'".$id_agente."',0
)";
} else {
$sql_insert2 = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES (
$id_agente_modulo, 0,'0000-00-00 00:00:00',0,100,'".$id_agente."',0
)";
}
$result=mysql_query($sql_insert2);
}
}
// MODULE DELETION
@ -691,15 +661,14 @@ if (isset($_GET["delete_module"])){ // DELETE agent module !
// Load page depending on tab selected
// -----------------------------------
if (isset($_GET["tab"]))
$tab = $_GET["tab"];
else
$tab = "main";
switch ($tab) {
case "main": require "agent_manager.php";
break;
case "module": require "module_manager.php";
case "module":
if ($form_moduletype == "")
require "module_manager.php";
else
require "module_manager_editor.php";
break;
case "alert": require "alert_manager.php";
break;

View File

@ -148,17 +148,17 @@ if ($search != ""){
// Show only selected groups
if ($ag_group > 1){
$sql1="SELECT * FROM tagente WHERE id_grupo=$ag_group
AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, $block_size ";
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo=$ag_group
AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $ag_group
AND disabled = 0 $search_sql ORDER BY nombre";
} else {
// Is admin user ??
if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id_user'", "nivel") == 1){
$sql1="SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, $block_size";
$sql1 = "SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo";
} else {
$sql1="SELECT * FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user')
ORDER BY nombre, id_grupo LIMIT $offset, $block_size";
ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') ORDER BY nombre, id_grupo";
}
}

View File

@ -3,402 +3,139 @@
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, project architecture and management.
// Copyright (c) 2004-2008 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
?>
<script language="JavaScript" type="text/javascript">
<!--
function type_change()
{
// type 1-4 - Generic_xxxxxx
if ((document.modulo.tipo.value > 0) && (document.modulo.tipo.value < 5)){
document.modulo.snmp_oid.style.background="#ddd";
document.modulo.snmp_oid.disabled=true;
document.modulo.snmp_community.style.background="#ddd";
document.modulo.snmp_community.disabled=true;
document.modulo.combo_snmp_oid.style.background="#ddd";
document.modulo.combo_snmp_oid.disabled=true;
document.modulo.oid.disabled=true;
document.modulo.tcp_send.style.background="#ddd";
document.modulo.tcp_send.disabled=true;
document.modulo.tcp_rcv.style.background="#ddd";
document.modulo.tcp_rcv.disabled=true;
document.modulo.tcp_port.style.background="#ddd";
document.modulo.tcp_port.disabled=true;
document.modulo.ip_target.style.background="#ddd";
document.modulo.ip_target.disabled=true;
document.modulo.modulo_max.style.background="#fff";
document.modulo.modulo_max.disabled=false;
document.modulo.modulo_min.style.background="#fff";
document.modulo.modulo_min.disabled=false;
}
// type 15-18- SNMP
if ((document.modulo.tipo.value > 14) && (document.modulo.tipo.value < 19 )){
document.modulo.snmp_oid.style.background="#fff";
document.modulo.snmp_oid.style.disabled=false;
document.modulo.snmp_community.style.background="#fff";
document.modulo.snmp_community.disabled=false;
document.modulo.combo_snmp_oid.style.background="#fff";
document.modulo.combo_snmp_oid.disabled=false;
document.modulo.oid.disabled=false;
document.modulo.tcp_send.style.background="#ddd";
document.modulo.tcp_send.disabled=true;
document.modulo.tcp_rcv.style.background="#ddd";
document.modulo.tcp_rcv.disabled=true;
document.modulo.tcp_port.style.background="#ddd";
document.modulo.tcp_port.disabled=true;
document.modulo.ip_target.style.background="#fff";
document.modulo.ip_target.disabled=false;
if (document.modulo.tipo.value == 18) {
document.modulo.modulo_max.style.background="#ddd";
document.modulo.modulo_max.disabled=true;
document.modulo.modulo_min.style.background="#ddd";
document.modulo.modulo_min.disabled=true;
} else {
document.modulo.modulo_max.style.background="#fff";
document.modulo.modulo_max.disabled=false;
document.modulo.modulo_min.style.background="#fff";
document.modulo.modulo_min.disabled=false;
}
}
// type 6-7 - ICMP
if ((document.modulo.tipo.value == 6) || (document.modulo.tipo.value == 7)){
document.modulo.snmp_oid.style.background="#ddd";
document.modulo.snmp_oid.disabled=true;
document.modulo.snmp_community.style.background="#ddd";
document.modulo.snmp_community.disabled=true;
document.modulo.combo_snmp_oid.style.background="#ddd";
document.modulo.combo_snmp_oid.disabled=true;
document.modulo.oid.disabled=true;
document.modulo.tcp_send.style.background="#ddd";
document.modulo.tcp_send.disabled=true;
document.modulo.tcp_rcv.style.background="#ddd";
document.modulo.tcp_rcv.disabled=true;
document.modulo.tcp_port.style.background="#ddd";
document.modulo.tcp_port.disabled=true;
document.modulo.ip_target.style.background="#fff";
document.modulo.ip_target.disabled=false;
document.modulo.modulo_max.style.background="#fff";
document.modulo.modulo_max.disabled=false;
document.modulo.modulo_min.style.background="#fff";
document.modulo.modulo_min.disabled=false;
}
// type 8-11 - TCP
if ((document.modulo.tipo.value > 7) && (document.modulo.tipo.value < 12)){
document.modulo.snmp_oid.style.background="#ddd";
document.modulo.snmp_oid.disabled=true;
document.modulo.snmp_community.style.background="#ddd";
document.modulo.snmp_community.disabled=true;
document.modulo.combo_snmp_oid.style.background="#ddd";
document.modulo.combo_snmp_oid.disabled=true;
document.modulo.oid.disabled=true;
document.modulo.tcp_send.style.background="#fff";
document.modulo.tcp_send.disabled=false;
document.modulo.tcp_rcv.style.background="#fff";
document.modulo.tcp_rcv.disabled=false;
document.modulo.tcp_port.style.background="#fff";
document.modulo.tcp_port.disabled=false;
document.modulo.ip_target.style.background="#fff";
document.modulo.ip_target.disabled=false;
document.modulo.modulo_max.style.background="#ddd";
document.modulo.modulo_max.disabled=true;
document.modulo.modulo_min.style.background="#ddd";
document.modulo.modulo_min.disabled=true;
}
// 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.
// type 12 - UDP
if (document.modulo.tipo.value == 12){
document.modulo.snmp_oid.style.background="#ddd";
document.modulo.snmp_oid.disabled=true;
document.modulo.snmp_community.style.background="#ddd";
document.modulo.snmp_community.disabled=true;
document.modulo.oid.disabled=true;
document.modulo.tcp_send.style.background="#fff";
document.modulo.tcp_send.disabled=false;
document.modulo.tcp_rcv.style.background="#fff";
document.modulo.tcp_rcv.disabled=false;
document.modulo.tcp_port.style.background="#fff";
document.modulo.tcp_port.disabled=false;
document.modulo.ip_target.style.background="#fff";
document.modulo.ip_target.disabled=false;
document.modulo.modulo_max.style.background="#ddd";
document.modulo.modulo_max.disabled=true;
document.modulo.modulo_min.style.background="#ddd";
document.modulo.modulo_min.disabled=true;
}
}
//-->
</script>
<?PHP
// Load global vars
require("include/config.php");
check_login();
if (give_acl($id_user, 0, "AW")!=1) {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
require ("general/noaccess.php");
exit;
if (give_acl($config["id_user"], 0, "AW")!=1) {
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
require ($config["homedir"]."/general/noaccess.php");
exit;
};
echo "<h2>".$lang_label["agent_conf"]." &gt; ".$lang_label["modules"]."</h2>";
// ==========================
// Create module/type combo
// ==========================
echo '<table width="300" cellpadding="4" cellspacing="4" class="databox">';
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
echo "<tr><td class='datos'>";
echo '<select name="form_moduletype">';
// Check if there is at least one server of each type available to assign that
// kind of modules. If not, do not show server type in combo
$network_available = get_db_value ("network_server", "tserver", "network_server", "1");
$wmi_available = get_db_value ("wmi_server", "tserver", "wmi_server", "1");
$plugin_available = get_db_value ("plugin_server", "tserver", "plugin_server", "1");
$prediction_available = get_db_value ("prediction_server", "tserver", "prediction_server", "1");
// Development mode to use all servers
if (1 == $develop_bypass) {
$network_available = 1;
$wmi_available = 1;
$plugin_available = 1;
$prediction_available = 1;
}
echo "<option value='dataserver'>".lang_string("Create a new data server module");
if ($network_available == 1)
echo "<option value='networkserver'>".lang_string("Create a new network server module");
if ($plugin_available == 1)
echo "<option value='pluginserver'>".lang_string("Create a new plugin Server module");
if ($wmi_available == 1)
echo "<option value='wmiserver'>".lang_string("Create a new WMI Server module");
if ($prediction_available == 1)
echo "<option value='predictionserver'>".lang_string("Create a new prediction Server module");
echo "</select></td>";
echo '<td class="datos">';
echo '<input align="right" name="updbutton" type="submit" class="sub wand" value="'.$lang_label["create"].'">';
echo "</form>";
echo "</table>";
// ==========================
// MODULE VISUALIZATION TABLE
// ==========================
echo "<h2>".$lang_label["agent_conf"]." &gt; ".$lang_label["modules"]."</h2>";
echo "<h3>".lang_string ("assigned_modules")."</h3>";
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = "'.$id_agente.'"
ORDER BY id_module_group, nombre ';
$result=mysql_query($sql1);
echo "<h3>".$lang_label["assigned_modules"]."&nbsp;<a href='#module_assignment' class='info'> <span>".$lang_label["module_asociation_form"]."</span><img src='images/wand.png'></a></h3>";
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_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";
while ($row=mysql_fetch_array($result)){
if ($color == 1){
$tdcolor="datos";
$color =0;
} else {
$tdcolor="datos2";
$color =1;
}
$id_tipo = $row["id_tipo_modulo"];
$nombre_modulo =$row["nombre"];
$descripcion = $row["descripcion"];
$module_max = $row["max"];
$module_min = $row["min"];
$module_interval2 = $row["module_interval"];
$module_group2 = $row["id_module_group"];
if ($module_group2 != $last_modulegroup ){
// Render module group names (fixed code)
$nombre_grupomodulo = dame_nombre_grupomodulo ($module_group2);
$last_modulegroup = $module_group2;
echo "<tr><td class='datos3' align='center' colspan='9'><b>".$nombre_grupomodulo."</b></td></tr>";
}
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_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";
while ($row=mysql_fetch_array($result)){
if ($color == 1){
$tdcolor="datos";
$color =0;
} else {
$tdcolor="datos2";
$color =1;
}
$id_tipo = $row["id_tipo_modulo"];
$nombre_modulo =$row["nombre"];
$descripcion = $row["descripcion"];
$module_max = $row["max"];
$module_min = $row["min"];
$module_interval2 = $row["module_interval"];
$module_group2 = $row["id_module_group"];
if ($module_group2 != $last_modulegroup ){
// Render module group names (fixed code)
$nombre_grupomodulo = dame_nombre_grupomodulo ($module_group2);
$last_modulegroup = $module_group2;
echo "<tr><td class='datos3' align='center' colspan='9'><b>".$nombre_grupomodulo."</b></td></tr>";
}
echo "<tr><td class='".$tdcolor."_id'>".$nombre_modulo."</td>";
echo "<td class='".$tdcolor."f9'>";
if ($id_tipo > 0) {
echo "<img src='images/".show_icon_type($id_tipo)."' border=0>";
}
echo "</td>";
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>";
echo "<td class='$tdcolor'>";
if ($module_max == $module_min) {
$module_max = "N/A";
$module_min = "N/A";
}
echo $module_max." / ".$module_min;
echo "</td>";
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>&nbsp;";
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 "&nbsp;";
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>";
}
}
echo "</table>";
echo "<tr><td class='".$tdcolor."_id'>".$nombre_modulo."</td>";
echo "<td class='".$tdcolor."f9'>";
if ($id_tipo > 0) {
echo "<img src='images/".show_icon_type($id_tipo)."' border=0>";
}
echo "</td>";
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>";
echo "<td class='$tdcolor'>";
if ($module_max == $module_min) {
$module_max = "N/A";
$module_min = "N/A";
}
echo $module_max." / ".$module_min;
echo "</td>";
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>&nbsp;";
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 "&nbsp;";
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>";
}
}
echo "</table>";
} else
echo "<div class='nf'>No modules</div>";
// ==========================
// Module assignment form
// ==========================
echo "<a name='module_assignment'></a>";
echo "<h3>".$lang_label["module_asociation_form"]."</h3>";
if ($update_module == "1")
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
else // equal than previous, but without #module_assigment
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'#module_assignment">';
if ($update_module == "1"){
echo '<input type="hidden" name="update_module" value=1>';
echo '<input type="hidden" name="id_agente_modulo" value="'.$id_agente_modulo.'">';
}
else { // Create
echo '<input type="hidden" name="insert_module" value=1>';
// Default values for new modules
if ($ip_target == ""){
$ip_target = $direccion_agente;
$snmp_community = "public";
if ($module_interval == 0)
$module_interval = $intervalo;
}
}
// Dont Delete this <a name>!!
echo '<a name="modules"></a>';
echo '<table width="700" cellpadding="4" cellspacing="4" class="databox_color">';
echo '<tr><td class="datos3">';
echo $lang_label["network_component"];
if ($update_module != "1"){
echo "<td class='datos3' colspan=2>";
echo '<select name="nc">';
$sql1='SELECT * FROM tnetwork_component ORDER BY name';
$result=mysql_query($sql1);
echo "<option value=-1>---".$lang_label["manual_config"]."---</option>";
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_nc"]."'>".substr($row["name"],0,20)." / ".substr($row["description"],0,20)."</option>";
}
echo "</select></td>";
echo '<td class="datos3"><input align="right" name="updbutton" type="submit" class="sub" value="'.$lang_label["update"].'">';
} else {
echo "<td class='datos3' colspan=3 align='left'>";
echo "<span class='redi'>";
echo $lang_label["not_available_in_edit_mode"];
echo "</span></td>";
}
echo '</tr><tr>';
echo '<td class="datos2">'.$lang_label["module_name"]."</td>";
echo '<td class="datos2"><input type="text" name="nombre" size="25" value="'.$modulo_nombre.'"></td>';
echo '<td class="datos2">'.$lang_label["ip_target"]."</td>";
echo '<td class="datos2"><input type="text" name="ip_target" size="25" value="'.$ip_target.'"></td>';
echo '</tr>';
echo "<tr>";
echo "<td colspan='4'>";
//-- Module type combobox
echo "<tr>";
echo "<td class='datos'>".$lang_label["module_type"]."</td>";
echo "<td class='datos'>";
if ($update_module == "1") {
echo "<input type='hidden' name='tipo' value='".$modulo_id_tipo_modulo."'>";
echo "<span class='redi'>".$lang_label["not_available_in_edit_mode"]."</span>";
} else {
echo '<select name="tipo" onChange="type_change()">';
$sql1='SELECT id_tipo, nombre FROM ttipo_modulo ORDER BY nombre';
$result=mysql_query($sql1);
if (($update_module == "1") OR ($modulo_id_tipo_modulo != 0)) {
echo "<option value='".$modulo_id_tipo_modulo ."'>".dame_nombre_tipo_modulo ($modulo_id_tipo_modulo)."</option>";
}
echo "<option>--</option>";
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_tipo"]."'>".$row["nombre"]."</option>";
}
echo "</select>";
}
?>
<!-- Module group selection -->
<td class="datos"><?php echo $lang_label["module_group"] ?></td>
<td class="datos">
<select name="id_module_group">
<?php
if (($id_module_group != 0) OR ($update_module == "1")){
echo "<option value='".$id_module_group."'>".dame_nombre_grupomodulo($id_module_group)."</option>";
}
$sql1='SELECT * FROM tmodule_group';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_mg"]."'>".$row["name"]."</option>";
}
?>
</select>
</td></tr>
<tr>
<td class="datos2"><?php echo $lang_label["module_interval"] ?></td>
<td class="datos2">
<input type="text" name="module_interval" size="5" value="<?php echo $module_interval ?>">
</td>
<td class="datos2"><?php echo $lang_label["tcp_port"] ?></td>
<td class="datos2">
<input type="text" name="tcp_port" size="5" value="<?php echo $tcp_port ?>">
</td>
</tr>
<tr>
<td class="datos"><?php echo $lang_label["snmp_oid"] ?></td>
<td class="datos">
<input type="text" name="snmp_oid" size="25" value="<?php echo $snmp_oid ?>">
</td>
<td class="datos"><?php echo $lang_label["snmp_community"] ?></td>
<td class="datos">
<input type="text" name="snmp_community" size="25" value="<?php echo $snmp_community ?>">
</td>
</tr>
<tr><td class="datos2"><?php echo $lang_label["snmp_oid"] ?></td>
<td colspan='2' class="datos2">
<select name="combo_snmp_oid">
<?php
// FILL OID Combobox
if (isset($_POST["oid"])){
for (reset($snmpwalk); $i = key($snmpwalk); next($snmpwalk)) {
// OJO, al indice tengo que restarle uno, el SNMP funciona con indices a partir de 0
// y el cabron de PHP me devuelve indices a partir de 1 !!!!!!!
//echo "$i: $a[$i]<br />\n";
$snmp_output = substr($i,0,35)." - ".substr($snmpwalk[$i],0,20);
echo "<option value=$i>".salida_limpia(substr($snmp_output,0,55))."</option>";
}
}
?>
</select></td>
<td class="datos2">
<input type="submit" class="sub next" name="oid" value="SNMP Walk">
</td>
</tr>
<tr><td class="datost"><?php echo $lang_label["tcp_send"] ?></td>
<td class="datos">
<textarea name="tcp_send" cols="22" rows="2"><?php echo $tcp_send ?></textarea>
</td>
<td class="datost"><?php echo $lang_label["tcp_rcv"] ?></td>
<td class="datos">
<textarea name="tcp_rcv" cols="22" rows="2"><?php echo $tcp_rcv ?></textarea>
</td>
</tr>
<tr>
<td class="datos2"><?php echo $lang_label["mindata"] ?></td>
<td class="datos2">
<input type="text" name="modulo_min" size="5" value="<?php echo $modulo_min ?>">
</td>
<td class="datos2"><?php echo $lang_label["maxdata"] ?></td>
<td class="datos2">
<input type="text" name="modulo_max" size="5" value="<?php echo $modulo_max ?>">
</td>
</tr>
<tr><td class="datost"><?php echo $lang_label["comments"] ?></td>
<td class="datos" colspan=3>
<textarea name="descripcion" cols=71 rows=2>
<?php echo $modulo_descripcion ?>
</textarea></td>
</tr></table>
<table width='700'>
<tr><td align='right'>
<?php
if ($update_module == "1"){
echo '<input name="updbutton" type="submit" class="sub next" value="'.$lang_label["update"].'">';
} else {
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.$lang_label["add"].'">';
}
?>
</form></td></tr>
</table>
echo "<div class='nf'>".lang_string("No available data to show")."</div>";

View File

@ -0,0 +1,112 @@
<?php
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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.
// General startup for established session
global $config;
check_login();
// Specific ACL check
if (give_acl($config["id_user"], 0, "AW")!=1) {
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
require ($config["homedir"]."/general/noaccess.php");
exit;
}
// Following variables come from module_manager.php -> configurar_agente.php :
//
// $form_moduletype: could be networkserver, pluginserver, wmiserver, or predictionserver
// Get form (GET)
$form_network_component = get_parameter_get("form_network_component", "");
// Using network component to fill some fields
if (($form_moduletype == "networkserver") && ($form_network_component != "")){
// Preload data from template
$row = get_db_row ("tnetwork_component", $id_nc , $form_network_component);
if ($row == 0){
unmanaged_error("Cannot load tnetwork_component reference from previous page");
}
$form_id_tipo_modulo = $row["type"];
$form_id_module_group = $row["id_module_group"];
$form_name = $row["name"];
$form_descripcion = $row["description"];
$form_tcp_send = $row["tcp_send"];
$form_tcp_rcv = $row["tcp_rcv"];
$form_tcp_port = $row["tcp_port"];
$form_snmp_community = $row["snmp_community"];
$form_snmp_oid = $row["snmp_oid"];
$form_id_module_group = $row["id_module_group"];
$form_interval = $row["module_interval"];
$form_maxvalue = $row["max"];
$form_minvalue = $row["min"];
$form_export_id = $row["export_id"];
$form_disabled = $row["disabled"];
$form_post_process = $row["post_process"];
$form_max_timeout = $row["max_timeout"];
$form_max_timeout = "";
$form_id_export = 0;
$form_disabled = 0;
$form_plugin_user = "";
$form_plugin_pass = "";
$form_plugin_parameter = "";
$form_prediction_module = "";
$form_id_plugin = "";
$form_post_process = "";
} else {
// Clean up specific network modules fields
$form_name = "";
$form_description = "";
$form_id_module_group = 1;
$form_id_tipo_modulo = 1;
$form_post_process = "";
$form_max_timeout = "";
$form_minvalue = "";
$form_maxvalue = "";
$form_interval = "";
$form_prediction_module = "";
$form_id_plugin = "";
$form_id_export = "";
$form_disabled= "0";
$form_tcp_send = "";
$form_tcp_rcv = "";
$form_tcp_port = "";
$form_snmp_community = "public";
$form_snmp_oid = "";
$form_ip_target = $direccion_agente; // taken from configurar_agente.php
$form_plugin_user = "";
$form_plugin_pass = "";
$form_plugin_parameter = "";
}
// WMI server
if ($form_moduletype == "wmiserver"){
include $config["homedir"]."/godmode/agentes/module_manager_editor_wmi.php";
}
// Plugin server
if ($form_moduletype == "pluginserver"){
include $config["homedir"]."/godmode/agentes/module_manager_editor_plugin.php";
}
// Network server
if ($form_moduletype == "networkserver"){
include $config["homedir"]."/godmode/agentes/module_manager_editor_network.php";
}
// Data Server
if ($form_moduletype == "dataserver"){
include $config["homedir"]."/godmode/agentes/module_manager_editor_data.php";
}
// Prediction server
if ($form_moduletype == "predictionserver"){
include $config["homedir"]."/godmode/agentes/module_manager_editor_prediction.php";
}

View File

@ -0,0 +1,100 @@
<?PHP
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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.
// General startup for established session
global $config;
check_login();
// Specific ACL check
if (give_acl ($config["id_user"], 0, "AW")!=1) {
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
require ($config["homedir"]."/general/noaccess.php");
exit;
}
echo "<h3>". lang_string ("module_assigment")." - ". lang_string("data server module")."</h3>";
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
echo '<input type="hidden" name="insert_module" value=1>';
// id_modulo 1 - Dataserver
echo "<input type='hidden' name='form_id_modulo' value='1'>";
echo '<table width="600" cellpadding="4" cellspacing="4" class="databox_color">';
echo '<tr>';
echo '<td class="datos2">'. lang_string ("module_name")."</td>";
echo '<td class="datos2"><input type="text" name="form_name" size="35" value="'.$form_name.'"></td>';
echo '<td class="datos2">'. lang_string ("disabled")."</td>";
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value=1></td>';
echo '</tr><tr>';
echo '<td class="datos">'. lang_string ("module_type")."</td>";
echo '<td class="datos">';
echo '<select name="form_id_tipo_modulo">';
$sql1 = 'SELECT id_tipo, nombre FROM ttipo_modulo WHERE categoria IN (0,1,2,9,6,7,8,-1) ORDER BY categoria, nombre';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_tipo"]."'>".$row["nombre"]."</option>";
}
echo "</select>";
echo "</tr>";
// Post process / Export server
echo "<tr>";
echo '<td class="datos2">'.lang_string ("post_process")."</td>";
echo '<td class="datos2"><input type="text" name="form_post_process" size="5" value="'.$form_post_process.'">';
pandora_help("postprocess");
echo "</td>";
echo '<td class="datos2">'.lang_string ("export_server")."</td>";
echo '<td class="datos2"><select name="form_id_export">';
echo "<option value='0'>".lang_string("None")."</option>";
$sql1='SELECT id, name FROM tserver_export ORDER BY name;';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
}
echo "</select>";
echo '</tr>';
// Max / min value
echo '<tr>';
echo '<td class="datos">'.lang_string ("min_value")."</td>";
echo '<td class="datos"><input type="text" name="form_minvalue" size="5" value="'.$form_minvalue.'"></td>';
echo '<td class="datos">'.lang_string ("max_value")."</td>";
echo '<td class="datos"><input type="text" name="form_maxvalue" size="5" value="'.$form_maxvalue.'"></td>';
echo '</tr>';
// Interval & id_module_group
echo '<tr>';
echo '<td class="datos2">'.lang_string ("interval")."</td>";
echo '<td class="datos2"><input type="text" name="form_interval" size="5" value="'.$form_interval.'"></td>';
echo '<td class="datos2">'.lang_string ("module_group")."</td>";
echo '<td class="datos2">';
echo '<select name="form_id_module_group">';
if ($form_id_module_group != 0){
echo "<option value='".$form_id_module_group."'>".dame_nombre_grupomodulo($form_id_module_group)."</option>";
}
$sql1='SELECT * FROM tmodule_group';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_mg"]."'>".$row["name"]."</option>";
}
echo '</select>';
// Description
echo '</tr><tr>';
echo '<td valign="top" class="datos">'.lang_string ("description")."</td>";
echo '<td valign="top" class="datos" colspan=3><textarea name="form_description" cols=65 rows=2>'.$form_interval.'</textarea>';
echo "</tr><tr>";
echo "</table>";
echo '<table width="600" cellpadding="4" cellspacing="4">';
echo '<td valign="top" align="right">';
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
echo "</table>";
?>

View File

@ -0,0 +1,167 @@
<?PHP
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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.
// General startup for established session
global $config;
check_login();
// Specific ACL check
if (give_acl($config["id_user"], 0, "AW")!=1) {
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
require ($config["homedir"]."/general/noaccess.php");
exit;
}
echo "<h3>".lang_string ("module_assigment")." - ".lang_string("network server module")."</h3>";
echo '<table width="680" cellpadding="4" cellspacing="4" class="databox_color">';
// Create from Network Component
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
echo '<input type="hidden" name="insert_module" value=1>';
// id_modulo 2 - Network
echo "<input type='hidden' name='form_id_modulo' value='2'>";
// Network component usage
echo "<tr><td class='datos3'>";
echo lang_string ("using_network_component");
echo "</td><td class='datos3' colspan=2>";
echo '<select name="form_network_component">';
$sql1='SELECT * FROM tnetwork_component ORDER BY name';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_nc"]."'>";
echo substr($row["name"],0,30);
echo " / ";
echo substr($row["description"],0,15);
echo "</option>";
}
echo "</select></td>";
echo '<td class="datos3">';
echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.$lang_label["get_data"].'">';
// Name / IP_target
echo '<tr>';
echo '<td class="datos2">'.lang_string ("module_name")."</td>";
echo '<td class="datos2"><input type="text" name="form_name" size="20" value="'.$form_name.'"></td>';
echo '<td class="datos2">'.lang_string ("disabled")."</td>";
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value=1></td>';
echo "</tr>";
// Ip target, tcp port
echo "<tr>";
echo '<td class="datos">'.lang_string ("ip_target")."</td>";
echo '<td class="datos"><input type="text" name="form_ip_target" size="25" value="'.$form_ip_target.'"></td>';
echo '<td class="datos">'.lang_string ("tcp_port")."</td>";
echo '<td class="datos"><input type="text" name="form_tcp_port" size="5" value="'.$form_tcp_port.'"></td>';
echo '</tr>';
// module type / max timeout
echo '</tr><tr>';
echo '<td class="datos2">'.lang_string ("module_type")."</td>";
echo '<td class="datos2">';
echo '<select name="form_id_tipo_modulo">';
$sql1='SELECT id_tipo, nombre FROM ttipo_modulo WHERE categoria IN (3,4,5) ORDER BY nombre;';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_tipo"]."'>".$row["nombre"]."</option>";
}
echo "</select>";
echo '<td class="datos2">'.lang_string ("max_timeout")."</td>";
echo '<td class="datos2"><input type="text" name="form_max_timeout" size="4" value="'.$form_max_timeout.'"></td></tr>';
// Interval & id_module_group
echo '<tr>';
echo '<td class="datos">'.lang_string ("interval")."</td>";
echo '<td class="datos"><input type="text" name="form_interval" size="5" value="'.$form_interval.'"></td>';
echo '<td class="datos">'.lang_string ("module_group")."</td>";
echo '<td class="datos">';
echo '<select name="form_id_module_group">';
if ($form_id_module_group != 0){
echo "<option value='".$form_id_module_group."'>".dame_nombre_grupomodulo($form_id_module_group)."</option>";
}
$sql1='SELECT * FROM tmodule_group';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_mg"]."'>".$row["name"]."</option>";
}
echo '</select>';
// Snmp walk
echo '<tr>';
echo '<td class="datos2">'.lang_string ("snmp_walk")."</td>";
echo '<td class="datos2" colspan=2>';
echo '<select name="form_combo_snmp_oid">';
// FILL OID Combobox
if (isset($_POST["oid"])){
for (reset($snmpwalk); $i = key($snmpwalk); next($snmpwalk)) {
// OJO, al indice tengo que restarle uno, el SNMP funciona con indices a partir de 0
// y el cabron de PHP me devuelve indices a partir de 1 !!!!!!!
//echo "$i: $a[$i]<br />\n";
$snmp_output = substr($i,0,35)." - ".substr($snmpwalk[$i],0,20);
echo "<option value=$i>".salida_limpia(substr($snmp_output,0,55))."</option>";
}
}
echo "</select>";
echo '<td class="datos2">';
echo '<input type="submit" class="sub next" name="oid" value="SNMP Walk">';
// Snmp Oid / community
echo '<tr>';
echo '<td class="datos">'.lang_string ("snmp_oid")."</td>";
echo '<td class="datos"><input type="text" name="form_snmp_oid" size="25" value="'.$form_snmp_oid.'"></td>';
echo '<td class="datos">'.lang_string ("snmp_community")."</td>";
echo '<td class="datos"><input type="text" name="form_snmp_community" size="12" value="'.$form_snmp_community.'"></td>';
echo '</tr>';
// Max / min value
echo '<tr>';
echo '<td class="datos2">'.lang_string ("min_value")."</td>";
echo '<td class="datos2"><input type="text" name="form_minvalue" size="5" value="'.$form_minvalue.'"></td>';
echo '<td class="datos2">'.lang_string ("max_value")."</td>";
echo '<td class="datos2"><input type="text" name="form_maxvalue" size="5" value="'.$form_maxvalue.'"></td>';
echo '</tr>';
// Post process / Export server
echo "<tr>";
echo '<td class="datos">'.lang_string ("post_process")."</td>";
echo '<td class="datos"><input type="text" name="form_post_process" size="5" value="'.$form_post_process.'">';
pandora_help("postprocess");
echo "</td>";
echo '<td class="datos">'.lang_string ("export_server")."</td>";
echo '<td class="datos"><select name="form_id_export">';
echo "<option value='0'>".lang_string("None")."</option>";
$sql1='SELECT id, name FROM tserver_export ORDER BY name;';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
}
echo "</select>";
echo '</tr>';
// tcp send / rcv value
echo '<tr>';
echo '<td class="datos2">'.lang_string ("tcp_send")."</td>";
echo '<td class="datos2"><textarea cols=20 style="height:40px;" name="form_tcp_send">'.$form_tcp_send.'</textarea>';
echo '<td class="datos2">'.lang_string ("tcp_rcv")."</td>";
echo '<td class="datos2"><textarea cols=20 style="height:40px;" name="form_tcp_rcv">'.$form_tcp_rcv.'</textarea>';
echo '</tr>';
// Description
echo '</tr><tr>';
echo '<td valign="top" class="datos">'.lang_string ("description")."</td>";
echo '<td valign="top" class="datos" colspan=3><textarea name="form_description" cols=65 rows=2>'.$form_interval.'</textarea>';
echo "</table>";
// SUbmit
echo '<table width="680" cellpadding="4" cellspacing="4">';
echo '<td valign="top" align="right">';
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
echo "</table>";
?>

View File

@ -0,0 +1,135 @@
<?PHP
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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.
// General startup for established session
global $config;
check_login();
// Specific ACL check
if (give_acl($config["id_user"], 0, "AW")!=1) {
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
require ($config["homedir"]."/general/noaccess.php");
exit;
}
echo "<h3>".lang_string ("module_assigment")." - ".lang_string("Plugin server module")."</h3>";
echo '<table width="680" cellpadding="4" cellspacing="4" class="databox_color">';
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
echo '<input type="hidden" name="insert_module" value=1>';
// id_modulo 4 - PLugin
echo "<input type='hidden' name='form_id_modulo' value='4'>";
// Name / IP_target
echo '<tr>';
echo '<td class="datos2">'.lang_string ("module_name")."</td>";
echo '<td class="datos2"><input type="text" name="form_name" size="20" value="'.$form_name.'"></td>';
echo '<td class="datos2">'.lang_string ("disabled")."</td>";
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value=1></td>';
echo "</tr>";
// Ip target, Plugin Parameter
echo "<tr>";
echo '<td class="datos">'.lang_string ("ip_target")."</td>";
echo '<td class="datos"><input type="text" name="form_ip_target" size="20" value="'.$form_ip_target.'"></td>';
echo '<td class="datos">'.lang_string ("plugin")."</td>";
echo '<td class="datos">';
echo '<select name="form_id_plugin">';
$sql1='SELECT id, name FROM tplugin ORDER BY name;';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
}
echo "</select>";
echo '</tr>';
echo '</tr><tr>';
echo '<td class="datos2">'.lang_string ("Plugin parameters")."</td>";
echo '<td class="datos2" colspan=3><input type="text" name="form_plugin_parameter" size="40" value="'.$form_plugin_parameter.'"></td>';
// username / password
echo '<tr>';
echo '<td class="datos">'.lang_string ("Username")."</td>";
echo '<td class="datos"><input type="text" name="form_plugin_user" size="10" value="'.$form_plugin_user.'"></td>';
echo '<td class="datos">'.lang_string ("Password")."</td>";
echo '<td class="datos"><input type="password" name="form_plugin_pass" size="10" value="'.$form_plugin_pass.'"></td>';
echo '</tr>';
// module type / max timeout
echo '</tr><tr>';
echo '<td class="datos2">'.lang_string ("module_type")."</td>";
echo '<td class="datos2">';
echo '<select name="form_id_tipo_modulo">';
$sql1='SELECT id_tipo, nombre FROM ttipo_modulo WHERE categoria IN (0,1,2,9) ORDER BY nombre;';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_tipo"]."'>".$row["nombre"]."</option>";
}
echo "</select>";
echo '<td class="datos2">'.lang_string ("max_timeout")."</td>";
echo '<td class="datos2"><input type="text" name="form_max_timeout" size="5" value="'.$form_max_timeout.'"></td></tr>';
// Interval & id_module_group
echo '<tr>';
echo '<td class="datos">'.lang_string ("interval")."</td>";
echo '<td class="datos"><input type="text" name="form_interval" size="5" value="'.$form_interval.'"></td>';
echo '<td class="datos">'.lang_string ("module_group")."</td>";
echo '<td class="datos">';
echo '<select name="form_id_module_group">';
if ($form_id_module_group != 0){
echo "<option value='".$form_id_module_group."'>".dame_nombre_grupomodulo($form_id_module_group)."</option>";
}
$sql1='SELECT * FROM tmodule_group';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_mg"]."'>".$row["name"]."</option>";
}
echo '</select>';
// Max / min value
echo '<tr>';
echo '<td class="datos2">'.lang_string ("min_value")."</td>";
echo '<td class="datos2"><input type="text" name="form_minvalue" size="5" value="'.$form_minvalue.'"></td>';
echo '<td class="datos2">'.lang_string ("max_value")."</td>";
echo '<td class="datos2"><input type="text" name="form_maxvalue" size="5" value="'.$form_maxvalue.'"></td>';
echo '</tr>';
// Post process / Export server
echo "<tr>";
echo '<td class="datos">'.lang_string ("post_process")."</td>";
echo '<td class="datos"><input type="text" name="form_post_process" size="5" value="'.$form_post_process.'">';
pandora_help("postprocess");
echo "</td>";
echo '<td class="datos">'.lang_string ("export_server")."</td>";
echo '<td class="datos"><select name="form_id_export">';
echo "<option value='0'>".lang_string("None")."</option>";
$sql1='SELECT id, name FROM tserver_export ORDER BY name;';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
}
echo "</select>";
echo '</tr>';
// Description
echo '</tr><tr>';
echo '<td valign="top" class="datos2">'.lang_string ("description")."</td>";
echo '<td valign="top" class="datos2" colspan=3><textarea name="form_description" cols=65 rows=2>'.$form_interval.'</textarea>';
echo "</table>";
// SUbmit
echo '<table width="680" cellpadding="4" cellspacing="4">';
echo '<td valign="top" align="right">';
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
echo "</table>";
?>

View File

@ -0,0 +1,106 @@
<?PHP
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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.
// General startup for established session
global $config;
check_login();
// Specific ACL check
if (give_acl($config["id_user"], 0, "AW")!=1) {
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
require ($config["homedir"]."/general/noaccess.php");
exit;
}
echo "<h3>".lang_string ("module_assigment")." - ".lang_string("Prediction server module")."</h3>";
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
echo '<input type="hidden" name="insert_module" value=1>';
// id_modulo 5 - Prediction
echo "<input type='hidden' name='form_id_modulo' value='5'>";
// name / disabled
echo '<table width="600" cellpadding="4" cellspacing="4" class="databox_color">';
echo '<tr>';
echo '<td class="datos2">'.lang_string ("module_name")."</td>";
echo '<td class="datos2"><input type="text" name="form_name" size="35" value="'.$form_name.'"></td>';
echo '<td class="datos2">'.lang_string ("disabled")."</td>";
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value=1></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="datos">'.lang_string ("source_module")."</td>";
echo '<td class="datos" colspan=3>';
echo '<select name="form_id_prediction_module">';
$sql1='SELECT id_agente_modulo, nombre, id_agente FROM tagente_modulo WHERE id_tipo_modulo NOT IN (100,24,19,20,21,22,23,17,10,2) ORDER BY nombre, id_agente';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row[0]."'>".$row["nombre"]." / ".dame_nombre_agente($row["id_agente"]);
}
echo "</select>";
echo "</tr>";
echo "<tr>";
echo '<td class="datos2">'.lang_string ("module_type")."</td>";
echo '<td class="datos2">';
echo '<select name="form_id_tipo_modulo">';
$sql1='SELECT id_tipo, nombre FROM ttipo_modulo WHERE id_tipo IN (1,2) ORDER BY nombre';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_tipo"]."'>".$row["nombre"]."</option>";
}
echo "</select>";
echo '<td class="datos2">'.lang_string ("interval")."</td>";
echo '<td class="datos2"><input type="text" name="form_interval" size="5" value="'.$form_interval.'"></td>';
echo "</tr>";
// Post process / Export server
echo "<tr>";
echo '<td class="datos">'.lang_string ("module_group")."</td>";
echo '<td class="datos">';
echo '<select name="form_id_module_group">';
if ($form_id_module_group != 0){
echo "<option value='".$form_id_module_group."'>".dame_nombre_grupomodulo($form_id_module_group)."</option>";
}
$sql1='SELECT * FROM tmodule_group';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_mg"]."'>".$row["name"]."</option>";
}
echo '</select>';
echo '<td class="datos">'.lang_string ("export_server")."</td>";
echo '<td class="datos"><select name="form_id_export">';
echo "<option value='0'>".lang_string("None")."</option>";
$sql1='SELECT id, name FROM tserver_export ORDER BY name;';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
}
echo "</select>";
echo '</tr>';
// Description
echo '<tr>';
echo '<td valign="top" class="datos2">'.lang_string ("description")."</td>";
echo '<td valign="top" class="datos2" colspan=3><textarea name="form_description" cols=65 rows=2>'.$form_interval.'</textarea>';
echo "</tr>";
echo "</table>";
echo '<table width="630" cellpadding="4" cellspacing="4">';
echo '<td valign="top" align="right">';
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
echo "</table>";
?>

View File

@ -0,0 +1,125 @@
<?PHP
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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.
// General startup for established session
global $config;
check_login();
// Specific ACL check
if (give_acl($config["id_user"], 0, "AW")!=1) {
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
require ($config["homedir"]."/general/noaccess.php");
exit;
}
echo "<h3>".lang_string ("module_assigment")." - ".lang_string("WMI server module")."</h3>";
echo '<table width="680" cellpadding="4" cellspacing="4" class="databox_color">';
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
echo '<input type="hidden" name="insert_module" value=1>';
// id_modulo 6 - WMI
echo "<input type='hidden' name='form_id_modulo' value='6'>";
// Name / IP_target
echo '<tr>';
echo '<td class="datos2">'.lang_string ("module_name")."</td>";
echo '<td class="datos2"><input type="text" name="form_name" size="20" value="'.$form_name.'"></td>';
echo '<td class="datos2">'.lang_string ("disabled")."</td>";
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value=1></td>';
echo "</tr>";
// Ip target, WMI query
echo "<tr>";
echo '<td class="datos">'.lang_string ("ip_target")."</td>";
echo '<td class="datos"><input type="text" name="form_ip_target" size="20" value="'.$form_ip_target.'"></td>';
echo '<td class="datos">'.lang_string ("WMI Query")."</td>";
echo '<td class="datos"><input type="text" name="form_snmp_oid" size="25" value="'.$form_snmp_oid.'"></td>';
echo '</tr>';
// username / password
echo '<tr>';
echo '<td class="datos2">'.lang_string ("Username")."</td>";
echo '<td class="datos2"><input type="text" name="form_plugin_user" size="10" value="'.$form_plugin_user.'"></td>';
echo '<td class="datos2">'.lang_string ("Password")."</td>";
echo '<td class="datos2"><input type="password" name="form_plugin_pass" size="10" value="'.$form_plugin_pass.'"></td>';
echo '</tr>';
// module type / max timeout
echo '</tr><tr>';
echo '<td class="datos">'.lang_string ("module_type")."</td>";
echo '<td class="datos">';
echo '<select name="form_id_tipo_modulo">';
$sql1='SELECT id_tipo, nombre FROM ttipo_modulo WHERE categoria IN (0,1,2) ORDER BY nombre;';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_tipo"]."'>".$row["nombre"]."</option>";
}
echo "</select>";
echo '<td class="datos">'.lang_string ("max_timeout")."</td>";
echo '<td class="datos"><input type="text" name="form_max_timeout" size="5" value="'.$form_max_timeout.'"></td></tr>';
// Interval & id_module_group
echo '<tr>';
echo '<td class="datos2">'.lang_string ("interval")."</td>";
echo '<td class="datos2"><input type="text" name="form_interval" size="5" value="'.$form_interval.'"></td>';
echo '<td class="datos2">'.lang_string ("module_group")."</td>";
echo '<td class="datos2">';
echo '<select name="form_id_module_group">';
if ($form_id_module_group != 0){
echo "<option value='".$form_id_module_group."'>".dame_nombre_grupomodulo($form_id_module_group)."</option>";
}
$sql1='SELECT * FROM tmodule_group';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_mg"]."'>".$row["name"]."</option>";
}
echo '</select>';
// Max / min value
echo '<tr>';
echo '<td class="datos">'.lang_string ("min_value")."</td>";
echo '<td class="datos"><input type="text" name="form_minvalue" size="5" value="'.$form_minvalue.'"></td>';
echo '<td class="datos">'.lang_string ("max_value")."</td>";
echo '<td class="datos"><input type="text" name="form_maxvalue" size="5" value="'.$form_maxvalue.'"></td>';
echo '</tr>';
// Post process / Export server
echo "<tr>";
echo '<td class="datos2">'.lang_string ("post_process")."</td>";
echo '<td class="datos2"><input type="text" name="form_post_process" size="5" value="'.$form_post_process.'">';
pandora_help("postprocess");
echo "</td>";
echo '<td class="datos2">'.lang_string ("export_server")."</td>";
echo '<td class="datos2"><select name="form_id_export">';
echo "<option value='0'>".lang_string("None")."</option>";
$sql1='SELECT id, name FROM tserver_export ORDER BY name;';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
}
echo "</select>";
echo '</tr>';
// Description
echo '</tr><tr>';
echo '<td valign="top" class="datos">'.lang_string ("description")."</td>";
echo '<td valign="top" class="datos" colspan=3><textarea name="form_description" cols=65 rows=2>'.$form_interval.'</textarea>';
echo "</table>";
// SUbmit
echo '<table width="680" cellpadding="4" cellspacing="4">';
echo '<td valign="top" align="right">';
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
echo "</table>";
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

View File

@ -6,21 +6,17 @@
// 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 for version 2.
//Pandora Version
if (!isset($build_version))
$build_version="PC080221";
if (!isset($pandora_version))
$pandora_version="v1.4-dev";
// Database configuration (default ones)
//$dbname="pandora"; // MySQL DataBase
//$dbuser="pandora"; // DB User
//$dbpassword="pandora"; // Password
//$dbhost="localhost"; // MySQL Host
$config["dbname"]="pandora";
$config["dbuser"]="pandora";
$config["dbpass"]="pandora";
$config["dbhost"]="localhost";
// This is used for reporting, please add "/" character at the end
//$config_homedir = "/var/www/pandora/";
$config["homedir"]="/var/www/pandora_console/";
$config["homeurl"]="/pandora_console/";
// Do not display any ERROR
//error_reporting(0); // Need to use active console at this moment
@ -32,84 +28,13 @@ error_reporting(E_ERROR);
// 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
$attachment_store=$config_homedir;
$config["attachment_store"]=$config["homedir"];
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
$config_fontpath = $config_homedir."/reporting/FreeSans.ttf";
$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf";
// Style (pandora by default)
$config_style = "pandora";
// Read remaining config tokens from DB
if (! mysql_connect($dbhost,$dbuser,$dbpassword)){
//Non-persistent connection. If you want persistent conn change it to mysql_pconnect()
exit ('<html><head><title>Pandora Error</title>
<link rel="stylesheet" href="./include/styles/pandora.css" type="text/css">
</head><body><div align="center">
<div id="db_f">
<div>
<a href="index.php"><img src="images/pandora_logo.png" border="0"></a>
</div>
<div id="db_ftxt">
<h1 id="log_f" class="error">Pandora Console Error DB-001</h1>
Cannot connect with Database, please check your database setup in the
<b>./include/config.php</b> file and read documentation.<i><br><br>
Probably any of your user/database/hostname values are incorrect or
database is not running.</i><br><br><font class="error">
<b>MySQL ERROR:</b> '. mysql_error().'</font>
<br>&nbsp;
</div>
</div></body></html>');
}
mysql_select_db($dbname);
if($result2=mysql_query("SELECT * FROM tconfig")){
while ($row2=mysql_fetch_array($result2)){
switch ($row2["token"]) {
case "language_code": $language_code=$row2["value"];
break;
case "block_size": $block_size=$row2["value"];
break;
case "days_purge": $days_purge=$row2["value"];
break;
case "days_compact": $days_compact=$row2["value"];
break;
case "graph_res": $config_graph_res=$row2["value"];
break;
case "step_compact": $config_step_compact=$row2["value"];
break;
case "truetype": $config_truetype=$row2["value"];
break;
case "graph_order": $config_graph_order=$row2["value"];
break;
case "bgimage": $config_bgimage=$row2["value"];
break;
case "style": $config_style=$row2["value"];
break;
}
}
} else {
exit ('<html><head><title>Pandora Error</title>
<link rel="stylesheet" href="./include/styles/pandora.css" type="text/css">
</head><body><div align="center">
<div id="db_f">
<div>
<a href="index.php"><img src="images/pandora_logo.png" border="0"></a>
</div>
<div id="db_ftxt">
<h1 id="log_f" class="error">Pandora Console Error DB-002</h1>
Cannot load configuration variables. Please check your database setup in the
<b>./include/config.php</b> file and read documentation.<i><br><br>
Probably database schema is created but there are no data inside it or you have a problem with DB access credentials.
</i><br>
</div>
</div></body></html>');
}
if ($language_code == 'ast_es') {
$help_code='ast';
}
else $help_code = substr($language_code,0,2);
$config["style"] = "pandora";
include ("config_process.php");
?>

View File

@ -0,0 +1,40 @@
<?php
// Pandora FMS - the Free monitoring system
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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 for version 2.
// Database configuration (default ones)
$config["dbname"]="pandora";
$config["dbuser"]="pandora";
$config["dbpass"]="none";
$config["dbhost"]="localhost";
// This is used for reporting, please add "/" character at the end
$config["homedir"]="/var/www/pandora_console/";
$config["homeurl"]="/pandora_console/";
// Do not display any ERROR
//error_reporting(0); // Need to use active console at this moment
// Display ALL errors
error_reporting(E_ALL);
// This is directory where placed "/attachment" directory, to upload files stores.
// 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"];
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
$config["fontpath"] = $config["homedir"]."/include/FreeSans.ttf";
// Style (pandora by default)
$config["style"] = "pandora";
include ("config_process.php");
?>

View File

@ -0,0 +1,83 @@
<?PHP
// Pandora FMS - the Free monitoring system
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, 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 for version 2.
//Pandora Version
if (!isset($build_version))
$build_version="PC080227";
if (!isset($pandora_version))
$pandora_version="v2.0-dev";
// Read remaining config tokens from DB
if (! mysql_connect($config["dbhost"],$config["dbuser"],$config["dbpass"])){
//Non-persistent connection. If you want persistent conn change it to mysql_pconnect()
exit ('<html><head><title>Pandora FMS Error</title>
<link rel="stylesheet" href="./include/styles/pandora.css" type="text/css">
</head><body><div align="center">
<div id="db_f">
<div>
<a href="index.php"><img src="images/pandora_logo.png" border="0"></a>
</div>
<div id="db_ftxt">
<h1 id="log_f" class="error">Pandora Console Error DB-001</h1>
Cannot connect with Database, please check your database setup in the
<b>./include/config.php</b> file and read documentation.<i><br><br>
Probably any of your user/database/hostname values are incorrect or
database is not running.</i><br><br><font class="error">
<b>MySQL ERROR:</b> '. mysql_error().'</font>
<br>&nbsp;
</div>
</div></body></html>');
}
mysql_select_db($config["dbname"]);
if($result2=mysql_query("SELECT * FROM tconfig")){
while ($row2=mysql_fetch_array($result2)){
switch ($row2["token"]) {
case "language_code": $config["language"]=$row2["value"];
break;
case "block_size": $config["block_size"]=$row2["value"];
break;
case "days_purge": $config["days_purge"]=$row2["value"];
break;
case "days_compact": $config["days_compact"]=$row2["value"];
break;
case "graph_res": $config["graph_res"]=$row2["value"];
break;
case "step_compact": $config["step_compact"]=$row2["value"];
break;
case "style": $config["style"]=$row2["value"];
break;
}
}
} else {
exit ('<html><head><title>Pandora FMS Error</title>
<link rel="stylesheet" href="./include/styles/pandora.css" type="text/css">
</head><body><div align="center">
<div id="db_f">
<div>
<a href="index.php"><img src="images/pandora_logo.png" border="0"></a>
</div>
<div id="db_ftxt">
<h1 id="log_f" class="error">Pandora Console Error DB-002</h1>
Cannot load configuration variables. Please check your database setup in the
<b>./include/config.php</b> file and read documentation.<i><br><br>
Probably database schema is created but there are no data inside it or you have a problem with DB access credentials.
</i><br>
</div>
</div></body></html>');
}
if ($config["language"] == 'ast_es') {
$help_code='ast';
}
else $help_code = substr($config["language"],0,2);
?>

View File

@ -9,6 +9,43 @@
// Please see http://pandora.sourceforge.net for full contribution list
function pandora_help ($id, $return = false) {
global $config;
$output = '<img src="'.$config['homeurl'].'images/help.png" onClick="pandora_help(\''.$id.'\')">';
if ($return)
return $return;
echo $output;
}
// ---------------------------------------------------------------
// safe_output()
// Write a string to screen, deleting all kind of problematic characters
// This should be safe for XSS.
// ---------------------------------------------------------------
function safe_output ($string) {
return preg_replace('/[^\x09\x0A\x0D\x20-\x7F]/e', '"&#".ord($0).";"', $string);
}
// ---------------------------------------------------------------
// safe_input()
// Get parameter, using UTF8 encoding, and cleaning bad codes
// ---------------------------------------------------------------
function safe_input ($string) {
return htmlentities(utf8_decode($string), ENT_QUOTES);
}
// ---------------------------------------------------------------
// salida_sql: Parse \' for replace to ' character, prearing
// SQL sentences to execute.
// ---------------------------------------------------------------
function salida_sql ($string) {
$body = str_replace("\'", "'", $string);
return $body;
}
// input: var, string.
// mesg, mesage to show, var content.
// ---------------------------------------------------------------
@ -199,7 +236,7 @@ function popup_help ($help_id){
function no_permission () {
require("config.php");
require ("include/languages/language_".$language_code.".php");
require ("include/languages/language_".$config["language"].".php");
echo "<h3 class='error'>".$lang_label["no_permission_title"]."</h3>";
echo "<img src='images/noaccess.png' alt='No access' width='120'><br><br>";
echo "<table width=550>";
@ -211,6 +248,26 @@ function no_permission () {
exit;
}
// ---------------------------------------------------------------
// unmanaged_error - Display generic error message and stop execution
// ---------------------------------------------------------------
function unmanaged_error ($error = "") {
require("config.php");
require ("include/languages/language_".$config["language"].".php");
echo "<h3 class='error'>".lang_string("Unmanaged error")."</h3>";
echo "<img src='images/errror.png' alt='error'><br><br>";
echo "<table width=550>";
echo "<tr><td>";
echo lang_string("Unmanaged error_text");
echo "<tr><td>";
echo $error;
echo "</table>";
echo "<tr><td><td><td><td>";
include "general/footer.php";
exit;
}
function list_files($directory, $stringSearch, $searchHandler, $outputHandler) {
$errorHandler = false;
$result = array();
@ -248,8 +305,8 @@ function list_files($directory, $stringSearch, $searchHandler, $outputHandler) {
function pagination ($count, $url, $offset ) {
require ("config.php");
require ("include/languages/language_".$language_code.".php");
global $config;
require ("include/languages/language_".$config["language"].".php");
/* URL passed render links with some parameter
&offset - Offset records passed to next page
@ -259,7 +316,7 @@ function pagination ($count, $url, $offset ) {
*/
$block_limit = 15; // Visualize only $block_limit blocks
if ($count > $block_size){
if ($count > $config["block_size"]){
// If exists more registers than I can put in a page, calculate index markers
$index_counter = ceil($count/$block_size); // Number of blocks of block_size with data
$index_page = ceil($offset/$block_size)-(ceil($block_limit/2)); // block to begin to show data;
@ -513,12 +570,30 @@ function render_time ($lapse) {
function get_parameter ($name, $default = '') {
// POST has precedence
if (isset($_POST[$name]))
return give_parameter_post ($name);
return get_parameter_post ($name, $default);
if (isset($_GET[$name]))
return give_parameter_get ($name);
return get_parameter_get ($name, $default);
return $default;
}
function get_parameter_get ($name, $default = "") {
if ((isset ($_GET[$name])) && ($_GET[$name] != ""))
return safe_input ($_GET[$name]);
return $default;
}
function get_parameter_post ( $name, $default = "" ){
if ((isset ($_POST[$name])) && ($_POST[$name] != ""))
return safe_input ($_POST[$name]);
return $default;
}
?>

View File

@ -8,6 +8,27 @@
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
function check_login() {
global $config;
if (!isset($config["homedir"])){
// No exists $config. Exit inmediatly
include ("general/noaccess.php");
exit;
}
if ((isset($_SESSION["id_usuario"])) AND ($_SESSION["id_usuario"] != "")) {
$id = $_SESSION["id_usuario"];
$query1="SELECT id_usuario FROM tusuario WHERE id_usuario= '$id'";
$resq1 = mysql_query($query1);
$rowdup = mysql_fetch_array($resq1);
$nombre = $rowdup[0];
if ( $id == $nombre ){
return 0 ;
}
}
audit_db("N/A", getenv("REMOTE_ADDR"), "No session", "Trying to access without a valid session");
include ($config["homedir"]."/general/noaccess.php");
exit;
}
// ---------------------------------------------------------------
// give_acl ()
@ -972,20 +993,18 @@ function agent_add_address ($id_agent, $ip_address) {
// ---------------------------------------------------------------
function agent_delete_address ($id_agent, $ip_address) {
require("config.php");
$address_exist = 0;
$id_address =-1;
$query1="SELECT * FROM taddress_agent, taddress
WHERE taddress_agent.id_a = taddress.id_a
AND ip = '$ip_address'
AND id_agent = $id_agent";
if ($resq1=mysql_query($query1)){
$rowdup=mysql_fetch_array($resq1);
$query1 = "SELECT * FROM taddress_agent, taddress
WHERE taddress_agent.id_a = taddress.id_a
AND ip = '$ip_address'
AND id_agent = $id_agent";
if ($resq1 = mysql_query($query1)){
$rowdup = mysql_fetch_array($resq1);
$id_ag = $rowdup["id_ag"];
$id_a = $rowdup["id_a"];
$sql_3="DELETE FROM taddress_agent
WHERE id_ag = $id_ag";
$result_3=mysql_query($sql_3);
$sql_3 = "DELETE FROM taddress_agent WHERE id_ag = $id_ag";
$result_3 = mysql_query($sql_3);
}
// Need to change main address ?
if (give_agent_address ($id_agent) == $ip_address){
@ -1005,11 +1024,10 @@ function agent_delete_address ($id_agent, $ip_address) {
// ---------------------------------------------------------------
function give_agent_address ($id_agent){
require("config.php");
$query1="SELECT * FROM tagente WHERE id_agente = $id_agent";
$resq1=mysql_query($query1);
if ($rowdup=mysql_fetch_array($resq1))
$pro=$rowdup["direccion"];
$query1 = "SELECT * FROM tagente WHERE id_agente = $id_agent";
$resq1 = mysql_query($query1);
if ($rowdup = mysql_fetch_array($resq1))
$pro = $rowdup["direccion"];
else
$pro = "";
return $pro;
@ -1020,7 +1038,6 @@ function give_agent_address ($id_agent){
// ---------------------------------------------------------------
function give_agent_address_from_list ($id_agent){
require("config.php");
$query1="SELECT * FROM taddress_agent, taddress
WHERE taddress_agent.id_a = taddress.id_a
AND id_agent = $id_agent";
@ -1038,7 +1055,6 @@ function give_agent_address_from_list ($id_agent){
// ---------------------------------------------------------------
function give_agent_id_from_module_id ($id_module){
require("config.php");
$query1="SELECT * FROM tagente_modulo WHERE id_agente_modulo = $id_module";
$resq1=mysql_query($query1);
if ($rowdup=mysql_fetch_array($resq1))
@ -1052,23 +1068,27 @@ function give_agent_id_from_module_id ($id_module){
// Generic access to a field ($field) given a table
// ---------------------------------------------------------------
function give_db_value ($field, $table, $field_search, $condition_value){
global $config;
$query = "SELECT $field FROM $table WHERE $field_search = '$condition_value' ";
$resq1 = mysql_query($query);
if ($rowdup = mysql_fetch_array($resq1))
$pro = $rowdup[0];
else
$pro = "";
return $pro;
function get_db_value ($field, $table, $field_search, $condition_value){
$query = "SELECT $field FROM $table WHERE $field_search = '$condition_value' ";
$resq1 = mysql_query($query);
if ($rowdup = mysql_fetch_array($resq1))
$pro = $rowdup[0];
else
$pro = "";
return $pro;
}
// ---------------------------------------------------------------
// Wrapper for old function name. Should be upgraded/renamed in next versions
// ---------------------------------------------------------------
function get_db_value ($field, $table, $field_search, $condition_value){
give_db_value ($field, $table, $field_search, $condition_value);
function get_db_row ($table, $field_search, $condition_value){
$query = "SELECT * FROM $table WHERE $field_search = '$condition_value' ";
$resq1 = mysql_query($query);
if ($rowdup = mysql_fetch_array($resq1))
return $rowdup;
else
return 0;
}
// ---------------------------------------------------------------
@ -1076,7 +1096,6 @@ function get_db_value ($field, $table, $field_search, $condition_value){
// ---------------------------------------------------------------
function get_db_sql ($sentence, $field = 0){
global $config;
if ($rowdup = mysql_fetch_array(mysql_query($sentence)))
return $rowdup[$field];
else
@ -1088,7 +1107,6 @@ function get_db_sql ($sentence, $field = 0){
// ---------------------------------------------------------------
function return_status_agent_module ($id_agentmodule = 0){
require ("config.php");
$query1 = "SELECT estado FROM tagente_estado WHERE id_agente_modulo = " . $id_agentmodule;
$resq1 = mysql_query ($query1);
if ($resq1 != 0) {
@ -1124,7 +1142,6 @@ function return_status_agent_module ($id_agentmodule = 0){
function return_status_layout ($id_layout = 0){
$temp_status = 0;
$temp_total = 0;
require("config.php");
$sql="SELECT * FROM tlayout_data WHERE id_layout = $id_layout";
$res=mysql_query($sql);
while ($row = mysql_fetch_array($res)){
@ -1152,7 +1169,6 @@ function return_status_layout ($id_layout = 0){
// ---------------------------------------------------------------
function return_value_agent_module ($id_agentmodule = 0){
require("config.php");
$query1="SELECT datos FROM tagente_estado WHERE id_agente_modulo = ".$id_agentmodule;
$resq1=mysql_query($query1);
if ($resq1 != 0) {
@ -1168,7 +1184,6 @@ function return_value_agent_module ($id_agentmodule = 0){
// ---------------------------------------------------------------
function return_coordinate_X_layoutdata ($id_layoutdata){
require("config.php");
$query1="SELECT pos_x FROM tlayout_data WHERE id = ".$id_layoutdata;
$resq1=mysql_query($query1);
if ($resq1 != 0) {
@ -1183,7 +1198,6 @@ function return_coordinate_X_layoutdata ($id_layoutdata){
// ---------------------------------------------------------------
function return_coordinate_y_layoutdata ($id_layoutdata){
require("config.php");
$query1="SELECT pos_y FROM tlayout_data WHERE id = ".$id_layoutdata;
$resq1=mysql_query($query1);
if ($resq1 != 0) {
@ -1194,7 +1208,6 @@ function return_coordinate_y_layoutdata ($id_layoutdata){
}
function return_moduledata_avg_value ($id_agent_module, $period){
require("config.php");
$datelimit = time() - $period; // limit date
$id_agent = give_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";
@ -1208,7 +1221,6 @@ function return_moduledata_avg_value ($id_agent_module, $period){
function return_moduledata_max_value ($id_agent_module, $period){
require("config.php");
$datelimit = time() - $period; // limit date
$id_agent = give_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";
@ -1222,7 +1234,6 @@ function return_moduledata_max_value ($id_agent_module, $period){
function return_moduledata_min_value ($id_agent_module, $period){
require("config.php");
$datelimit = time() - $period; // limit date
$id_agent = give_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";
@ -1234,4 +1245,12 @@ function return_moduledata_min_value ($id_agent_module, $period){
return (0);
}
function lang_string ($string){
global $config;
require ($config["homedir"]."/include/languages/language_".$config["language"].".php");
if (isset ($lang_label[$string]))
return $lang_label[$string];
else
return "[".$string."]";
}
?>

View File

@ -0,0 +1,4 @@
<h1>Post process</h1>
Post process is a numeric value that is used after get data to numerical post process in a multipliear operation. For example a data with a value of 1000 with a Post Process value of 1024 will result in a definitive data of 1024000 value. This is useful to normalize data, convert between units, etc. This also could be used to divide, by using a multiplier under 1 value, like, for example, 0.001 that will divide current value by 1000.
<br><br>
Value of 0 of empty is for disable usage of post process (default).

View File

@ -0,0 +1,19 @@
/* Function to hide/unhide a specific Div id */
function toggleDiv (divid){
if (document.getElementById(divid).style.display == 'none'){
document.getElementById(divid).style.display = 'block';
} else {
document.getElementById(divid).style.display = 'none';
}
}
function winopeng(url,wid) {
nueva_ventana=open(url,wid,"width=530,height=275,status=no,toolbar=no,menubar=no");
// WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE
status =wid;
}
function pandora_help(help_id) {
nueva_ventana=open("general/pandora_help.php?id="+help_id, "pandorahelp","width=600,height=500,status=no,toolbar=no,menubar=no,scrollbar=yes");
}

View File

@ -877,6 +877,17 @@ $lang_label["render_now"]="Render now";
$lang_label["ntemplates"]="Net. Templates";
$lang_label["setup_agent"]="Setup Agent";
// Pandora 2.0 new stringd
$lang_label["Stand alone module"]="Stand alone module";
$lang_label["help_error"]="Help system error";
$lang_label["help_error_msg"]="Pandora FMS help system has been called with a help reference that currently don't exist. There is no help content to show.";
$lang_label["export_server"]="Export server";
$lang_label["post_process"]="Post process";
$lang_label["max_timeout"]="Max. timeout";
$lang_label["snmp_walk"]="SNMP walk";
global $lang_label;
global $help_label;
?>

View File

@ -430,6 +430,15 @@ div.title_line {
height: 5px;
width: 762px;
}
#menu_tab_frame {
background: #D84437;
width: 805px;
min-height: 22px;
padding-left: 0x;
margin-left: -25px;
float:left;
border-bottom: 1px solid #778866;
}
#menu_tab .mn, #menu_tab ul, #menu_tab .mn ul {
padding: 0px;
list-style: none;
@ -443,17 +452,27 @@ div.title_line {
background: #d4ddc6;
padding: 2px 10px 2px 10px;
color: #333;
border-left: 1px solid #fff;
border-left: 2px solid #778866;
font-weight: bold;
line-height: 18px;
}
#menu_tab li.nomn_high a {
background: #799E48;
color: #fff;
padding: 2px 10px 2px 10px;
border-left: 2px solid #778866;
font-weight: bold;
line-height: 18px;
}
#menu_tab .mn li a {
display: block;
text-decoration: none;
}
#menu_tab li.nomn:hover a,
#menu_tab li.nomn:hover a, li.nomn:hover_high a
#menu_tab li:hover ul a:hover {
background: #cde0ad;
background: #799E48;
color: #fff;
}
#menu_tab li:hover a {
background: #b2b08a url("../images/arrow.png") no-repeat right 3px;
@ -466,7 +485,7 @@ div.title_line {
#menu_tab_left .mn, #menu_tab_left ul, #menu_tab_left .mn ul {
padding: 0px 0px 0px 0px;
list-style: none;
margin: 0px 0px 0px -20px;
margin: 0px 0px 0px 2px;
}
#menu_tab_left .mn li {
float: left;
@ -511,6 +530,18 @@ span.net {
span.master {
background: url(../../images/master.png) no-repeat;
}
span.wmi {
background: url(../../images/wmi.png) no-repeat;
}
span.prediction {
background: url(../../images/chart_bar.png) no-repeat;
}
span.plugin {
background: url(../../images/plugin.png) no-repeat;
}
span.export {
background: url(../../images/database_refresh.png) no-repeat;
}
span.snmp {
background: url(../../images/snmp.png) no-repeat;
}
@ -526,8 +557,14 @@ span.rmess {
span.nrmess {
background: url(../../images/email.png) no-repeat;
}
/* This kind of span do not have any sense, should be replaced on PHP code
by a real img in code. They are not useful because insert too much margin around
(for example, not valid to use in the table of server view */
span.users, span.agents, span.data, span.alerts, span.time, span.net,
span.master, span.snmp, span.binary, span.recon {
span.master, span.snmp, span.binary, span.recon, span.wmi, span.prediction,
span.plugin, span.plugin, span.export {
margin-left: 4px;
margin-top: 10px;
padding: 4px 8px 12px 30px;

View File

@ -2,10 +2,7 @@
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, project architecture and management.
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP code additions
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or
@ -19,13 +16,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Pandora FMS 1.x uses icons from famfamfam, licensed under CC Atr. 2.5
// Pandora FMS uses icons from famfamfam, licensed under CC Atr. 2.5
// Silk icon set 1.3 (cc) Mark James, http://www.famfamfam.com/lab/icons/silk/
// Pandora FMS 1.x uses Pear Image::Graph code
// Pandora FMS uses Pear Image::Graph code
//Pandora Version, if not defined here it would take from config.php
$build_version="PC080221";
$pandora_version="v1.4-dev";
$build_version="PC080226";
$pandora_version="v2.0-dev";
global $build_version;
global $pandora_version;
@ -50,8 +46,7 @@ if ($develop_bypass != 1){
// Check perms for config.php
if ((substr(sprintf('%o', fileperms('include/config.php')), -4) != "0600") &&
(substr(sprintf('%o', fileperms('include/config.php')), -4) != "0660") &&
(substr(sprintf('%o', fileperms('include/config.php')), -4) != "0640") &&
(substr(sprintf('%o', fileperms('include/config.php')), -4) != "0600"))
(substr(sprintf('%o', fileperms('include/config.php')), -4) != "0640"))
{
include "general/error_perms.php";
exit;
@ -66,7 +61,7 @@ if ((! file_exists("include/config.php")) OR (! is_readable("include/config.php"
// Real start
session_start();
include "include/config.php";
include "include/languages/language_".$language_code.".php";
include "include/languages/language_".$config["language"].".php";
require "include/functions.php"; // Including funcions.
require "include/functions_db.php";
?>
@ -101,34 +96,34 @@ if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
}
}
?>
<title>Pandora FMS - <?php echo $lang_label["header_title"]; ?></title>
<title>Pandora FMS - <?php echo lang_string("header_title"); ?></title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Sancho Lerena, Raul Mateos">
<meta name="author" content="Sancho Lerena">
<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and others">
<meta name="keywords" content="pandora, monitoring, system, GPL, software">
<meta name="robots" content="index, follow">
<link rel="icon" href="images/pandora.ico" type="image/ico">
<?php
// Pandora FMS 1.3 custom style selection
echo '<link rel="stylesheet" href="include/styles/'.$config_style.'.css" type="text/css">';
// Pandora FMS custom style selection
echo '<link rel="stylesheet" href="include/styles/'.$config['style'].'.css" type="text/css">';
?>
<script type="text/javascript" src="include/javascript/wz_jsgraphics.js"></script>
<script type="text/javascript" src="include/javascript/pandora.js"></script>
</head>
<?php
// Show custom background
echo '<body bgcolor="#555555">';
$REMOTE_ADDR = getenv ("REMOTE_ADDR");
global $REMOTE_ADDR;
// Show custom background
echo '<body bgcolor="#555555">';
$REMOTE_ADDR = getenv ("REMOTE_ADDR");
// Login process
if ( (! isset ($_SESSION['id_usuario'])) AND (isset ($_GET["login"]))) {
$nick = entrada_limpia ($_POST["nick"]);
$pass = entrada_limpia ($_POST["pass"]);
// Login process
if ( (! isset ($_SESSION['id_usuario'])) AND (isset ($_GET["login"]))) {
$nick = get_parameter_post ("nick");
$pass = get_parameter_post ("pass");
// Connect to Database
$sql1 = 'SELECT * FROM tusuario WHERE id_usuario = "'.$nick.'"';
@ -178,7 +173,10 @@ if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
// There is no user connected
include "general/login_page.php";
exit;
}
} else {
// There is session for id_usuario
$config["id_user"] = $_SESSION["id_usuario"];
}
// Log off
if (isset ($_GET["bye"])) {

View File

@ -3,8 +3,6 @@
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, project architecture and management.
// Copyright (c) 2004-2008 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
// Load global vars
@ -85,17 +83,17 @@ if (comprueba_login() == 0) {
// Show only selected groups
if ($ag_group > 1){
$sql="SELECT * FROM tagente WHERE id_grupo=$ag_group
AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, $block_size ";
AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, ".$config['block_size'];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo=$ag_group
AND disabled = 0 $search_sql ORDER BY nombre";
} else {
// Is admin user ??
if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id_user'", "nivel") == 1){
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, $block_size";
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config['block_size'];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo";
} else {
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user')
ORDER BY nombre, id_grupo LIMIT $offset, $block_size";
ORDER BY nombre, id_grupo LIMIT $offset, ".$config['block_size'];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') ORDER BY nombre, id_grupo";
}
}
@ -128,7 +126,6 @@ if (comprueba_login() == 0) {
$direccion_agente =$row["direccion"];
$id_grupo=$row["id_grupo"];
$id_os = $row["id_os"];
$agent_type = $row["agent_type"];
$ultimo_contacto = $row["ultimo_contacto"];
$biginterval=$intervalo;
foreach ($mis_grupos as $migrupo){ //Verifiy if the group this agent begins is one of the user groups

View File

@ -6,23 +6,6 @@
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
?>
<!-- Javascript -->
<script language="javascript1.2" type="text/javascript">
<!--
function winopeng(url,wid) {
nueva_ventana=open(url,wid,"width=530,height=275,status=no,toolbar=no,menubar=no");
// WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE
status =wid;
}
function help_popup(help_id) {
nueva_ventana=open("general/pandora_help.php?id=1","width=300,height=100,status=no,toolbar=no,menubar=no");
}
-->
</script>
<?php
require("include/config.php");
if (comprueba_login() == 0) {

View File

@ -232,9 +232,12 @@
else
echo "-";
if (($network_server == 1) OR ($data_server == 1) OR ($recon_server == 1))
if (($network_server == 1) OR ($data_server == 1) OR ($recon_server == 1)){
if ($percentil > 100)
$percentil = 100;
// Progress bar render
echo '<img src="reporting/fgraph.php?tipo=progress&percent='.$percentil.'&height=18&width=80">';
}
// Number of modules
echo "<td class='$tdcolor'>";

View File

@ -15,224 +15,271 @@ $modules_server = 0;
$total_modules_network = 0;
$total_modules_data = 0;
if (comprueba_login() == 0) {
if ((give_acl($id_user, 0, "AR")==1) or (give_acl($id_user,0,"AW")) or (dame_admin($id_user)==1)) {
echo "<h2>".$lang_label["view_servers"]." &gt; ";
echo $lang_label["server_detail"]."</h2>";
if (comprueba_login() != 0) {
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to access Agent view");
require ($config["homeurl"]."/general/noaccess.php");
}
// Get total modules defined (network)
$total_modules_network = get_db_sql ("SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4 AND id_tipo_modulo != 100");
if ((give_acl($id_user, 0, "AR")==0) AND (give_acl($id_user,0,"AW") == 0) AND (dame_admin($id_user) == 0) ){
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation","Trying to access Agent view");
require ($config["homeurl"]."/general/noaccess.php");
}
// Get total modules defined (data)
$total_modules_data = get_db_sql ("SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo < 5 OR id_tipo_modulo = 100");
echo "<h2>".$lang_label["view_servers"]." &gt; ";
echo $lang_label["server_detail"]."</h2>";
// Connect DataBase
$sql='SELECT * FROM tserver';
$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>";
echo "<th class='datos'>".$lang_label['description']."</th>";
echo "<th class='datos' width=80>".$lang_label['type']."</th>";
echo "<th class='datos'>".$lang_label['version']."</th>";
echo "<th class='datos'>".$lang_label['lastupdate']."</th>";
$color=1;
while ($row=mysql_fetch_array($result)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
// Get total modules defined (network)
$total_modules_network = get_db_sql ("SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4 AND id_tipo_modulo != 100");
// Get total modules defined (data)
$total_modules_data = get_db_sql ("SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo < 5 OR id_tipo_modulo = 100");
// Connect DataBase
$sql='SELECT * FROM tserver';
$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>";
echo "<th class='datos'>".$lang_label['description']."</th>";
echo "<th class='datos' width=80>".$lang_label['type']."</th>";
echo "<th class='datos'>".$lang_label['version']."</th>";
echo "<th class='datos'>".$lang_label['lastupdate']."</th>";
$color=1;
while ($row=mysql_fetch_array($result)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
$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"];
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"];
$modules_server = 0;
if (($network_server == 1) OR ($data_server == 1)){
// Get total modules defined for this server (data modules)
$modules_server = get_db_sql ("SELECT COUNT(running_by) FROM tagente_estado WHERE running_by = $id_server");
}
echo "<tr><td class='$tdcolor'>";
if ($recon_server == 1)
echo "<b><a href='index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id=$id_server'>$name</a></b> ";
else
echo "<b>$name</b>";
echo "<td class='$tdcolor' align='middle'>";
if ($status ==0){
echo "<img src='images/dot_red.png'>";
} else {
echo "<img src='images/dot_green.png'>";
}
echo "<td class='$tdcolor' align='middle'>";
if (($network_server == 1) OR ($data_server == 1)){
// Progress bar calculations
if ($network_server == 1){
if ($total_modules_network == 0)
$percentil = 0;
if ($total_modules_network > 0)
$percentil = $modules_server / ($total_modules_network / 100);
else
$percentil = 0;
$total_modules_temp = $total_modules_network;
} 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){
$modules_server = get_db_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE id_network_server = $id_server");
$total_modules = get_db_sql ("SELECT COUNT(id_rt) FROM trecon_task");
if ($total_modules == 0)
$wmi_server = $row["wmi_server"];
$plugin_server = $row["plugin_server"];
$prediction_server = $row["prediction_server"];
$export_server = $row["export_server"];
$master = $row["master"];
$checksum = $row["checksum"];
$description = $row["description"];
$version = $row["version"];
$modules_server = 0;
// Get total modules defined for this server (data modules)
$modules_server = get_db_sql ("SELECT COUNT(running_by) FROM tagente_estado WHERE running_by = $id_server");
echo "<tr><td class='$tdcolor'>";
// Recon server detail
if ($recon_server == 1)
echo "<b><a href='index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id=$id_server'>$name</a></b> ";
else
echo "<b>$name</b>";
// Status (bad or good)
echo "<td class='$tdcolor' align='middle'>";
if ($status ==0){
echo "<img src='images/dot_red.png'>";
} else {
echo "<img src='images/dot_green.png'>";
}
echo "<td class='$tdcolor' align='middle'>";
if (($snmp_server == 0) OR ($recon_server == 0)){
// Progress bar calculations
if ($network_server == 1){
if ($total_modules_network == 0)
$percentil = 0;
if ($total_modules_network > 0)
$percentil = $modules_server / ($total_modules_network / 100);
else
$percentil = $modules_server / ($total_modules / 100);
$total_modules_temp = $total_modules;
$percentil = 0;
$total_modules_temp = $total_modules_network;
} else {
if ($total_modules_data == 0)
$percentil = 0;
else
$percentil = $modules_server / ($total_modules_data / 100);
$total_modules_temp = $total_modules_data;
}
else
echo "-";
} elseif ($recon_server == 1){
$modules_server = get_db_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE id_network_server = $id_server");
$total_modules = get_db_sql ("SELECT COUNT(id_rt) FROM trecon_task");
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 "-";
// Progress bar render
if ($snmp_server == 0) {
// Check bad values for percentile
if ($percentil > 100){
$percentil = 100;
}
if ($percentil < 0){
$percentil = 0;
}
echo '<img src="reporting/fgraph.php?tipo=progress&percent='.$percentil.'&height=18&width=80">';
}
// 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)){
if ($network_server == 1)
$sql1 = "SELECT MIN(last_execution_try),current_interval FROM tagente_estado WHERE last_execution_try > 0 AND running_by=$id_server GROUP BY current_interval ORDER BY 1";
if ($data_server == 1)
// This only checks for agent with a last_execution_try of at
// maximun: ten times it's interval.... if is bigger, it probably
// will be because an agent down
$sql1 = "SELECT MAX(last_execution_try), current_interval, id_agente FROM tagente_estado WHERE last_execution_try > 0 AND (tagente_estado.last_execution_try + (tagente_estado.current_interval * 10) > UNIX_TIMESTAMP()) AND running_by=$id_server GROUP BY id_agente ORDER BY 1 ASC LIMIT 1";
$nowtime = time();
$maxlag=0;
if ($result1=mysql_query($sql1))
while ($row1=mysql_fetch_array($result1)){
if (($row1[0] + $row1[1]) < $nowtime){
$maxlag2 = $nowtime - ($row1[0] + $row1[1]);
// More than 5 times module interval is not lag, is a big
// problem in agent, network or servers..
if ($maxlag2 < ($row1[1]*5))
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"]);
// 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) OR ($wmi_server == 1) OR ($plugin_server == 1)) {
if (($network_server == 1) OR ($wmi_server == 1) OR ($plugin_server == 1)) {
$sql1 = "SELECT MIN(last_execution_try),current_interval FROM tagente_estado WHERE last_execution_try > 0 AND running_by=$id_server GROUP BY current_interval ORDER BY 1";
} elseif ($data_server == 1){
// This only checks for agent with a last_execution_try of at
// maximun: ten times it's interval.... if is bigger, it probably
// will be because an agent down
$sql1 = "SELECT MAX(last_execution_try), current_interval, id_agente FROM tagente_estado WHERE last_execution_try > 0 AND (tagente_estado.last_execution_try + (tagente_estado.current_interval * 10) > UNIX_TIMESTAMP()) AND running_by=$id_server GROUP BY id_agente ORDER BY 1 ASC LIMIT 1";
}
$nowtime = time();
$maxlag=0;
if ($result1=mysql_query($sql1))
while ($row1=mysql_fetch_array($result1)){
if (($row1[0] + $row1[1]) < $nowtime){
$maxlag2 = $nowtime - ($row1[0] + $row1[1]);
// More than 5 times module interval is not lag, is a big
// problem in agent, network or servers..
if ($maxlag2 < ($row1[1]*5))
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 "<td class='".$tdcolor."f9'>".substr($description,0,25)."</td>";
echo "<td class='$tdcolor' align='middle'>";
if ($network_server == 1){
echo " <img src='images/network.png'>";
}
if ($data_server == 1){
echo "&nbsp; <img src='images/data.png'>";
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 ($snmp_server == 1){
echo "&nbsp; <img src='images/snmp.png'>";
}
if ($recon_server == 1){
echo "&nbsp; <img src='images/recon.png'>";
}
if ($master == 1){
echo "&nbsp; <img src='images/master.png'>";
}
if ($checksum == 1){
echo "&nbsp; <img src='images/binary.png'>";
}
echo "</td><td class='".$tdcolor."f9' align='middle'>";
echo $version;
echo "</td><td class='".$tdcolor."f9' align='middle'>";
// if ($status ==0)
echo substr($keepalive,0,25)."</td>";
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 "<td class='".$tdcolor."f9'>".substr($description,0,25)."</td>";
echo "<td class='$tdcolor' align='middle'>";
if ($network_server == 1){
echo '<img src="images/network.png" title="network">';
}
echo '</tr></table>';
echo "<table cellpadding=2 cellspacing=0>";
echo "
<tr>
<td>
<span class='net'>".$lang_label["network_server"]."</span>
</td>
<td>
<span class='master'>".$lang_label["master"]."</span>
</td>
<td>
<span class='data'>".$lang_label["data_server"]."</span>
</td>
<td>
<span class='binary'>".$lang_label["md5_checksum"]."</span>
</td>
<td>
<span class='snmp'>".$lang_label["snmp_console"]."</span>
</td>
<td>
<span class='recon'>".$lang_label["recon_server"]."</span>
</td>
</tr>";
echo "</table>";
} else {
echo "<div class='nf'>".$lang_label["no_server"]."</div>";
if ($data_server == 1){
echo '&nbsp; <img src="images/data.png" title="data server">';
}
if ($snmp_server == 1){
echo "&nbsp; <img src='images/snmp.png' title='snmp console'>";
}
if ($recon_server == 1){
echo "&nbsp; <img src='images/recon.png' title='recon'>";
}
if ($export_server == 1){
echo "&nbsp; <img src='images/database_refresh.png' title='export'>";
}
if ($wmi_server == 1){
echo "&nbsp; <img src='images/wmi.png' title='WMI'>";
}
if ($prediction_server == 1){
echo "&nbsp; <img src='images/chart_bar.png' title='prediction'>";
}
if ($plugin_server == 1){
echo "&nbsp; <img src='images/plugin.png' title='plugin'>";
}
if ($master == 1){
echo "&nbsp; <img src='images/master.png' title='master'>";
}
if ($checksum == 1){
echo "&nbsp; <img src='images/binary.png' title='checksum'>";
}
echo "</td><td class='".$tdcolor."f9' align='middle'>";
echo $version;
echo "</td><td class='".$tdcolor."f9' align='middle'>";
// if ($status ==0)
echo substr($keepalive,0,25)."</td>";
}
} else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent view");
require ("general/noaccess.php");
}
echo '</tr></table>';
echo "<table cellpadding=2 cellspacing=0>";
echo "
<tr>
<td>
<span class='net'>".$lang_label["network_server"]."</span>
</td>
<td>
<span class='data'>".$lang_label["data_server"]."</span>
</td>
<td>
<span class='plugin'>".lang_string ("plugin_server")."</span>
</td>
<td>
<span class='wmi'>".lang_string ("wmi_server")."</span>
</td>
<td>
<span class='prediction'>".lang_string ("prediction_server")."</span>
</td>
</tr>
<tr>
<td>
<span class='export'>".lang_string ("export_server"). "</span>
</td>
<td>
<span class='snmp'>".lang_string ("snmp_console"). "</span>
</td>
<td>
<span class='recon'>".lang_string ("recon_server"). "</span>
</td>
<td>
<span class='binary'>".lang_string ("md5_checksum"). "</span>
</td>
<td>
<span class='master'>".lang_string ("master"). "</span>
</td>
</tr>";
echo "</table>";
}
?>

View File

@ -28,7 +28,6 @@ CREATE TABLE `tagent_access` (
KEY `agent_index` (`id_agent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tagente` (
`id_agente` mediumint(8) unsigned NOT NULL auto_increment,
`nombre` varchar(100) NOT NULL default '',
@ -43,20 +42,14 @@ CREATE TABLE `tagente` (
`agent_version` varchar(100) default '',
`ultimo_contacto_remoto` datetime default '0000-00-00 00:00:00',
`disabled` tinyint(2) NOT NULL default '0',
`agent_type` int(2) unsigned NOT NULL default '0',
`id_server` int(10) unsigned default '0',
`id_network_server` int(4) unsigned default '0',
`id_plugin_server` int(4) unsigned default '0',
`id_prediction_server` int(4) unsigned default '0',
`id_wmi_server` int(4) unsigned default '0',
`id_parent` mediumint(8) unsigned default '0',
PRIMARY KEY (`id_agente`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/* Data source field explanation (Pandora FMS 1.4.x)
1 - Classic module data from tagente_modulo
2 - New data coming from plugin modules
3 - New data coming from predictive engine
.
*/
CREATE TABLE `tagente_datos` (
`id_agente_datos` bigint(10) unsigned NOT NULL auto_increment,
`id_agente_modulo` mediumint(8) unsigned NOT NULL default '0',
@ -64,10 +57,8 @@ CREATE TABLE `tagente_datos` (
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`id_agente` mediumint(8) unsigned NOT NULL default '0',
`utimestamp` int(10) unsigned default '0',
`data_source` tinyint(3) unsigned default `1`,
PRIMARY KEY (`id_agente_datos`),
KEY `data_index2` (`id_agente`,`id_agente_modulo`),
KEY `data_index3` (`data_source`,`id_agente_modulo`)
KEY `data_index2` (`id_agente`,`id_agente_modulo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tagent_data_image` (
@ -78,10 +69,8 @@ CREATE TABLE `tagent_data_image` (
`filename` varchar(255) default '',
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`utimestamp` int(10) unsigned default '0',
`data_source` tinyint(3) unsigned default `1`,
PRIMARY KEY (`id`),
KEY `img_idx1` (`id_agent`,`id_agent_module`),
KEY `img_idx2` (`data_source`,`id_agent_module`)
KEY `img_idx1` (`id_agent`,`id_agent_module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tagente_datos_inc` (
@ -90,10 +79,8 @@ CREATE TABLE `tagente_datos_inc` (
`datos` double(18,2) default NULL,
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`utimestamp` int(10) unsigned default '0',
`data_source` tinyint(3) unsigned default `1`,
PRIMARY KEY (`id_adi`),
KEY `data_inc_index_1` (`id_agente_modulo`),
KEY `data_inc_index3` (`data_source`,`id_agente_modulo`)
KEY `data_inc_index_1` (`id_agente_modulo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -104,10 +91,8 @@ CREATE TABLE `tagente_datos_string` (
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`id_agente` bigint(4) unsigned NOT NULL default '0',
`utimestamp` int(10) unsigned NOT NULL default 0,
`data_source` tinyint(3) unsigned default `1`,
PRIMARY KEY (`id_tagente_datos_string`),
KEY `data_string_index_1` (`id_agente`,`id_agente_modulo`),
KEY `data_string_index_3` (`data_source`,`id_agente_modulo`)
KEY `data_string_index_1` (`id_agente`,`id_agente_modulo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -124,16 +109,25 @@ CREATE TABLE `tagente_estado` (
`current_interval` int(10) unsigned NOT NULL default '0',
`running_by` int(10) unsigned NULL default 0,
`last_execution_try` bigint(20) NOT NULL default '0',
`data_source` tinyint(3) unsigned default `1`,
PRIMARY KEY (`id_agente_estado`),
KEY `status_index_1` (`id_agente_modulo`),
KEY `status_index_2` (`id_agente_modulo`,`estado`),
KEY `status_index_3` (`id_agente_modulo`,`data_source`)
KEY `status_index_2` (`id_agente_modulo`,`estado`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*
id_modulo now uses tmodule
1 - Data server modules (agent related modules)
2 - Network server modules
4 - Plugin server
5 - Predictive server
6 - WMI server
*/
CREATE TABLE `tagente_modulo` (
`id_agente_modulo` bigint(100) unsigned NOT NULL auto_increment,
`id_agente_modulo` bigint(14) unsigned NOT NULL auto_increment,
`id_agente` int(11) NOT NULL default '0',
`id_tipo_modulo` int(11) NOT NULL default '0',
`descripcion` varchar(100) NOT NULL default '',
@ -151,11 +145,20 @@ CREATE TABLE `tagente_modulo` (
`flag` tinyint(3) unsigned default '1',
`id_modulo` int(11) unsigned NULL default 0,
`disabled` tinyint(3) unsigned default '0',
`export` tinyint(3) unsigned default '0',
`id_export` tinyint(3) unsigned default '0',
`plugin_user` varchar(250) default '',
`plugin_pass` varchar(250) default '',
`plugin_parameter` text default '',
`id_plugin` int(11) default '0',
`post_process` double(18,2) default NULL,
`prediction_module` bigint(14) default '0',
`max_timeout` tinyint(3) unsigned default '0',
PRIMARY KEY (`id_agente_modulo`, `id_agente`),
KEY `tam_agente` (`id_agente`)
KEY `tam_agente` (`id_agente`),
KEY `tam_plugin` (`id_plugin`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- snmp_oid is also used for WMI query
CREATE TABLE `talert_snmp` (
`id_as` int(10) unsigned NOT NULL auto_increment,
@ -226,7 +229,7 @@ CREATE TABLE tnotification (
`recovery_notify` tinyint(3) default '0',
`disabled` tinyint(3) default '0',
`last_fired` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id_aam`),
PRIMARY KEY (`id`),
KEY `tnotif_indx_1` (`id_alerta`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -234,7 +237,7 @@ 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`,
`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 '',
@ -248,7 +251,14 @@ CREATE TABLE `tnotification_component` (
`disabled` int(4) default '0',
`time_from` TIME default '00:00:00',
`time_to` TIME default '00:00:00',
PRIMARY KEY (`id_aam`),
`monday` tinyint(3) default '0',
`tuesday` tinyint(3) default '0',
`wednesday` tinyint(3) default '0',
`thursday` tinyint(3) default '0',
`friday` tinyint(3) default '0',
`saturday` tinyint(3) default '0',
`sunday` tinyint(3) default '0',
PRIMARY KEY (`id`),
KEY `tnotifcom_indx_1` (`id_notification`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -473,10 +483,13 @@ CREATE TABLE `tserver` (
`description` varchar(255) default NULL,
`recon_server` tinyint(3) unsigned NOT NULL default '0',
`version` varchar(20) NOT NULL default '',
`plugin_server` tinyint(3) unsigned NOT NULL default '0',
`prediction_server` tinyint(3) unsigned NOT NULL default '0',
`wmi_server` tinyint(3) unsigned NOT NULL default '0',
`export_server` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`id_server`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tsesion` (
`ID_sesion` bigint(4) unsigned NOT NULL auto_increment,
`ID_usuario` varchar(60) NOT NULL default '0',
@ -568,7 +581,6 @@ CREATE TABLE `tgraph_source` (
PRIMARY KEY(`id_gs`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `treport` (
`id_report` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_user` varchar(100) NOT NULL default '',
@ -649,38 +661,34 @@ CREATE TABLE tplugin (
`net_port_opt` varchar(50) default '',
`user_opt` varchar(50) default '',
`pass_opt` varchar(50) default '',
PRIMARY KEY('id')
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tagent_plugin` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_agent` int(11) NOT NULL default '0',
`id_plugin` int(11) NOT NULL default '0',
`id_module_type` int(11) NOT NULL default '0',
`net_dst` varchar(250) default '',
`net_port` varchar(250) default '',
`access_user` varchar(250) default '',
`access_pass` varchar(250) default '',
`field1` varchar(250) default '',
`field2` varchar(250) default '',
`field3` varchar(250) default '',
`field4` varchar(250) default '',
`field5` varchar(250) default ''
`id_module_group` int(4) unsigned default '0',
`flag` tinyint(3) unsigned default '1',
`disabled` tinyint(3) unsigned default '0',
`export` tinyint(3) unsigned default '0',
PRIMARY KEY (`id`),
KEY `ag_plugin_idx1` (`id_agent`,`id`)
CREATE TABLE `tmodule` (
`id_module` int(11) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id_module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tagent_predictive` (
CREATE TABLE `tserver_export` (
`id` int(10) unsigned NOT NULL auto_increment,
`id_agent` int(11) NOT NULL default '0',
`id_module_group` int(4) unsigned default '0',
`flag` tinyint(3) unsigned default '1',
`disabled` tinyint(3) unsigned default '0',
`export` tinyint(3) unsigned default '0',
PRIMARY KEY (`id`),
KEY `ag_pred_idx1` (`id_agent`,`id`)
`name` varchar(100) NOT NULL default '',
`preffix` varchar(100) NOT NULL default '',
`interval` int(5) unsigned NOT NULL default '300',
`ip_server` varchar(100) NOT NULL default '',
`connect_mode` tinyint(2) NOT NULL default '0',
`id_export_server` int(5) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Used to implement fast login (using a predefined hash)
CREATE TABLE `tquicksession` (
`id` int(20) unsigned NOT NULL auto_increment,
`id_user` varchar(250) NOT NULL default '',
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`pwdhash` varchar(250) NOT NULL default '',
PRIMARY KEY (`id`)
);

View File

@ -91,69 +91,10 @@ INSERT INTO `tmodule_group` VALUES (1,'General'),(2,'Networking'),(3,'Applicatio
UNLOCK TABLES;
/*!40000 ALTER TABLE `tmodule_group` ENABLE KEYS */;
--
-- Dumping data for table `tnetwork_component`
--
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);
--
-- Dumping data for table `tnetwork_component_group`
--
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);
--
-- Dumping data for table `torigen`
--
INSERT INTO `torigen` VALUES ('Operating System event'),('IDS events'),('Firewall records'),('Database event'),('Application data'),('Logfiles'),('Other data source'),('Pandora FMS Event'),('User report'),('Unknown source');
--
@ -163,26 +104,31 @@ INSERT INTO `torigen` VALUES ('Operating System event'),('IDS events'),('Firewal
INSERT INTO `ttipo_modulo` VALUES
(1,'generic_data',0,'Generic module to adquire numeric data','mod_data.png'),
(2,'generic_proc',1,'Generic module to adquire boolean data','mod_proc.png'),
(3,'generic_data_string',0,'Generic module to adquire alphanumeric data','mod_string.png'),
(3,'generic_data_string',2,'Generic module to adquire alphanumeric data','mod_string.png'),
(4,'generic_data_inc',0,'Generic module to adquire numeric incremental data','mod_data_inc.png'),
(6,'remote_icmp_proc',3,'Remote ICMP network agent, boolean data','mod_icmp_proc.png'),
(7,'remote_icmp',2,'Remote ICMP network agent (latency)','mod_icmp_data.png'),
(8,'remote_tcp',2,'Remote TCP network agent, numeric data','mod_tcp_data.png'),
(9,'remote_tcp_proc',3,'Remote TCP network agent, boolean data','mod_tcp_proc.png'),
(10,'remote_tcp_string',2,'Remote TCP network agent, alphanumeric data','mod_tcp_string.png'),
(11,'remote_tcp_inc',2,'Remote TCP network agent, incremental data','mod_tcp_inc.png'),
(15,'remote_snmp',2,'Remote SNMP network agent, numeric data','mod_snmp_data.png'),
(16,'remote_snmp_inc',2,'Remote SNMP network agent, incremental data','mod_snmp_inc.png'),
(17,'remote_snmp_string',2,'Remote SNMP network agent, alphanumeric data','mod_snmp_string.png'),
(18,'remote_snmp_proc',3,'Remote SNMP network agent, boolean data','mod_snmp_proc.png'),
(6,'remote_icmp_proc',4,'Remote ICMP network agent, boolean data','mod_icmp_proc.png'),
(7,'remote_icmp',3,'Remote ICMP network agent (latency)','mod_icmp_data.png'),
(8,'remote_tcp',3,'Remote TCP network agent, numeric data','mod_tcp_data.png'),
(9,'remote_tcp_proc',4,'Remote TCP network agent, boolean data','mod_tcp_proc.png'),
(10,'remote_tcp_string',5,'Remote TCP network agent, alphanumeric data','mod_tcp_string.png'),
(11,'remote_tcp_inc',3,'Remote TCP network agent, incremental data','mod_tcp_inc.png'),
(15,'remote_snmp',3,'Remote SNMP network agent, numeric data','mod_snmp_data.png'),
(16,'remote_snmp_inc',3,'Remote SNMP network agent, incremental data','mod_snmp_inc.png'),
(17,'remote_snmp_string',5,'Remote SNMP network agent, alphanumeric data','mod_snmp_string.png'),
(18,'remote_snmp_proc',4,'Remote SNMP network agent, boolean data','mod_snmp_proc.png'),
(19,'image_jpg',9,'Image JPG data', 'mod_image_jpg.png'),
(20,'image_png',9,'Image PNG data', 'mod_image_png.png'),
(21,'async_proc', 5, 'Asyncronous proc data', 'mod_async_proc.png'),
(22,'async_data', 4, 'Asyncronous numeric data', 'mod_async_data.png'),
(23,'async_string', 4, 'Asyncronous string data', 'mod_async_string.png'),
(24,'predictive', 6, 'Predictive Estimation Data', 'mod_predictive.png'),
(21,'async_proc', 7, 'Asyncronous proc data', 'mod_async_proc.png'),
(22,'async_data', 6, 'Asyncronous numeric data', 'mod_async_data.png'),
(23,'async_string', 8, 'Asyncronous string data', 'mod_async_string.png'),
(24,'predictive', 10, 'Predictive Estimation Data', 'mod_predictive.png'),
(100,'keep_alive',-1,'KeepAlive','mod_keepalive.png');
/* Categoria field is used to segregate several types (plugin, agents, network) on their data
types, could be used or could be avoided and use directly primary key (id_tipo) */
--
-- Dumping data for table `tusuario`
--
@ -201,24 +147,112 @@ INSERT INTO `tusuario_perfil` VALUES (1,'admin',5,1,'admin');
INSERT INTO `tperfil` VALUES (1,'Operator (Read)',0,1,0,1,0,0,0,0,0,0),(2,'Operator (Write)',1,1,0,1,0,0,0,0,0,0),(3,'Chief Operator',1,1,1,1,0,0,0,0,0,0),(4,'Group coordinator',1,1,1,1,1,1,1,0,0,0),(5,'Pandora Administrator',1,1,1,1,1,1,1,1,1,1);
INSERT INTO `tnews` VALUES (1,'admin','Welcome to Pandora FMS!','This is our new console, a lot of new features has been added from last version. Please read documentation about it and be free to test any option.\r\n\r\nPandora FMS team.','2007-06-22 13:03:20');
INSERT INTO `tnews` VALUES (1,'admin','Welcome to Pandora FMS!','This is our new console, a lot of new features has been added from last version. Please read documentation about it and be free to test any option.\r\n\r\nPandora FMS team.','2008-02-26 13:03:20');
INSERT INTO tmodule VALUES (1,'Agent module');
INSERT INTO tmodule VALUES (2,'Network module');
INSERT INTO tmodule VALUES (4,'Plugin module');
INSERT INTO tmodule VALUES (5,'IA module');
INSERT INTO tmodule VALUES (6,'WMI module');
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (1,'OS Total process','Total process in Operating System (UNIX MIB)',13,15,0,0,180,0,'','','public','HOST-RESOURCES-MIB::hrSystemProcesses.0 ',4);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (2,'OS CPU Load (1 min)','CPU Load in Operating System (UNIX MIB)',13,15,0,0,180,0,'','','public','UCD-SNMP-MIB::laLoad.1',4);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (4,'OS Users','Active users in Operating System (UNIX MIB)',13,15,0,0,180,0,'','','public','HOST-RESOURCES-MIB::hrSystemNumUsers.0',4);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (11,'Catalyst CPU Usage (5min)','Cisco Catalyst Switches CPU Usage. Taken from ftp://ftp.cisco.com/pub/mibs/oid/OLD-CISCO-CPU-MIB.oid',2,15,0,0,180,0,'','','public','1.3.6.1.4.1.9.2.1.58',4);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (22,'HSRP Status','Get status of HSRP',2,18,0,0,180,0,'','','public','1.3.6.1.4.1.9.9.106.1.2.1.1.15.12.106',2);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (34,'Host Alive','Check if host is alive using ICMP ping check.',10,6,0,0,120,0,'','','','',2);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (36,'Host Latency','Get host network latency in miliseconds, using ICMP.',10,7,0,0,180,0,'','','','',2);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (39,'Check SSH Server','Checks port 22 is opened',10,9,0,0,300,22,'','','','',2);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (40,'Check Telnet server','Check telnet port',10,9,0,0,300,23,'','','','',2);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (41,'Check SMTP server','Check if SMTP port it&#039;s open',10,9,0,0,300,25,'','','','',2);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (42,'Check POP3 server','Check POP3 port.',10,9,0,0,300,110,'','','','',2);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) 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` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (49,'OS CPU Load (5 min)','CPU load on a 5 min average interval. UCD-SNMP Mib (Usually for all Linux and some UNIX)',13,15,0,0,180,0,'','','public','UCD-SNMP-MIB::laLoad.2',4);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (50,'System Description','Get system description (all mibs).',1,17,0,0,9000,0,'','','public','SNMPv2-MIB::sysDescr.0',4);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (51,'OS Raw Interrupts','Get system raw interrupts from SO',13,16,0,0,180,0,'','','public','UCD-SNMP-MIB::ssRawInterrupts.0',4);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (52,'OS IO Signals sent','IO Signals sent by Kernel',13,16,0,0,180,0,'','','public','UCD-SNMP-MIB::ssIOSent.0',4);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (53,'System Uptime','Sistem uptime in timeticks',1,15,0,0,180,0,'','','public','HOST-RESOURCES-MIB::hrSystemUptime.0',4);
INSERT INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`) VALUES (54,'Catalyst Free Mem','Taken from ftp://ftp.cisco.com/pub/mibs/oid/OLD-CISCO-MEMORY-MIB.oid',2,15,0,0,180,0,'','','public','1.3.6.1.4.1.9.2.1.8',4);
--
-- Dumping data for table `tnetwork_component_group`
--
INSERT INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (1,'General group',0);
INSERT INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (2,'Cisco MIBs',10);
INSERT INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (5,'UNIX MIBs',12);
INSERT INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (10,'Network Management',0);
INSERT INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (11,'Microsoft Windows MIB',12);
INSERT INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (12,'Operating Systems',0);
INSERT INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (13,'UCD Mibs (Linux, UCD-SNMP)',12);
-- Network profile
INSERT INTO `tnetwork_profile` (`id_np`, `name`, `description`) VALUES (1,'Basic Network Monitoring','This includes basic SNMP, ICMP, and TCP checks.');
INSERT INTO `tnetwork_profile` (`id_np`, `name`, `description`) VALUES (2,'Basic Monitoring','Only ICMP check');
INSERT INTO `tnetwork_profile` (`id_np`, `name`, `description`) VALUES (3,'Basic DMZ Server monitoring','This group of network checks, checks for default services located on DMZ servers...');
INSERT INTO `tnetwork_profile` (`id_np`, `name`, `description`) VALUES (4,'Full SNMP Monitoring','');
INSERT INTO `tnetwork_profile` (`id_np`, `name`, `description`) VALUES (5,'Linux Server','Full Monitoring of a Linux server services.');
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (1,24,1);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (2,25,1);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (3,27,1);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (4,28,1);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (5,30,1);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (6,31,1);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (7,34,1);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (8,39,1);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (9,34,2);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (10,34,3);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (11,37,3);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (12,39,3);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (13,38,3);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (14,24,3);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (15,3,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (16,24,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (17,25,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (18,26,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (19,27,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (20,28,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (21,29,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (22,30,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (23,31,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (24,32,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (25,45,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (26,46,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (27,47,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (28,48,4);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (29,3,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (30,50,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (31,53,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (32,24,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (33,30,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (34,27,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (35,34,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (36,1,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (37,2,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (38,49,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (39,4,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (40,51,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (41,52,5);
INSERT INTO `tnetwork_profile_component` (`id_npc`, `id_nc`, `id_np`) VALUES (42,39,5);
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

@ -4,10 +4,8 @@
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development, project architecture and management.
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP code additions
// Copyright (c) 2006 Jose Navarro <jnavarro@jnavarro.net>
// Additions to code for Pandora FMS 1.2 graph code
// Additions to graphical code (slide menu)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -24,42 +22,32 @@
// Silk icon set 1.3 (cc) Mark James, http://www.famfamfam.com/lab/icons/silk/
// Pandora FMS 1.x uses Pear Image::Graph code
include ("../include/config.php");
include ("../include/functions.php");
include ("../include/functions_db.php");
require ("../include/languages/language_".$language_code.".php");
include ('../include/config.php');
include ($config["homedir"].'/include/functions.php');
include ($config["homedir"].'/include/functions_db.php');
require ($config["homedir"].'/include/languages/language_'.$config['language'].'.php');
/**
* Show a brief error message in a PNG graph
*/
function graphic_error () {
Header("Content-type: image/png");
$imgPng = imageCreateFromPng("../images/image_problem.png");
Header('Content-type: image/png');
$imgPng = imageCreateFromPng('../images/image_problem.png');
imageAlphaBlending($imgPng, true);
imageSaveAlpha($imgPng, true);
imagePng($imgPng);
}
function dame_fecha_grafico ($mh, $format){
// Date 24x7x30 hours ago (one month)
$m_year = date("Y", time()-$mh*60);
$m_month = date("m", time()-$mh*60);
$m_month_word = date("M", time()-$mh*60);
$m_day = date ("d", time()-$mh*60);
$m_hour = date ("H", time()-$mh*60);
$m_min = date ("i", time()-$mh*60);
switch ($format) {
case 1: $m = $m_month."/".$m_day." ".$m_hour.":".$m_min;
break;
case 2: $m = $m_year."-".$m_month."-".$m_day;
break;
case 3: $m = $m_day."th -".$m_month_word."\n".$m_year;
break;
case 4: $m = $m_day."th -".$m_month_word;
break;
}
return $m;
}
/**
* Return a MySQL timestamp date, formatted with actual date MINUS X minutes,
*
* @param int Date in unix format (timestamp)
*
* @return string Formatted date string (YY-MM-DD hh:mm:ss)
*/
function dame_fecha($mh){
// Return a MySQL timestamp date, formatted with actual date MINUS X minutes, given as parameter
$m_year = date("Y", time()-$mh*60);
$m_month = date("m", time()-$mh*60);
$m_day = date ("d", time()-$mh*60);
@ -69,15 +57,39 @@ function dame_fecha($mh){
return $m;
}
/**
* Return a short timestamp data, D/M h:m
*
* @param int Date in unix format (timestamp)
*
* @return string Formatted date string
*/
function dame_fecha_grafico_timestamp ($timestamp) {
return date('d/m H:i', $timestamp);
}
function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $height, $title, $unit_name, $show_event=0, $show_alert=0, $pure =0 ) {
/**
* Produces a combined/user defined PNG graph
*
* @param array List of source modules
* @param array List of weighs for each module
* @param int Period (in seconds)
* @param int Width, in pixels
* @param int Height, in pixels
* @param string Title for graph
* @param string Unit name, for render in legend
* @param int Show events in graph (set to 1)
* @param int Show alerts in graph (set to 1)
* @param int Pure mode (without titles) (set to 1)
*/
function graphic_combined_module ( $module_list, $weight_list, $periodo, $width, $height, $title, $unit_name, $show_event=0, $show_alert=0, $pure =0 ){
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
require_once 'Image/Graph.php';
$resolution = $config_graph_res * 50; // Number of "slices" we want in graph
$resolution = $config['graph_res'] * 50; // Number of "slices" we want in graph
//$unix_timestamp = strtotime($mysql_timestamp) // Convert MYSQL format tio utime
$fechatope = time() - $periodo; // limit date
@ -232,7 +244,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
else
$title_period = "Last ".format_numeric(($periodo / (3600*24)),2)." days";
if ($pure == 0){
$Font =& $Graph->addNew('font', $config_fontpath);
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(6);
$Graph->setFont($Font);
$Graph->add(
@ -253,7 +265,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
$Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
$Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
} else {
$Font =& $Graph->addNew('font', $config_fontpath);
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(6);
$Graph->setFont($Font);
$Graph->add(
@ -351,10 +363,10 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event,
$width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0 ) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
require_once 'Image/Graph.php';
$resolution = $config_graph_res * 50; // Number of "slices" we want in graph
$resolution = $config["graph_res"] * 50; // Number of "slices" we want in graph
//$unix_timestamp = strtotime($mysql_timestamp) // Convert MYSQL format tio utime
$fechatope = time() - $periodo; // limit date
@ -481,7 +493,7 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event,
// *************
$Graph =& Image_Graph::factory('graph', array($width, $height));
// add a TrueType font
$Font =& $Graph->addNew('font', $config_fontpath);
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(6);
$Graph->setFont($Font);
@ -624,13 +636,13 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event,
function generic_pie_graph ($width=300, $height=200, $data, $legend) {
require ("../include/config.php");
require_once 'Image/Graph.php';
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
if (sizeof($data) > 0){
// create the graph
$driver=& Image_Canvas::factory('png',array('width'=>$width,'height'=>$height,'antialias' => 'native'));
$Graph = & Image_Graph::factory('graph', $driver);
// add a TrueType font
$Font =& $Graph->addNew('font', $config_fontpath);
$Font =& $Graph->addNew('font', $config['fontpath']);
// set the font size to 7 pixels
$Font->setSize(7);
$Graph->setFont($Font);
@ -685,7 +697,7 @@ function generic_pie_graph ($width=300, $height=200, $data, $legend) {
function graphic_agentmodules($id_agent, $width, $height) {
include ("../include/config.php");
require_once 'Image/Graph.php';
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$sql1="SELECT * FROM ttipo_modulo";
$result=mysql_query($sql1);
@ -733,11 +745,11 @@ function graphic_agentmodules($id_agent, $width, $height) {
function graphic_agentaccess($id_agent, $periodo, $width, $height){
include ("../include/config.php");
require_once 'Image/Graph.php';
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$color ="#437722"; // Green pandora 1.1 octopus color
/*
$agent_interval = give_agentinterval($id_agent);
$intervalo = 30 * $config_graph_res; // Desired interval / range between dates
$intervalo = 30 * $config['graph_res']; // Desired interval / range between dates
$intervalo_real = (86400 / $agent_interval); // 60x60x24 secs
if ($intervalo_real < $intervalo ) {
$intervalo = $intervalo_real;
@ -786,7 +798,7 @@ function graphic_agentaccess($id_agent, $periodo, $width, $height){
// create the graph
$Graph =& Image_Graph::factory('graph', array($width, $height));
// add a TrueType font
$Font =& $Graph->addNew('font', $config_fontpath);
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(6);
$Graph->setFont($Font);
$Graph->add(
@ -826,7 +838,7 @@ function graphic_agentaccess($id_agent, $periodo, $width, $height){
function grafico_incidente_estados() {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array(0,0,0,0);
// 0 - Abierta / Sin notas
@ -859,7 +871,7 @@ function grafico_incidente_estados() {
function grafico_incidente_prioridad() {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array(0,0,0,0,0,0);
// 0 - Abierta / Sin notas
@ -896,7 +908,7 @@ function grafico_incidente_prioridad() {
function graphic_incident_group() {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array();
$legend = array();
@ -935,7 +947,7 @@ function graphic_incident_group() {
function graphic_incident_user() {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array();
$legend = array();
@ -974,7 +986,7 @@ function graphic_incident_user() {
function graphic_user_activity($width=350, $height=230) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array();
$legend = array();
@ -1016,7 +1028,7 @@ function graphic_user_activity($width=350, $height=230) {
function graphic_incident_source ($width=320, $height=200) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array();
$legend = array();
@ -1055,7 +1067,7 @@ function graphic_incident_source ($width=320, $height=200) {
function grafico_db_agentes_modulos($width, $height) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array();
$legend = array();
@ -1086,7 +1098,7 @@ function grafico_db_agentes_modulos($width, $height) {
function grafico_eventos_usuario( $width=420, $height=200) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array();
$legend = array();
@ -1127,7 +1139,7 @@ function grafico_eventos_usuario( $width=420, $height=200) {
function grafico_eventos_total() {
require ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array();
$legend = array();
@ -1165,7 +1177,7 @@ function grafico_eventos_total() {
function grafico_eventos_grupo ($width = 300, $height = 200 ) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array();
$legend = array();
@ -1208,7 +1220,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200 ) {
function generic_bar_graph ( $width =380, $height = 200, $data, $legend) {
include ("../include/config.php");
require_once 'Image/Graph.php';
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
if (sizeof($data) > 10){
$height = sizeof($legend) * 20;
@ -1217,7 +1229,7 @@ function generic_bar_graph ( $width =380, $height = 200, $data, $legend) {
// create the graph
$Graph =& Image_Graph::factory('graph', array($width, $height));
// add a TrueType font
$Font =& $Graph->addNew('font', $config_fontpath);
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(9);
$Graph->setFont($Font);
$Graph->add(
@ -1246,7 +1258,7 @@ function generic_bar_graph ( $width =380, $height = 200, $data, $legend) {
function grafico_db_agentes_paquetes ($width = 380, $height = 300) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
$data = array();
$legend = array();
@ -1284,7 +1296,7 @@ function grafico_db_agentes_paquetes ($width = 380, $height = 300) {
function grafico_db_agentes_purge ($id_agent, $width, $height) {
include ("../include/config.php");
require_once 'Image/Graph.php';
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
// All data (now)
$purge_all=date("Y-m-d H:i:s",time());
@ -1328,7 +1340,7 @@ function grafico_db_agentes_purge ($id_agent, $width, $height) {
function drawWarning($width,$height) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
if ($width == 0) {
$width = 50;
}
@ -1346,7 +1358,7 @@ function drawWarning($width,$height) {
ImageFilledRectangle($image,0,0,$width-1,$height-1,$back);
ImageRectangle($image,0,0,$width-1,$height-1,$border);
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config_fontpath, $lang_label["no_data"]);
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config['fontpath'], $lang_label["no_data"]);
imagePNG($image);
imagedestroy($image);
}
@ -1360,7 +1372,7 @@ function progress_bar($progress,$width,$height) {
// Code ripped from Babel Project :-)
function drawRating($rating,$width,$height) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
if ($width == 0) {
$width = 150;
}
@ -1384,11 +1396,11 @@ function progress_bar($progress,$width,$height) {
ImageRectangle($image,0,0,$width-1,$height-1,$border);
if ($rating > 50)
if ($rating > 100)
ImageTTFText($image, 8, 0, ($width/4), ($height/2)+($height/5), $back, $config_fontpath,$lang_label["out_of_limits"]);
ImageTTFText($image, 8, 0, ($width/4), ($height/2)+($height/5), $back, $config['fontpath'],$lang_label["out_of_limits"]);
else
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $config_fontpath, $rating."%");
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $config['fontpath'], $rating."%");
else
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config_fontpath, $rating."%");
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config['fontpath'], $rating."%");
imagePNG($image);
imagedestroy($image);
}
@ -1456,7 +1468,7 @@ function graphic_test ($id, $period, $interval, $label, $width, $height){
// create the graph
$Graph =& Image_Graph::factory('graph', array($width, $height));
// add a TrueType font
$Font =& $Graph->addNew('font', $config_fontpath);
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(6);
$Graph->setFont($Font);
$Graph->add(
@ -1502,7 +1514,7 @@ function odo_tactic ($value1, $value2, $value3){
$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);
$Font =& $Graph->addNew('font', $config['fontpath']);
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
@ -1598,10 +1610,10 @@ function grafico_modulo_boolean ( $id_agente_modulo, $periodo, $show_event,
$width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0 ) {
include ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
require ("../include/languages/language_".$config['language'].".php");
require_once 'Image/Graph.php';
$resolution = $config_graph_res * 50; // Number of "slices" we want in graph
$resolution = $config['graph_res'] * 50; // Number of "slices" we want in graph
//$unix_timestamp = strtotime($mysql_timestamp) // Convert MYSQL format tio utime
$fechatope = time() - $periodo; // limit date
@ -1746,7 +1758,7 @@ function grafico_modulo_boolean ( $id_agente_modulo, $periodo, $show_event,
// *************
$Graph =& Image_Graph::factory('graph', array($width, $height));
// add a TrueType font
$Font =& $Graph->addNew('font', $config_fontpath);
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(6);
$Graph->setFont($Font);