2008-01-10 Sancho Lerena <slerena@gmail.com>

Code merged from 1.3.1 branch:

        * functions_db.php: Some changes in future generic SQL interface access.

        * pandora_console/include/functions.php: Added generic acces to HTTP 
        parameters.

        * status_monitor.php: Fixed problems detected by Pierre Gaxatte.

        * estado_agente.php: Fixed the same kind of problems (ACL / Group acces)
        and added a Agent search field as request by J.Corona.

        * tactical.php: Rename of generic SQL function access.
        
        * view_server.php: Rename of generic SQL function access.

        * modificar_agente.php: Fixed some render problems, added a Agent search
        option and better formatting.

        * configurar_agente.php: New management for KeepAlive module.

        New code for 1.4 development branch (trunk)

        * pandoradbdata_13_to_14.sql: Migration SQL (data) code from 1.3 to 1.4

        * pandoradb_13_to_14.sql: Migration SQL (schema) code frrom 1.3 to 1.4

        * pandoradb_data.sql: Modified code to fresh install SQL data.

        * pandoradb.sql: Modified code to fresh install SQL schema.

        * index.php,
        * install.php: new version info.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@700 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-01-10 16:40:00 +00:00
parent 90a15aeb2a
commit b4a87a0eef
18 changed files with 560 additions and 487 deletions

View File

@ -1,3 +1,39 @@
2008-01-10 Sancho Lerena <slerena@gmail.com>
Code merged from 1.3.1 branch:
* functions_db.php: Some changes in future generic SQL interface access.
* pandora_console/include/functions.php: Added generic acces to HTTP
parameters.
* status_monitor.php: Fixed problems detected by Pierre Gaxatte.
* estado_agente.php: Fixed the same kind of problems (ACL / Group acces)
and added a Agent search field as request by J.Corona.
* tactical.php: Rename of generic SQL function access.
* view_server.php: Rename of generic SQL function access.
* modificar_agente.php: Fixed some render problems, added a Agent search
option and better formatting.
* configurar_agente.php: New management for KeepAlive module.
New code for 1.4 development branch (trunk)
* pandoradbdata_13_to_14.sql: Migration SQL (data) code from 1.3 to 1.4
* pandoradb_13_to_14.sql: Migration SQL (schema) code frrom 1.3 to 1.4
* pandoradb_data.sql: Modified code to fresh install SQL data.
* pandoradb.sql: Modified code to fresh install SQL schema.
* index.php,
* install.php: new version info.
2008-01-09 Sancho Lerena <slerena@gmail.com>
* fgraph.php: Solved problem in combined area render (ugly graphs most of times).

View File

@ -1,27 +1,11 @@
<?php
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-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 additions
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// Javascript Active Console code.
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
// Load global vars
require("include/config.php");
@ -123,7 +107,7 @@ if (isset($_POST["create_agent"])) { // Create a new and shining agent
$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, 1, $id_agente, 0,0,0,0,0)";
$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

View File

@ -1,26 +1,11 @@
<?php
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-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 additions
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// Javascript Active Console code.
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
// Load global vars
require("include/config.php");
@ -32,22 +17,16 @@ if (give_acl($id_user, 0, "AW") != 1) {
exit;
}
if (isset($_GET["offset"]))
$offset = entrada_limpia($_GET["offset"]);
else
$offset = 0;
if (isset($_GET["group_id"]))
$group_id = entrada_limpia($_GET["group_id"]);
else
$group_id = 0;
if (isset($_POST["ag_group"]))
$ag_group = $_POST["ag_group"];
elseif (isset($_GET["group_id"]))
$ag_group = $_GET["group_id"];
else
$ag_group = -1;
// Take some parameters (GET)
$offset = get_parameter ("offset", 0);
$group_id = get_parameter ("group_id", 0);
$ag_group = get_parameter ("ag_group", -1);
if (($ag_group == -1) && ($group_id != 0))
$ag_group = $group_id;
if (isset($_GET["ag_group_refresh"])){
$ag_group = $_GET["ag_group_refresh"];
}
$search = get_parameter ("search", "");
if (isset($_GET["borrar_agente"])){ // if delete agent
$id_agente = entrada_limpia($_GET["borrar_agente"]);
@ -120,9 +99,9 @@ if (isset($_POST["ag_group"])){
action='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente'>";
}
echo "<table cellpadding='4' cellspacing='4' class='databox'><tr>";
echo "<td>".$lang_label["group"]."</td>";
echo "<td valign='middle'>";
echo "<table cellpadding='4' cellspacing='4' class='databox' width=700><tr>";
echo "<td valign='top'>".$lang_label["group"]."</td>";
echo "<td valign='top'>";
echo "<select name='ag_group' onChange='javascript:this.form.submit();'
class='w130'>";
@ -133,23 +112,57 @@ if ( $ag_group > 1 ){
echo "<option value=1>".dame_nombre_grupo(1)."</option>"; // Group all is always active
$mis_grupos = list_group ($id_user); //Print combo for groups and set an array with all groups
echo "</select>";
echo "<td valign='middle'>
echo "<td valign='top'>
<noscript>
<input name='uptbutton' type='submit' class='sub upd'
value='".$lang_label["show"]."'>
</noscript>
</td>
</form>
</table>";
if (isset($ag_group) && $ag_group> 1){
$sql1="SELECT id_agente, nombre, id_grupo, comentarios, id_os
FROM tagente WHERE id_grupo = $ag_group ORDER BY nombre LIMIT $offset, $block_size";
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $ag_group";
<td valign='top'>";
echo $lang_label["free_text_search"];
echo "</td><td>";
// Show group selector
if (isset($_POST["ag_group"])){
$group_mod = "&ag_group_refresh=".$_POST["ag_group"];
} else {
$sql1="SELECT id_agente, nombre, id_grupo, comentarios, id_os
FROM tagente ORDER BY nombre LIMIT $offset, $block_size";
$sql2="SELECT COUNT(id_agente) FROM tagente";
$group_mod ="";
}
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&refr=60$group_mod'>";
echo "<input type=text name='search' size='15' >";
echo "</td><td valign='top'>";
echo "<input name='srcbutton' type='submit' class='sub'
value='".$lang_label["search"]."'>";
echo "</form>";
echo "</td></table>";
if ($search != ""){
$search_sql = " AND nombre LIKE '%$search%' ";
} else {
$search_sql = "";
}
// 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";
} 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";
$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";
$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";
}
}
$result=mysql_query($sql1);
$result2=mysql_query($sql2);
$row2=mysql_fetch_array($result2);
@ -160,7 +173,7 @@ pagination ($total_events, "index.php?sec=gagente&sec2=godmode/agentes/modificar
echo "<div style='height: 20px'> </div>";
if (mysql_num_rows($result)){
echo "<table cellpadding='4' cellspacing='4' width='700' class='databox'>";
echo "<table cellpadding='4' cellspacing='4' width='750' class='databox'>";
echo "<th>".$lang_label["agent_name"]."</th>";
echo "<th>".$lang_label["os"]."</th>";
echo "<th>".$lang_label["group"]."</th>";
@ -182,7 +195,7 @@ if (mysql_num_rows($result)){
echo "<tr><td class='$tdcolor'>
<b><a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main&
id_agente=".$row["id_agente"]."'>".strtoupper($row["nombre"])."</a></b></td>";
id_agente=".$row["id_agente"]."'>".substr(strtoupper($row["nombre"]),0,20)."</a></b></td>";
// Operating System icon
echo "<td class='$tdcolor' align='center'>
<img src='images/".dame_so_icon($row["id_os"])."'></td>";
@ -191,7 +204,7 @@ if (mysql_num_rows($result)){
<img src='images/groups_small/".show_icon_group($id_grupo).".png' class='bot' border='0'>
&nbsp; ".dame_grupo($id_grupo)."</td>";
// Description
echo "<td class='$tdcolor'>".$row["comentarios"]."</td>";
echo "<td class='".$tdcolor."f9'>".$row["comentarios"]."</td>";
// Action
echo "<td class='$tdcolor' align='center'><a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
borrar_agente=".$row["id_agente"]."'";
@ -200,7 +213,7 @@ if (mysql_num_rows($result)){
}
}
echo "</table>";
echo "<table width='700'><tr><td align='right'>";
echo "<table width='750'><tr><td align='right'>";
} else {
echo "<div class='nf'>".$lang_label["no_agent_def"]."</div>";
echo "&nbsp;</td></tr><tr><td>";

View File

@ -1,28 +1,14 @@
<?php
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-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 additions
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// Javascript Active Console code.
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// ---------------------------------------------------------------
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
// input: var, string.
// mesg, mesage to show, var content.
// ---------------------------------------------------------------
@ -524,4 +510,15 @@ function render_time ($lapse) {
return $output;
}
function get_parameter ($name, $default = '') {
// POST has precedence
if (isset($_POST[$name]))
return give_parameter_post ($name);
if (isset($_GET[$name]))
return give_parameter_get ($name);
return $default;
}
?>

View File

@ -1,26 +1,13 @@
<?php
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-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 additions
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// Additions to Pandora FMS 1.2 graph code
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Database functions
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
// ---------------------------------------------------------------
// give_acl ()
@ -611,11 +598,7 @@ function dame_email($id){
// ---------------------------------------------------------------
function dame_admin($id){
require("config.php");
$query1="SELECT * FROM tusuario WHERE id_usuario ='".$id."'";
$rowdup=mysql_query($query1);
$rowdup2=mysql_fetch_array($rowdup);
$admin=$rowdup2["nivel"];
$admin = get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id'", "nivel");
return $admin;
}
@ -1080,6 +1063,25 @@ function give_db_value ($field, $table, $field_search, $condition_value){
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);
}
// ---------------------------------------------------------------
// Generic access to single field using a free SQL sentence
// ---------------------------------------------------------------
function get_db_sql ($sentence, $field = 0){
global $config;
if ($rowdup = mysql_fetch_array(mysql_query($sentence)))
return $rowdup[$field];
else
return "";
}
// ---------------------------------------------------------------
// Return current status from a given agent module (1 alive, 0 down)
@ -1232,7 +1234,4 @@ function return_moduledata_min_value ($id_agent_module, $period){
return (0);
}
?>

View File

@ -453,7 +453,7 @@ div.title_line {
}
#menu_tab li.nomn:hover a,
#menu_tab li:hover ul a:hover {
background: #cde0ad;
background: #66AA44;
}
#menu_tab li:hover a {
background: #b2b08a url("../images/arrow.png") no-repeat right 3px;

View File

@ -2,7 +2,7 @@
// 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
@ -24,8 +24,8 @@
// Pandora FMS 1.x uses Pear Image::Graph code
//Pandora Version, if not defined here it would take from config.php
$build_version="PC071216";
$pandora_version="v1.4dev";
$build_version="PC080109";
$pandora_version="v1.4-dev";
global $build_version;
global $pandora_version;

View File

@ -1,12 +1,12 @@
<?php
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@openideas.info
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas
// 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
// Copyright (c) 2006-2007 Jose Navarro jose@jnavarro.net
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]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

View File

@ -1,22 +1,11 @@
<?php
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@openideas.info
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas
// 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
// Copyright (c) 2006-2007 Jose Navarro jose@jnavarro.net
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
// Load global vars
require("include/config.php");
@ -28,30 +17,21 @@ if (comprueba_login() == 0) {
exit;
}
if (isset($_GET["offset"]))
$offset = entrada_limpia($_GET["offset"]);
else
$offset = 0;
if (isset($_GET["group_id"]))
$group_id = entrada_limpia($_GET["group_id"]);
else
$group_id = 0;
if (isset($_POST["ag_group"]))
$ag_group = $_POST["ag_group"];
elseif (isset($_GET["group_id"]))
$ag_group = $_GET["group_id"];
else
$ag_group = -1;
// Take some parameters (GET)
$offset = get_parameter ("offset", 0);
$group_id = get_parameter ("group_id", 0);
$ag_group = get_parameter ("ag_group", -1);
if (($ag_group == -1) && ($group_id != 0))
$ag_group = $group_id;
if (isset($_GET["ag_group_refresh"])){
$ag_group = $_GET["ag_group_refresh"];
}
$search = get_parameter ("search", "");
echo "<h2>".$lang_label["ag_title"]." &gt; ".$lang_label["summary"]."</h2>";
// Show group selector
// Show group selector (POST)
if (isset($_POST["ag_group"])){
$ag_group = $_POST["ag_group"];
echo "<form method='post'
@ -64,8 +44,8 @@ if (comprueba_login() == 0) {
}
echo "<table cellpadding='4' cellspacing='4' class='databox'><tr>";
echo "<td>".$lang_label["group"]."</td>";
echo "<td valign='middle'>";
echo "<td valign='top'>".$lang_label["group"]."</td>";
echo "<td valign='top'>";
echo "<select name='ag_group' onChange='javascript:this.form.submit();'
class='w130'>";
@ -76,27 +56,48 @@ if (comprueba_login() == 0) {
$mis_grupos=list_group ($id_user); //Print combo for groups and set an array with all groups
echo "</select>";
echo "<td valign='middle'>
echo "<td valign='top'>
<noscript>
<input name='uptbutton' type='submit' class='sub'
value='".$lang_label["show"]."'>
</noscript>
</td>
</form>
</table>";
</td></form><td valign='top'>";
echo $lang_label["free_text_search"];
echo "</td><td>";
echo "<form method='post'
action='index.php?sec=estado&sec2=operation/agentes/estado_agente
&refr=60'>";
echo "<input type=text name='search' size='15' >";
echo "</td><td valign='top'>";
echo "<input name='srcbutton' type='submit' class='sub'
value='".$lang_label["search"]."'>";
echo "</form>";
echo "</td></table>";
if ($search != ""){
$search_sql = " AND nombre LIKE '%$search%' ";
} else {
$search_sql = "";
}
// Show only selected groups
if ($ag_group > 1){
$sql="SELECT * FROM tagente WHERE id_grupo=$ag_group
AND disabled = 0 ORDER BY nombre LIMIT $offset, $block_size ";
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 ORDER BY nombre";
}
else {
$sql="SELECT * FROM tagente WHERE disabled = 0
ORDER BY nombre, id_grupo LIMIT $offset, $block_size";
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0
ORDER BY nombre, id_grupo";
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";
$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";
$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";
}
}
$result2=mysql_query($sql2);

View File

@ -1,26 +1,11 @@
<?PHP
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-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 additions
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// Javascript Active Console code.
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
?>
<!-- Javascript -->
@ -103,7 +88,7 @@ if (comprueba_login() == 0) {
$id_grupo = $row_t["id_grupo"];
$id_usuario=$_SESSION["id_usuario"];
if (give_acl($id_usuario, $id_grupo, "AW")==1){
if ($row3["id_tipo_modulo"] > 4){
if ($row3["id_tipo_modulo"] > 4 AND ($row3["id_tipo_modulo"] < 100)){
if ($row3["flag"] == 0){
echo "<a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&
@ -157,6 +142,7 @@ if (comprueba_login() == 0) {
// For types not string type (3 data_string, 9 tcp_string, 14 snmp_string)
if (($row3["id_tipo_modulo"] != 3)
AND ($row3["id_tipo_modulo"] != 10)
AND ($row3["id_tipo_modulo"] != 100) // Type not keepalive (1.4)
AND ($row3["id_tipo_modulo"] != 17)){
echo "<td class=".$tdcolor.">";
if (is_numeric($row3["datos"])) {
@ -201,9 +187,12 @@ if (comprueba_login() == 0) {
}
echo "<td class=".$tdcolor." width=70>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=mes&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=semana&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=dia&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.png'></a>";
if ($row3["id_tipo_modulo"] != 100) {
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=mes&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=semana&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.png'></a>&nbsp;&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=dia&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.png'></a>";
}
echo "<td class='".$tdcolor."f9'>";
if ($row3["timestamp"] == "0000-00-00 00:00:00"){
echo $lang_label["never"];

View File

@ -18,172 +18,176 @@
// Load global vars
require("include/config.php");
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["ag_title"]." &gt; ";
echo $lang_label["monitor_listing"]."</h2>";
if (isset($_POST["ag_group"]))
$ag_group = $_POST["ag_group"];
elseif (isset($_GET["group_id"]))
$ag_group = $_GET["group_id"];
else
$ag_group = -1;
if (isset($_GET["ag_group_refresh"])){
$ag_group = $_GET["ag_group_refresh"];
}
if (isset($_POST["ag_group"])){
$ag_group = $_POST["ag_group"];
echo "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&ag_group_refresh=".$ag_group."'>";
} else {
echo "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60'>";
}
echo "<table cellspacing='4' cellpadding='4' width='600' class='databox'>";
echo "<tr><td valign='middle'>".$lang_label["group"]."</td>";
echo "<td valign='middle'>";
echo "<select name='ag_group' onChange='javascript:this.form.submit();' class='w130'>";
if (comprueba_login() != 0) {
require ("general/noaccess.php");
exit;
}
if ( $ag_group > 1 ){
echo "<option value='".$ag_group."'>".dame_nombre_grupo($ag_group)."</option>";
}
echo "<option value=1>".dame_nombre_grupo(1)."</option>";
list_group ($id_user);
echo "</select>";
if ((give_acl($id_user, 0, "AR")!=1) AND (give_acl($id_user,0,"AW")!=1)) {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Management");
require ("general/noaccess.php");
exit;
}
// Module name selector
// This code thanks for an idea from Nikum, nikun_h@hotmail.com
if (isset($_POST["ag_modulename"])){
$ag_modulename = $_POST["ag_modulename"];
echo "<form method='post' action='index.php?sec=estado&
sec2=operation/agentes/status_monitor&
refr=60&ag_modulename=".$ag_modulename."'>";
} else {
echo "<form method='post' action='index.php?sec=estado&
sec2=operation/agentes/status_monitor&refr=60'>";
}
echo "<td class='f9' style='padding-left: 10px;'>";
echo "<img src='images/pixel_green.png' width=40 height=18><br>".$lang_label["green_light"]."</td>";
echo "<td class='f9' style='padding-left: 10px;'>";
echo "<img src='images/pixel_red.png' width=40 height=18><br>".$lang_label["red_light"]."</td>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td valign='middle'>".$lang_label["module_name"]."</td>";
echo "<td valign='middle'>
<select name='ag_modulename' onChange='javascript:this.form.submit();'>";
if ( isset($ag_modulename)){
echo "<option>".$ag_modulename."</option>";
}
echo "<option>".$lang_label["all"]."</option>";
$sql='SELECT DISTINCT nombre
FROM tagente_modulo
WHERE id_tipo_modulo in (2, 9, 12, 18, 6, 100)';
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){
echo "<option>".$row['0']."</option>";
}
echo "</select>";
echo "<td valign='middle'>
<noscript><input name='uptbutton' type='submit' class='sub'
value='".$lang_label["show"]."'></noscript>
</form>";
echo "<h2>".$lang_label["ag_title"]." &gt; ";
echo $lang_label["monitor_listing"]."</h2>";
// Show only selected names & groups
if ($ag_group > 1)
$sql='SELECT * FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre';
else
$sql='SELECT * FROM tagente ORDER BY id_grupo, nombre';
echo "</table>";
echo "<br>";
$color =1;
$result=mysql_query($sql);
if (mysql_num_rows($result)){
while ($row=mysql_fetch_array($result)){ //while there are agents
if ($row["disabled"] == 0) {
if ((isset($ag_modulename)) && ($ag_modulename != $lang_label["all"]))
$query_gen='SELECT * FROM tagente_modulo
WHERE id_agente = '.$row["id_agente"].'
AND nombre = "'.entrada_limpia($_POST["ag_modulename"]).'"
AND
id_tipo_modulo in (2, 9, 12, 18, 6)';
// generic_proc, remote_tcp_proc, ??, remote_snmp_proc, remote_icmp_proc
else
$query_gen='SELECT * FROM tagente_modulo
WHERE id_agente = '.$row["id_agente"].'
AND
id_tipo_modulo in (2, 9, 12, 18, 6) ';
$result_gen=mysql_query($query_gen);
if (mysql_num_rows ($result_gen)) {
while ($data=mysql_fetch_array($result_gen)){
if ($color == 1){
$tdcolor="datos";
$color =0;
} else {
$tdcolor="datos2";
$color =1;
}
if (!isset($string)) {$string='';}
$string=$string. "<tr><td class='$tdcolor'>";
$string=$string. "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$data["id_agente"]."&id_agente_modulo=".$data["id_agente_modulo"]."&flag=1&tab=data&refr=60'>";
$string=$string."<img src='images/target.png'></a>";
$string=$string. "</td><td class='$tdcolor'>";
$string=$string."<b><a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&
id_agente=".$data["id_agente"]."'>".
strtoupper(substr(dame_nombre_agente($data["id_agente"]),0,21))."</a></b>";
$string=$string."</td><td class='$tdcolor'>";
$string=$string."
<img src='images/".show_icon_type($data["id_tipo_modulo"])."' border=0>
</td>";
$string=$string."<td class='$tdcolor'>".
substr($data["nombre"],0,21)."</td>";
$string=$string."<td class='".$tdcolor."f9'>".
substr($data["descripcion"],0,30)."</td>";
$string=$string."<td align='center' class='$tdcolor' width=25>";
if ($data["max"] == $data["min"])
$string .= "--";
else
$data["max"]."/".$data["min"]."</td>";
$string=$string."<td class='$tdcolor' align='center' width=25>";
if ($data["module_interval"] == 0){
$my_interval = give_agentinterval($data["id_agente"]);
} else {
$my_interval = $data["module_interval"];
}
$string .= $my_interval;
$query_gen2='SELECT * FROM tagente_estado
WHERE id_agente_modulo = '.$data["id_agente_modulo"];
$result_gen2=mysql_query($query_gen2);
$data2=mysql_fetch_array($result_gen2);
$string=$string."<td class='$tdcolor' align='center' width=20>";
if ($data2["datos"] > 0){
$string=$string."<img src='images/pixel_green.png' width=40 height=18>";
} else {
$string=$string."<img src='images/pixel_red.png' width=40 height=18>";
}
$string=$string."<td class='".$tdcolor."f9'>";
$seconds = time() - $data2["utimestamp"];
if ($seconds >= ($my_interval*2))
$string .= "<span class='redb'>";
else
$string .= "<span>";
$string .= human_time_comparation($data2["timestamp"])."</td></tr>";
if (isset($_POST["ag_group"]))
$ag_group = $_POST["ag_group"];
elseif (isset($_GET["group_id"]))
$ag_group = $_GET["group_id"];
else
$ag_group = -1;
if (isset($_GET["ag_group_refresh"])){
$ag_group = $_GET["ag_group_refresh"];
}
if (isset($_POST["ag_group"])){
$ag_group = $_POST["ag_group"];
echo "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&ag_group_refresh=".$ag_group."'>";
} else {
echo "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60'>";
}
echo "<table cellspacing='4' cellpadding='4' width='600' class='databox'>";
echo "<tr><td valign='middle'>".$lang_label["group"]."</td>";
echo "<td valign='middle'>";
echo "<select name='ag_group' onChange='javascript:this.form.submit();' class='w130'>";
if ( $ag_group > 1 ){
echo "<option value='".$ag_group."'>".dame_nombre_grupo($ag_group)."</option>";
}
echo "<option value=1>".dame_nombre_grupo(1)."</option>";
list_group ($id_user);
echo "</select>";
// Module name selector
// This code thanks for an idea from Nikum, nikun_h@hotmail.com
if (isset($_POST["ag_modulename"])){
$ag_modulename = $_POST["ag_modulename"];
echo "<form method='post' action='index.php?sec=estado&
sec2=operation/agentes/status_monitor&
refr=60&ag_modulename=".$ag_modulename."'>";
} else {
echo "<form method='post' action='index.php?sec=estado&
sec2=operation/agentes/status_monitor&refr=60'>";
}
echo "<td class='f9' style='padding-left: 10px;'>";
echo "<img src='images/pixel_green.png' width=40 height=18><br>".$lang_label["green_light"]."</td>";
echo "<td class='f9' style='padding-left: 10px;'>";
echo "<img src='images/pixel_red.png' width=40 height=18><br>".$lang_label["red_light"]."</td>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td valign='middle'>".$lang_label["module_name"]."</td>";
echo "<td valign='middle'>
<select name='ag_modulename' onChange='javascript:this.form.submit();'>";
if ( isset($ag_modulename)){
echo "<option>".$ag_modulename."</option>";
}
echo "<option>".$lang_label["all"]."</option>";
$sql='SELECT DISTINCT nombre
FROM tagente_modulo
WHERE id_tipo_modulo in (2, 9, 12, 18, 6, 100)';
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){
echo "<option>".$row['0']."</option>";
}
echo "</select>";
echo "<td valign='middle'>
<noscript><input name='uptbutton' type='submit' class='sub'
value='".$lang_label["show"]."'></noscript>
</form>";
// Show only selected names & groups
if ($ag_group > 1)
$sql='SELECT * FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre';
else
$sql='SELECT * FROM tagente ORDER BY id_grupo, nombre';
echo "</table>";
echo "<br>";
$color =1;
$result=mysql_query($sql);
if (mysql_num_rows($result)){
while ($row=mysql_fetch_array($result)){ //while there are agents
if ($row["disabled"] == 0) {
if ((isset($ag_modulename)) && ($ag_modulename != $lang_label["all"])){
$query_gen='SELECT * FROM tagente_modulo
WHERE id_agente = '.$row["id_agente"].'
AND nombre = "'.entrada_limpia($_POST["ag_modulename"]).'"
AND
id_tipo_modulo in (2, 9, 12, 18, 6, 100)';
// generic_proc, remote_tcp_proc, ??, remote_snmp_proc, remote_icmp_proc
} else {
$query_gen='SELECT * FROM tagente_modulo
WHERE id_agente = '.$row["id_agente"].'
AND
id_tipo_modulo in (2, 9, 12, 18, 6, 100)';
}
$result_gen=mysql_query($query_gen);
if (mysql_num_rows ($result_gen)) {
while ($data=mysql_fetch_array($result_gen)){
if ($color == 1){
$tdcolor="datos";
$color =0;
} else {
$tdcolor="datos2";
$color =1;
}
if (!isset($string)) {$string='';}
$string=$string. "<tr><td class='$tdcolor'>";
$string=$string. "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$data["id_agente"]."&id_agente_modulo=".$data["id_agente_modulo"]."&flag=1&tab=data&refr=60'>";
$string=$string."<img src='images/target.png'></a>";
$string=$string. "</td><td class='$tdcolor'>";
$string=$string."<b><a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&
id_agente=".$data["id_agente"]."'>".
strtoupper(substr(dame_nombre_agente($data["id_agente"]),0,21))."</a></b>";
$string=$string."</td><td class='$tdcolor'>";
$string=$string."
<img src='images/".show_icon_type($data["id_tipo_modulo"])."' border=0>
</td>";
$string=$string."<td class='$tdcolor'>".
substr($data["nombre"],0,21)."</td>";
$string=$string."<td class='".$tdcolor."f9'>".
substr($data["descripcion"],0,30)."</td>";
$string=$string."<td class='$tdcolor' align='center' width=25>";
if ($data["module_interval"] == 0){
$my_interval = give_agentinterval($data["id_agente"]);
} else {
$my_interval = $data["module_interval"];
}
$string .= $my_interval;
$query_gen2='SELECT * FROM tagente_estado
WHERE id_agente_modulo = '.$data["id_agente_modulo"];
$result_gen2=mysql_query($query_gen2);
$data2=mysql_fetch_array($result_gen2);
$string=$string."<td class='$tdcolor' align='center' width=20>";
if ($data2["datos"] > 0){
$string=$string."<img src='images/pixel_green.png' width=40 height=18>";
} else {
$string=$string."<img src='images/pixel_red.png' width=40 height=18>";
}
$string=$string."<td class='".$tdcolor."f9'>";
$seconds = time() - $data2["utimestamp"];
if ($seconds >= ($my_interval*2))
$string .= "<span class='redb'>";
else
$string .= "<span>";
$string .= human_time_comparation($data2["timestamp"])."</td></tr>";
}
else if($ag_group>1) {unset($string);}
}
}
if (isset($string)) {
}
if (isset($string)) {
echo "
<table cellpadding='4' cellspacing='4' width='750' class='databox'>
<tr>
@ -192,21 +196,16 @@ if (comprueba_login() == 0) {
<th>".$lang_label["type"]."</th>
<th>".$lang_label["name"]."</th>
<th>".$lang_label["description"]."</th>
<th>".$lang_label["max_min"]."</th>
<th>".$lang_label["interval"]."</th>
<th>".$lang_label["status"]."</th>
<th>".$lang_label["timestamp"]."</th>";
echo $string; //the built table of monitors
echo "</table>";
}
else {
echo "<div class='nf'>".$lang_label["no_monitors_g"]."</div>";
}
} else {
echo "<div class='nf'>".$lang_label["no_agent"]."</div>";
echo "<div class='nf'>".$lang_label["no_monitors_g"]."</div>";
}
} //end acl
} //end login
} else {
echo "<div class='nf'>".$lang_label["no_agent"]."</div>";
}
?>

View File

@ -1,25 +1,14 @@
<?php
// Pandora FMS - the Free monitoring system
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-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 additions
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// Additions to Pandora FMS 1.2 graph code
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// CSS and some PHP code additions
// Please see http://pandora.sourceforge.net for full contribution list
// Load global vars
require("include/config.php");
@ -149,28 +138,15 @@
echo "<h2>".$lang_label["tactical_indicator"]."</h2>";
echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";
// Server information
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$sql='SELECT * FROM tserver';
// 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");
echo "<h2>".$lang_label["tactical_server_information"]."</h2>";
// Get total modules defined (network)
$sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4';
$result1=mysql_query($sql1);
$row1=mysql_fetch_array($result1);
$total_modules = $row1[0];
// Get total modules defined (data)
$sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo < 5 AND id_tipo_modulo != -1';
if ($result1=mysql_query($sql1)){
$row1=mysql_fetch_array($result1);
$total_modules_data = $row1[0];
} else
$total_modules_data = 0;
// 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'>";

View File

@ -1,21 +1,12 @@
<?php
// Pandora - the Free monitoring system
// ====================================
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L, info@artica.es
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
// 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.
// 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
// Please see http://pandora.sourceforge.net for full contribution list
// Load global vars
require("include/config.php");
@ -26,27 +17,17 @@ $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)) {
$sql='SELECT * FROM tserver';
echo "<h2>".$lang_label["view_servers"]." &gt; ";
echo $lang_label["server_detail"]."</h2>";
// Get total modules defined (network)
$sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4';
$result1=mysql_query($sql1);
$row1=mysql_fetch_array($result1);
$total_modules_network = $row1[0];
$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)
$sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo < 5 AND id_tipo_modulo != -1';
if ($result1=mysql_query($sql1)){
$row1=mysql_fetch_array($result1);
$total_modules_data = $row1[0];
} else
$total_modules_data = 0;
$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'>";
@ -86,11 +67,8 @@ if (comprueba_login() == 0) {
$modules_server = 0;
if (($network_server == 1) OR ($data_server == 1)){
// Get total modules defined for this server (data modules)
$sql2 = "SELECT COUNT(running_by) FROM tagente_estado WHERE running_by = $id_server";
$result2=mysql_query($sql2);
$row2=mysql_fetch_array($result2);
$modules_server = $row2[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'>";
if ($recon_server == 1)
@ -122,16 +100,8 @@ if (comprueba_login() == 0) {
$total_modules_temp = $total_modules_data;
}
} elseif ($recon_server == 1){
$sql2 = "SELECT COUNT(id_rt) FROM trecon_task WHERE id_network_server = $id_server";
$result2=mysql_query($sql2);
$row2=mysql_fetch_array($result2);
$modules_server = $row2[0];
$sql2 = "SELECT COUNT(id_rt) FROM trecon_task";
$result2=mysql_query($sql2);
$row2=mysql_fetch_array($result2);
$total_modules = $row2[0];
$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
@ -164,7 +134,7 @@ if (comprueba_login() == 0) {
// 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";
$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))

View File

@ -1,8 +1,12 @@
<?php
// Pandora - the Free monitoring system
// ====================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@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.
// 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
// Load global vars
require("include/config.php");

View File

@ -1,5 +1,6 @@
-- Pandora FMS official tables for 1.3 version
--------------------------------------------------------------
-- Pandora FMS official tables for 1.4 version --
--------------------------------------------------------------
CREATE TABLE `taddress` (
`id_a` bigint(20) unsigned NOT NULL auto_increment,
@ -43,6 +44,7 @@ CREATE TABLE `tagente` (
`disabled` tinyint(2) NOT NULL default '0',
`agent_type` int(2) unsigned NOT NULL default '0',
`id_server` int(10) unsigned default '0',
`id_parent` mediumint(8) unsigned default '0',
PRIMARY KEY (`id_agente`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -58,6 +60,17 @@ CREATE TABLE `tagente_datos` (
KEY `data_index2` (`id_agente`,`id_agente_modulo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tagent_data_image` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`id_agente_modulo` mediumint(8) unsigned NOT NULL default '0',
`blob` blob NOT NULL,
`filename` varchar(255) default '',
`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',
PRIMARY KEY (`id`),
KEY `img_idx2` (`id_agente`,`id_agente_modulo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tagente_datos_inc` (
`id_adi` bigint(20) unsigned NOT NULL auto_increment,
@ -102,13 +115,6 @@ CREATE TABLE `tagente_estado` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
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 `tagente_modulo` (
`id_agente_modulo` bigint(100) unsigned NOT NULL auto_increment,
`id_agente` int(11) NOT NULL default '0',
@ -128,6 +134,7 @@ 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',
PRIMARY KEY (`id_agente_modulo`, `id_agente`),
KEY `tam_agente` (`id_agente`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -162,31 +169,45 @@ CREATE TABLE `talerta` (
PRIMARY KEY (`id_alerta`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `talerta_agente_modulo` (
`id_aam` int(11) unsigned NOT NULL auto_increment,
`id_agente_modulo` int(11) NOT NULL default '0',
`id_alerta` int(11) NOT NULL default '0',
`al_campo1` varchar(255) default '',
`al_campo2` varchar(255) default '',
`al_campo3` mediumtext NOT NULL,
`descripcion` varchar(255) default '',
`dis_max` double(18,2) default NULL,
`dis_min` double(18,2) default NULL,
`time_threshold` int(11) NOT NULL default '0',
`last_fired` datetime NOT NULL default '0000-00-00 00:00:00',
`max_alerts` int(4) NOT NULL default '1',
`times_fired` int(11) NOT NULL default '0',
`module_type` int(11) NOT NULL default '0',
`min_alerts` int(4) NOT NULL default '0',
`internal_counter` int(4) default '0',
`alert_text` varchar(255) default '',
`disable` int(4) default '0',
`time_from` TIME default '00:00:00',
`time_to` TIME default '00:00:00',
PRIMARY KEY (`id_aam`)
CREATE TABLE tnotification (
`id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(255) default '',
`description` varchar(255) default '',
`id_alerta` int(11) NOT NULL default '0',
`id_agent` int(11) NOT NULL default '0',
`al_f1` varchar(255) default '',
`al_f2` mediumtext NOT NULL,
`al_f3` mediumtext NOT NULL,
`alrec_f1` varchar(255) default '',
`alrec_f2` mediumtext NOT NULL,
`alrec_f3` mediumtext NOT NULL,
`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`),
KEY `tnotif_indx_1` (`id_alerta`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
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',
`dis_max` double(18,2) default NULL,
`dis_min` double(18,2) default NULL,
`alert_text` varchar(255) default '',
`time_threshold` int(11) NOT NULL default '0',
`last_fired` datetime NOT NULL default '0000-00-00 00:00:00',
`max_alerts` int(4) NOT NULL default '1',
`times_fired` int(11) NOT NULL default '0',
`module_type` int(11) NOT NULL default '0',
`min_alerts` int(4) NOT NULL default '0',
`internal_counter` int(4) default '0',
`disabled` int(4) default '0',
`time_from` TIME default '00:00:00',
`time_to` TIME default '00:00:00',
PRIMARY KEY (`id_aam`),
KEY `tnotifcom_indx_1` (`id_notification`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tattachment` (
`id_attachment` bigint(20) unsigned NOT NULL auto_increment,

View File

@ -0,0 +1,72 @@
----------------------------------------------------------------------
-- Database schema modifications to upgrade from 1.3 to 1.4 version
----------------------------------------------------------------------
-- Old tables deteled
--DROP TABLE tmodule;
--DROP TABLE talerta_agente_modulo;
-- There is not migration code yet, do not delete without make backup !
-- New tables
CREATE TABLE `tagent_data_image` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`id_agente_modulo` mediumint(8) unsigned NOT NULL default '0',
`blob` blob NOT NULL,
`filename` varchar(255) default '',
`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',
PRIMARY KEY (`id`),
KEY `img_idx2` (`id_agente`,`id_agente_modulo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE tnotification (
`id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(255) default '',
`description` varchar(255) default '',
`id_alerta` int(11) NOT NULL default '0',
`id_agent` int(11) NOT NULL default '0',
`al_f1` varchar(255) default '',
`al_f2` mediumtext NOT NULL,
`al_f3` mediumtext NOT NULL,
`alrec_f1` varchar(255) default '',
`alrec_f2` mediumtext NOT NULL,
`alrec_f3` mediumtext NOT NULL,
`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`),
KEY `tnotif_indx_1` (`id_alerta`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
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',
`dis_max` double(18,2) default NULL,
`dis_min` double(18,2) default NULL,
`alert_text` varchar(255) default '',
`time_threshold` int(11) NOT NULL default '0',
`last_fired` datetime NOT NULL default '0000-00-00 00:00:00',
`max_alerts` int(4) NOT NULL default '1',
`min_alerts` int(4) NOT NULL default '0',
`logical_type` tinyint(3) NOT NULL default '0',
-- 0 OR, 1 AND, 2 NOT
`internal_counter` int(4) default '0',
`times_fired` int(11) NOT NULL default '0',
`disabled` int(4) default '0',
`time_from` TIME default '00:00:00',
`time_to` TIME default '00:00:00',
PRIMARY KEY (`id_aam`),
KEY `tnotifcom_indx_1` (`id_notification`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Updated tables
ALTER TABLE tagente_modulo ADD COLUMN `disable` tinyint(3) unsigned NULL default 0;
ALTER TABLE tagente_modulo ADD COLUMN `export` tinyint(3) unsigned default '0';
ALTER TABLE tagente ADD COLUMN `id_parent` mediumint(8) unsigned default '0';

View File

@ -161,7 +161,7 @@ INSERT INTO `torigen` VALUES ('Operating System event'),('IDS events'),('Firewal
-- Dumping data for table `ttipo_modulo`
--
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'),(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',1,'Remote SNMP network agent, boolean data','mod_snmp_proc.png'), (100,'keep_alive',-1,'KeepAlive','mod_keepalive.png');
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'),(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',1,'Remote SNMP network agent, boolean data','mod_snmp_proc.png'), (100,'keep_alive',-1,'KeepAlive','mod_keepalive.png'), (19, 'image_jpg',4,'Image JPG data', 'mod_image_jpg.png'), (20, 'image_png',4,'Image PNG data', 'mod_image_png.png'), (21, 'async_proc', 5, 'Asyncronous proc data', 'mod_async_proc.png'), (22, 'async_data', 5, 'Asyncronous numeric data', 'mod_async_data.png'), (23, 'async_string', 5, 'Asyncronous string data', 'mod_async_string.png');
--
-- Dumping data for table `tusuario`

View File

@ -0,0 +1,12 @@
-- New data
UPDATE tconfig SET value = '1.4dev' WHERE token = 'db_scheme_version';
UPDATE tconfig SET value = '1.4dev' WHERE token = 'db_scheme_build';
INSERT INTO `ttipo_modulo` VALUES (100,'keep_alive',-1,'KeepAlive','mod_keepalive.png'), (19, 'image_jpg',4,'Image JPG data', 'mod_image_jpg.png'), (20, 'image_png',4,'Image PNG data', 'mod_image_png.png'), (21, 'async_proc', 5, 'Asyncronous proc data', 'mod_async_proc.png'), (22, 'async_data', 5, 'Asyncronous numeric data', 'mod_async_data.png'), (23, 'async_string', 5, 'Asyncronous string data', 'mod_async_string.png');
INSERT INTO tconfig (token, value) VALUES ('string_days_purge','7');
INSERT INTO tconfig (token, value) VALUES ('image_days_purge','2');