2009-05-22 Esteban Sanchez <estebans@artica.es>
* extras/pandoradb_migrate_v2.x_to_v3.0.sql, pandoradb.sql: Added id_plugin. Database breakage requested and approved. * godmode/modules/manage_network_components_form_common.php, godmode/modules/manage_network_components_form_plugin.php: Added to repository. New editor for network components. * godmode/modules/manage_network_components_form_network.php, godmode/modules/manage_network_components_form_wmi.php, godmode/modules/manage_network_components.php: Adapted to changes in component editors and missing fields. Added option to create plugin components. * godmode/modules/manage_network_components_form.php: Make the different network component editors to reutilize the code and have a common UI. * godmode/agentes/module_manager_editor.php: Style correction. * include/styles/pandora.css: Style for network component editor. * include/functions_ui.php: Security fix in get_url_refresh() to avoid showing login info. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1702 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
a6a7d57799
commit
46b052f259
|
@ -1,3 +1,30 @@
|
|||
2009-05-22 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* extras/pandoradb_migrate_v2.x_to_v3.0.sql,
|
||||
pandoradb.sql: Added id_plugin. Database breakage requested and
|
||||
approved.
|
||||
|
||||
* godmode/modules/manage_network_components_form_common.php,
|
||||
godmode/modules/manage_network_components_form_plugin.php: Added
|
||||
to repository. New editor for network components.
|
||||
|
||||
* godmode/modules/manage_network_components_form_network.php,
|
||||
godmode/modules/manage_network_components_form_wmi.php,
|
||||
godmode/modules/manage_network_components.php: Adapted to changes
|
||||
in component editors and missing fields. Added option to create
|
||||
plugin components.
|
||||
|
||||
* godmode/modules/manage_network_components_form.php: Make the
|
||||
different network component editors to reutilize the code and
|
||||
have a common UI.
|
||||
|
||||
* godmode/agentes/module_manager_editor.php: Style correction.
|
||||
|
||||
* include/styles/pandora.css: Style for network component editor.
|
||||
|
||||
* include/functions_ui.php: Security fix in get_url_refresh() to
|
||||
avoid showing login info.
|
||||
|
||||
2009-05-21 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/functions_network_components.php: Added to repository.
|
||||
|
|
|
@ -183,7 +183,8 @@ UNSIGNED NOT NULL DEFAULT '1', ADD `min_warning` DOUBLE( 18, 2 ) NOT
|
|||
NULL DEFAULT '0', ADD `max_warning` DOUBLE( 18, 2 ) NOT NULL
|
||||
DEFAULT '0', ADD `min_critical` DOUBLE( 18, 2 ) NOT NULL DEFAULT
|
||||
'0', ADD `max_critical` DOUBLE( 18, 2 ) NOT NULL DEFAULT '0', ADD
|
||||
`min_ff_event` INT( 4 ) UNSIGNED NOT NULL DEFAULT '0';
|
||||
`min_ff_event` INT( 4 ) UNSIGNED NOT NULL DEFAULT '0', ADD
|
||||
`id_plugin` integer unsigned default 0;
|
||||
|
||||
ALTER TABLE `tusuario` CHANGE `nombre_real` `fullname` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
||||
ALTER TABLE `tusuario` CHANGE `comentarios` `comments` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
||||
|
|
|
@ -178,7 +178,7 @@ case 4:
|
|||
case "predictionserver":
|
||||
$moduletype = 5;
|
||||
case 5:
|
||||
$categories = array (0,1);
|
||||
$categories = array (0, 1);
|
||||
require ('module_manager_editor_common.php');
|
||||
require ('module_manager_editor_prediction.php');
|
||||
break;
|
||||
|
|
|
@ -30,11 +30,11 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
|
|||
|
||||
require_once ('include/functions_network_components.php');
|
||||
|
||||
$type = (int) get_parameter ('tipo');
|
||||
$type = (int) get_parameter ('type');
|
||||
$name = (string) get_parameter ('name');
|
||||
$description = (string) get_parameter ('descripcion');
|
||||
$modulo_max = (int) get_parameter ('modulo_max');
|
||||
$modulo_min = (int) get_parameter ('modulo_min');
|
||||
$description = (string) get_parameter ('description');
|
||||
$max = (int) get_parameter ('max');
|
||||
$min = (int) get_parameter ('min');
|
||||
$tcp_send = (string) get_parameter ('tcp_send');
|
||||
$tcp_rcv = (string) get_parameter ('tcp_rcv');
|
||||
$tcp_port = (int) get_parameter ('tcp_port');
|
||||
|
@ -47,7 +47,14 @@ $plugin_user = (string) get_parameter ('plugin_user');
|
|||
$plugin_pass = (string) get_parameter ('plugin_pass');
|
||||
$plugin_parameter = (string) get_parameter ('plugin_parameter');
|
||||
$max_timeout = (int) get_parameter ('max_timeout');
|
||||
$id_modulo = (string) get_parameter ('id_modulo');
|
||||
$id_modulo = (int) get_parameter ('id_component_type');
|
||||
$id_plugin = (int) get_parameter ('id_plugin');
|
||||
$min_warning = (int) get_parameter ('min_warning');
|
||||
$max_warning = (int) get_parameter ('max_warning');
|
||||
$min_critical = (int) get_parameter ('min_critical');
|
||||
$max_critical = (int) get_parameter ('max_critical');
|
||||
$ff_event = (int) get_parameter ('ff_event');
|
||||
$history_data = (bool) get_parameter ('history_data');
|
||||
$id = (int) get_parameter ('id');
|
||||
|
||||
$create_component = (bool) get_parameter ('create_component');
|
||||
|
@ -59,8 +66,8 @@ if ($create_component) {
|
|||
$id = create_network_component ($name, $type, $id_group,
|
||||
array ('description' => $description,
|
||||
'module_interval' => $module_interval,
|
||||
'max' => $modulo_max,
|
||||
'min' => $modulo_min,
|
||||
'max' => $max,
|
||||
'min' => $min,
|
||||
'tcp_send' => $tcp_send,
|
||||
'tcp_rcv' => $tcp_rcv,
|
||||
'tcp_port' => $tcp_port,
|
||||
|
@ -68,13 +75,20 @@ if ($create_component) {
|
|||
'snmp_community' => $snmp_community,
|
||||
'id_module_group' => $id_module_group,
|
||||
'id_modulo' => $id_modulo,
|
||||
'id_plugin' => $id_plugin,
|
||||
'plugin_user' => $plugin_user,
|
||||
'plugin_pass' => $plugin_pass,
|
||||
'plugin_parameter' => $plugin_parameter,
|
||||
'max_timeout' => $max_timeout));
|
||||
'max_timeout' => $max_timeout,
|
||||
'history_data' => $history_data,
|
||||
'min_warning' => $min_warning,
|
||||
'max_warning' => $max_warning,
|
||||
'min_critical' => $min_critical,
|
||||
'max_critical' => $max_critical,
|
||||
'min_ff_event' => $ff_event));
|
||||
if ($id === false) {
|
||||
print_error_message (__('Could not be created'));
|
||||
include_once ('manage_network_components_form.php');
|
||||
include_once ('godmode/modules/manage_network_components_form.php');
|
||||
return;
|
||||
}
|
||||
print_success_message (__('Created successfully'));
|
||||
|
@ -90,8 +104,8 @@ if ($update_component) {
|
|||
'id_group' => $id_group,
|
||||
'description' => $description,
|
||||
'module_interval' => $module_interval,
|
||||
'max' => $modulo_max,
|
||||
'min' => $modulo_min,
|
||||
'max' => $max,
|
||||
'min' => $min,
|
||||
'tcp_send' => $tcp_send,
|
||||
'tcp_rcv' => $tcp_rcv,
|
||||
'tcp_port' => $tcp_port,
|
||||
|
@ -99,13 +113,20 @@ if ($update_component) {
|
|||
'snmp_community' => $snmp_community,
|
||||
'id_module_group' => $id_module_group,
|
||||
'id_modulo' => $id_modulo,
|
||||
'id_plugin' => $id_plugin,
|
||||
'plugin_user' => $plugin_user,
|
||||
'plugin_pass' => $plugin_pass,
|
||||
'plugin_parameter' => $plugin_parameter,
|
||||
'max_timeout' => $max_timeout));
|
||||
'max_timeout' => $max_timeout,
|
||||
'history_data' => $history_data,
|
||||
'min_warning' => $min_warning,
|
||||
'max_warning' => $max_warning,
|
||||
'min_critical' => $min_critical,
|
||||
'max_critical' => $max_critical,
|
||||
'min_ff_event' => $ff_event));
|
||||
if ($result === false) {
|
||||
print_error_message (__('Could not be updated'));
|
||||
include_once ('manage_network_components_form.php');
|
||||
include_once ('godmode/modules/manage_network_components_form.php');
|
||||
return;
|
||||
}
|
||||
print_success_message (__('Updated successfully'));
|
||||
|
@ -125,20 +146,23 @@ if ($delete_component) {
|
|||
}
|
||||
|
||||
if ($id || $new_component) {
|
||||
include_once ('manage_network_components_form.php');
|
||||
include_once ('godmode/modules/manage_network_components_form.php');
|
||||
return;
|
||||
}
|
||||
|
||||
$url = get_url_refresh (array ('offset' => false,
|
||||
'id' => false,
|
||||
'create_component' => false,
|
||||
'update_component' => false,
|
||||
'delete_component' => false,
|
||||
'id_network_component' => false,
|
||||
'tipo' => false,
|
||||
'upd' => false,
|
||||
'crt' => false,
|
||||
'type' => false,
|
||||
'name' => false,
|
||||
'descripcion' => false,
|
||||
'modulo_max' => false,
|
||||
'modulo_min' => false,
|
||||
'description' => false,
|
||||
'max' => false,
|
||||
'min' => false,
|
||||
'tcp_send' => false,
|
||||
'tcp_rcv' => false,
|
||||
'tcp_port' => false,
|
||||
|
@ -151,7 +175,15 @@ $url = get_url_refresh (array ('offset' => false,
|
|||
'plugin_pass' => false,
|
||||
'plugin_parameter' => false,
|
||||
'max_timeout' => false,
|
||||
'id_modulo' => false));
|
||||
'id_modulo' => false,
|
||||
'id_plugin' => false,
|
||||
'history_data' => false,
|
||||
'min_warning' => false,
|
||||
'max_warning' => false,
|
||||
'min_critical' => false,
|
||||
'max_critical' => false,
|
||||
'ff_event' => false,
|
||||
'id_component_type' => false));
|
||||
|
||||
echo "<h2>".__('Module management')." » ";
|
||||
echo __('Module component management')."</h2>";
|
||||
|
@ -214,6 +246,10 @@ $table->data = array ();
|
|||
foreach ($components as $component) {
|
||||
$data = array ();
|
||||
|
||||
if ($component['max'] == $component['min'] && $component['max'] == 0) {
|
||||
$component['max'] = $component['min'] = __('N/A');
|
||||
}
|
||||
|
||||
$data[0] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'">';
|
||||
$data[0] .= $component['name'];
|
||||
$data[0] .= '</a>';
|
||||
|
@ -240,6 +276,7 @@ echo '<form method="post" action="'.$url.'">';
|
|||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
print_input_hidden ('new_component', 1);
|
||||
print_select (array (2 => __('Create a new network component'),
|
||||
4 => __('Create a new plugin component'),
|
||||
6 => __('Create a new WMI component')),
|
||||
'id_component_type', '', '', '', '', '');
|
||||
print_submit_button (__('Create'), 'crt', false, 'class="sub next"');
|
||||
|
|
|
@ -30,15 +30,173 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
|
|||
|
||||
$id_component_type = (int) get_parameter ('id_component_type');
|
||||
if (isset ($id)) {
|
||||
$component = get_network_component ($id, false, 'id_modulo');
|
||||
if ($component !== false)
|
||||
$id_component_type =$component['id_modulo'];
|
||||
$component = get_network_component ((int) $id);
|
||||
if ($component !== false) {
|
||||
$id_component_type = $component['id_modulo'];
|
||||
$name = $component["name"];
|
||||
$type = $component["type"];
|
||||
$description = $component["description"];
|
||||
$max = $component["max"];
|
||||
$min = $component["min"];
|
||||
$module_interval = $component["module_interval"];
|
||||
$tcp_port = $component["tcp_port"];
|
||||
$tcp_rcv = $component["tcp_rcv"];
|
||||
$tcp_send = $component["tcp_send"];
|
||||
$snmp_community = $component["snmp_community"];
|
||||
$snmp_oid = $component["snmp_oid"];
|
||||
$id_module_group = $component["id_module_group"];
|
||||
$id_group = $component["id_group"];
|
||||
$id_plugin = $component['id_plugin'];
|
||||
$plugin_user = $component["plugin_user"];
|
||||
$plugin_pass = $component["plugin_pass"];
|
||||
$plugin_parameter = $component["plugin_parameter"];
|
||||
$max_timeout = $component["max_timeout"];
|
||||
$min_warning = $component["min_warning"];
|
||||
$max_warning = $component["max_warning"];
|
||||
$max_critical = $component["max_critical"];
|
||||
$min_critical = $component["min_critical"];
|
||||
$ff_event = $component["min_ff_event"];
|
||||
$history_data = $component["history_data"];
|
||||
} elseif (isset ($new_component) && $new_component) {
|
||||
$name = "";
|
||||
$snmp_oid = "";
|
||||
$description = "";
|
||||
$id_group = 1;
|
||||
$oid = "";
|
||||
$max = "0";
|
||||
$min = "0";
|
||||
$module_interval = "0";
|
||||
$tcp_port = "";
|
||||
$tcp_rcv = "";
|
||||
$tcp_send = "";
|
||||
$snmp_community = "";
|
||||
$id_module_group = "";
|
||||
$id_group = "";
|
||||
$type = 0;
|
||||
$min_warning = 0;
|
||||
$max_warning = 0;
|
||||
$max_critical = 0;
|
||||
$min_critical = 0;
|
||||
$ff_event = 0;
|
||||
$history_data = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($id_component_type == 6) {
|
||||
$categories = array (0, 1, 2);
|
||||
require ("godmode/modules/manage_network_components_form_common.php");
|
||||
require ("godmode/modules/manage_network_components_form_wmi.php");
|
||||
} else if ($id_component_type == 4) {
|
||||
$categories = array (0, 1, 2);
|
||||
require ("godmode/modules/manage_network_components_form_common.php");
|
||||
require ("godmode/modules/manage_network_components_form_plugin.php");
|
||||
} else if ($id_component_type == 2) {
|
||||
$categories = array (3, 4, 5);
|
||||
require ("godmode/modules/manage_network_components_form_common.php");
|
||||
require ("godmode/modules/manage_network_components_form_network.php");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<form name="component" method="post">';
|
||||
|
||||
/* $table came from manage_network_components_form_common.php */
|
||||
$table->colspan['description'][1] = 3;
|
||||
$data = array ();
|
||||
$data[0] = __('Description');
|
||||
$data[1] = print_textarea ('description', 2, 65, $description, '', true);
|
||||
push_table_row ($data, 'description');
|
||||
|
||||
print_table ($table);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
print_input_hidden ('id_component_type', $id_component_type);
|
||||
if ($id) {
|
||||
print_input_hidden ('update_component', 1);
|
||||
print_input_hidden ('id', $id);
|
||||
print_submit_button (__('Update'), 'upd', false, 'class="sub upd"');
|
||||
} else {
|
||||
print_input_hidden ('create_component', 1);
|
||||
print_submit_button (__('Create'), 'crt', false, 'class="sub next"');
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
<!--
|
||||
function type_change () {
|
||||
// type 1-4 - Generic_xxxxxx
|
||||
if ((document.component.type.value > 0) && (document.component.type.value < 5)){
|
||||
document.component.snmp_oid.style.background="#ddd";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.component.tcp_send.style.background="#ddd";
|
||||
document.component.tcp_send.disabled=true;
|
||||
document.component.tcp_rcv.style.background="#ddd";
|
||||
document.component.tcp_rcv.disabled=true;
|
||||
document.component.tcp_port.style.background="#ddd";
|
||||
document.component.tcp_port.disabled=true;
|
||||
}
|
||||
// type 15-18- SNMP
|
||||
if ((document.component.type.value > 14) && (document.component.type.value < 19 )){
|
||||
document.component.snmp_oid.style.background="#fff";
|
||||
document.component.snmp_oid.style.disabled=false;
|
||||
document.component.snmp_community.style.background="#fff";
|
||||
document.component.snmp_community.disabled=false;
|
||||
document.component.snmp_oid.style.background="#fff";
|
||||
document.component.snmp_oid.disabled=false;
|
||||
document.component.tcp_send.style.background="#ddd";
|
||||
document.component.tcp_send.disabled=true;
|
||||
document.component.tcp_rcv.style.background="#ddd";
|
||||
document.component.tcp_rcv.disabled=true;
|
||||
document.component.tcp_port.style.background="#ddd";
|
||||
document.component.tcp_port.disabled=true;
|
||||
}
|
||||
// type 6-7 - ICMP
|
||||
if ((document.component.type.value == 6) || (document.component.type.value == 7)){
|
||||
document.component.snmp_oid.style.background="#ddd";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.component.snmp_oid.style.background="#ddd";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.tcp_send.style.background="#ddd";
|
||||
document.component.tcp_send.disabled=true;
|
||||
document.component.tcp_rcv.style.background="#ddd";
|
||||
document.component.tcp_rcv.disabled=true;
|
||||
document.component.tcp_port.style.background="#ddd";
|
||||
document.component.tcp_port.disabled=true;
|
||||
}
|
||||
// type 8-11 - TCP
|
||||
if ((document.component.type.value > 7) && (document.component.type.value < 12)){
|
||||
document.component.snmp_oid.style.background="#ddd";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.component.tcp_send.style.background="#fff";
|
||||
document.component.tcp_send.disabled=false;
|
||||
document.component.tcp_rcv.style.background="#fff";
|
||||
document.component.tcp_rcv.disabled=false;
|
||||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
}
|
||||
// type 12 - UDP
|
||||
if (document.component.type.value == 12){
|
||||
document.component.snmp_oid.style.background="#ddd";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.component.tcp_send.style.background="#fff";
|
||||
document.component.tcp_send.disabled=false;
|
||||
document.component.tcp_rcv.style.background="#fff";
|
||||
document.component.tcp_rcv.disabled=false;
|
||||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
}
|
||||
}
|
||||
<?php if ($id_component_type == 2) :?>
|
||||
type_change ();
|
||||
<?php endif; ?>
|
||||
//-->
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - the Flexible Monitoring System
|
||||
// ============================================
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
// Please see http://pandora.sourceforge.net for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require_once ('include/config.php');
|
||||
|
||||
if (! give_acl ($config['id_user'], 0, "PM")) {
|
||||
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
||||
"Trying to access Agent Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
function push_table_row ($row, $id = false) {
|
||||
global $table;
|
||||
|
||||
if ($id)
|
||||
$data = array ($id => $row);
|
||||
else
|
||||
$data = array ($row);
|
||||
|
||||
$table->data = array_merge ($table->data, $data);
|
||||
}
|
||||
|
||||
|
||||
$table->id = 'network_component';
|
||||
$table->width = '90%';
|
||||
$table->class = 'databox_color';
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->colspan = array ();
|
||||
$table->colspan[0][1] = 3;
|
||||
$table->data = array ();
|
||||
|
||||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = print_input_text ('name', $name, '', 55, 255, true);
|
||||
|
||||
$table->data[1][0] = __('Type').' '.print_help_icon ('module_type', true);
|
||||
$sql = sprintf ('SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
$table->data[1][1] = print_select_from_sql ($sql, 'type',
|
||||
$type, ($id_component_type == 2 ? 'type_change()' : ''), '', '', true,
|
||||
false, false);
|
||||
|
||||
$table->data[1][2] = __('Module group');
|
||||
$table->data[1][3] = print_select_from_sql ('SELECT id_mg, name FROM tmodule_group ORDER BY name',
|
||||
'id_module_group', $id_module_group, '', '', '', true, false, false);
|
||||
|
||||
$table->data[2][0] = __('Group');
|
||||
$table->data[2][1] = print_select (get_network_component_groups (),
|
||||
'id_group', $id_group, '', '', '', true, false, false);
|
||||
$table->data[2][2] = __('Interval');
|
||||
$table->data[2][3] = print_input_text ('module_interval', $module_interval, '',
|
||||
5, 15, true);
|
||||
|
||||
$table->data[3][0] = __('Warning status');
|
||||
$table->data[3][1] = '<em>'.__('Min.').'</em>';
|
||||
$table->data[3][1] .= print_input_text ('min_warning', $min_warning,
|
||||
'', 5, 15, true);
|
||||
$table->data[3][1] .= '<br /><em>'.__('Max.').'</em>';
|
||||
$table->data[3][1] .= print_input_text ('max_warning', $max_warning,
|
||||
'', 5, 15, true);
|
||||
$table->data[3][2] = __('Critical status');
|
||||
$table->data[3][3] = '<em>'.__('Min.').'</em>';
|
||||
$table->data[3][3] .= print_input_text ('min_critical', $min_critical,
|
||||
'', 5, 15, true);
|
||||
$table->data[3][3] .= '<br /><em>'.__('Max.').'</em>';
|
||||
$table->data[3][3] .= print_input_text ('max_critical', $max_critical,
|
||||
'', 5, 15, true);
|
||||
|
||||
$table->data[4][0] = __('FF threshold').' '.print_help_icon ('ff_threshold', true);
|
||||
$table->data[4][1] = print_input_text ('ff_event', $ff_event,
|
||||
'', 5, 15, true);
|
||||
$table->data[4][2] = __('Historical data');
|
||||
$table->data[4][3] = print_checkbox ("history_data", 1, $history_data, true);
|
||||
|
||||
$table->data[5][0] = __('Min. Value');
|
||||
$table->data[5][1] = print_input_text ('min', $min, '', 5, 15, true);
|
||||
$table->data[5][2] = __('Max. Value');
|
||||
$table->data[5][3] = print_input_text ('max', $max, '', 5, 15, true);
|
||||
?>
|
|
@ -16,122 +16,6 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
?>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
<!--
|
||||
function type_change () {
|
||||
// type 1-4 - Generic_xxxxxx
|
||||
if ((document.modulo.tipo.value > 0) && (document.modulo.tipo.value < 5)){
|
||||
document.modulo.snmp_oid.style.background="#ddd";
|
||||
document.modulo.snmp_oid.disabled=true;
|
||||
document.modulo.snmp_community.style.background="#ddd";
|
||||
document.modulo.snmp_community.disabled=true;
|
||||
document.modulo.tcp_send.style.background="#ddd";
|
||||
document.modulo.tcp_send.disabled=true;
|
||||
document.modulo.tcp_rcv.style.background="#ddd";
|
||||
document.modulo.tcp_rcv.disabled=true;
|
||||
document.modulo.tcp_port.style.background="#ddd";
|
||||
document.modulo.tcp_port.disabled=true;
|
||||
document.modulo.ip_target.style.background="#ddd";
|
||||
document.modulo.ip_target.disabled=true;
|
||||
document.modulo.modulo_max.style.background="#fff";
|
||||
document.modulo.modulo_max.disabled=false;
|
||||
document.modulo.modulo_min.style.background="#fff";
|
||||
document.modulo.modulo_min.disabled=false;
|
||||
}
|
||||
// type 15-18- SNMP
|
||||
if ((document.modulo.tipo.value > 14) && (document.modulo.tipo.value < 19 )){
|
||||
document.modulo.snmp_oid.style.background="#fff";
|
||||
document.modulo.snmp_oid.style.disabled=false;
|
||||
document.modulo.snmp_community.style.background="#fff";
|
||||
document.modulo.snmp_community.disabled=false;
|
||||
document.modulo.combo_snmp_oid.style.background="#fff";
|
||||
document.modulo.combo_snmp_oid.disabled=false;
|
||||
document.modulo.oid.disabled=false;
|
||||
document.modulo.tcp_send.style.background="#ddd";
|
||||
document.modulo.tcp_send.disabled=true;
|
||||
document.modulo.tcp_rcv.style.background="#ddd";
|
||||
document.modulo.tcp_rcv.disabled=true;
|
||||
document.modulo.tcp_port.style.background="#ddd";
|
||||
document.modulo.tcp_port.disabled=true;
|
||||
document.modulo.ip_target.style.background="#fff";
|
||||
document.modulo.ip_target.disabled=false;
|
||||
if (document.modulo.tipo.value == 18) {
|
||||
document.modulo.modulo_max.style.background="#ddd";
|
||||
document.modulo.modulo_max.disabled=true;
|
||||
document.modulo.modulo_min.style.background="#ddd";
|
||||
document.modulo.modulo_min.disabled=true;
|
||||
} else {
|
||||
document.modulo.modulo_max.style.background="#fff";
|
||||
document.modulo.modulo_max.disabled=false;
|
||||
document.modulo.modulo_min.style.background="#fff";
|
||||
document.modulo.modulo_min.disabled=false;
|
||||
}
|
||||
}
|
||||
// type 6-7 - ICMP
|
||||
if ((document.modulo.tipo.value == 6) || (document.modulo.tipo.value == 7)){
|
||||
document.modulo.snmp_oid.style.background="#ddd";
|
||||
document.modulo.snmp_oid.disabled=true;
|
||||
document.modulo.snmp_community.style.background="#ddd";
|
||||
document.modulo.snmp_community.disabled=true;
|
||||
document.modulo.combo_snmp_oid.style.background="#ddd";
|
||||
document.modulo.combo_snmp_oid.disabled=true;
|
||||
document.modulo.oid.disabled=true;
|
||||
document.modulo.tcp_send.style.background="#ddd";
|
||||
document.modulo.tcp_send.disabled=true;
|
||||
document.modulo.tcp_rcv.style.background="#ddd";
|
||||
document.modulo.tcp_rcv.disabled=true;
|
||||
document.modulo.tcp_port.style.background="#ddd";
|
||||
document.modulo.tcp_port.disabled=true;
|
||||
document.modulo.ip_target.style.background="#fff";
|
||||
document.modulo.ip_target.disabled=false;
|
||||
document.modulo.modulo_max.style.background="#fff";
|
||||
document.modulo.modulo_max.disabled=false;
|
||||
document.modulo.modulo_min.style.background="#fff";
|
||||
document.modulo.modulo_min.disabled=false;
|
||||
}
|
||||
// type 8-11 - TCP
|
||||
if ((document.modulo.tipo.value > 7) && (document.modulo.tipo.value < 12)){
|
||||
document.modulo.snmp_oid.style.background="#ddd";
|
||||
document.modulo.snmp_oid.disabled=true;
|
||||
document.modulo.snmp_community.style.background="#ddd";
|
||||
document.modulo.snmp_community.disabled=true;
|
||||
document.modulo.tcp_send.style.background="#fff";
|
||||
document.modulo.tcp_send.disabled=false;
|
||||
document.modulo.tcp_rcv.style.background="#fff";
|
||||
document.modulo.tcp_rcv.disabled=false;
|
||||
document.modulo.tcp_port.style.background="#fff";
|
||||
document.modulo.tcp_port.disabled=false;
|
||||
document.modulo.ip_target.style.background="#fff";
|
||||
document.modulo.ip_target.disabled=false;
|
||||
document.modulo.modulo_max.style.background="#ddd";
|
||||
document.modulo.modulo_max.disabled=true;
|
||||
document.modulo.modulo_min.style.background="#ddd";
|
||||
document.modulo.modulo_min.disabled=true;
|
||||
}
|
||||
// type 12 - UDP
|
||||
if (document.modulo.tipo.value == 12){
|
||||
document.modulo.snmp_oid.style.background="#ddd";
|
||||
document.modulo.snmp_oid.disabled=true;
|
||||
document.modulo.snmp_community.style.background="#ddd";
|
||||
document.modulo.snmp_community.disabled=true;
|
||||
document.modulo.tcp_send.style.background="#fff";
|
||||
document.modulo.tcp_send.disabled=false;
|
||||
document.modulo.tcp_rcv.style.background="#fff";
|
||||
document.modulo.tcp_rcv.disabled=false;
|
||||
document.modulo.tcp_port.style.background="#fff";
|
||||
document.modulo.tcp_port.disabled=false;
|
||||
document.modulo.ip_target.style.background="#fff";
|
||||
document.modulo.ip_target.disabled=false;
|
||||
document.modulo.modulo_max.style.background="#ddd";
|
||||
document.modulo.modulo_max.disabled=true;
|
||||
document.modulo.modulo_min.style.background="#ddd";
|
||||
document.modulo.modulo_min.disabled=true;
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
<?PHP
|
||||
// Load global vars
|
||||
require ("include/config.php");
|
||||
|
||||
|
@ -144,87 +28,43 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
$component = get_network_component ($id);
|
||||
if ($component === false)
|
||||
return;
|
||||
$name = $component["name"];
|
||||
$type = $component["type"];
|
||||
$description = $component["description"];
|
||||
$modulo_max = $component["max"];
|
||||
$modulo_min = $component["min"];
|
||||
$module_interval = $component["module_interval"];
|
||||
$tcp_port = $component["tcp_port"];
|
||||
$tcp_rcv = $component["tcp_rcv"];
|
||||
$tcp_send = $component["tcp_send"];
|
||||
$snmp_community = $component["snmp_community"];
|
||||
$snmp_oid = $component["snmp_oid"];
|
||||
$id_module_group = $component["id_module_group"];
|
||||
$id_group = $component["id_group"];
|
||||
} else {
|
||||
$name = "";
|
||||
$snmp_oid = "";
|
||||
$description = "";
|
||||
$id_group = 1;
|
||||
$oid = "";
|
||||
$modulo_max = "0";
|
||||
$modulo_min = "0";
|
||||
$module_interval = "0";
|
||||
$tcp_port = "";
|
||||
$tcp_rcv = "";
|
||||
$tcp_send = "";
|
||||
if (! $id) {
|
||||
$snmp_community = "public";
|
||||
$id_module_group = "";
|
||||
$id_group = "";
|
||||
$type = 0;
|
||||
}
|
||||
|
||||
echo "<h2>".__('Module component management')."</h2>";
|
||||
echo "<h4>".__('Network component')."</h4>";
|
||||
|
||||
echo '<form name="modulo" method="post" action="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components">';
|
||||
$data = array ();
|
||||
$data[0] = _('Port');
|
||||
$data[1] = print_input_text ('tcp_port', $tcp_port, '', 5, 20, true);
|
||||
$data[2] = __('SNMP community');
|
||||
$data[3] = print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
|
||||
|
||||
echo '<table width="95%" cellspacing="4" cellpadding="4" class="databox_color">';
|
||||
push_table_row ($data, 'snmp_port');
|
||||
|
||||
// Different Form url if it's a create or if it's a update form
|
||||
$data = array ();
|
||||
$data[0] = __('SNMP OID');
|
||||
$data[1] = print_input_text ('snmp_oid', $snmp_oid, '', 30, 120, true);
|
||||
$table->colspan['snmp_2'][1] = 3;
|
||||
|
||||
echo "<tr>";
|
||||
echo '<tr><td class="datos2">'.__('Module name');
|
||||
echo "<td class='datos2'><input type='text' name='name' size='25' value='$name'>";
|
||||
push_table_row ($data, 'snmp_2');
|
||||
|
||||
//-- Module type combobox
|
||||
echo "<td class='datos2'>".__('Module type')."</td>";
|
||||
echo "<td class='datos2'>";
|
||||
echo '<select name="tipo" onChange="type_change()">';
|
||||
$sql1="SELECT id_tipo, nombre FROM ttipo_modulo WHERE id_tipo != '$type' ORDER BY nombre";
|
||||
$result=mysql_query($sql1);
|
||||
echo "<option value='$type'>". get_moduletype_name ($type);
|
||||
while ($component=mysql_fetch_array($result)){
|
||||
echo "<option value='".$component["id_tipo"]."'>".$component["nombre"]."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
/* Advanced stuff */
|
||||
$data = array ();
|
||||
$data[0] = __('TCP send').' '.print_help_icon ("tcp_send", true);
|
||||
$data[1] = print_textarea ('tcp_send', 2, 65, $tcp_send, '', true);
|
||||
$table->colspan['tcp_send'][1] = 3;
|
||||
|
||||
echo "</td></tr>";
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>".__('Group')."</td>";
|
||||
echo "<td class='datos'>";
|
||||
print_select (get_network_component_groups (),
|
||||
'id_group', $id_group, '', '', '', false, false, false);
|
||||
push_table_row ($data, 'tcp_send');
|
||||
|
||||
echo "<td class='datos'>".__('Module group')."</td>";
|
||||
echo '<td class="datos">';
|
||||
echo '<select name="id_module_group">';
|
||||
if ($id_nc != -1 )
|
||||
echo "<option value='".$id_module_group."'>".get_modulegroup_name($id_module_group);
|
||||
$sql1='SELECT * FROM tmodule_group';
|
||||
$result=mysql_query($sql1);
|
||||
while ($component=mysql_fetch_array($result))
|
||||
echo "<option value='".$component["id_mg"]."'>".$component["name"]."</option>";
|
||||
echo "</select>";
|
||||
$data[0] = __('TCP receive');
|
||||
$data[1] = print_textarea ('tcp_rcv', 2, 65, $tcp_rcv, '', true);
|
||||
$table->colspan['tcp_receive'][1] = 3;
|
||||
|
||||
echo "<tr>";
|
||||
echo '<td class="datos2">'.__('Module Interval');
|
||||
echo '<td class="datos2">';
|
||||
echo '<input type="text" name="module_interval" size="5" value="'.$module_interval.'">';
|
||||
push_table_row ($data, 'tcp_receive');
|
||||
|
||||
return;
|
||||
?>
|
||||
|
||||
<td class="datos2"><?php echo __('TCP port') ?></td>
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - the Flexible Monitoring System
|
||||
// ============================================
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
// Copyright (c) 2008 Esteban Sanche, http://www.artica.es
|
||||
// Please see http://pandora.sourceforge.net for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
// Load global variables
|
||||
require_once ('include/config.php');
|
||||
|
||||
check_login ();
|
||||
|
||||
echo '<h2>'.__('Module component management').'</h2>';
|
||||
echo '<h4>'.__('Plugin component').'</h4>';
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('Plugin');
|
||||
$data[1] = print_select_from_sql ('SELECT id, name FROM tplugin ORDER BY name',
|
||||
'id_plugin', $id_plugin, '', __('None'), 0, true, false, false);
|
||||
$table->colspan['plugin_1'][1] = 3;
|
||||
|
||||
push_table_row ($data, 'plugin_1');
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('Username');
|
||||
$data[1] = print_input_text ('plugin_user', $plugin_user, '', 15, 60, true);
|
||||
$data[2] = _('Password');
|
||||
$data[3] = print_input_password ('plugin_pass', $plugin_pass, '', 15, 60, true);
|
||||
|
||||
push_table_row ($data, 'plugin_2');
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('Plugin parameters');
|
||||
$data[0] .= print_help_icon ('plugin_parameters', true);
|
||||
$data[1] = print_input_text ('plugin_parameter', $plugin_parameter, '', 30, 60, true);
|
||||
$table->colspan['plugin_3'][1] = 3;
|
||||
|
||||
push_table_row ($data, 'plugin_3');
|
||||
|
||||
?>
|
||||
|
|
@ -29,37 +29,37 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
|
|||
return;
|
||||
}
|
||||
|
||||
echo '<h2>'.__('Module component management').'</h2>';
|
||||
echo '<h4>'.__('WMI component management').'</h4>';
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('WMI query');
|
||||
$data[1] = print_input_text ('snmp_oid', $snmp_oid, '', 25, 255, true);
|
||||
$data[2] = __('Key string').' '.print_help_icon ('wmikey', true);
|
||||
$data[3] = print_input_text ('snmp_community', $snmp_community, '', 25, 255, true);
|
||||
|
||||
push_table_row ($data, 'wmi_1');
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('Field number').' '.print_help_icon ('wmifield', true);
|
||||
$data[1] = print_input_text ('tcp_port', $tcp_port, '', 5, 25, true);
|
||||
$data[2] = __('Namespace').' '.print_help_icon ('wminamespace', true);
|
||||
$data[3] = print_input_text ('tcp_send', $tcp_send, '', 25, 255, true);
|
||||
|
||||
push_table_row ($data, 'wmi_2');
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('Username');
|
||||
$data[1] = print_input_text ('plugin_user', $plugin_user, '', 15, 255, true);
|
||||
$data[2] = __('Password');
|
||||
$data[3] = print_input_password ('plugin_pass', $plugin_pass, '', 25, 255, true);
|
||||
|
||||
push_table_row ($data, 'wmi_2');
|
||||
|
||||
return;
|
||||
// Update an existing component
|
||||
if ($id) {
|
||||
$component = get_network_component ($id);
|
||||
if ($component === false)
|
||||
return;
|
||||
$name = $component["name"];
|
||||
$type = $component["type"];
|
||||
$description = $component["description"];
|
||||
$modulo_max = $component["max"];
|
||||
$modulo_min = $component["min"];
|
||||
$module_interval = $component["module_interval"];
|
||||
$tcp_port = $component["tcp_port"];
|
||||
$tcp_rcv = $component["tcp_rcv"];
|
||||
$tcp_send = $component["tcp_send"];
|
||||
$snmp_community = $component["snmp_community"];
|
||||
$snmp_oid = $component["snmp_oid"];
|
||||
$id_module_group = $component["id_module_group"];
|
||||
$id_group = $component["id_group"];
|
||||
$plugin_user = $component["plugin_user"];
|
||||
$plugin_pass = $component["plugin_pass"];
|
||||
$plugin_parameter = $component["plugin_parameter"];
|
||||
$max_timeout = $component["max_timeout"];
|
||||
} else {
|
||||
$name = "";
|
||||
$snmp_oid = "";
|
||||
$description = "";
|
||||
$id_group = 1;
|
||||
$oid = "";
|
||||
$modulo_max = "0";
|
||||
$modulo_min = "0";
|
||||
$module_interval = "300";
|
||||
if (! $id) {
|
||||
$module_interval = 300;
|
||||
$tcp_port = "";
|
||||
$tcp_rcv = "";
|
||||
$tcp_send = "";
|
||||
|
@ -73,7 +73,6 @@ if ($id) {
|
|||
$max_timeout = 10;
|
||||
}
|
||||
|
||||
echo '<h2>' . __('WMI component management') . '</h2>';
|
||||
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components">';
|
||||
|
||||
echo '<table width="95%" cellspacing="4" cellpadding="4" class="databox_color">';
|
||||
|
|
|
@ -1170,6 +1170,10 @@ function get_url_refresh ($params = false, $relative = true, $add_post = true) {
|
|||
|
||||
if (! is_array ($params))
|
||||
$params = array ();
|
||||
/* Avoid showing login info */
|
||||
$params['pass'] = false;
|
||||
$params['nick'] = false;
|
||||
$params['unnamed'] = false;
|
||||
|
||||
//We don't clean these variables up as they're only being passed along
|
||||
foreach ($_GET as $key => $value) {
|
||||
|
|
|
@ -781,11 +781,13 @@ input[type=image] {
|
|||
}
|
||||
table#simple select#id_module_type,
|
||||
table#alert_search select#id_agent,
|
||||
table#alert_search select#id_group {
|
||||
table#alert_search select#id_group,
|
||||
table#network_component select#type {
|
||||
width: 200px;
|
||||
}
|
||||
table#simple select#select_snmp_oid,
|
||||
table#simple select#id_plugin {
|
||||
table#simple select#id_plugin,
|
||||
table#network_component select#id_plugin {
|
||||
width: 270px;
|
||||
}
|
||||
table#simple input#text-plugin_parameter,
|
||||
|
|
|
@ -483,6 +483,7 @@ CREATE TABLE IF NOT EXISTS `tnetwork_component` (
|
|||
`snmp_oid` varchar(400) NOT NULL,
|
||||
`id_module_group` tinyint(4) unsigned NOT NULL default '0',
|
||||
`id_modulo` int(10) unsigned default '0',
|
||||
`id_plugin` INTEGER unsigned default '0',
|
||||
`plugin_user` varchar(250) default '',
|
||||
`plugin_pass` varchar(250) default '',
|
||||
`plugin_parameter` text,
|
||||
|
|
Loading…
Reference in New Issue