2013-05-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_incidents.php, include/api.php, include/functions.php, include/functions_modules.php, include/graphs/flot/pandora.flot.js, include/functions_cron.php, include/functions_graph.php: improved the source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8140 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
d3d36ae09e
commit
0fd149893e
|
@ -1,3 +1,10 @@
|
||||||
|
2013-05-16 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_incidents.php, include/api.php,
|
||||||
|
include/functions.php, include/functions_modules.php,
|
||||||
|
include/graphs/flot/pandora.flot.js, include/functions_cron.php,
|
||||||
|
include/functions_graph.php: improved the source code style.
|
||||||
|
|
||||||
2013-05-16 Miguel de Dios <miguel.dedios@artica.es>
|
2013-05-16 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* operation/agentes/stat_win.php: disabled show events when the
|
* operation/agentes/stat_win.php: disabled show events when the
|
||||||
|
|
|
@ -49,7 +49,7 @@ $user_in_db = null;
|
||||||
$no_login_msg = "";
|
$no_login_msg = "";
|
||||||
|
|
||||||
if (isInACL($ipOrigin)) {
|
if (isInACL($ipOrigin)) {
|
||||||
if(empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) {
|
if (empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) {
|
||||||
$user_in_db = process_user_login($user, $password, true);
|
$user_in_db = process_user_login($user, $password, true);
|
||||||
|
|
||||||
if ($user_in_db !== false) {
|
if ($user_in_db !== false) {
|
||||||
|
@ -78,7 +78,7 @@ if ($correctLogin) {
|
||||||
if ($op2 == 'extension') {
|
if ($op2 == 'extension') {
|
||||||
$extension_api_url = $config["homedir"]."/".EXTENSIONS_DIR."/$ext_name/$ext_name.api.php";
|
$extension_api_url = $config["homedir"]."/".EXTENSIONS_DIR."/$ext_name/$ext_name.api.php";
|
||||||
// The extension API file must exist and the extension must be enabled
|
// The extension API file must exist and the extension must be enabled
|
||||||
if(file_exists($extension_api_url) && !in_array($ext_name,extensions_get_disabled_extensions())) {
|
if (file_exists($extension_api_url) && !in_array($ext_name,extensions_get_disabled_extensions())) {
|
||||||
include_once($extension_api_url);
|
include_once($extension_api_url);
|
||||||
$function_name = 'apiextension_'.$op.'_'.$ext_function;
|
$function_name = 'apiextension_'.$op.'_'.$ext_function;
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,8 +203,8 @@ function list_files ($directory, $stringSearch, $searchHandler, $return = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($searchHandler == 1) {
|
if ($searchHandler == 1) {
|
||||||
while(false !== ($fileName = @readdir ($directoryHandler))) {
|
while (false !== ($fileName = @readdir ($directoryHandler))) {
|
||||||
if(@substr_count ($fileName, $stringSearch) > 0) {
|
if (@substr_count ($fileName, $stringSearch) > 0) {
|
||||||
$result[$fileName] = $fileName;
|
$result[$fileName] = $fileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ function get_user_language ($id_user = null) {
|
||||||
|
|
||||||
$quick_language = get_parameter('quick_language_change', 0);
|
$quick_language = get_parameter('quick_language_change', 0);
|
||||||
|
|
||||||
if($quick_language) {
|
if ($quick_language) {
|
||||||
$language = get_parameter('language', 0);
|
$language = get_parameter('language', 0);
|
||||||
|
|
||||||
if($language === 'default') {
|
if($language === 'default') {
|
||||||
|
@ -378,7 +378,7 @@ function get_user_language ($id_user = null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($id_user === null && isset($config['id_user'])) {
|
if ($id_user === null && isset($config['id_user'])) {
|
||||||
$id_user = $config['id_user'];
|
$id_user = $config['id_user'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
||||||
|
|
||||||
$years = floor($seconds / 31104000);
|
$years = floor($seconds / 31104000);
|
||||||
|
|
||||||
if($years != 0) {
|
if ($years != 0) {
|
||||||
$seconds = $seconds - ($years * 31104000);
|
$seconds = $seconds - ($years * 31104000);
|
||||||
|
|
||||||
$returnDate .= "$years $yearsString ";
|
$returnDate .= "$years $yearsString ";
|
||||||
|
@ -465,7 +465,7 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
||||||
|
|
||||||
$months = floor($seconds / 2592000);
|
$months = floor($seconds / 2592000);
|
||||||
|
|
||||||
if($months != 0) {
|
if ($months != 0) {
|
||||||
$seconds = $seconds - ($months * 2592000);
|
$seconds = $seconds - ($months * 2592000);
|
||||||
|
|
||||||
$returnDate .= "$months $monthsString ";
|
$returnDate .= "$months $monthsString ";
|
||||||
|
@ -473,7 +473,7 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
||||||
|
|
||||||
$days = floor($seconds / 86400);
|
$days = floor($seconds / 86400);
|
||||||
|
|
||||||
if($days != 0) {
|
if ($days != 0) {
|
||||||
$seconds = $seconds - ($days * 86400);
|
$seconds = $seconds - ($days * 86400);
|
||||||
|
|
||||||
$returnDate .= "$days $daysString ";
|
$returnDate .= "$days $daysString ";
|
||||||
|
@ -483,7 +483,7 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
||||||
|
|
||||||
$hours = floor($seconds / 3600);
|
$hours = floor($seconds / 3600);
|
||||||
|
|
||||||
if($hours != 0) {
|
if ($hours != 0) {
|
||||||
$seconds = $seconds - ($hours * 3600);
|
$seconds = $seconds - ($hours * 3600);
|
||||||
|
|
||||||
$returnTime .= "$hours $hoursString ";
|
$returnTime .= "$hours $hoursString ";
|
||||||
|
@ -491,7 +491,7 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
||||||
|
|
||||||
$mins = floor($seconds / 60);
|
$mins = floor($seconds / 60);
|
||||||
|
|
||||||
if($mins != 0) {
|
if ($mins != 0) {
|
||||||
$seconds = $seconds - ($mins * 60);
|
$seconds = $seconds - ($mins * 60);
|
||||||
|
|
||||||
if($hours == 0) {
|
if($hours == 0) {
|
||||||
|
@ -502,7 +502,7 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($seconds != 0) {
|
if ($seconds != 0) {
|
||||||
if($hours == 0) {
|
if($hours == 0) {
|
||||||
$returnTime .= "$seconds $secondsString ";
|
$returnTime .= "$seconds $secondsString ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ function cron_next_execution ($cron) {
|
||||||
$nex_time = cron_next_execution_date ($cron, $nex_time);
|
$nex_time = cron_next_execution_date ($cron, $nex_time);
|
||||||
$nex_time_wd = $nex_time;
|
$nex_time_wd = $nex_time;
|
||||||
list ($nex_mon, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
list ($nex_mon, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// Check the day of the week
|
// Check the day of the week
|
||||||
if ($nex_wday == $wday) {
|
if ($nex_wday == $wday) {
|
||||||
|
@ -61,9 +62,12 @@ function cron_next_execution ($cron) {
|
||||||
// Move to the next day of the month
|
// Move to the next day of the month
|
||||||
$nex_time_wd += 86400;
|
$nex_time_wd += 86400;
|
||||||
list ($nex_mon_wd, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
list ($nex_mon_wd, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
||||||
} while ($mday == '*' && $nex_mon_wd == $nex_mon);
|
}
|
||||||
|
while ($mday == '*' && $nex_mon_wd == $nex_mon);
|
||||||
|
|
||||||
$count++;
|
$count++;
|
||||||
} while ($count < 60);
|
}
|
||||||
|
while ($count < 60);
|
||||||
|
|
||||||
// Something went wrong, default to 5 minutes
|
// Something went wrong, default to 5 minutes
|
||||||
return 300;
|
return 300;
|
||||||
|
@ -76,7 +80,7 @@ function cron_next_execution_date ($cron, $cur_time = false) {
|
||||||
list ($min, $hour, $mday, $mon, $wday) = explode (" ", $cron);
|
list ($min, $hour, $mday, $mon, $wday) = explode (" ", $cron);
|
||||||
|
|
||||||
// Months start from 0
|
// Months start from 0
|
||||||
if($mon != '*') {
|
if ($mon != '*') {
|
||||||
$mon -= 1;
|
$mon -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +153,8 @@ function cron_next_execution_date ($cron, $cur_time = false) {
|
||||||
$nex_year++;
|
$nex_year++;
|
||||||
}
|
}
|
||||||
$count++;
|
$count++;
|
||||||
} while ($count < 86400);
|
}
|
||||||
|
while ($count < 86400);
|
||||||
|
|
||||||
// Something went wrong, default to 5 minutes
|
// Something went wrong, default to 5 minutes
|
||||||
return $cur_time + 300;
|
return $cur_time + 300;
|
||||||
|
|
|
@ -1332,7 +1332,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return =
|
||||||
$config['fontpath'], $config['font_size'], "", 1, array(), array(), 0, 0, '', false, '', false);
|
$config['fontpath'], $config['font_size'], "", 1, array(), array(), 0, 0, '', false, '', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($return) {
|
if ($return) {
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2747,10 +2747,10 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||||
$chart[$timestamp]['min'.$series_suffix] = 0;
|
$chart[$timestamp]['min'.$series_suffix] = 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if(!empty($event_ids)) {
|
if (!empty($event_ids)) {
|
||||||
$chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids);
|
$chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids);
|
||||||
}
|
}
|
||||||
if(!empty($alert_ids)) {
|
if (!empty($alert_ids)) {
|
||||||
$chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids);
|
$chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ function incidents_print_priority_img ($id_priority, $return = false) {
|
||||||
if ($return === false) {
|
if ($return === false) {
|
||||||
echo $img;
|
echo $img;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $img;
|
return $img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +123,7 @@ function incidents_print_status_img ($id_status, $return = false) {
|
||||||
if ($return === false) {
|
if ($return === false) {
|
||||||
echo $img;
|
echo $img;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $img;
|
return $img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +169,7 @@ function incidents_process_chown ($id_incident, $owner = false) {
|
||||||
}
|
}
|
||||||
$id_incident = implode (",", $id_incident);
|
$id_incident = implode (",", $id_incident);
|
||||||
$sql = sprintf ("UPDATE tincidencia SET id_usuario = '%s' WHERE id_incidencia IN (%s)", $owner, $id_incident);
|
$sql = sprintf ("UPDATE tincidencia SET id_usuario = '%s' WHERE id_incidencia IN (%s)", $owner, $id_incident);
|
||||||
|
|
||||||
return db_process_sql ($sql);
|
return db_process_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,6 +185,7 @@ function incidents_get_author ($id_incident) {
|
||||||
if ($id_incident < 1) {
|
if ($id_incident < 1) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string) db_get_value ('id_creator', 'tincidencia', 'id_incidencia', (int) $id_incident);
|
return (string) db_get_value ('id_creator', 'tincidencia', 'id_incidencia', (int) $id_incident);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,6 +200,7 @@ function incidents_get_owner ($id_incident) {
|
||||||
if ($id_incident < 1) {
|
if ($id_incident < 1) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string) db_get_value ('id_usuario', 'tincidencia', 'id_incidencia', (int) $id_incident);
|
return (string) db_get_value ('id_usuario', 'tincidencia', 'id_incidencia', (int) $id_incident);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,6 +215,7 @@ function incidents_get_lastupdate ($id_incident) {
|
||||||
if ($id_incident < 1) {
|
if ($id_incident < 1) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string) db_get_value ('id_lastupdate', 'tincidencia', 'id_incidencia', (int) $id_incident);
|
return (string) db_get_value ('id_lastupdate', 'tincidencia', 'id_incidencia', (int) $id_incident);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,6 +231,7 @@ function incidents_get_group ($id_incident) {
|
||||||
if ($id_incident < 1) {
|
if ($id_incident < 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) db_get_value ('id_grupo', 'tincidencia', 'id_incidencia', (int) $id_incident);
|
return (int) db_get_value ('id_grupo', 'tincidencia', 'id_incidencia', (int) $id_incident);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +426,7 @@ function incidents_call_api($url, $postparameters = false) {
|
||||||
*/
|
*/
|
||||||
function incidents_xml_to_array($xml) {
|
function incidents_xml_to_array($xml) {
|
||||||
$xmlObj = simplexml_load_string($xml,'SimpleXMLElement',LIBXML_NOCDATA);
|
$xmlObj = simplexml_load_string($xml,'SimpleXMLElement',LIBXML_NOCDATA);
|
||||||
|
|
||||||
return json_decode(json_encode($xmlObj), true);
|
return json_decode(json_encode($xmlObj), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,10 +155,10 @@ function modules_change_disabled($id_agent_module, $new_value = 1) {
|
||||||
|
|
||||||
$id_agent_module_changed = array();
|
$id_agent_module_changed = array();
|
||||||
|
|
||||||
foreach($id_agent_module as $id_module) {
|
foreach ($id_agent_module as $id_module) {
|
||||||
// If the module is already disabled/enabled ignore
|
// If the module is already disabled/enabled ignore
|
||||||
$current_disabled = db_get_value('disabled', 'tagente_modulo', 'id_agente_modulo', $id_module);
|
$current_disabled = db_get_value('disabled', 'tagente_modulo', 'id_agente_modulo', $id_module);
|
||||||
if($current_disabled == $new_value) {
|
if ($current_disabled == $new_value) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,14 +166,14 @@ function modules_change_disabled($id_agent_module, $new_value = 1) {
|
||||||
$id_agent_module_changed[] = $id_module;
|
$id_agent_module_changed[] = $id_module;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($id_agent_module_changed)) {
|
if (empty($id_agent_module_changed)) {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = db_process_sql_update('tagente_modulo', array('disabled' => (int) $new_value), array('id_agente_modulo' => $id_agent_module_changed));
|
$result = db_process_sql_update('tagente_modulo', array('disabled' => (int) $new_value), array('id_agente_modulo' => $id_agent_module_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($result) {
|
if ($result) {
|
||||||
// Change the agent flag to update modules count
|
// Change the agent flag to update modules count
|
||||||
db_process_sql_update('tagente', array('update_module_count' => 1), array('id_agente' => $id_agent_changed));
|
db_process_sql_update('tagente', array('update_module_count' => 1), array('id_agente' => $id_agent_changed));
|
||||||
return NOERR;
|
return NOERR;
|
||||||
|
@ -264,7 +264,7 @@ function modules_update_agent_module ($id, $values, $onlyNoDeletePending = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset ($values['nombre'])) {
|
if (isset ($values['nombre'])) {
|
||||||
if(empty ($values['nombre'])) {
|
if (empty ($values['nombre'])) {
|
||||||
return ERR_INCOMPLETE;
|
return ERR_INCOMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ function modules_update_agent_module ($id, $values, $onlyNoDeletePending = false
|
||||||
|
|
||||||
$exists = (bool)db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('nombre' => $values['nombre'], 'id_agente' => $id_agent, 'id_agente_modulo' => "<>$id"));
|
$exists = (bool)db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('nombre' => $values['nombre'], 'id_agente' => $id_agent, 'id_agente_modulo' => "<>$id"));
|
||||||
|
|
||||||
if($exists) {
|
if ($exists) {
|
||||||
return ERR_EXIST;
|
return ERR_EXIST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
||||||
|
|
||||||
$exists = (bool)db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('nombre' => $name, 'id_agente' => (int)$id_agent));
|
$exists = (bool)db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('nombre' => $name, 'id_agente' => (int)$id_agent));
|
||||||
|
|
||||||
if($exists) {
|
if ($exists) {
|
||||||
return ERR_EXIST;
|
return ERR_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update module status count if the module is not created disabled
|
// Update module status count if the module is not created disabled
|
||||||
if(!isset ($values['disabled']) || $values['disabled'] == 0) {
|
if (!isset ($values['disabled']) || $values['disabled'] == 0) {
|
||||||
if ($status == 0) {
|
if ($status == 0) {
|
||||||
db_process_sql ('UPDATE tagente SET total_count=total_count+1, normal_count=normal_count+1 WHERE id_agente=' . (int)$id_agent);
|
db_process_sql ('UPDATE tagente SET total_count=total_count+1, normal_count=normal_count+1 WHERE id_agente=' . (int)$id_agent);
|
||||||
}
|
}
|
||||||
|
@ -1374,7 +1374,7 @@ function modules_get_modulegroups () {
|
||||||
* @return string The modulegroup name
|
* @return string The modulegroup name
|
||||||
*/
|
*/
|
||||||
function modules_get_modulegroup_name ($modulegroup_id) {
|
function modules_get_modulegroup_name ($modulegroup_id) {
|
||||||
if($modulegroup_id == 0)
|
if ($modulegroup_id == 0)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return (string) db_get_value ('name', 'tmodule_group', 'id_mg', (int) $modulegroup_id);
|
return (string) db_get_value ('name', 'tmodule_group', 'id_mg', (int) $modulegroup_id);
|
||||||
|
@ -1449,8 +1449,15 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
|
||||||
function modules_agents_unknown ($module_name) {
|
function modules_agents_unknown ($module_name) {
|
||||||
|
|
||||||
//TODO REVIEW ORACLE AND POSTGRES
|
//TODO REVIEW ORACLE AND POSTGRES
|
||||||
return db_get_sql ("SELECT COUNT( DISTINCT tagente.id_agente) FROM tagente_estado, tagente, tagente_modulo WHERE tagente.disabled = 0 AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.estado = 3 AND tagente_modulo.nombre = '$module_name'");
|
return db_get_sql ("SELECT COUNT( DISTINCT tagente.id_agente)
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.disabled = 0
|
||||||
|
AND tagente_estado.utimestamp != 0
|
||||||
|
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0
|
||||||
|
AND tagente_estado.id_agente = tagente.id_agente
|
||||||
|
AND tagente_estado.estado = 3
|
||||||
|
AND tagente_modulo.nombre = '$module_name'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get ok agents by using the status code in modules.
|
// Get ok agents by using the status code in modules.
|
||||||
|
@ -1465,8 +1472,17 @@ function modules_agents_ok ($module_name) {
|
||||||
//Then we count the agents of the group selected to know how many agents are in OK status
|
//Then we count the agents of the group selected to know how many agents are in OK status
|
||||||
|
|
||||||
//TODO REVIEW ORACLE AND POSTGRES
|
//TODO REVIEW ORACLE AND POSTGRES
|
||||||
return db_get_sql ("SELECT COUNT(max_estado) FROM (SELECT MAX(tagente_estado.estado) as max_estado FROM tagente_estado, tagente, tagente_modulo WHERE tagente.disabled = 0 AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente AND tagente_modulo.nombre = '$module_name' GROUP BY tagente.id_agente HAVING max_estado = 0) AS S1");
|
return db_get_sql ("SELECT COUNT(max_estado)
|
||||||
|
FROM (
|
||||||
|
SELECT MAX(tagente_estado.estado) as max_estado
|
||||||
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.disabled = 0
|
||||||
|
AND tagente_estado.utimestamp != 0
|
||||||
|
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0
|
||||||
|
AND tagente_estado.id_agente = tagente.id_agente
|
||||||
|
AND tagente_modulo.nombre = '$module_name'
|
||||||
|
GROUP BY tagente.id_agente HAVING max_estado = 0) AS S1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get critical agents by using the status code in modules.
|
// Get critical agents by using the status code in modules.
|
||||||
|
@ -1489,7 +1505,6 @@ function modules_agents_critical ($module_name) {
|
||||||
AND estado = 1
|
AND estado = 1
|
||||||
AND tagente_estado.id_agente = tagente.id_agente
|
AND tagente_estado.id_agente = tagente.id_agente
|
||||||
AND tagente_modulo.nombre = '$module_name'");
|
AND tagente_modulo.nombre = '$module_name'");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get warning agents by using the status code in modules.
|
// Get warning agents by using the status code in modules.
|
||||||
|
@ -1515,35 +1530,48 @@ function modules_agents_warning ($module_name) {
|
||||||
AND tagente_modulo.nombre = '$module_name'
|
AND tagente_modulo.nombre = '$module_name'
|
||||||
GROUP BY tagente.id_agente
|
GROUP BY tagente.id_agente
|
||||||
HAVING min_estado = 2) AS S1");
|
HAVING min_estado = 2) AS S1");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get unknown agents by using the status code in modules
|
// Get unknown agents by using the status code in modules
|
||||||
|
|
||||||
function modules_group_agent_unknown ($module_group) {
|
function modules_group_agent_unknown ($module_group) {
|
||||||
|
|
||||||
return db_get_sql ("SELECT COUNT(*) FROM tagente, tagente_modulo WHERE tagente.id_agente=tagente_modulo.id_agente AND critical_count=0 AND warning_count=0 AND unknown_count>0 AND id_module_group = $module_group");
|
return db_get_sql ("SELECT COUNT(*)
|
||||||
|
FROM tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_agente=tagente_modulo.id_agente
|
||||||
|
AND critical_count=0 AND warning_count=0
|
||||||
|
AND unknown_count>0 AND id_module_group = $module_group");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get ok agents by using the status code in modules.
|
// Get ok agents by using the status code in modules.
|
||||||
|
|
||||||
function modules_group_agent_ok ($module_group) {
|
function modules_group_agent_ok ($module_group) {
|
||||||
|
|
||||||
return db_get_sql ("SELECT COUNT(*) FROM tagente, tagente_modulo WHERE tagente.id_agente=tagente_modulo.id_agente AND normal_count=total_count AND id_module_group = $module_group");
|
return db_get_sql ("SELECT COUNT(*)
|
||||||
|
FROM tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_agente=tagente_modulo.id_agente
|
||||||
|
AND normal_count = total_count
|
||||||
|
AND id_module_group = $module_group");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get critical agents by using the status code in modules.
|
// Get critical agents by using the status code in modules.
|
||||||
|
|
||||||
function modules_group_agent_critical ($module_group) {
|
function modules_group_agent_critical ($module_group) {
|
||||||
|
|
||||||
return db_get_sql ("SELECT COUNT(*) FROM tagente, tagente_modulo WHERE tagente.id_agente=tagente_modulo.id_agente AND critical_count>0 AND id_module_group = $module_group");
|
return db_get_sql ("SELECT COUNT(*)
|
||||||
|
FROM tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_agente=tagente_modulo.id_agente
|
||||||
|
AND critical_count > 0 AND id_module_group = $module_group");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get warning agents by using the status code in modules.
|
// Get warning agents by using the status code in modules.
|
||||||
|
|
||||||
function modules_group_agent_warning ($module_group) {
|
function modules_group_agent_warning ($module_group) {
|
||||||
|
|
||||||
return db_get_sql ("SELECT COUNT(*) FROM tagente, tagente_modulo WHERE tagente.id_agente=tagente_modulo.id_agente AND critical_count=0 AND warning_count>0 AND id_module_group = $module_group");
|
return db_get_sql ("SELECT COUNT(*)
|
||||||
|
FROM tagente, tagente_modulo
|
||||||
|
WHERE tagente.id_agente=tagente_modulo.id_agente
|
||||||
|
AND critical_count = 0 AND warning_count > 0
|
||||||
|
AND id_module_group = $module_group");
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -43,7 +43,7 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat
|
||||||
}
|
}
|
||||||
|
|
||||||
var show_legend = true;
|
var show_legend = true;
|
||||||
if(legend_position == 'hidden') {
|
if (legend_position == 'hidden') {
|
||||||
show_legend = false;
|
show_legend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue