mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
2009-01-07 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions.php: Removed safe_sql_string. Cleaned documenation so it would be parsed without errors by phpdoc * include/functions_exportserver.php: Aggregate all exportserver functions here. * include/functions_db.php: Cleaned up documentation. Added get_modulegroups and get_modulegroup_name. * godmode/db/db_refine.php: Fixed the selection box. * godmode/agentes/agent_disk_conf_editor.php: Added todo. Don't handle the footer anymore * godmode/agentes/agent_template.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_data.php, godmode/agentes/alert_manager_editor.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager.php, godmode/agentes/agent_manager.php, godmode/agentes/alert_manager.php: Removed the ACL part since it was redundant due to the inclusion. Just made sure that it was included (checking on $id_agente) * godmode/agentes/manage_config.php, godmode/agentes/manage_config_remote.php, godmode/agentes/planned_downtime.php: Style fix * godmode/agentes/configurar_agente.php godmode/agentes/module_manager_editor_prediction.php: Fixed prediction module creation/update bugs * godmode/setup/links.php: No more relying on antique (PHP4) functions git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1321 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
fa69ce621b
commit
d95cc86e82
@ -1,3 +1,41 @@
|
|||||||
|
2009-01-07 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||||
|
|
||||||
|
* include/functions.php: Removed safe_sql_string. Cleaned documenation so
|
||||||
|
it would be parsed without errors by phpdoc
|
||||||
|
|
||||||
|
* include/functions_exportserver.php: Aggregate all exportserver functions
|
||||||
|
here.
|
||||||
|
|
||||||
|
* include/functions_db.php: Cleaned up documentation. Added
|
||||||
|
get_modulegroups and get_modulegroup_name.
|
||||||
|
|
||||||
|
* godmode/db/db_refine.php: Fixed the selection box.
|
||||||
|
|
||||||
|
* godmode/agentes/agent_disk_conf_editor.php: Added todo. Don't handle
|
||||||
|
the footer anymore
|
||||||
|
|
||||||
|
* godmode/agentes/agent_template.php,
|
||||||
|
godmode/agentes/module_manager_editor_plugin.php,
|
||||||
|
godmode/agentes/module_manager_editor_wmi.php,
|
||||||
|
godmode/agentes/module_manager_editor.php,
|
||||||
|
godmode/agentes/module_manager_editor_data.php,
|
||||||
|
godmode/agentes/alert_manager_editor.php,
|
||||||
|
godmode/agentes/module_manager_editor_network.php,
|
||||||
|
godmode/agentes/module_manager.php, godmode/agentes/agent_manager.php,
|
||||||
|
godmode/agentes/alert_manager.php:
|
||||||
|
Removed the ACL part since it was redundant due to the inclusion.
|
||||||
|
Just made sure that it was included (checking on $id_agente)
|
||||||
|
|
||||||
|
* godmode/agentes/manage_config.php,
|
||||||
|
godmode/agentes/manage_config_remote.php,
|
||||||
|
godmode/agentes/planned_downtime.php: Style fix
|
||||||
|
|
||||||
|
* godmode/agentes/configurar_agente.php
|
||||||
|
godmode/agentes/module_manager_editor_prediction.php: Fixed prediction
|
||||||
|
module creation/update bugs
|
||||||
|
|
||||||
|
* godmode/setup/links.php: No more relying on antique (PHP4) functions
|
||||||
|
|
||||||
2009-01-07 Esteban Sanchez <estebans@artica.es>
|
2009-01-07 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* godmode/agentes/modificar_agente.php: Old functions replace with new
|
* godmode/agentes/modificar_agente.php: Old functions replace with new
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
<?PHP
|
<?php
|
||||||
|
//TODO: Implement an open source version
|
||||||
if (enterprise_include ("godmode/agentes/agent_disk_conf_editor.php") === ENTERPRISE_NOT_HOOK) {
|
if (enterprise_include ("godmode/agentes/agent_disk_conf_editor.php") === ENTERPRISE_NOT_HOOK) {
|
||||||
echo "<h3>This feature is not included on OpenSource version. Please visit our website to learn more about the advanced features of <a href='http://pandorafms.com'>Pandora FMS Enterprise edition</a></h3>";
|
echo "<h3>This feature is not included on the Open Source version. Please visit our website to learn more about the advanced features of <a href='http://pandorafms.com'>Pandora FMS Enterprise edition</a></h3>";
|
||||||
// Footer
|
|
||||||
echo "</div><div id='foot'>";
|
|
||||||
include ("general/footer.php");
|
|
||||||
echo "</div>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -16,24 +16,17 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
// Load global vars
|
||||||
|
enterprise_include ('godmode/agentes/agent_manager.php');
|
||||||
|
|
||||||
|
if (!isset ($id_agente)) {
|
||||||
|
die ("Not Authorized");
|
||||||
|
}
|
||||||
|
|
||||||
// ========================
|
// ========================
|
||||||
// AGENT GENERAL DATA FORM
|
// AGENT GENERAL DATA FORM
|
||||||
// ========================
|
// ========================
|
||||||
|
|
||||||
// Load global vars
|
|
||||||
require_once ('include/config.php');
|
|
||||||
|
|
||||||
enterprise_include ('godmode/agentes/agent_manager.php');
|
|
||||||
|
|
||||||
check_login ();
|
|
||||||
|
|
||||||
if (! give_acl ($config['id_user'], 0, "AW")) {
|
|
||||||
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
|
||||||
"Trying to access agent manager");
|
|
||||||
require ("general/noaccess.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<h2>".__('Agent configuration');
|
echo "<h2>".__('Agent configuration');
|
||||||
if (isset($_GET["create_agent"])) {
|
if (isset($_GET["create_agent"])) {
|
||||||
$create_agent = 1;
|
$create_agent = 1;
|
||||||
|
@ -17,16 +17,8 @@
|
|||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars
|
||||||
require_once ("include/config.php");
|
if (!isset ($id_agente)) {
|
||||||
|
die ("Not Authorized");
|
||||||
check_login ();
|
|
||||||
|
|
||||||
// Access control
|
|
||||||
if (! give_acl ($config['id_user'], 0, "AW") || !isset ($id_agente)) {
|
|
||||||
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
|
||||||
"Trying to access agent manager");
|
|
||||||
require ("general/noaccess.php");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================
|
// ==========================
|
||||||
|
@ -16,19 +16,10 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars
|
||||||
require("include/config.php");
|
if (!isset ($id_agente)) {
|
||||||
|
die ("Not Authorized");
|
||||||
check_login();
|
}
|
||||||
|
|
||||||
if (! give_acl ($config["id_user"], 0, "AW")) {
|
|
||||||
audit_db ($config["id_user"], $REMOTE_ADDR, "ACL Violation",
|
|
||||||
"Trying to access agent manager");
|
|
||||||
require ($config["homedir"]."/general/noaccess.php");
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
echo "<h2>".__('Agent configuration')." > ".__('Alerts')."</h2>";
|
echo "<h2>".__('Agent configuration')." > ".__('Alerts')."</h2>";
|
||||||
// ==========================
|
// ==========================
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
if (!isset ($id_agente)) {
|
||||||
|
die ("Not Authorized");
|
||||||
|
}
|
||||||
|
|
||||||
$add_component = get_parameter ("add_component",0);
|
$add_component = get_parameter ("add_component",0);
|
||||||
echo "<h3>".__('Alert association form');
|
echo "<h3>".__('Alert association form');
|
||||||
|
@ -16,17 +16,16 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars
|
||||||
require("include/config.php");
|
require_once ("include/config.php");
|
||||||
enterprise_include('godmode/agentes/configurar_agente.php');
|
enterprise_include ('godmode/agentes/configurar_agente.php');
|
||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
//See if id_agente is set (either POST or GET, otherwise -1
|
//See if id_agente is set (either POST or GET, otherwise -1
|
||||||
$id_agente = get_parameter ("id_agente", -1);
|
$id_agente = (int) get_parameter ("id_agente", -1);
|
||||||
|
|
||||||
$group = dame_id_grupo ($id_agente); //Will return 0 or an int
|
$group = get_agent_group ($id_agente);
|
||||||
|
|
||||||
if (! give_acl($config["id_user"], $group, "AW")) {
|
if (! give_acl($config["id_user"], $group, "AW")) {
|
||||||
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
||||||
@ -35,7 +34,6 @@ if (! give_acl($config["id_user"], $group, "AW")) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get passed variables
|
// Get passed variables
|
||||||
$tab = get_parameter_get ("tab", "main");
|
$tab = get_parameter_get ("tab", "main");
|
||||||
$form_moduletype = get_parameter_post ("form_moduletype");
|
$form_moduletype = get_parameter_post ("form_moduletype");
|
||||||
@ -699,7 +697,6 @@ if ((isset ($_POST["update_module"])) || (isset ($_POST["insert_module"]))) {
|
|||||||
$form_minvalue = (int) get_parameter_post ("form_minvalue",0);
|
$form_minvalue = (int) get_parameter_post ("form_minvalue",0);
|
||||||
$form_maxvalue = (int) get_parameter ("form_maxvalue",0);
|
$form_maxvalue = (int) get_parameter ("form_maxvalue",0);
|
||||||
$form_interval = (int) get_parameter ("form_interval",300);
|
$form_interval = (int) get_parameter ("form_interval",300);
|
||||||
$form_id_prediction_module = (int) get_parameter ("form_id_prediction_module",0);
|
|
||||||
$form_id_plugin = (int) get_parameter ("form_id_plugin",0);
|
$form_id_plugin = (int) get_parameter ("form_id_plugin",0);
|
||||||
$form_id_export = (int) get_parameter ("form_id_export",0);
|
$form_id_export = (int) get_parameter ("form_id_export",0);
|
||||||
$form_disabled = (bool) get_parameter ("form_disabled",0);
|
$form_disabled = (bool) get_parameter ("form_disabled",0);
|
||||||
@ -725,6 +722,7 @@ if ((isset ($_POST["update_module"])) && (!isset ($_POST["oid"]))) { // if modif
|
|||||||
$snmp_oid = $form_combo_snmp_oid;
|
$snmp_oid = $form_combo_snmp_oid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf ("UPDATE tagente_modulo SET
|
$sql = sprintf ("UPDATE tagente_modulo SET
|
||||||
descripcion = '%s',
|
descripcion = '%s',
|
||||||
id_module_group = %d,
|
id_module_group = %d,
|
||||||
@ -801,7 +799,7 @@ if (((!isset ($_POST["nc"]) OR ($_POST["nc"] == -1))) && (!isset ($_POST["oid"])
|
|||||||
VALUES (%d,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%d,'%s','%s',%d,'%s','%s','%s',%d,%d,%d,%d,%d,%d,'%s')",
|
VALUES (%d,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%d,'%s','%s',%d,'%s','%s','%s',%d,%d,%d,%d,%d,%d,'%s')",
|
||||||
$id_agente, $form_id_tipo_modulo, $form_name, $form_description, $form_maxvalue, $form_minvalue, $form_snmp_oid, $form_snmp_community,
|
$id_agente, $form_id_tipo_modulo, $form_name, $form_description, $form_maxvalue, $form_minvalue, $form_snmp_oid, $form_snmp_community,
|
||||||
$form_id_module_group, $form_interval, $form_ip_target, $form_tcp_port, $form_tcp_rcv, $form_tcp_send, $form_id_export, $form_plugin_user, $form_plugin_pass,
|
$form_id_module_group, $form_interval, $form_ip_target, $form_tcp_port, $form_tcp_rcv, $form_tcp_send, $form_id_export, $form_plugin_user, $form_plugin_pass,
|
||||||
$form_plugin_parameter, $form_id_plugin, $form_post_process, $form_id_prediction_module, $form_max_timeout, $form_disabled, $form_id_modulo, $form_custom_id);
|
$form_plugin_parameter, $form_id_plugin, $form_post_process, $form_prediction_module, $form_max_timeout, $form_disabled, $form_id_modulo, $form_custom_id);
|
||||||
$id_agente_modulo = process_sql ($sql, 'insert_id');
|
$id_agente_modulo = process_sql ($sql, 'insert_id');
|
||||||
|
|
||||||
if ($id_agente_modulo === false){
|
if ($id_agente_modulo === false){
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars
|
||||||
require ("include/config.php");
|
require_once ("include/config.php");
|
||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars
|
||||||
require ("include/config.php");
|
require_once ("include/config.php");
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
|
@ -16,24 +16,20 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars
|
||||||
require_once ("include/config.php");
|
require_once ("include/config.php");
|
||||||
|
|
||||||
if (give_acl($config["id_user"], 0, "AW") != 1) {
|
check_login ();
|
||||||
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation",
|
|
||||||
"Trying to access Agent Management");
|
|
||||||
require ("general/noaccess.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take some parameters (GET)
|
// Take some parameters (GET)
|
||||||
$offset = get_parameter ("offset", 0);
|
$offset = get_parameter ("offset", 0);
|
||||||
$group_id = get_parameter ("group_id", 0);
|
$group_id = get_parameter ("group_id", 0);
|
||||||
$ag_group = get_parameter ("ag_group", -1);
|
$ag_group = get_parameter ("ag_group", -1);
|
||||||
|
|
||||||
if (($ag_group == -1) && ($group_id != 0)) {
|
if (($ag_group == -1) && ($group_id != 0)) {
|
||||||
$ag_group = $group_id;
|
$ag_group = $group_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset ($_GET["ag_group_refresh"])){
|
if (isset ($_GET["ag_group_refresh"])){
|
||||||
$ag_group = get_parameter_get ("ag_group_refresh", -1);
|
$ag_group = get_parameter_get ("ag_group_refresh", -1);
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,9 @@
|
|||||||
|
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars
|
||||||
require("include/config.php");
|
if (!isset ($id_agente)) {
|
||||||
check_login();
|
die ("Not Authorized");
|
||||||
|
}
|
||||||
if (give_acl($config["id_user"], 0, "AW")!=1) {
|
|
||||||
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
|
|
||||||
require ($config["homedir"]."/general/noaccess.php");
|
|
||||||
exit;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
echo "<h2>".__('Agent configuration')." > ".__('Modules')."</h2>";
|
echo "<h2>".__('Agent configuration')." > ".__('Modules')."</h2>";
|
||||||
|
|
||||||
|
@ -16,18 +16,12 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
if (!isset ($id_agente)) {
|
||||||
|
die ("Not Authorized");
|
||||||
// General startup for established session
|
|
||||||
check_login();
|
|
||||||
|
|
||||||
// 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");
|
|
||||||
require ($config["homedir"]."/general/noaccess.php");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once ("include/functions_exportserver.php");
|
||||||
|
|
||||||
// Following variables come from module_manager.php -> configurar_agente.php :
|
// Following variables come from module_manager.php -> configurar_agente.php :
|
||||||
//
|
//
|
||||||
// $form_moduletype: could be [1] Agent module/Data server, [2] network server, [4] plugin server, [6] wmiserver, or [5] predictionserver
|
// $form_moduletype: could be [1] Agent module/Data server, [2] network server, [4] plugin server, [6] wmiserver, or [5] predictionserver
|
||||||
|
@ -17,7 +17,9 @@
|
|||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
// General startup for established session
|
// General startup for established session
|
||||||
check_login();
|
if (!isset ($id_agente)) {
|
||||||
|
die ("Not Authorized");
|
||||||
|
}
|
||||||
|
|
||||||
// get the variable form_moduletype
|
// get the variable form_moduletype
|
||||||
$form_moduletype = get_parameter_post ("form_moduletype");
|
$form_moduletype = get_parameter_post ("form_moduletype");
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
|
|
||||||
// General startup for established session
|
// General startup for established session
|
||||||
global $config;
|
if (!isset ($id_agente)) {
|
||||||
check_login();
|
die ("Not Authorized");
|
||||||
global $form_snmp_community;
|
}
|
||||||
|
|
||||||
// get the variable form_moduletype
|
// get the variable form_moduletype
|
||||||
$form_moduletype = get_parameter_post ("form_moduletype");
|
$form_moduletype = get_parameter_post ("form_moduletype");
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
|
|
||||||
|
|
||||||
// General startup for established session
|
// General startup for established session
|
||||||
global $config;
|
if (!isset ($id_agente)) {
|
||||||
check_login();
|
die ("Not Authorized");
|
||||||
|
}
|
||||||
|
|
||||||
// get the variable form_moduletype
|
// get the variable form_moduletype
|
||||||
$form_moduletype = get_parameter_post ("form_moduletype");
|
$form_moduletype = get_parameter_post ("form_moduletype");
|
||||||
|
@ -16,11 +16,10 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// General startup for established session
|
// General startup for established session
|
||||||
global $config;
|
if (!isset ($id_agente)) {
|
||||||
check_login();
|
die ("Not Authorized");
|
||||||
|
}
|
||||||
|
|
||||||
// get the variable form_moduletype
|
// get the variable form_moduletype
|
||||||
$form_moduletype = get_parameter_post ("form_moduletype");
|
$form_moduletype = get_parameter_post ("form_moduletype");
|
||||||
@ -30,7 +29,7 @@ $update_module_id = get_parameter_get ("update_module");
|
|||||||
$disabled_status = NULL;
|
$disabled_status = NULL;
|
||||||
|
|
||||||
// Specific ACL check
|
// Specific ACL check
|
||||||
if (give_acl($config["id_user"], 0, "AW")!=1) {
|
if (give_acl($config["id_user"], 0, "AW") != 1) {
|
||||||
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
|
audit_db($config["id_user"], $REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
|
||||||
require ($config["homedir"]."/general/noaccess.php");
|
require ($config["homedir"]."/general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
@ -82,112 +81,102 @@ echo "<h3>".__('Module assignment')." - ".__('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 '<form name="modulo" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
||||||
// Whether in update or insert mode
|
// Whether in update or insert mode
|
||||||
if ($update_module_id == NULL){
|
if ($update_module_id == NULL){
|
||||||
echo "<input type='hidden' name='insert_module' value='1'>";
|
print_input_hidden ("insert_module", 1);
|
||||||
} else {
|
} else {
|
||||||
echo "<input type='hidden' name='update_module' value='1'>";
|
print_input_hidden ("update_module", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//id_agente_module
|
//id_agente_module
|
||||||
echo "<input type='hidden' name='id_agente_modulo'' value='".$update_module_id."'>";
|
print_input_hidden ("id_agente_modulo", $update_module_id);
|
||||||
|
|
||||||
// id_modulo 5 - Prediction
|
// id_modulo 5 - Prediction
|
||||||
echo "<input type='hidden' name='form_id_modulo' value='5'>";
|
print_input_hidden ("form_id_modulo", 5);
|
||||||
|
|
||||||
// name / disabled
|
// name / disabled
|
||||||
echo '<table width="600" cellpadding="4" cellspacing="4" class="databox_color">';
|
echo '<table width="600" cellpadding="4" cellspacing="4" class="databox_color">';
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td class="datos2">'.__('Module name')."</td>";
|
echo '<td class="datos2">'.__('Module name').'</td>';
|
||||||
echo '<td class="datos2"><input type="text" name="form_name" size="35" value="'.$form_name.'"></td>';
|
echo '<td class="datos2">';
|
||||||
echo '<td class="datos2">'.__('Disabled')."</td>";
|
print_input_text ("form_name", $form_name, '', 35);
|
||||||
echo '<td class="datos2"><input type="checkbox" name="form_disabled" value="1" "'.$disabled_status.'"></td>';
|
echo '<td class="datos2">'.__('Disabled').'</td>';
|
||||||
echo '</tr>';
|
echo '<td class="datos2">';
|
||||||
|
print_checkbox ("form_disabled", 1, $disabled_status);
|
||||||
|
echo '</td></tr>';
|
||||||
|
|
||||||
|
//Source module
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td class="datos">'.__('Source module');
|
echo '<td class="datos">'.__('Source module');
|
||||||
pandora_help ("prediction_source_module");
|
pandora_help ("prediction_source_module");
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '<td class="datos" colspan="3">';
|
echo '<td class="datos" colspan="3">';
|
||||||
echo '<select name="form_id_prediction_module">';
|
|
||||||
$sql1='SELECT id_agente_modulo, tagente_modulo.nombre, tagente.id_agente, tagente.id_grupo, tagente.nombre FROM tagente_modulo, tagente WHERE id_tipo_modulo NOT IN (100,24,19,20,21,22,23,17,10,2) AND tagente.id_agente = tagente_modulo.id_agente ORDER BY tagente.nombre';
|
|
||||||
$result=mysql_query($sql1);
|
|
||||||
while ($row=mysql_fetch_array($result)){
|
|
||||||
if (give_acl($config["id_user"], $row[3], "AR"))
|
|
||||||
echo "<option value='".$row[0]."'>".$row[1]. " / ". $row[4];
|
|
||||||
}
|
|
||||||
echo "</select>";
|
|
||||||
echo "</tr>";
|
|
||||||
|
|
||||||
// module type
|
$agents = get_group_agents (array_keys (get_user_groups ($config["id_user"], "AW")));
|
||||||
echo '</tr><tr>';
|
$fields = array ();
|
||||||
echo '<td class="datos2">'. __('Module type') .'</td>';
|
|
||||||
echo '<td class="datos2">';
|
foreach ($agents as $agent_id => $agent_name) {
|
||||||
if ($update_module_id != NULL){
|
$modules = get_agent_modules ($agent_id);
|
||||||
echo "<span class='redi'>Not available in edition mode</span>";
|
foreach ($modules as $module_id => $module_name) {
|
||||||
echo "<input type='hidden' name='form_id_tipo_modulo' value='".$form_id_tipo_modulo."'>";
|
$fields[$module_id] = $agent_name.' / '.$module_name;
|
||||||
} 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 '<td class="datos2">'.__('Interval')."</td>";
|
print_select ($fields, "form_prediction_module", $form_prediction_module);
|
||||||
echo '<td class="datos2"><input type="text" name="form_interval" size="5" value="'.$form_interval.'"></td></tr>';
|
echo '</td></tr>';
|
||||||
|
|
||||||
|
// module type / interval
|
||||||
|
echo '<tr><td class="datos2">'. __('Module type') .'</td><td class="datos2">';
|
||||||
|
if (!empty ($update_module_id)) {
|
||||||
|
echo '<span class="redi">Not available in edition mode</span>';
|
||||||
|
print_input_hidden ("form_id_tipo_modulo", $form_id_tipo_modulo);
|
||||||
|
} else {
|
||||||
|
$fields = array ();
|
||||||
|
$fields[1] = get_moduletype_name (1);
|
||||||
|
$fields[2] = get_moduletype_name (2);
|
||||||
|
print_select ($fields, "form_id_tipo_modulo");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<td class="datos2">'.__('Interval').'</td><td class="datos2">';
|
||||||
|
print_input_text ("form_interval", $form_interval, '', 5);
|
||||||
|
echo '</td></tr>';
|
||||||
|
|
||||||
// Post process / Export server
|
// Post process / Export server
|
||||||
echo '<tr>';
|
echo '<tr><td class="datos">'.__('Module group').'</td><td class="datos">';
|
||||||
echo '<td class="datos">'.__('Module group')."</td>";
|
$fields = get_modulegroups ();
|
||||||
echo '<td class="datos"><select name="form_id_module_group">';
|
print_select ($fields, "form_id_module_group", $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>";
|
|
||||||
}
|
|
||||||
$sql1='SELECT * FROM tmodule_group';
|
|
||||||
$result=mysql_query($sql1);
|
|
||||||
while ($row=mysql_fetch_array($result)){
|
|
||||||
echo "<option value='".$row["id_mg"]."'>".$row["name"]."</option>";
|
|
||||||
}
|
|
||||||
echo '</select>';
|
|
||||||
// Export target is a server where the data will be sent
|
// Export target is a server where the data will be sent
|
||||||
echo '<td class="datos">'.__('Export target')."</td>";
|
echo '<td class="datos">'.__('Export target').'</td>';
|
||||||
echo '<td class="datos"><select name="form_id_export">';
|
echo '<td class="datos">';
|
||||||
if ($form_id_export != 0){
|
|
||||||
echo "<option value='".$form_id_export."'>".dame_nombre_servidorexportacion($form_id_export)."</option>";
|
$fields = get_exportservers_info ();
|
||||||
}
|
$fields[0] = __('None');
|
||||||
echo "<option value='0'>".__('None')."</option>";
|
|
||||||
$sql1='SELECT id, name FROM tserver_export ORDER BY name;';
|
print_select ($fields, "form_id_export", $form_id_export);
|
||||||
$result=mysql_query($sql1);
|
echo '</td></tr>';
|
||||||
while ($row=mysql_fetch_array($result)){
|
|
||||||
echo "<option value='".$row["id"]."'>".$row["name"]."</option>";
|
|
||||||
}
|
|
||||||
echo '</select>';
|
|
||||||
echo '</tr>';
|
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td valign="top" class="datos2">'.__('Description')."</td>";
|
echo '<td valign="top" class="datos2">'.__('Description').'</td>';
|
||||||
echo '<td valign="top" class="datos2" colspan="3"><textarea name="form_description" cols="65" rows="2">'.$form_description.'</textarea>';
|
echo '<td valign="top" class="datos2" colspan="3">';
|
||||||
echo '</tr>';
|
print_textarea ("form_description", 2, 65, $form_description);
|
||||||
|
echo '</td></tr>';
|
||||||
|
|
||||||
// Custom ID
|
// Custom ID
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td class="datos">'.__('Custom ID')."</td>";
|
echo '<td class="datos">'.__('Custom ID').'</td>';
|
||||||
echo '<td class="datos" colspan="3"><input type="text" name="form_custom_id" size="20" value="'.$form_custom_id.'"></td>';
|
echo '<td class="datos" colspan="3">';
|
||||||
echo '</tr>';
|
print_input_text ("form_custom_id", $form_custom_id, '', 20);
|
||||||
|
echo '</td></tr>';
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
// Submit
|
// Submit
|
||||||
echo '<table width="680" cellpadding="4" cellspacing="4">';
|
echo '<div style="width:680px; text-align: right">';
|
||||||
echo '<td valign="top" align="right">';
|
|
||||||
if ($update_module_id == NULL){
|
if ($update_module_id == NULL){
|
||||||
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.__('Create').'">';
|
print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
|
||||||
} else {
|
} else {
|
||||||
echo '<input name="updbutton" type="submit" class="sub wand" value="'.__('Update').'">';
|
print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
|
||||||
}
|
}
|
||||||
echo '</table>';
|
echo '</div>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -16,11 +16,10 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// General startup for established session
|
// General startup for established session
|
||||||
global $config;
|
if (!isset ($id_agente)) {
|
||||||
check_login();
|
die ("Not Authorized");
|
||||||
|
}
|
||||||
|
|
||||||
// get the variable form_moduletype
|
// get the variable form_moduletype
|
||||||
$form_moduletype = get_parameter_post ("form_moduletype");
|
$form_moduletype = get_parameter_post ("form_moduletype");
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// Pandora FMS - the Flexible Monitoring System
|
// Pandora FMS - the Flexible Monitoring System
|
||||||
// ============================================
|
// ============================================
|
||||||
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||||
|
// Copyright (c) 2008-2009 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||||
// Please see http://pandora.sourceforge.net for full contribution list
|
// Please see http://pandora.sourceforge.net for full contribution list
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
@ -16,13 +17,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
// Copyright (c) 2008 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
|
||||||
// Please see http://pandora.sourceforge.net for full contribution list
|
|
||||||
|
|
||||||
|
|
||||||
// Load global vars
|
// Load global vars
|
||||||
require("include/config.php");
|
require_once ("include/config.php");
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
|
@ -64,13 +64,13 @@ echo '<div style="float:left; width: 250px;">';
|
|||||||
echo '<b>'.__('Source agent').'</b><br />';
|
echo '<b>'.__('Source agent').'</b><br />';
|
||||||
|
|
||||||
$agent_selected = get_parameter_post ("origen", 0);
|
$agent_selected = get_parameter_post ("origen", 0);
|
||||||
$agents = get_group_agents (get_user_groups ($config["id_user"], "AW"));
|
$agents = get_group_agents (array_keys (get_user_groups ($config["id_user"], "AW")));
|
||||||
|
|
||||||
print_select ($agents, "origen", $agent_selected, 'javascript:this.form.update_agent.click();', __('No agent selected'), '0', false, false, false, 'w130');
|
print_select ($agents, "origen", $agent_selected, 'javascript:this.form.update_agent.click();', __('No agent selected'), '0', false, false, false, 'w130');
|
||||||
|
|
||||||
echo ' ';
|
echo ' ';
|
||||||
|
|
||||||
print_submit_button (__('Get Info'), 'update_agent', false, 'class="sub upd"');
|
print_submit_button (__('Get Info'), 'update_agent', false, 'style="display:none;"');
|
||||||
|
|
||||||
echo '<br /><br />';
|
echo '<br /><br />';
|
||||||
echo '<b>'.__('Modules').'</b><br /><br />';
|
echo '<b>'.__('Modules').'</b><br /><br />';
|
||||||
|
@ -29,9 +29,8 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user']
|
|||||||
|
|
||||||
|
|
||||||
if (isset($_POST["create"])){ // If create
|
if (isset($_POST["create"])){ // If create
|
||||||
$name = entrada_limpia($_POST["name"]);
|
$name = get_parameter_post ("name");
|
||||||
$link = entrada_limpia($_POST["link"]);
|
$link = get_parameter_post ("link");
|
||||||
$link = safe_sql_string ($link);
|
|
||||||
$sql_insert = "INSERT INTO tlink (name,link) VALUES ('$name','$link')";
|
$sql_insert = "INSERT INTO tlink (name,link) VALUES ('$name','$link')";
|
||||||
$result=mysql_query($sql_insert);
|
$result=mysql_query($sql_insert);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
|
@ -43,9 +43,9 @@ function pandora_help ($help_id, $return = false) {
|
|||||||
* entities. UTF-8 is necessary for foreign chars like asian
|
* entities. UTF-8 is necessary for foreign chars like asian
|
||||||
* and our databases are (or should be) UTF-8
|
* and our databases are (or should be) UTF-8
|
||||||
*
|
*
|
||||||
* @param mixed String or array of strings to be cleaned.
|
* @param (mixed) String or array of strings to be cleaned.
|
||||||
*
|
*
|
||||||
* @return The cleaned string.
|
* @return (mixed) The cleaned string or array.
|
||||||
*/
|
*/
|
||||||
function safe_input ($value) {
|
function safe_input ($value) {
|
||||||
if (is_numeric ($value))
|
if (is_numeric ($value))
|
||||||
@ -135,21 +135,21 @@ function output_clean_strict ($string) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WARNING: Deprecated function, use safe_input. Keep from compatibility.
|
* DEPRECATED use safe_input. Keep for compatibility.
|
||||||
*/
|
*/
|
||||||
function entrada_limpia ($string) {
|
function entrada_limpia ($string) {
|
||||||
return safe_input ($string);
|
return safe_input ($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs an extra clean to a string.
|
* Performs an extra clean to a string. Makes it usable in an URL
|
||||||
*
|
*
|
||||||
* It's useful on sec and sec2 index parameters, to avoid the use of
|
* It's useful on sec and sec2 index parameters, to avoid the use of
|
||||||
* malicious parameters. The string is also stripped to 125 charactes.
|
* malicious parameters. The string is also stripped to 125 charactes.
|
||||||
*
|
*
|
||||||
* @param string String to clean
|
* @param (string) String to clean
|
||||||
*
|
*
|
||||||
* @return
|
* @return (string) Cleaned string
|
||||||
*/
|
*/
|
||||||
function safe_url_extraclean ($string) {
|
function safe_url_extraclean ($string) {
|
||||||
/* Clean "://" from the strings
|
/* Clean "://" from the strings
|
||||||
@ -371,10 +371,10 @@ function pagination ($count, $url, $offset, $pagination = 0) {
|
|||||||
* If the number is zero or it's integer value, no decimals are
|
* If the number is zero or it's integer value, no decimals are
|
||||||
* shown. Otherwise, the number of decimals are given in the call.
|
* shown. Otherwise, the number of decimals are given in the call.
|
||||||
*
|
*
|
||||||
* @param number Number to be rendered
|
* @param (float) Number to be rendered
|
||||||
* @param decimals Number of decimals to be shown. Default value: 1
|
* @param (int) Number of decimals to be shown. Default value: 1
|
||||||
*
|
*
|
||||||
* @return
|
* @return (string) A formatted number for use in output
|
||||||
*/
|
*/
|
||||||
function format_numeric ($number, $decimals = 1) {
|
function format_numeric ($number, $decimals = 1) {
|
||||||
//Translate to float in case there are characters in the string so
|
//Translate to float in case there are characters in the string so
|
||||||
@ -442,9 +442,9 @@ function human_time_comparation ($timestamp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function get_system_time
|
* This function gets the time from either system or sql based on preference and returns it
|
||||||
* @abstract This function gets the time from either system or sql based on preference and returns it
|
*
|
||||||
* @result Unix timestamp
|
* @return (int) Unix timestamp
|
||||||
**/
|
**/
|
||||||
function get_system_time () {
|
function get_system_time () {
|
||||||
global $config;
|
global $config;
|
||||||
@ -525,11 +525,7 @@ function human_date_relative ($seconds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* DEPRECATED: Use print_timestamp instead
|
||||||
*
|
|
||||||
* @param lapse
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
function render_time ($lapse) {
|
function render_time ($lapse) {
|
||||||
$myhour = intval (($lapse*30) / 60);
|
$myhour = intval (($lapse*30) / 60);
|
||||||
@ -547,15 +543,15 @@ function render_time ($lapse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a paramter from a request.
|
* Get a parameter from a request.
|
||||||
*
|
*
|
||||||
* It checks first on post request, if there were nothing defined, it
|
* It checks first on post request, if there were nothing defined, it
|
||||||
* would return get request
|
* would return get request
|
||||||
*
|
*
|
||||||
* @param name
|
* @param (string) name of the parameter in the $_POST or $_GET array
|
||||||
* @param default
|
* @param (mixed) default value if it wasn't found
|
||||||
*
|
*
|
||||||
* @return
|
* @return (mixed) Whatever was in that parameter, cleaned however
|
||||||
*/
|
*/
|
||||||
function get_parameter ($name, $default = '') {
|
function get_parameter ($name, $default = '') {
|
||||||
// POST has precedence
|
// POST has precedence
|
||||||
@ -628,11 +624,11 @@ function get_alert_priority ($priority = 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets a translated string of names of days based on the boolean properties of it's input ($row["monday"] = (bool) 1 will output Mon)
|
||||||
*
|
*
|
||||||
|
* @param (array) The array of boolean values to check. They should have monday -> sunday in boolean
|
||||||
*
|
*
|
||||||
* @param row
|
* @return (string) Translated names of days
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
function get_alert_days ($row) {
|
function get_alert_days ($row) {
|
||||||
global $config;
|
global $config;
|
||||||
@ -669,11 +665,11 @@ function get_alert_days ($row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the alert times values and returns them as string
|
||||||
*
|
*
|
||||||
|
* @param (array) Array with time_from and time_to in it's keys
|
||||||
*
|
*
|
||||||
* @param row2
|
* @return (string) A string with the concatenated values
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
function get_alert_times ($row2) {
|
function get_alert_times ($row2) {
|
||||||
if ($row2["time_from"]){
|
if ($row2["time_from"]){
|
||||||
@ -693,14 +689,14 @@ function get_alert_times ($row2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* DEPRECATED: This has been replaced with print_table or format_alert_row
|
||||||
*
|
*
|
||||||
* @param row2
|
* @param row2
|
||||||
* @param tdcolor
|
* @param tdcolor
|
||||||
* @param id_tipo_modulo
|
* @param id_tipo_modulo
|
||||||
* @param combined
|
* @param combined
|
||||||
*
|
*
|
||||||
* @return
|
* @return (string) HTML code
|
||||||
*/
|
*/
|
||||||
function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $combined = 0){
|
function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $combined = 0){
|
||||||
global $config;
|
global $config;
|
||||||
@ -805,9 +801,9 @@ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $c
|
|||||||
/**
|
/**
|
||||||
* Formats a row from the alert table and returns an array usable in the table function
|
* Formats a row from the alert table and returns an array usable in the table function
|
||||||
*
|
*
|
||||||
* @param $alert (array) A valid (non empty) row from the alert table
|
* @param (array) $alert A valid (non empty) row from the alert table
|
||||||
* @param $agent (bool) Whether to print the agent information with the module information
|
* @param (bool) $combined Whether or not this is a combined alert
|
||||||
* @param $combined (bool) Whether or not this is a combined alert
|
* @param (bool) $agent Whether to print the agent information with the module information
|
||||||
*
|
*
|
||||||
* @return (array) A formatted array with proper html for use in $table -> 7 columns
|
* @return (array) A formatted array with proper html for use in $table -> 7 columns
|
||||||
*/
|
*/
|
||||||
@ -1110,17 +1106,6 @@ function unsafe_string ($string) {
|
|||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deprecated by get_parameter functions and safe_input funcitons
|
|
||||||
* Magic Quotes are deprecated in PHP5 and will be removed in PHP6
|
|
||||||
*/
|
|
||||||
|
|
||||||
function safe_sql_string ($string) {
|
|
||||||
if (get_magic_quotes_gpc () == 0)
|
|
||||||
$string = mysql_escape_string ($string);
|
|
||||||
return $string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enterprise functions
|
* enterprise functions
|
||||||
*/
|
*/
|
||||||
|
@ -192,8 +192,7 @@ function give_disabled_group ($id_group) {
|
|||||||
/**
|
/**
|
||||||
* Get all the agents within a group(s).
|
* Get all the agents within a group(s).
|
||||||
*
|
*
|
||||||
* @param id_group Group id or a comma delimited list of id_groups or an array
|
* @param id_group Group id or an array of ID's
|
||||||
* of ID's
|
|
||||||
*
|
*
|
||||||
* @param disabled Add disabled agents to agents. Default: False.
|
* @param disabled Add disabled agents to agents. Default: False.
|
||||||
*
|
*
|
||||||
@ -202,17 +201,15 @@ function give_disabled_group ($id_group) {
|
|||||||
* @return An array with all agents in the group or an empty array
|
* @return An array with all agents in the group or an empty array
|
||||||
*/
|
*/
|
||||||
function get_group_agents ($id_group, $disabled = false, $case = "lower") {
|
function get_group_agents ($id_group, $disabled = false, $case = "lower") {
|
||||||
$id_group = safe_int ($id_group, 1);
|
$id_group = (array) safe_int ($id_group, 1);
|
||||||
|
|
||||||
if (is_array ($id_group)) {
|
//If id_group is an array, then
|
||||||
//If id_group is an array, then
|
if (in_array (1, $id_group)) {
|
||||||
if (in_array (1, $id_group)) {
|
//If All is included in the group list, just select All
|
||||||
//If All is included in the group list, just select All
|
$id_group = 1;
|
||||||
$id_group = 1;
|
} else {
|
||||||
} else {
|
//If All is not included, select what we need
|
||||||
//If All is not included, select what we need
|
$id_group = implode (",", $id_group);
|
||||||
$id_group = implode (",", $id_group);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 'All' group must return all agents */
|
/* 'All' group must return all agents */
|
||||||
@ -808,7 +805,7 @@ function get_server_name ($id_server) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the module type name.
|
* Get the module type name (type = generic_data, remote_snmp, ...)
|
||||||
*
|
*
|
||||||
* @param id_type Type id
|
* @param id_type Type id
|
||||||
*
|
*
|
||||||
@ -828,9 +825,9 @@ function dame_id_grupo ($id_agent) {
|
|||||||
/**
|
/**
|
||||||
* Get the number of pandora data in the database.
|
* Get the number of pandora data in the database.
|
||||||
*
|
*
|
||||||
* @param id_agent Agent id or 0 for all
|
* @param (int) $id_agent Agent id or 0 for all
|
||||||
*
|
*
|
||||||
* @return
|
* @return (int) The number of data in the database
|
||||||
*/
|
*/
|
||||||
function dame_numero_datos ($id_agent = 0) {
|
function dame_numero_datos ($id_agent = 0) {
|
||||||
if ($id_agent < 1) {
|
if ($id_agent < 1) {
|
||||||
@ -950,12 +947,12 @@ function existe ($id_user) {
|
|||||||
*
|
*
|
||||||
* If the module interval is not set, the agent interval is returned
|
* If the module interval is not set, the agent interval is returned
|
||||||
*
|
*
|
||||||
* @param id_agent_module Id agent module to get the interval value.
|
* @param (int) $id_agent_module Id agent module to get the interval value.
|
||||||
*
|
*
|
||||||
* @return
|
* @return (int) Module interval or agent interval if no module interval
|
||||||
*/
|
*/
|
||||||
function get_module_interval ($id_agent_module) {
|
function get_module_interval ($id_agent_module) {
|
||||||
$interval = (int) get_db_value ('module_interval', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
|
$interval = (int) get_db_value ('module_interval', 'tagente_modulo', 'id_agente_modulo', (int) $id_agent_module);
|
||||||
if ($interval > 0)
|
if ($interval > 0)
|
||||||
return $interval;
|
return $interval;
|
||||||
|
|
||||||
@ -1530,7 +1527,7 @@ function get_db_all_rows_field_filter ($table, $field, $condition, $order_field
|
|||||||
*
|
*
|
||||||
* @return A matrix with all the values in the table that matches the condition in the field
|
* @return A matrix with all the values in the table that matches the condition in the field
|
||||||
*/
|
*/
|
||||||
function get_db_all_fields_in_table ($table, $field, $condition = '', $order_field = '') {
|
function get_db_all_fields_in_table ($table, $field = '', $condition = '', $order_field = '') {
|
||||||
$sql = sprintf ("SELECT * FROM `%s`", $table);
|
$sql = sprintf ("SELECT * FROM `%s`", $table);
|
||||||
if ($condition != '') {
|
if ($condition != '') {
|
||||||
$sql .= sprintf (" WHERE `%s` = '%s'", $field, $condition);
|
$sql .= sprintf (" WHERE `%s` = '%s'", $field, $condition);
|
||||||
@ -1861,11 +1858,11 @@ function check_server_status () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* DEPRECATED or MOVE: Will show a small HTML table with some compound alert information
|
||||||
*
|
*
|
||||||
|
* @param (int) id_combined_alert
|
||||||
*
|
*
|
||||||
* @param id_combined_alert
|
* @return (string) HTML block
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
function show_alert_row_mini ($id_combined_alert) {
|
function show_alert_row_mini ($id_combined_alert) {
|
||||||
$color=1;
|
$color=1;
|
||||||
@ -2183,9 +2180,9 @@ function get_server_info ($id_server = -1) {
|
|||||||
/**
|
/**
|
||||||
* This function will return the number of all agent modules in the database
|
* This function will return the number of all agent modules in the database
|
||||||
*
|
*
|
||||||
* @param integer or array of integers with agent(s). Leave empty to select everything
|
* @param (int) or (array) of integers with agent(s). Leave empty to select everything
|
||||||
*
|
*
|
||||||
* @return integer with the number of agent modules
|
* @return (int) The number of agent modules
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
function get_agent_modules_count ($id_agent = 0) {
|
function get_agent_modules_count ($id_agent = 0) {
|
||||||
@ -2235,19 +2232,17 @@ function get_group_name ($id_group) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function process_alerts_validate
|
* Validates an alert id or an array of alert id's
|
||||||
* @abstract Validates an alert id or an array of alert id's
|
*
|
||||||
* @param $alert_id Array of or single id
|
* @param $alert_id (array) Array of or a single id
|
||||||
* @result True if it was successful, false if it doesn't
|
*
|
||||||
|
* @return (bool) True if it was successful, false if it doesn't
|
||||||
**/
|
**/
|
||||||
function process_alerts_validate ($id_alert) {
|
function process_alerts_validate ($id_alert) {
|
||||||
global $config;
|
global $config;
|
||||||
require_once ("include/functions_events.php");
|
require_once ("include/functions_events.php");
|
||||||
|
|
||||||
if (!is_array ($id_alert)) {
|
$id_alert = (array) safe_int ($id_alert, 1);
|
||||||
$id_alert = (array) $id_alert;
|
|
||||||
}
|
|
||||||
$id_alert = safe_int ($id_alert, 1);
|
|
||||||
|
|
||||||
if (empty ($id_alert)) {
|
if (empty ($id_alert)) {
|
||||||
return false;
|
return false;
|
||||||
@ -2280,4 +2275,35 @@ function process_alerts_validate ($id_alert) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all module groups. (General, Networking, System). Module groups are merely for sorting frontend
|
||||||
|
*
|
||||||
|
* @return (array) All module groups
|
||||||
|
**/
|
||||||
|
function get_modulegroups () {
|
||||||
|
$result = get_db_all_fields_in_table ("tmodule_group");
|
||||||
|
$return = array ();
|
||||||
|
|
||||||
|
if (empty ($result)) {
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($result as $modulegroup) {
|
||||||
|
$return[$modulegroup["id_mg"]] = $modulegroup["name"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a modulegroup name based on the id
|
||||||
|
*
|
||||||
|
* @param (int) $modulegroup_id The id of the modulegroup
|
||||||
|
*
|
||||||
|
* @return (string) The modulegroup name
|
||||||
|
**/
|
||||||
|
function get_modulegroup_name ($modulegroup_id) {
|
||||||
|
return (string) get_db_value ('name', 'tmodule_group', 'id_mg', (int) $modulegroup_id);
|
||||||
|
}
|
||||||
?>
|
?>
|
68
pandora_console/include/functions_exportserver.php
Normal file
68
pandora_console/include/functions_exportserver.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
// Pandora FMS - the Flexible Monitoring System
|
||||||
|
// ============================================
|
||||||
|
// Copyright (c) 2009 Evi Vanoost, <vanooste@rcbi.rochester.edu>
|
||||||
|
// Please see http://pandora.sourceforge.net for full contribution list
|
||||||
|
//
|
||||||
|
// This file is part of Pandora FMS.
|
||||||
|
//
|
||||||
|
// Pandora FMS is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Pandora FMS 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 Pandora FMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all export servers out of the database
|
||||||
|
*
|
||||||
|
* @param (bool) $active Whether or not to exclude inactive servers (defaults to 1 => no inactive servers)
|
||||||
|
*
|
||||||
|
* @return (array) An array of server information (similar to server_info) but without the other servers
|
||||||
|
**/
|
||||||
|
function get_exportservers ($active = 1) {
|
||||||
|
$query = "SELECT * FROM tserver WHERE export_server = 1";
|
||||||
|
$return = array ();
|
||||||
|
|
||||||
|
if ($active == 1) {
|
||||||
|
$servers = get_db_all_rows_sql ($query.' AND status = 1');
|
||||||
|
} else {
|
||||||
|
$servers = get_db_all_rows_sql ($query);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty ($servers)) {
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($servers as $server) {
|
||||||
|
$return[$server["id_server"]] = $server;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a specific piece of info on the export servers table (defaults to name)
|
||||||
|
*
|
||||||
|
* @param (bool) $active (bool) Whether or not to exclude inactive servers (defaults to 1 => no inactive servers)
|
||||||
|
* @param (string) $row What row to select from the server info table
|
||||||
|
*
|
||||||
|
* @return (array) An array of server information (similar to get_exportservers) but without the extra data
|
||||||
|
**/
|
||||||
|
function get_exportservers_info ($active = 1, $row = "name") {
|
||||||
|
$exportservers = get_exportservers ();
|
||||||
|
$return = array ();
|
||||||
|
|
||||||
|
foreach ($exportservers as $server_id => $server_info) {
|
||||||
|
$return[$server_id] = $server_info[$row];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user