2008-10-22 Ramon Novoa <rnovoa@artica.es>

* include/styles/op.css,
          include/styles/pandora.css,
          pandoradb.sql,
          operation/menu.php,
          godmode/agentes/configurar_agente.php,
          godmode/agentes/agent_manager.php,
          godmode/menu.php: Added inventory support.

        * operation/agentes/export_csv.php: Fixed, didn't work.

        * operation/agentes/ver_agente.php: Fixed tabs.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1183 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2008-10-22 09:08:03 +00:00
parent 545cec59ce
commit e94f4f491e
10 changed files with 120 additions and 25 deletions

View File

@ -1,3 +1,17 @@
2008-10-22 Ramon Novoa <rnovoa@artica.es>
* include/styles/op.css,
include/styles/pandora.css,
pandoradb.sql,
operation/menu.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/agent_manager.php,
godmode/menu.php: Added inventory support.
* operation/agentes/export_csv.php: Fixed, didn't work.
* operation/agentes/ver_agente.php: Fixed tabs.
2008-10-21 Jorge Gonzalez <jorgegonz@svn.gnome.org> 2008-10-21 Jorge Gonzalez <jorgegonz@svn.gnome.org>
* operation/servers/view_server.php, * operation/servers/view_server.php,

View File

@ -175,6 +175,19 @@ if ($id_prediction_server == 0) {
print_select_from_sql ('SELECT id_server, name FROM tserver WHERE prediction_server = 1 ORDER BY name', print_select_from_sql ('SELECT id_server, name FROM tserver WHERE prediction_server = 1 ORDER BY name',
'prediction_server', $id_prediction_server, '', $none, $none_value); 'prediction_server', $id_prediction_server, '', $none, $none_value);
// Inventory Server
echo '<tr><td class="datos2"><b>'.__('Inventory Server').'</b>';
echo '<a href="#" class="tip">&nbsp;<span>'.__('You must select an Inventory Server for the Agent, so it can work properly with this kind of modules').'</span></a>';
echo '</td><td class="datos2">';
$none = '';
$none_value = '';
if ($id_inventory_server == 0) {
$none = $none_str;
$none_value = 0;
}
print_select_from_sql ('SELECT id_server, name FROM tserver WHERE inventory_server = 1 ORDER BY name',
'inventory_server', $id_inventory_server, '', $none, $none_value);
// Description // Description
echo '<tr><td class="datos2"><b>'; echo '<tr><td class="datos2"><b>';
echo __('Description'); echo __('Description');

View File

@ -19,6 +19,7 @@
// Load global vars // Load global vars
require("include/config.php"); require("include/config.php");
enterprise_include('godmode/agentes/configurar_agente.php');
check_login (); check_login ();
@ -103,6 +104,7 @@ $id_network_server = 0;
$id_plugin_server = 0; $id_plugin_server = 0;
$id_prediction_server = 0; $id_prediction_server = 0;
$id_wmi_server = 0; $id_wmi_server = 0;
$id_inventory_server = 0;
$grupo = 0; $grupo = 0;
$id_os = 0; $id_os = 0;
@ -123,6 +125,7 @@ if (isset ($_POST["create_agent"])) { // Create a new and shiny agent
$id_plugin_server = get_parameter_post ("plugin_server", 0); $id_plugin_server = get_parameter_post ("plugin_server", 0);
$id_prediction_server = get_parameter_post ("prediction_server", 0); $id_prediction_server = get_parameter_post ("prediction_server", 0);
$id_wmi_server = get_parameter_post ("wmi_server", 0); $id_wmi_server = get_parameter_post ("wmi_server", 0);
$id_inventory_server = get_parameter_post ("inventory_server", 0);
$id_os = get_parameter_post ("id_os", 0); $id_os = get_parameter_post ("id_os", 0);
$disabled = get_parameter_post ("disabled", 0); $disabled = get_parameter_post ("disabled", 0);
@ -135,10 +138,10 @@ if (isset ($_POST["create_agent"])) { // Create a new and shiny agent
$agent_created_ok = 0; $agent_created_ok = 0;
} else { } else {
$sql = sprintf ("INSERT INTO tagente $sql = sprintf ("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, id_parent) (nombre, direccion, id_grupo, intervalo, comentarios, modo, id_os, disabled, id_network_server, id_plugin_server, id_wmi_server, id_prediction_server, id_inventory_server, id_parent)
VALUES VALUES
('%s', '%s', %d, %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d)", ('%s', '%s', %d, %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d)",
$nombre_agente, $direccion_agente, $grupo, $intervalo, $comentarios, $modo, $id_os, $disabled, $id_network_server, $id_plugin_server, $id_wmi_server, $id_prediction_server, $id_parent); $nombre_agente, $direccion_agente, $grupo, $intervalo, $comentarios, $modo, $id_os, $disabled, $id_network_server, $id_plugin_server, $id_wmi_server, $id_prediction_server, $id_inventory_server, $id_parent);
$id_agente = process_sql ($sql, "insert_id"); $id_agente = process_sql ($sql, "insert_id");
if ($id_agente !== false) { if ($id_agente !== false) {
$agent_created_ok = 1; $agent_created_ok = 1;
@ -226,6 +229,8 @@ if ($tab == "template") {
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;".__('Net. Templates')."</a>"; 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;".__('Net. Templates')."</a>";
echo "</li>"; echo "</li>";
enterprise_hook ('inventory_tab');
echo "</ul>"; echo "</ul>";
echo "</div>"; echo "</div>";
echo "</div>"; // menu_tab_frame echo "</div>"; // menu_tab_frame
@ -496,6 +501,7 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
$id_plugin_server = (int) get_parameter_post ("plugin_server", 0); $id_plugin_server = (int) get_parameter_post ("plugin_server", 0);
$id_wmi_server = (int) get_parameter_post ("wmi_server", 0); $id_wmi_server = (int) get_parameter_post ("wmi_server", 0);
$id_prediction_server = (int) get_parameter_post ("prediction_server", 0); $id_prediction_server = (int) get_parameter_post ("prediction_server", 0);
$id_inventory_server = (int) get_parameter_post ("inventory_server", 0);
$id_parent = (int) get_parameter_post ("id_parent", 0); $id_parent = (int) get_parameter_post ("id_parent", 0);
//Verify if there is another agent with the same name but different ID //Verify if there is another agent with the same name but different ID
@ -529,8 +535,9 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
id_network_server = %d, id_network_server = %d,
id_plugin_server = %d, id_plugin_server = %d,
id_wmi_server = %d, id_wmi_server = %d,
id_prediction_server = %d id_prediction_server = %d,
WHERE id_agente = %d",$disabled,$id_parent,$id_os,$modo,$nombre_agente,$direccion_agente,$grupo,$intervalo,$comentarios,$id_network_server,$id_plugin_server,$id_wmi_server,$id_prediction_server,$id_agente); id_inventory_server = %d
WHERE id_agente = %d",$disabled,$id_parent,$id_os,$modo,$nombre_agente,$direccion_agente,$grupo,$intervalo,$comentarios,$id_network_server,$id_plugin_server,$id_wmi_server,$id_prediction_server,$id_inventory_server,$id_agente);
$result = process_sql ($sql); $result = process_sql ($sql);
if ($result === false) { if ($result === false) {
echo '<h3 class="error">'.__('There was a problem updating agent').'</h3>'; echo '<h3 class="error">'.__('There was a problem updating agent').'</h3>';
@ -575,6 +582,7 @@ if (isset($_GET["id_agente"])) {
$id_network_server = $row["id_network_server"]; $id_network_server = $row["id_network_server"];
$id_prediction_server = $row["id_prediction_server"]; $id_prediction_server = $row["id_prediction_server"];
$id_wmi_server = $row["id_wmi_server"]; $id_wmi_server = $row["id_wmi_server"];
$id_inventory_server = $row["id_inventory_server"];
$modo = $row["modo"]; $modo = $row["modo"];
$id_os = $row["id_os"]; $id_os = $row["id_os"];
$disabled = $row["disabled"]; $disabled = $row["disabled"];
@ -895,6 +903,9 @@ switch ($tab) {
case "template": case "template":
require "agent_template.php"; require "agent_template.php";
break; break;
case "inventory":
enterprise_include ('godmode/agentes/inventory_manager.php');
break;
default: default:
//This will make sure that blank pages will have at least some //This will make sure that blank pages will have at least some
//debug info in them //debug info in them

View File

@ -16,6 +16,8 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
enterprise_include ('godmode/menu.php');
if (comprueba_login ()) { if (comprueba_login ()) {
return; return;
} }
@ -104,6 +106,8 @@ if ((give_acl($config['id_user'], 0, "PM")==1)){
echo "<div class='arrowg'>"; echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates' class='mn'>".__('Module templates')."</a></li></ul></div>"; echo "<ul class='mn'><li><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates' class='mn'>".__('Module templates')."</a></li></ul></div>";
} }
// Inventory modules
enterprise_hook ('inventory_submenu');
} }
if (give_acl ($config['id_user'], 0, "LM")) { if (give_acl ($config['id_user'], 0, "LM")) {

View File

@ -59,6 +59,9 @@
#op9 li { #op9 li {
background: url(../../images/monitor.png) no-repeat 4px 3px; background: url(../../images/monitor.png) no-repeat 4px 3px;
} }
#op10 li {
background: url(../../images/page_white_text.png) no-repeat 4px 3px;
}
#op-extensions li { #op-extensions li {
background: url(../../images/extensions.png) no-repeat 4px 3px; background: url(../../images/extensions.png) no-repeat 4px 3px;
} }

View File

@ -466,7 +466,7 @@ div.title_line {
} }
#menu_tab li a, #menu_tab li.nomn a { #menu_tab li a, #menu_tab li.nomn a {
background: #d4ddc6; background: #d4ddc6;
padding: 2px 10px 2px 10px; padding: 2px 5px 2px 5px;
color: #333; color: #333;
border-left: 2px solid #778866; border-left: 2px solid #778866;
font-weight: bold; font-weight: bold;
@ -509,7 +509,7 @@ div.title_line {
} }
#menu_tab_left li a { #menu_tab_left li a {
background: #d84437; background: #d84437;
padding: 2px 10px 2px 10px; padding: 2px 5px 2px 5px;
color: #fff; color: #fff;
font-weight: bold; font-weight: bold;
line-height: 18px; line-height: 18px;

View File

@ -16,13 +16,14 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
session_start();
require_once ("../../include/config.php");
require_once ("../../include/functions.php");
require_once ("../../include/functions_db.php");
require ("include/config.php"); $config["id_user"] = $_SESSION["id_usuario"];
if (! give_acl ($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'], 0, "AW")) {
check_login ();
if (! give_acl($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'], 0, "AW")){
require ("../../general/noaccess.php"); require ("../../general/noaccess.php");
return; return;
} }
@ -31,7 +32,7 @@ if (isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){
$id_agentmodule = $_GET["agentmodule"]; $id_agentmodule = $_GET["agentmodule"];
$id_agent = $_GET["agent"]; $id_agent = $_GET["agent"];
$agentmodule_name = dame_nombre_modulo_agentemodulo ($id_agentmodule); $agentmodule_name = dame_nombre_modulo_agentemodulo ($id_agentmodule);
if (! give_acl ($config['id_user'], dame_id_grupo ($id_agent), "AR") != 1) { if (! give_acl ($config['id_user'], dame_id_grupo ($id_agent), "AR")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Export Data"); "Trying to access Agent Export Data");
require ("../../general/noaccess.php"); require ("../../general/noaccess.php");

View File

@ -18,6 +18,7 @@
// Load global vars // Load global vars
require("include/config.php"); require("include/config.php");
enterprise_include('operation/agentes/ver_agente.php');
check_login(); check_login();
@ -189,10 +190,10 @@ if (give_acl ($config['id_user'],$id_grupo, "AW")) {
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
} else { } else {
echo "<li class='nomn'>"; echo "<li class='nomn'>";
}
// Manage agent // Manage agent
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente'><img src='images/setup.png' width='16' class='top' border=0> ".__('Manage')." </a>"; echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente'><img src='images/setup.png' width='16' class='top' border=0> ".__('Manage')." </a>";
echo "</li>"; echo "</li>";
}
} }
// Main view // Main view
@ -200,30 +201,40 @@ if ($tab == "main") {
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
} else { } else {
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/monitor.png' class='top' border=0> ".__('Main')." </a>";
echo "</li>";
} }
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/monitor.png' class='top' border=0> ".__('Main')." </a>";
echo "</li>";
// Data // Data
if ($tab == "data") { if ($tab == "data") {
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
} else { } else {
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data'><img src='images/lightbulb.png' class='top' border=0> ".__('Data')." </a>";
echo "</li>";
} }
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data'><img src='images/lightbulb.png' class='top' border=0> ".__('Data')." </a>";
echo "</li>";
// Alerts // Alerts
if ($tab == "alert") { if ($tab == "alert") {
echo "<li class='nomn_high'>"; echo "<li class='nomn_high'>";
} else { } else {
echo "<li class='nomn'>"; echo "<li class='nomn'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=alert'><img src='images/bell.png' class='top' border=0> ".__('Alerts')." </a>";
echo "</li>";
} }
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=alert'><img src='images/bell.png' class='top' border=0> ".__('Alerts')." </a>";
echo "</li>";
// Go to SLA view // Go to SLA view
echo "<li class='nomn'>"; if ($tab == "sla") {
echo "<li class='nomn_high'>";
} else {
echo "<li class='nomn'>";
}
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente=$id_agente'><img src='images/images.png' class='top' border=0> ".__('S.L.A')." </a>"; echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente=$id_agente'><img src='images/images.png' class='top' border=0> ".__('S.L.A')." </a>";
echo "</li>"; echo "</li>";
// Inventory
enterprise_hook ('inventory_tab');
echo "</ul>"; echo "</ul>";
echo "</div>"; echo "</div>";
echo "</div>"; echo "</div>";
@ -248,6 +259,9 @@ case "data":
case "alert": case "alert":
require "estado_alertas.php"; require "estado_alertas.php";
break; break;
case "inventory":
enterprise_include ('operation/agentes/agent_inventory.php');
break;
} }
?> ?>

View File

@ -19,6 +19,8 @@
if (! isset ($config['id_user'])) { if (! isset ($config['id_user'])) {
return; return;
} }
enterprise_include ('operation/menu.php');
?> ?>
<div class="tit bg">:: <?php echo __('Operation'); ?> ::</div> <div class="tit bg">:: <?php echo __('Operation'); ?> ::</div>
@ -117,6 +119,7 @@ if (give_acl ($config['id_user'], 0, "AR")) {
} }
} }
enterprise_hook ('inventory_menu');
// Server view // Server view
if ( $sec == "estado_server") { if ( $sec == "estado_server") {

View File

@ -57,6 +57,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
`id_prediction_server` smallint(4) unsigned default '0', `id_prediction_server` smallint(4) unsigned default '0',
`id_wmi_server` smallint(4) unsigned default '0', `id_wmi_server` smallint(4) unsigned default '0',
`id_parent` int(10) unsigned default '0', `id_parent` int(10) unsigned default '0',
`id_inventory_server` smallint(4) unsigned default '0',
PRIMARY KEY (`id_agente`), PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`), KEY `nombre` (`nombre`),
KEY `direccion` (`direccion`), KEY `direccion` (`direccion`),
@ -493,6 +494,7 @@ CREATE TABLE IF NOT EXISTS `tserver` (
`prediction_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', `wmi_server` tinyint(3) unsigned NOT NULL default '0',
`export_server` tinyint(3) unsigned NOT NULL default '0', `export_server` tinyint(3) unsigned NOT NULL default '0',
`inventory_server` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`id_server`), PRIMARY KEY (`id_server`),
KEY `name` (`name`), KEY `name` (`name`),
KEY `keepalive` (`keepalive`), KEY `keepalive` (`keepalive`),
@ -724,3 +726,33 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime_agents` (
`id_downtime` mediumint(8) unsigned NOT NULL default '0', `id_downtime` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tmodule_inventory` (
`id_module_inventory` int(10) NOT NULL auto_increment,
`id_os` int(10) unsigned NOT NULL,
`name` varchar(100) default '',
`description` varchar(100) default '',
`interpreter` varchar(100) default '',
`code` BLOB NOT NULL,
PRIMARY KEY (`id_module_inventory`),
FOREIGN KEY (`id_os`) REFERENCES tconfig_os(`id_os`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tagent_module_inventory` (
`id_agent_module_inventory` int(10) NOT NULL auto_increment,
`id_agente` int(10) unsigned NOT NULL,
`id_module_inventory` int(10) NOT NULL,
`target` varchar(100) default '',
`interval` int(10) unsigned NOT NULL default '3600',
`username` varchar(100) default '',
`password` varchar(100) default '',
`data` BLOB NOT NULL,
`timestamp` datetime default '0000-00-00 00:00:00',
`flag` tinyint(1) unsigned default '1',
PRIMARY KEY (`id_agent_module_inventory`),
FOREIGN KEY (`id_agente`) REFERENCES tagente(`id_agente`)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (`id_module_inventory`) REFERENCES tmodule_inventory(`id_module_inventory`)
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;