From 39abc8cb4ede28366f0410cd5891d7f8f6e2cc85 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Wed, 7 Dec 2011 09:02:36 +0000 Subject: [PATCH] 2011-12-07 Sergio Martin * include/functions_api.php: Added two new functions to external API: set_enable_module_alerts and set_disable_module_alerts for feature request 3427673 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5236 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++ pandora_console/include/functions_api.php | 43 +++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2b8c22584a..9c5590a043 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-12-07 Sergio Martin + + * include/functions_api.php: Added two new functions + to external API: set_enable_module_alerts and + set_disable_module_alerts for feature request 3427673 + 2011-12-07 Juan Manuel Ramon * operation/events/events_list.php diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 2efaabe82b..ad1d69f505 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -2056,7 +2056,7 @@ function set_enable_module ($agent_name, $module_name, $thrast3, $thrash4) { /** - * Disable a alert + * Disable an alert * * @param string $agent_name Name of agent (for example "myagent") * @param string $module_name Name of the module (for example "Host alive") @@ -2077,7 +2077,7 @@ function set_disable_alert ($agent_name, $module_name, $template_name, $thrash4) } /** - * Enable a alert + * Enable an alert * * @param string $agent_name Name of agent (for example "myagent") * @param string $module_name Name of the module (for example "Host alive") @@ -2097,5 +2097,44 @@ function set_enable_alert ($agent_name, $module_name, $template_name, $thrash4) returnData('string', array('type' => 'string', 'data' => "Correct alert enable")); } +/** + * Disable all the alerts of one module + * + * @param string $agent_name Name of agent (for example "myagent") + * @param string $module_name Name of the module (for example "Host alive") + * @param $thrash3 Don't use. + * @param $thrash4 Don't use. + +// http://localhost/pandora_console/include/api.php?op=set&op2=disable_module_alerts&id=garfio&id2=Status + */ + +function set_disable_module_alerts ($agent_name, $module_name, $thrash3, $thrash4) { + + $id_agent = agents_get_agent_id($agent_name); + $id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent, 'nombre' => $module_name)); + + db_process_sql("UPDATE talert_template_modules SET disabled = 1 WHERE id_agent_module = $id_agent_module"); + returnData('string', array('type' => 'string', 'data' => "Correct alerts disable")); +} + +/** + * Enable all the alerts of one module + * + * @param string $agent_name Name of agent (for example "myagent") + * @param string $module_name Name of the module (for example "Host alive") + * @param $thrash3 Don't use. + * @param $thrash4 Don't use. + +// http://localhost/pandora_console/include/api.php?op=set&op2=enable_module_alerts&id=garfio&id2=Status + */ + +function set_enable_module_alerts ($agent_name, $module_name, $thrash3, $thrash4) { + + $id_agent = agents_get_agent_id($agent_name); + $id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent, 'nombre' => $module_name)); + + db_process_sql("UPDATE talert_template_modules SET disabled = 0 WHERE id_agent_module = $id_agent_module"); + returnData('string', array('type' => 'string', 'data' => "Correct alerts enable")); +} ?>