2006-03-27 05:37:27 +02:00
|
|
|
<?php
|
|
|
|
|
2007-03-12 18:58:52 +01:00
|
|
|
// 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-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
|
|
|
|
//
|
2006-07-17 10:17:58 +02:00
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2007-03-12 18:58:52 +01:00
|
|
|
// as published by the Free Software Foundation; version 2
|
2006-07-17 10:17:58 +02:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
// Load global vars
|
2006-03-27 05:37:27 +02:00
|
|
|
require("include/config.php");
|
2006-07-17 10:17:58 +02:00
|
|
|
|
2006-03-27 05:37:27 +02:00
|
|
|
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)) {
|
|
|
|
|
|
|
|
if (isset($_GET["delete"])) {
|
|
|
|
$id_server=entrada_limpia($_GET["server_del"]);
|
|
|
|
$sql = "DELETE FROM tserver WHERE id_server='".$id_server."'";
|
|
|
|
$result=mysql_query($sql);
|
|
|
|
if ($result) echo "<h3 class='suc'>".$lang_label["del_server_ok"]."</h3>";
|
|
|
|
else echo "<h3 class='suc'>".$lang_label["del_server_no"]."</h3>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET["update"])) {
|
|
|
|
$name=entrada_limpia($_POST["name"]);
|
|
|
|
$address=entrada_limpia($_POST["address"]);
|
|
|
|
$description=entrada_limpia($_POST["description"]);
|
|
|
|
$id_server=entrada_limpia($_POST["server"]);
|
|
|
|
$sql = "UPDATE tserver SET name='".$name."', ip_address='".$address."', description='".$description."' WHERE id_server='".$id_server."'";
|
|
|
|
$result=mysql_query($sql);
|
|
|
|
if ($result) echo "<h3 class='suc'>".$lang_label["upd_server_ok"]."</h3>";
|
|
|
|
else echo "<h3 class='suc'>".$lang_label["upd_server_no"]."</h3>";
|
|
|
|
}
|
|
|
|
if (isset($_GET["server"])) {
|
|
|
|
$id_server=entrada_limpia($_GET["server"]);
|
|
|
|
echo "<h2>".$lang_label["view_servers"]."</h2>";
|
2006-09-10 18:48:18 +02:00
|
|
|
echo "<h3>".$lang_label["update_server"]."<a href='help/".$help_code."/chap7.php#7' target='_help' class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
2006-07-03 12:49:42 +02:00
|
|
|
$query="SELECT * FROM tserver WHERE id_server=".$id_server;
|
2006-03-27 05:37:27 +02:00
|
|
|
$result=mysql_query($query);
|
|
|
|
if (mysql_num_rows($result)){
|
|
|
|
$row=mysql_fetch_array($result);
|
|
|
|
$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"];
|
|
|
|
$master = $row["master"];
|
|
|
|
$checksum = $row["checksum"];
|
|
|
|
$description = $row["description"];
|
|
|
|
echo '<form name="servers" method="POST" action="index.php?sec=gserver&sec2=godmode/servers/modificar_server&update=1">';
|
2006-07-17 10:17:58 +02:00
|
|
|
echo "<table cellpadding='3' cellspacing='3' width='450'>";
|
|
|
|
echo "<tr><td class='lb' rowspan='3' width='5'>";
|
2007-04-18 23:45:03 +02:00
|
|
|
echo "<td class='datos'>".$lang_label["name"]."</td><td class='datos'><input type='text' name='name' value='".$name."' width="200px">";
|
|
|
|
echo "<tr><td class='datos2'>".$lang_label['ip_address']."</td><td class='datos2'><input type='text' name='address' value='".$address."' width="200px">";
|
2007-03-12 18:58:52 +01:00
|
|
|
echo "<tr><td class='datos'>".$lang_label['description']."<td class='datos'><input type='text' name='description' value='".$description."'><input type='hidden' name='server' value='".entrada_limpia($_GET["server"])."'></input>";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
else {
|
2006-12-08 17:57:43 +01:00
|
|
|
echo "<div class='nf'>".$lang_label["no_server"]."</div>";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2006-07-17 10:17:58 +02:00
|
|
|
echo '<tr><td colspan="3"><div class="raya"></div></td></tr>';
|
2006-03-27 05:37:27 +02:00
|
|
|
echo '<tr><td colspan="3" align="right">';
|
|
|
|
echo '<input type="submit" class="sub" value="'.$lang_label["update"].'"></table>';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$sql='SELECT * FROM tserver';
|
|
|
|
|
|
|
|
echo "<h2>".$lang_label["view_servers"]."</h2>";
|
2006-09-10 18:48:18 +02:00
|
|
|
echo "<h3>".$lang_label["manage_servers"]."<a href='help/".$help_code."/chap7.php#7' target='_help' class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
// Connect DataBase
|
|
|
|
$result=mysql_query($sql);
|
2006-07-17 10:17:58 +02:00
|
|
|
if (mysql_num_rows($result)){
|
2006-03-27 05:37:27 +02:00
|
|
|
echo "<table cellpadding='3' cellspacing='3' witdh=550>";
|
|
|
|
echo "<tr><th class='datos'>".$lang_label["name"];
|
|
|
|
echo "<th class='datos'>".$lang_label['status'];
|
|
|
|
echo "<th class='datos'>".$lang_label['ip_address'];
|
|
|
|
echo "<th class='datos'>".$lang_label['description'];
|
|
|
|
echo "<th class='datos'>".$lang_label['network'];
|
|
|
|
echo "<th class='datos'>".$lang_label['data'];
|
|
|
|
echo "<th class='datos'>".$lang_label['snmp'];
|
|
|
|
echo "<th class='datos'>".$lang_label['master'];
|
|
|
|
echo "<th class='datos'>".$lang_label['checksum'];
|
|
|
|
echo "<th class='datos'>".$lang_label['laststart'];
|
|
|
|
echo "<th class='datos'>".$lang_label['lastupdate'];
|
2007-03-19 20:39:40 +01:00
|
|
|
echo "<th class='datos'>".$lang_label['delete'];
|
2006-07-03 12:49:42 +02:00
|
|
|
$color=1;
|
2006-03-27 05:37:27 +02:00
|
|
|
while ($row=mysql_fetch_array($result)){
|
|
|
|
$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"];
|
|
|
|
$master = $row["master"];
|
|
|
|
$checksum = $row["checksum"];
|
|
|
|
$description = $row["description"];
|
|
|
|
$id_server = $row["id_server"];
|
|
|
|
|
2006-07-03 12:49:42 +02:00
|
|
|
if ($color == 1){
|
|
|
|
$tdcolor = "datos";
|
|
|
|
$color = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$tdcolor = "datos2";
|
|
|
|
$color = 1;
|
|
|
|
}
|
|
|
|
echo "<tr><td class='$tdcolor'>";
|
2007-03-19 20:39:40 +01:00
|
|
|
echo "<a href='index.php?sec=gserver&sec2=godmode/servers/modificar_server&server=".$id_server."'><b>$name</b></a>";
|
2006-07-17 10:17:58 +02:00
|
|
|
echo "<td class='$tdcolor' align='middle'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
if ($status ==0){
|
|
|
|
echo "<img src='images/dot_red.gif'>";
|
|
|
|
} else {
|
|
|
|
echo "<img src='images/dot_green.gif'>";
|
|
|
|
}
|
2006-07-03 12:49:42 +02:00
|
|
|
echo "<td class='$tdcolor' align='middle'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
echo "$address";
|
2006-07-03 12:49:42 +02:00
|
|
|
echo "<td class='".$tdcolor."f9'>".substr($description,0,25);
|
|
|
|
echo "<td class='$tdcolor' align='middle'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
if ($network_server == 1){
|
|
|
|
echo "<img src='images/network.gif'>";
|
|
|
|
}
|
2006-07-03 12:49:42 +02:00
|
|
|
echo "<td class='$tdcolor' align='middle'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
if ($data_server == 1){
|
|
|
|
echo "<img src='images/data.gif'>";
|
|
|
|
}
|
2006-07-03 12:49:42 +02:00
|
|
|
echo "<td class='$tdcolor' align='middle'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
if ($snmp_server == 1){
|
|
|
|
echo "<img src='images/snmp.gif'>";
|
|
|
|
}
|
2006-07-03 12:49:42 +02:00
|
|
|
echo "<td class='$tdcolor' align='middle'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
if ($master == 1){
|
|
|
|
echo "<img src='images/master.gif'>";
|
|
|
|
}
|
2006-07-03 12:49:42 +02:00
|
|
|
echo "<td class='$tdcolor' align='middle'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
if ($checksum == 1){
|
|
|
|
echo "<img src='images/binary.gif'>";
|
|
|
|
}
|
2006-07-03 12:49:42 +02:00
|
|
|
echo "<td class='".$tdcolor."f9' align='middle'>".substr($keepalive,0,25);
|
|
|
|
echo "<td class='".$tdcolor."f9' align='middle'>".substr($laststart,0,25);
|
2007-04-02 Raul Mateos <raulofpandora@gmail.com>
* images/ok.gif: Deleted
* images/cross.png, go.png, ok.png, upd.png: Added new images
* include/styles/pandora.css, tip.css, op.css: Updated. Deleted some
old styles, not all.
* include/languages/language_en.php, language_es_es.php: Added text
for no recon task.
* godmode/*.php, operation/*.php, help/*.php: Changed some icons,
updated several buttons with new icons.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@410 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2007-04-02 19:17:27 +02:00
|
|
|
echo "<td class='".$tdcolor."f9' align='middle'><a href='index.php?sec=gserver&sec2=godmode/servers/modificar_server&server_del=".$id_server."&delete'><img src='images/cross.png' border='0'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
echo '<tr><td colspan="12"><div class="raya"></div></td></tr></table>';
|
|
|
|
}
|
|
|
|
else {
|
2006-12-08 17:57:43 +01:00
|
|
|
echo "<div class='nf'>".$lang_label["no_server"]."</div>";
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent view");
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|