2008-04-03 Jorge Gonzalez <jo[Brge.gonzalez@artica.es>

* include/functions_db.php: New functions added to handle plugins and
        export servers.

        * include/languages/language_en.php: Updated English translation file.

        * general/header.php: Updated header.

        * godmode/agentes/manage_config.php,
        godmode/agentes/module_manager_editor_data.php,
        godmode/agentes/module_manager_editor_network.php,
        godmode/agentes/module_manager.php,
        godmode/agentes/modificar_agente.php,
        godmode/agentes/module_manager_editor_wmi.php,
        godmode/agentes/configurar_agente.php,
        godmode/agentes/module_manager_editor_plugin.php,
        godmode/agentes/module_manager_editor.php,
        godmode/agentes/module_manager_editor_prediction.php,
        godmode/agentes/agent_manager.php, godmode/modules/module_list.php:
        Added infrastructure to add/edit modules.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@792 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
aloriel 2008-04-03 16:52:11 +00:00
parent bfe9e0db18
commit 479240063d
16 changed files with 719 additions and 227 deletions

View File

@ -1,4 +1,26 @@
2008-04-03 Sancho Lerena <slerena@gmail.com>
2008-04-03 Jorge Gonzalez <jo[Brge.gonzalez@artica.es>
* include/functions_db.php: New functions added to handle plugins and
export servers.
* include/languages/language_en.php: Updated English translation file.
* general/header.php: Updated header.
* godmode/agentes/manage_config.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/agent_manager.php, godmode/modules/module_list.php:
Added infrastructure to add/edit modules.
2008-04-03 Sancho Lerena <slerena@gmail.com>
* pandoradb_data.sql: IA to prediction in description.

View File

@ -25,6 +25,7 @@ echo '
';
echo "<div id='head_m'>";
echo "<table width=520 border='0' cellpadding=3>
<tr>";
if (isset ($_SESSION["id_usuario"])){

View File

@ -3,6 +3,7 @@
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or

View File

@ -2,6 +2,7 @@
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or
@ -33,9 +34,10 @@ else {
}
// Get passed variables
$tab = get_parameter_get("tab","main");
$tab = get_parameter_get ("tab","main");
$form_moduletype = get_parameter_post ("form_moduletype");
$form_alerttype = get_parameter ("form_alerttype");
$moduletype = get_parameter_get ("moduletype");
// Init vars
$descripcion = "";
@ -98,7 +100,7 @@ $alert_priority = "0";
// ================================
// Create AGENT
// ================================
// We need to create agent BEFORE show tabs, because we need to get agent_id
// We need to create agent BEFORE showing 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"]);
@ -108,13 +110,13 @@ if ( isset ($_POST["create_agent"])) { // Create a new and shining agent
$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_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 )
// 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)){
@ -449,10 +451,10 @@ 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_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);
$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);
@ -614,29 +616,29 @@ if ((isset($_POST["update_module"])) || (isset($_POST["insert_module"]))) {
}
$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");
$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",300);
$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
@ -649,25 +651,37 @@ if ((isset($_POST["update_module"])) && (!isset($_POST["oid"]))){ // if modified
}
}
$sql_update = "UPDATE tagente_modulo
SET max ='".$modulo_max."',
min = '".$modulo_min."',
nombre='".$nombre."',
descripcion='".$descripcion."',
tcp_send = '$tcp_send',
tcp_rcv = '$tcp_rcv',
tcp_port = '$tcp_port',
ip_target = '$ip_target',
snmp_oid = '$snmp_oid',
snmp_community = '$snmp_community',
id_module_group = '$id_module_group',
module_interval = '$module_interval'
WHERE id_agente_modulo = ".$id_agente_modulo;
$result=mysql_query($sql_update);
SET descripcion = '$form_description',
nombre = '$form_name',
max = '$form_maxvalue',
min = '$form_minvalue',
module_interval = '$form_interval',
tcp_port = '$form_tcp_port',
tcp_send = '$form_tcp_send',
tcp_rcv = '$form_tcp_rcv',
snmp_community = '$form_snmp_community',
snmp_oid = '$form_snmp_oid',
ip_target = '$form_ip_target',
id_module_group = '$form_id_module_group',
flag = '$form_flag',
id_modulo = '$form_id_modulo',
disabled = '$form_disabled',
id_export = '$form_id_export',
plugin_user = '$form_plugin_user',
plugin_pass = '$form_plugin_pass',
plugin_parameter = '$form_plugin_parameter',
id_plugin = '$form_id_plugin',
post_process = '$form_post_process',
prediction_module = '$form_prediction_module',
max_timeout = '$form_max_timeout'
WHERE id_agente_modulo = '$id_agente_modulo'";
$result=mysql_query($sql_update);
if (! $result) {
echo "<h3 class='error'>".$lang_label["update_module_no"]."</h3>";
} else {
echo "<h3 class='suc'>".$lang_label["update_module_ok"]."</h3>";
}
/*
// Init vars to null to avoid trash in forms
$id_tipo_modulo = "";$nombre = "";$descripcion = "";$modulo_max = "";
$modulo_min = "";// Pandora 1.2 new module data:
@ -675,14 +689,15 @@ if ((isset($_POST["update_module"])) && (!isset($_POST["oid"]))){ // if modified
$snmp_oid = "";$snmp_community = "";$id_module_group = "";
$module_interval = ""; $modulo_nombre = ""; $modulo_descripcion = "";
$update_module = 0;
*/
}
// =========================================================
// OID Refresh button to get SNMPWALK from data in form
// This code is also applied when submitting a new module (insert_module = 1)
// =========================================================
if (isset($_POST["oid"])){
snmp_set_quick_print(1);
if (! ($snmpwalk = snmprealwalk($ip_target, $snmp_community, ""))) {
snmp_set_quick_print(1);
if (! ($snmpwalk = snmprealwalk($form_ip_target, $form_snmp_community, ""))) {
echo "<h3 class='error'>".$lang_label["cannot_read_snmp"]."</h3>";
} else {
echo "<h3 class='suc'>".$lang_label["ok_read_snmp"]."</h3>";
@ -694,9 +709,7 @@ if (isset($_POST["oid"])){
// MODULE INSERT
// =========================================================
if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1)) ) &&
(!isset($_POST["oid"])) &&
(isset($_POST["insert_module"]))){
if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1))) && (!isset($_POST["oid"])) && (isset($_POST["insert_module"])) && (isset($_POST['crtbutton']))){
if (isset($_POST["form_combo_snmp_oid"])) {
$combo_snmp_oid = entrada_limpia($_POST["form_combo_snmp_oid"]);
@ -722,12 +735,12 @@ if (((!isset($_POST["nc"]) OR ($_POST["nc"]==-1)) ) &&
$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
($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)
@ -787,23 +800,23 @@ if (isset($_GET["delete_module"])){ // DELETE agent module !
// -----------------------------------
switch ($tab) {
case "main": require "agent_manager.php";
case "main":
require "agent_manager.php";
break;
case "module":
if ($form_moduletype == "")
require "module_manager.php";
else
require "module_manager_editor.php";
case "module":
if (($form_moduletype == "") && ($moduletype == ""))
require "module_manager.php";
else
require "module_manager_editor.php";
break;
case "alert":
case "alert":
if (($form_alerttype == "") AND (!isset($_GET["update_alert"])))
require "alert_manager.php";
else
require "alert_manager_editor.php";
break;
case "template":require "agent_template.php";
case "template":
require "agent_template.php";
break;
}
?>

View File

@ -5,6 +5,7 @@
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2006 Artica Soluciones Tecnol<6F>icas S.L, info@artica.es
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@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; either version 2

View File

@ -2,6 +2,7 @@
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or

View File

@ -2,6 +2,7 @@
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// 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
@ -77,18 +78,18 @@ if ($row=mysql_num_rows($result)){
echo "<th>".$lang_label["description"]."</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)){
$color=1; $last_modulegroup = "0";
while ($row = mysql_fetch_array($result)){
if ($color == 1){
$tdcolor="datos";
$color =0;
$tdcolor = "datos";
$color = 0;
} else {
$tdcolor="datos2";
$color =1;
$tdcolor = "datos2";
$color = 1;
}
$id_tipo = $row["id_tipo_modulo"];
$id_module = $row["id_modulo"];
$nombre_modulo =$row["nombre"];
$nombre_modulo = $row["nombre"];
$descripcion = $row["descripcion"];
$module_max = $row["max"];
$module_min = $row["min"];
@ -139,7 +140,8 @@ if ($row=mysql_num_rows($result)){
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'>";
// Update module
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=$id_agente&tab=module&update_module=".$row["id_agente_modulo"]."&moduletype=$id_module#modules'>";
echo "<img src='images/config.png' border=0 title='".$lang_label["update"]."' onLoad='type_change()'></b></a>";
// Make a data normalization
@ -151,5 +153,6 @@ if ($row=mysql_num_rows($result)){
}
}
echo "</table>";
} else
echo "<div class='nf'>".lang_string("No available data to show")."</div>";

View File

@ -2,6 +2,7 @@
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// 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
@ -21,15 +22,38 @@ if (give_acl($config["id_user"], 0, "AW")!=1) {
// Following variables come from module_manager.php -> configurar_agente.php :
//
// $form_moduletype: could be networkserver, pluginserver, wmiserver, or predictionserver
// $form_moduletype: could be [1] Agent module/Data server, [2] network server, [4] plugin server, [6] wmiserver, or [5] predictionserver
// $moduletype: helper to fix get/post method; copy of $form_moduletype just to edit modules, not to create them
if (($form_moduletype == "") && ($moduletype != "")){
switch ($moduletype) {
case "1":
$form_moduletype = "dataserver";
break;
case "2":
$form_moduletype = "networkserver";
break;
case "4":
$form_moduletype = "pluginserver";
break;
case "5":
$form_moduletype = "predictionserver";
break;
case "6":
$form_moduletype = "wmiserver";
break;
}
}
// Get form (GET)
$form_network_component = get_parameter_get("form_network_component", "");
if($form_network_component == "")
$form_network_component = get_parameter_post("form_network_component", "");
// Using network component to fill some fields
if (($form_moduletype == "networkserver") && ($form_network_component != "")){
if (($form_moduletype == "networkserver") && ($form_network_component != "") && (!isset($_POST['crtbutton'])) && (!isset($_POST['oid']))){
// Preload data from template
$row = get_db_row ("tnetwork_component", $id_nc , $form_network_component);
$row = get_db_row ("tnetwork_component", 'id_nc', $form_network_component);
if ($row == 0){
unmanaged_error("Cannot load tnetwork_component reference from previous page");
}
@ -85,14 +109,9 @@ if (($form_moduletype == "networkserver") && ($form_network_component != "")){
$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";
// Data Server
if ($form_moduletype == "dataserver"){
include $config["homedir"]."/godmode/agentes/module_manager_editor_data.php";
}
// Network server
@ -100,9 +119,9 @@ 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";
// Plugin server
if ($form_moduletype == "pluginserver"){
include $config["homedir"]."/godmode/agentes/module_manager_editor_plugin.php";
}
// Prediction server
@ -110,3 +129,8 @@ if ($form_moduletype == "predictionserver"){
include $config["homedir"]."/godmode/agentes/module_manager_editor_prediction.php";
}
// WMI server
if ($form_moduletype == "wmiserver"){
include $config["homedir"]."/godmode/agentes/module_manager_editor_wmi.php";
}

View File

@ -2,6 +2,7 @@
// Pandora FMS - the Free Monitoring System
// ========================================
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// Please see http://pandora.sourceforge.net for full contribution list
// This program is free software; you can redistribute it and/or
@ -20,6 +21,11 @@
global $config;
check_login();
// get the variable form_moduletype
$form_moduletype = get_parameter_post ("form_moduletype");
// get the module to update
$update_module_id = get_parameter_get ("update_module");
// 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");
@ -27,9 +33,60 @@ if (give_acl ($config["id_user"], 0, "AW")!=1) {
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>';
// Check whether we are updataing and get data if so
if ($update_module_id != NULL){
echo "<p>UMid $update_module_id</p>";
$row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id);
if ($row == 0){
unmanaged_error("Cannot load tnetwork_component reference from previous page");
}
else{
$id_agente = $row['id_agente'];
$form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter
$form_description = $row['descripcion'];
$form_name = $row['nombre'];
$form_minvalue = $row['max'];
$form_maxvalue = $row['min'];
$form_interval = $row['module_interval'];
$form_tcp_port = $row['tcp_port'];
$form_tcp_send = $row['tcp_send'];
$form_tcp_rcv = $row['tcp_rcv'];
$form_snmp_community = $row['snmp_community'];
$form_snmp_oid = $row['snmp_oid'];
$form_ip_target = $row['ip_target'];
$form_id_module_group = $row['id_module_group'];
$tbl_flag = $row['flag']; // It doesn't matter
$tbl_id_modulo = $row['id_modulo']; // It doesn't matter
$tbl_disabled = $row['disabled'];
$form_id_export = $row['id_export'];
$form_plugin_user = $row['plugin_user'];
$form_plugin_pass = $row['plugin_pass'];
$form_plugin_parameter = $row['plugin_parameter'];
$form_id_plugin = $row['id_plugin']; // It doesn't matter
$form_post_process = $row['post_process'];
$tbl_prediction_module = $row['prediction_module']; // It doesn't matter
$form_max_timeout = $row['max_timeout'];
if ($tbl_disabled == 1){
$disabled_status = 'checked="ckecked"';
} else {
$disabled_status = NULL;
}
}
}
echo "<h3>". lang_string ("module_assignment")." - ". 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.'&form_moduletype='.$form_moduletype.'">';
// Whether in update or insert mode
if ($update_module_id == NULL){
echo "<input type='hidden' name='insert_module' value='1'>";
} else {
echo "<input type='hidden' name='update_module' value='1'>";
}
//id_agente_module
echo "<input type='hidden' name='id_agente_modulo'' value='".$update_module_id."'>";
// 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">';
@ -37,28 +94,39 @@ 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 '<td class="datos2"><input type="checkbox" name="form_disabled" value="1" "'.$disabled_status.'"></td>';
echo '</tr><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,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>";
if ($update_module_id != NULL){
echo "<span class='redi'>Not available in edition mode</span>";
echo "<input type='hidden' name='form_id_tipo_modulo' value='".$form_id_tipo_modulo."'>";
} else {
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 "</select>";
echo "</tr>";
echo '</tr>';
// Post process / Export server
echo "<tr>";
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">';
if ($form_id_export != 0){
echo "<option value='".$form_id_export."'>".dame_nombre_servidorexportacion($form_id_export)."</option>";
}
echo "<option value='0'>".lang_string("None")."</option>";
$sql1='SELECT id, name FROM tserver_export ORDER BY name;';
$result=mysql_query($sql1);
@ -92,17 +160,23 @@ while ($row=mysql_fetch_array($result)){
echo "<option value='".$row["id_mg"]."'>".$row["name"]."</option>";
}
echo '</select>';
echo '</tr>';
// Description
echo '</tr><tr>';
echo '<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 '<td valign="top" class="datos" colspan="3"><textarea name="form_description" cols="65" rows="2">'.$form_description.'</textarea>';
echo '</tr>';
echo '</table>';
echo "</tr><tr>";
echo "</table>";
//Submit
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>";
if ($update_module_id == NULL){
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
} else {
echo '<input name="updbutton" type="submit" class="sub wand" value="'.lang_string ("update").'">';
}
echo '</table>';
?>
?>

View File

@ -1,17 +1,31 @@
<?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.
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// 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, version 2.
// 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.
// General startup for established session
global $config;
check_login();
// get the variable form_moduletype
$form_moduletype = get_parameter_post ("form_moduletype");
// get the module to update
$update_module_id = get_parameter_get ("update_module");
// 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");
@ -19,11 +33,62 @@ if (give_acl($config["id_user"], 0, "AW")!=1) {
exit;
}
echo "<h3>".lang_string ("module_assigment")." - ".lang_string("network server module")."</h3>";
// Check whether we are updataing and get data if so
if ($update_module_id != NULL){
echo "<p>UMid $update_module_id</p>";
$row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id);
if ($row == 0){
unmanaged_error("Cannot load tnetwork_component reference from previous page");
}
else{
$id_agente = $row['id_agente'];
$form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter
$form_description = $row['descripcion'];
$form_name = $row['nombre'];
$form_minvalue = $row['max'];
$form_maxvalue = $row['min'];
$form_interval = $row['module_interval'];
$form_tcp_port = $row['tcp_port'];
$form_tcp_send = $row['tcp_send'];
$form_tcp_rcv = $row['tcp_rcv'];
$form_snmp_community = $row['snmp_community'];
$form_snmp_oid = $row['snmp_oid'];
$form_ip_target = $row['ip_target'];
$form_id_module_group = $row['id_module_group'];
$tbl_flag = $row['flag']; // It doesn't matter
$tbl_id_modulo = $row['id_modulo']; // It doesn't matter
$tbl_disabled = $row['disabled'];
$form_id_export = $row['id_export'];
$form_plugin_user = $row['plugin_user'];
$form_plugin_pass = $row['plugin_pass'];
$form_plugin_parameter = $row['plugin_parameter'];
$form_id_plugin = $row['id_plugin']; // It doesn't matter
$form_post_process = $row['post_process'];
$tbl_prediction_module = $row['prediction_module']; // It doesn't matter
$form_max_timeout = $row['max_timeout'];
if ($tbl_disabled == 1){
$disabled_status = 'checked="ckecked"';
} else {
$disabled_status = NULL;
}
}
}
echo "<h3>".lang_string ("module_assignment")." - ".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>';
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'&form_moduletype='.$form_moduletype.'">';
// Whether in update or insert mode
if ($update_module_id == NULL){
echo "<input type='hidden' name='insert_module' value='1'>";
} else {
echo "<input type='hidden' name='update_module' value='1'>";
}
//id_agente_module
echo "<input type='hidden' name='id_agente_modulo'' value='".$update_module_id."'>";
// id_modulo 2 - Network
echo "<input type='hidden' name='form_id_modulo' value='2'>";
@ -31,30 +96,41 @@ echo "<input type='hidden' name='form_id_modulo' value='2'>";
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>";
if ($update_module_id != NULL){
echo "<span class='redi'>Not available in edition mode</span>";
echo "<input type='hidden' name='form_id_tipo_modulo' value='".$form_id_tipo_modulo."'>";
} else {
echo '<select name="form_network_component">';
echo '<option>---'.$lang_label["manual_config"].'---</option>';
$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>";
}
echo "</select></td>";
echo '</td>';
echo '<td class="datos3">';
echo '<input type="hidden" name="form_moduletype" value="'.$form_moduletype.'">';
if ($update_module_id == NULL){
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>";
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value="1" "'.$disabled_status.'"></td>';
echo '</tr>';
// Ip target, tcp port
echo "<tr>";
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>";
@ -65,13 +141,20 @@ echo '</tr>';
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>";
if ($update_module_id != NULL){
echo "<span class='redi'>Not available in edition mode</span>";
echo "<input type='hidden' name='form_id_tipo_modulo' value='".$form_id_tipo_modulo."'>";
} else {
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 "</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>';
@ -104,7 +187,7 @@ if (isset($_POST["oid"])){
// 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 "<option value=".$i.">".salida_limpia(substr($snmp_output,0,55))."</option>";
}
}
echo "</select>";
@ -135,13 +218,16 @@ pandora_help("postprocess");
echo "</td>";
echo '<td class="datos">'.lang_string ("export_server")."</td>";
echo '<td class="datos"><select name="form_id_export">';
if ($form_id_export != 0){
echo "<option value='".$form_id_export."'>".dame_nombre_servidorexportacion($form_id_export)."</option>";
}
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 '</select>';
echo '</tr>';
// tcp send / rcv value
@ -153,15 +239,20 @@ echo '<td class="datos2"><textarea cols=20 style="height:40px;" name="form_tcp_r
echo '</tr>';
// Description
echo '</tr><tr>';
echo '<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>";
echo '<td valign="top" class="datos" colspan="3"><textarea name="form_description" cols="65" rows="2">'.$form_description.'</textarea>';
echo '</tr>';
echo '</table>';
// SUbmit
// 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>";
if ($update_module_id == NULL){
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
} else {
echo '<input name="updbutton" type="submit" class="sub wand" value="'.lang_string ("update").'">';
}
echo '</table>';
?>
?>

View File

@ -1,17 +1,31 @@
<?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.
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// 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, version 2.
// 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.
// General startup for established session
global $config;
check_login();
// get the variable form_moduletype
$form_moduletype = get_parameter_post ("form_moduletype");
// get the module to update
$update_module_id = get_parameter_get ("update_module");
// 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");
@ -19,10 +33,60 @@ if (give_acl($config["id_user"], 0, "AW")!=1) {
exit;
}
echo "<h3>".lang_string ("module_assigment")." - ".lang_string("Plugin server module")."</h3>";
// Check whether we are updataing and get data if so
if ($update_module_id != NULL){
echo "<p>UMid $update_module_id</p>";
$row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id);
if ($row == 0){
unmanaged_error("Cannot load tnetwork_component reference from previous page");
}
else{
$id_agente = $row['id_agente'];
$form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter
$form_description = $row['descripcion'];
$form_name = $row['nombre'];
$form_minvalue = $row['max'];
$form_maxvalue = $row['min'];
$form_interval = $row['module_interval'];
$form_tcp_port = $row['tcp_port'];
$form_tcp_send = $row['tcp_send'];
$form_tcp_rcv = $row['tcp_rcv'];
$form_snmp_community = $row['snmp_community'];
$form_snmp_oid = $row['snmp_oid'];
$form_ip_target = $row['ip_target'];
$form_id_module_group = $row['id_module_group'];
$tbl_flag = $row['flag']; // It doesn't matter
$tbl_id_modulo = $row['id_modulo']; // It doesn't matter
$tbl_disabled = $row['disabled'];
$form_id_export = $row['id_export'];
$form_plugin_user = $row['plugin_user'];
$form_plugin_pass = $row['plugin_pass'];
$form_plugin_parameter = $row['plugin_parameter'];
$form_id_plugin = $row['id_plugin']; // It doesn't matter
$form_post_process = $row['post_process'];
$tbl_prediction_module = $row['prediction_module']; // It doesn't matter
$form_max_timeout = $row['max_timeout'];
if ($tbl_disabled == 1){
$disabled_status = 'checked="ckecked"';
} else {
$disabled_status = NULL;
}
}
}
echo "<h3>".lang_string ("module_assignment")." - ".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>';
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'&form_moduletype='.$form_moduletype.'">';
// Whether in update or insert mode
if ($update_module_id == NULL){
echo "<input type='hidden' name='insert_module' value='1'>";
} else {
echo "<input type='hidden' name='update_module' value='1'>";
}
//id_agente_module
echo "<input type='hidden' name='id_agente_modulo'' value='".$update_module_id."'>";
// id_modulo 4 - PLugin
echo "<input type='hidden' name='form_id_modulo' value='4'>";
@ -32,8 +96,8 @@ 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>";
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value="1" "'.$disabled_status.'"></td>';
echo '</tr>';
// Ip target, Plugin Parameter
echo "<tr>";
@ -41,13 +105,18 @@ 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">';
// Get actual plugin ID and nicename
echo '<select name="form_id_plugin">';
if ($form_id_plugin != 0){
echo "<option value='".$form_id_plugin."'>".dame_nombre_pluginid($form_id_plugin)."</option>";
}
echo "<option value='0'>".lang_string("None")."</option>";
$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 '</select>';
echo '</tr>';
echo '</tr><tr>';
@ -62,18 +131,24 @@ 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>";
if ($update_module_id != NULL){
echo "<span class='redi'>Not available in edition mode</span>";
echo "<input type='hidden' name='form_id_tipo_modulo' value='".$form_id_tipo_modulo."'>";
} else {
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 "</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>';
@ -110,26 +185,33 @@ pandora_help("postprocess");
echo "</td>";
echo '<td class="datos">'.lang_string ("export_server")."</td>";
echo '<td class="datos"><select name="form_id_export">';
if ($form_id_export != 0){
echo "<option value='".$form_id_export."'>".dame_nombre_servidorexportacion($form_id_export)."</option>";
}
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 '</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>";
echo '<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_description.'</textarea>';
echo '</tr>';
echo '</table>';
// SUbmit
// 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>";
if ($update_module_id == NULL){
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
} else {
echo '<input name="updbutton" type="submit" class="sub wand" value="'.lang_string ("update").'">';
}
echo '</table>';
?>
?>

View File

@ -1,17 +1,31 @@
<?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.
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// 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, version 2.
// 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.
// General startup for established session
global $config;
check_login();
// get the variable form_moduletype
$form_moduletype = get_parameter_post ("form_moduletype");
// get the module to update
$update_module_id = get_parameter_get ("update_module");
// 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");
@ -19,9 +33,60 @@ if (give_acl($config["id_user"], 0, "AW")!=1) {
exit;
}
echo "<h3>".lang_string ("module_assigment")." - ".lang_string("Prediction server module")."</h3>";
// Check whether we are updataing and get data if so
if ($update_module_id != NULL){
echo "<p>UMid $update_module_id</p>";
$row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id);
if ($row == 0){
unmanaged_error("Cannot load tnetwork_component reference from previous page");
}
else{
$id_agente = $row['id_agente'];
$form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter
$form_description = $row['descripcion'];
$form_name = $row['nombre'];
$form_minvalue = $row['max'];
$form_maxvalue = $row['min'];
$form_interval = $row['module_interval'];
$form_tcp_port = $row['tcp_port'];
$form_tcp_send = $row['tcp_send'];
$form_tcp_rcv = $row['tcp_rcv'];
$form_snmp_community = $row['snmp_community'];
$form_snmp_oid = $row['snmp_oid'];
$form_ip_target = $row['ip_target'];
$form_id_module_group = $row['id_module_group'];
$tbl_flag = $row['flag']; // It doesn't matter
$tbl_id_modulo = $row['id_modulo']; // It doesn't matter
$tbl_disabled = $row['disabled'];
$form_id_export = $row['id_export'];
$form_plugin_user = $row['plugin_user'];
$form_plugin_pass = $row['plugin_pass'];
$form_plugin_parameter = $row['plugin_parameter'];
$form_id_plugin = $row['id_plugin']; // It doesn't matter
$form_post_process = $row['post_process'];
$tbl_prediction_module = $row['prediction_module']; // It doesn't matter
$form_max_timeout = $row['max_timeout'];
if ($tbl_disabled == 1){
$disabled_status = 'checked="ckecked"';
} else {
$disabled_status = NULL;
}
}
}
echo "<h3>".lang_string ("module_assignment")." - ".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>';
// Whether in update or insert mode
if ($update_module_id == NULL){
echo "<input type='hidden' name='insert_module' value='1'>";
} else {
echo "<input type='hidden' name='update_module' value='1'>";
}
//id_agente_module
echo "<input type='hidden' name='id_agente_modulo'' value='".$update_module_id."'>";
// id_modulo 5 - Prediction
echo "<input type='hidden' name='form_id_modulo' value='5'>";
@ -31,7 +96,7 @@ 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 '<td class="datos2"><input type="checkbox" name="form_disabled" value="1" "'.$disabled_status.'"></td>';
echo '</tr>';
@ -50,25 +115,26 @@ 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>";
if ($update_module_id != NULL){
echo "<span class='redi'>Not available in edition mode</span>";
echo "<input type='hidden' name='form_id_tipo_modulo' value='".$form_id_tipo_modulo."'>";
} else {
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 "</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>";
echo '<td class="datos2"><input type="text" name="form_interval" size="5" value="'.$form_interval.'"></td></tr>';
// Post process / Export server
echo "<tr>";
echo '<tr>';
echo '<td class="datos">'.lang_string ("module_group")."</td>";
echo '<td class="datos">';
echo '<select name="form_id_module_group">';
echo '<td class="datos"><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>";
}
@ -81,26 +147,33 @@ echo '</select>';
echo '<td class="datos">'.lang_string ("export_server")."</td>";
echo '<td class="datos"><select name="form_id_export">';
if ($form_id_export != 0){
echo "<option value='".$form_id_export."'>".dame_nombre_servidorexportacion($form_id_export)."</option>";
}
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 '</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 '<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_description.'</textarea>';
echo '</tr>';
echo '</table>';
echo '<table width="630" cellpadding="4" cellspacing="4">';
// 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>";
if ($update_module_id == NULL){
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
} else {
echo '<input name="updbutton" type="submit" class="sub wand" value="'.lang_string ("update").'">';
}
echo '</table>';
?>
?>

View File

@ -1,17 +1,31 @@
<?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.
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// 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, version 2.
// 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.
// General startup for established session
global $config;
check_login();
// get the variable form_moduletype
$form_moduletype = get_parameter_post ("form_moduletype");
// get the module to update
$update_module_id = get_parameter_get ("update_module");
// 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");
@ -19,10 +33,60 @@ if (give_acl($config["id_user"], 0, "AW")!=1) {
exit;
}
echo "<h3>".lang_string ("module_assigment")." - ".lang_string("WMI server module")."</h3>";
// Check whether we are updataing and get data if so
if ($update_module_id != NULL){
echo "<p>UMid $update_module_id</p>";
$row = get_db_row ("tagente_modulo", 'id_agente_modulo', $update_module_id);
if ($row == 0){
unmanaged_error("Cannot load tnetwork_component reference from previous page");
}
else{
$id_agente = $row['id_agente'];
$form_id_tipo_modulo = $row['id_tipo_modulo']; // It doesn't matter
$form_description = $row['descripcion'];
$form_name = $row['nombre'];
$form_minvalue = $row['max'];
$form_maxvalue = $row['min'];
$form_interval = $row['module_interval'];
$form_tcp_port = $row['tcp_port'];
$form_tcp_send = $row['tcp_send'];
$form_tcp_rcv = $row['tcp_rcv'];
$form_snmp_community = $row['snmp_community'];
$form_snmp_oid = $row['snmp_oid'];
$form_ip_target = $row['ip_target'];
$form_id_module_group = $row['id_module_group'];
$tbl_flag = $row['flag']; // It doesn't matter
$tbl_id_modulo = $row['id_modulo']; // It doesn't matter
$tbl_disabled = $row['disabled'];
$form_id_export = $row['id_export'];
$form_plugin_user = $row['plugin_user'];
$form_plugin_pass = $row['plugin_pass'];
$form_plugin_parameter = $row['plugin_parameter'];
$form_id_plugin = $row['id_plugin']; // It doesn't matter
$form_post_process = $row['post_process'];
$tbl_prediction_module = $row['prediction_module']; // It doesn't matter
$form_max_timeout = $row['max_timeout'];
if ($tbl_disabled == 1){
$disabled_status = 'checked="ckecked"';
} else {
$disabled_status = NULL;
}
}
}
echo "<h3>".lang_string ("module_assignment")." - ".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>';
echo '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'&form_moduletype='.$form_moduletype.'">';
// Whether in update or insert mode
if ($update_module_id == NULL){
echo "<input type='hidden' name='insert_module' value='1'>";
} else {
echo "<input type='hidden' name='update_module' value='1'>";
}
//id_agente_module
echo "<input type='hidden' name='id_agente_modulo'' value='".$update_module_id."'>";
// id_modulo 6 - WMI
echo "<input type='hidden' name='form_id_modulo' value='6'>";
@ -32,11 +96,11 @@ 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>";
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value="1" "'.$disabled_status.'"></td>';
echo '</tr>';
// Ip target, WMI query
echo "<tr>";
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>";
@ -57,13 +121,19 @@ echo '</tr>';
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>";
if ($update_module_id != NULL){
echo "<span class='redi'>Not available in edition mode</span>";
echo "<input type='hidden' name='form_id_tipo_modulo' value='".$form_id_tipo_modulo."'>";
} else {
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 "</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>';
@ -93,33 +163,40 @@ echo '<td class="datos"><input type="text" name="form_maxvalue" size="5" value="
echo '</tr>';
// Post process / Export server
echo "<tr>";
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">';
if ($form_id_export != 0){
echo "<option value='".$form_id_export."'>".dame_nombre_servidorexportacion($form_id_export)."</option>";
}
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 '</select>';
echo '</tr>';
// Description
echo '</tr><tr>';
echo '<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>";
echo '<td valign="top" class="datos" colspan="3"><textarea name="form_description" cols="65" rows="2">'.$form_description.'</textarea>';
echo '</tr>';
echo '</table>';
// SUbmit
// 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>";
if ($update_module_id == NULL){
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.lang_string ("create").'">';
} else {
echo '<input name="updbutton" type="submit" class="sub wand" value="'.lang_string ("update").'">';
}
echo '</table>';
?>
?>

View File

@ -105,4 +105,4 @@ else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access module management");
require ("general/noaccess.php");
}
?>
?>

View File

@ -351,6 +351,36 @@ function dame_nombre_grupomodulo($id){
return $pro;
}
// ---------------------------------------------------------------
// Returns name of a export server
// ---------------------------------------------------------------
function dame_nombre_servidorexportacion($id){
require("config.php");
$query1="SELECT id, name FROM tserver_export WHERE id = ".$id;
$resq1=mysql_query($query1);
if ($rowdup=mysql_fetch_array($resq1))
$pro=$rowdup["name"];
else
$pro = "";
return $pro;
}
// ---------------------------------------------------------------
// Returns name of a plugin module
// ---------------------------------------------------------------
function dame_nombre_pluginid($id){
require("config.php");
$query1="SELECT id, name FROM tplugin WHERE id = ".$id;
$resq1=mysql_query($query1);
if ($rowdup=mysql_fetch_array($resq1))
$pro=$rowdup["name"];
else
$pro = "";
return $pro;
}
// ---------------------------------------------------------------
// Returns agent name, given a ID of agente_module table
// ---------------------------------------------------------------
@ -1290,7 +1320,6 @@ function lang_string ($string){
return "[".$string."]";
}
function check_server_status (){
global $config;
// This check assumes that server_keepalive should be AT LEAST 15 MIN

View File

@ -923,4 +923,4 @@ $lang_label["Source Agent/Alert"]="Source Agent/Alert";
global $lang_label;
global $help_label;
?>
?>