2012-07-31 Sergio Martin <sergio.martin@artica.es>

* include/functions_api.php: Added API function to 
	get the module data info from the agent conf file



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6833 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-07-31 15:58:35 +00:00
parent f5033d41a9
commit b2d24c1a72
2 changed files with 46 additions and 8 deletions

View File

@ -1,3 +1,13 @@
2012-07-31 Sergio Martin <sergio.martin@artica.es>
* include/functions_api.php: Added API function to
get the module data info from the agent conf file
2012-07-31 Sergio Martin <sergio.martin@artica.es>
* include/functions_api.php: Change the API calls to
hooks
2012-07-31 Sergio Martin <sergio.martin@artica.es>
* include/functions_api.php: Fix a unclosed key

View File

@ -3220,9 +3220,9 @@ function api_set_add_module_in_conf($id_agent, $module_name, $configuration_data
exit;
}
$result = config_agents_add_module_in_conf($id_agent, $new_configuration_data);
if($result) {
$result = enterprise_hook('config_agents_add_module_in_conf', array($id_agent, $new_configuration_data));
if($result && $result !== ENTERPRISE_NOT_HOOK) {
returnData('string', array('type' => 'string', 'data' => 'Successfully added module to conf.'));
}
else {
@ -3230,6 +3230,32 @@ function api_set_add_module_in_conf($id_agent, $module_name, $configuration_data
}
}
/**
* Get module data configuration from agent configuration file
*
* @param string $id_agent Id of the agent
* @param string $module_name
* @param $thrash2 Don't use
* @param $thrash3 Don't use
*
* Call example:
*
* api.php?op=get&op2=module_from_conf&user=admin&pass=pandora&id=9043&id2=example_name
*
* @return string success or error message
*/
function api_get_module_from_conf($id_agent, $module_name, $thrash2, $thrash3) {
$result = enterprise_hook('config_agents_get_module_from_conf', array($id_agent, $module_name));
if($result !== ENTERPRISE_NOT_HOOK) {
returnData('string', array('type' => 'string', 'data' => $result));
}
else {
returnError('error_adding_module_conf', 'Error getting module from conf file.');
}
}
/**
* Delete module data configuration from agent configuration file
*
@ -3247,7 +3273,9 @@ function api_set_add_module_in_conf($id_agent, $module_name, $configuration_data
function api_set_delete_module_in_conf($id_agent, $module_name, $thrash2, $thrash3) {
$result = config_agents_delete_module_in_conf($id_agent, $module_name);
if($result) {
$result = enterprise_hook('config_agents_delete_module_in_conf', array($id_agent, $module_name));
if($result && $result !== ENTERPRISE_NOT_HOOK) {
returnData('string', array('type' => 'string', 'data' => 'Successfully deleted module from conf.'));
}
else {
@ -3286,10 +3314,10 @@ function api_set_update_module_in_conf($id_agent, $module_name, $configuration_d
echo "No change";
exit;
}
$result = config_agents_update_module_in_conf($id_agent, $old_configuration_data, $new_configuration_data);
if($result) {
$result = enterprise_hook('config_agents_update_module_in_conf', array($id_agent, $old_configuration_data, $new_configuration_data));
if($result && $result !== ENTERPRISE_NOT_HOOK) {
returnData('string', array('type' => 'string', 'data' => 'Successfully updated module in conf.'));
}
else {