2012-07-10 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_ui.php: moved the constants for the status
	images to contants file.
	
	* include/constants.php: added the contants for the
	"Agent module status" and added contants for the "Status images"
	from functions_ui.php.
	
	* include/functions_modules.php: killed a unicorn (magic number)
	into the function "modules_get_agentmodule_status".




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6761 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-10 11:37:14 +00:00
parent 8b1cb4f3fe
commit 9f3f620015
4 changed files with 51 additions and 26 deletions

View File

@ -1,3 +1,15 @@
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: moved the constants for the status
images to contants file.
* include/constants.php: added the contants for the
"Agent module status" and added contants for the "Status images"
from functions_ui.php.
* include/functions_modules.php: killed a unicorn (magic number)
into the function "modules_get_agentmodule_status".
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_networkmap.php, include/functions_netflow.php,

View File

@ -109,6 +109,15 @@ define('GENERIC_SIZE_TEXT', 25);
/* Agent module status */
define('AGENT_MODULE_STATUS_CRITICAL_BAD', 1);
define('AGENT_MODULE_STATUS_CRITICAL_ALERT', 4);
define('AGENT_MODULE_STATUS_NORMAL', 0);
define('AGENT_MODULE_STATUS_WARNING', 2);
define('AGENT_MODULE_STATUS_UNKNOW', 3);
/* Visual maps contants */
//The items kind
define('STATIC_GRAPH', 0);
@ -146,4 +155,27 @@ define('SERVICE_STATUS_UNKNOW', -1);
define('SERVICE_STATUS_NORMAL', 0);
define('SERVICE_STATUS_CRITICAL', 1);
define('SERVICE_STATUS_WARNING', 2);
/* Status images */
//For modules
define ('STATUS_MODULE_OK', 'module_ok.png');
define ('STATUS_MODULE_CRITICAL', 'module_critical.png');
define ('STATUS_MODULE_WARNING', 'module_warning.png');
define ('STATUS_MODULE_NO_DATA', 'module_no_data.png');
define ('STATUS_MODULE_UNKNOWN', 'module_unknown.png');
//For agents
define ('STATUS_AGENT_CRITICAL', 'agent_critical.png');
define ('STATUS_AGENT_WARNING', 'agent_warning.png');
define ('STATUS_AGENT_DOWN', 'agent_down.png');
define ('STATUS_AGENT_OK', 'agent_ok.png');
define ('STATUS_AGENT_NO_DATA', 'agent_no_data.png');
//For alerts
define ('STATUS_ALERT_FIRED', 'alert_fired.png');
define ('STATUS_ALERT_NOT_FIRED', 'alert_not_fired.png');
define ('STATUS_ALERT_DISABLED', 'alert_disabled.png');
//For servers
define ('STATUS_SERVER_OK', 'server_ok.png');
define ('STATUS_SERVER_DOWN', 'server_down.png');
?>

View File

@ -1006,7 +1006,7 @@ function modules_get_agentmodule_status($id_agentmodule = 0, $without_alerts = f
if (!$without_alerts) {
$times_fired = db_get_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule);
if ($times_fired > 0) {
return 4; // Alert fired
return AGENT_MODULE_STATUS_CRITICAL_ALERT; // Alert fired
}
}

View File

@ -1644,41 +1644,22 @@ function ui_format_filesize ($bytes) {
*/
function ui_get_status_images_path () {
global $config;
$imageset = $config["status_images_set"];
if (strpos ($imageset, ",") === false)
$imageset .= ",40x18";
list ($imageset, $sizes) = preg_split ("/\,/", $imageset);
if (strpos ($sizes, "x") === false)
$sizes .= "x18";
list ($imagewidth, $imageheight) = preg_split ("/x/", $sizes);
$imagespath = 'images/status_sets/'.$imageset;
return array ($imagespath);
}
define ('STATUS_MODULE_OK', 'module_ok.png');
define ('STATUS_MODULE_CRITICAL', 'module_critical.png');
define ('STATUS_MODULE_WARNING', 'module_warning.png');
define ('STATUS_MODULE_NO_DATA', 'module_no_data.png');
define ('STATUS_MODULE_UNKNOWN', 'module_unknown.png');
define ('STATUS_AGENT_CRITICAL', 'agent_critical.png');
define ('STATUS_AGENT_WARNING', 'agent_warning.png');
define ('STATUS_AGENT_DOWN', 'agent_down.png');
define ('STATUS_AGENT_OK', 'agent_ok.png');
define ('STATUS_AGENT_NO_DATA', 'agent_no_data.png');
define ('STATUS_ALERT_FIRED', 'alert_fired.png');
define ('STATUS_ALERT_NOT_FIRED', 'alert_not_fired.png');
define ('STATUS_ALERT_DISABLED', 'alert_disabled.png');
define ('STATUS_SERVER_OK', 'server_ok.png');
define ('STATUS_SERVER_DOWN', 'server_down.png');
/**
* Prints an image representing a status.
*
@ -1712,7 +1693,7 @@ function ui_print_ui_agents_list ($options = false, $filter = false, $return = f
global $config;
$output = '';
$group_filter = true;
$text_filter = true;
$access = 'AR';