Killing pink unicorns and magic numbers.
This commit is contained in:
parent
d70c5f5811
commit
0473856048
|
@ -298,20 +298,28 @@ function mainAgentsModules() {
|
|||
echo "<td style='text-align: center;'>";
|
||||
$win_handle = dechex(crc32($module_id.$module["name"]));
|
||||
$graph_type = return_graphtype (modules_get_agentmodule_type($module_id));
|
||||
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module_id."&label=".rawurlencode(urlencode(base64_encode($module["name"])))."&refresh=600','day_".$win_handle."')";
|
||||
$link ="winopeng('" .
|
||||
"operation/agentes/stat_win.php?" .
|
||||
"type=$graph_type&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"id=" . $module_id . "&" .
|
||||
"label=" . rawurlencode(
|
||||
urlencode(
|
||||
base64_encode($module["name"]))) . "&" .
|
||||
"refresh=" . SECONDS_10MINUTES . "', 'day_".$win_handle."')";
|
||||
|
||||
echo '<a href="javascript:'.$link.'">';
|
||||
switch ($status) {
|
||||
case 0:
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
ui_print_status_image ('module_ok.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 1:
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
ui_print_status_image ('module_critical.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 2:
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
ui_print_status_image ('module_warning.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 3:
|
||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
|
||||
break;
|
||||
case 4:
|
||||
|
|
|
@ -156,7 +156,7 @@ if ($delete_template) {
|
|||
$id = get_parameter ('id');
|
||||
$al_template = alerts_get_alert_template($id);
|
||||
|
||||
if ($al_template !== false){
|
||||
if ($al_template !== false) {
|
||||
// If user tries to delete a template with group=ALL then must have "PM" access privileges
|
||||
if ($al_template['id_group'] == 0) {
|
||||
if (! check_acl ($config['id_user'], 0, "PM")) {
|
||||
|
|
|
@ -31,22 +31,22 @@ if (! check_acl ($config['id_user'], 0, "DM")) {
|
|||
$time["all"] = get_system_time ();
|
||||
|
||||
// 1 day ago
|
||||
$time["1day"] = $time["all"]-86400;
|
||||
$time["1day"] = $time["all"] - SECONDS_1DAY;
|
||||
|
||||
// 3 days ago
|
||||
$time["3day"] = $time["all"]-(86400*3);
|
||||
$time["3day"] = $time["all"] - ( SECONDS_1DAY * 3);
|
||||
|
||||
// 1 week ago
|
||||
$time["1week"] = $time["all"]-(86400*7);
|
||||
$time["1week"] = $time["all"] - SECONDS_1WEEK;
|
||||
|
||||
// 2 weeks ago
|
||||
$time["2week"] = $time["all"]-(86400*14);
|
||||
$time["2week"] = $time["all"] - SECONDS_2WEEK;
|
||||
|
||||
// 1 month ago
|
||||
$time["1month"] = $time["all"]-(86400*30);
|
||||
$time["1month"] = $time["all"] - SECONDS_1MONTH;
|
||||
|
||||
// Three months ago
|
||||
$time["3month"] = $time["all"]-(86400*90);
|
||||
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
|
||||
|
||||
// Todo for a good DB maintenance
|
||||
/*
|
||||
|
|
|
@ -73,7 +73,7 @@ else {
|
|||
$name = "Pandora FMS combined graph";
|
||||
$width = 550;
|
||||
$height = 210;
|
||||
$period = 86400;
|
||||
$period = SECONDS_1DAY;
|
||||
//$alerts= "";
|
||||
$events = 0;
|
||||
$factor = 1;
|
||||
|
|
|
@ -63,10 +63,10 @@ $top_n_value = 10;
|
|||
$exception_condition = REPORT_EXCEPTION_CONDITION_EVERYTHING;
|
||||
$exception_condition_value = 10;
|
||||
$modulegroup = 0;
|
||||
$period = 86400;
|
||||
$period = SECONDS_1DAY;
|
||||
// Added support for projection graphs
|
||||
$period_pg = 432000;
|
||||
$projection_period = 432000;
|
||||
$period_pg = SECONDS_5DAY;
|
||||
$projection_period = SECONDS_5DAY;
|
||||
$only_display_wrong = 0;
|
||||
// Added support for prediction date report
|
||||
$min_interval = '0.00';
|
||||
|
|
|
@ -72,7 +72,7 @@ if ($get_module_detail) {
|
|||
ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/");
|
||||
|
||||
$module_id = (int) get_parameter('id_module');
|
||||
$period = (int) get_parameter("period", 86400);
|
||||
$period = (int) get_parameter("period", SECONDS_1DAY);
|
||||
$group = agents_get_agentmodule_group ($module_id);
|
||||
$agentId = (int) get_parameter("id_agent");
|
||||
$server_name = (string) get_parameter('server_name');
|
||||
|
@ -975,11 +975,26 @@ if ($list_modules) {
|
|||
} else {
|
||||
$draw_events = 0;
|
||||
}
|
||||
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module["id_agente_modulo"]."&label=".rawurlencode(urlencode(base64_encode($module["nombre"])))."&refresh=600&draw_events=$draw_events','day_".$win_handle."')";
|
||||
$link ="winopeng('" .
|
||||
"operation/agentes/stat_win.php?" .
|
||||
"type=$graph_type&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"id=" . $module["id_agente_modulo"] . "&" .
|
||||
"label=" . rawurlencode(
|
||||
urlencode(
|
||||
base64_encode($module["nombre"]))) . "&" .
|
||||
"refresh=" . SECONDS_10MINUTES . "&" .
|
||||
"draw_events=$draw_events', 'day_".$win_handle."')";
|
||||
|
||||
$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> ';
|
||||
$server_name = '';
|
||||
$data[8] .= "<a href='javascript: show_module_detail_dialog(" . $module["id_agente_modulo"] . ", ". $id_agente.", \"" . $server_name . "\", 0, 86400)'>". html_print_image ("images/binary.png", true, array ("border" => "0", "alt" => "")) . "</a>";
|
||||
$data[8] .= "<a href='javascript: " .
|
||||
"show_module_detail_dialog(" .
|
||||
$module["id_agente_modulo"] . ", ".
|
||||
$id_agente . ", " .
|
||||
"\"" . $server_name . "\", " .
|
||||
0 . ", " .
|
||||
SECONDS_1DAY . ")'>". html_print_image ("images/binary.png", true, array ("border" => "0", "alt" => "")) . "</a>";
|
||||
}
|
||||
|
||||
if ($module['estado'] == 3) {
|
||||
|
|
|
@ -1181,7 +1181,7 @@ class Tree {
|
|||
$module['statusText'] = "ok";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ($statusType !== STATUS_MODULE_UNKNOWN_BALL
|
||||
&& $statusType !== STATUS_MODULE_NO_DATA_BALL) {
|
||||
if (is_numeric($module["value"])) {
|
||||
|
@ -1193,108 +1193,110 @@ class Tree {
|
|||
}
|
||||
|
||||
$module['statusImageHTML'] = ui_print_status_image($statusType, $statusTitle, true);
|
||||
|
||||
|
||||
// HTML of the server type image
|
||||
$module['serverTypeHTML'] = servers_show_type($module['server_type']);
|
||||
|
||||
|
||||
// Link to the Module graph
|
||||
$graphType = return_graphtype($module['id']);
|
||||
$winHandle = dechex(crc32($module['id'] . $module['name']));
|
||||
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
$moduleGraphURL = $config['homeurl'] .
|
||||
"/operation/agentes/stat_win.php?" .
|
||||
"type=$graphType&" .
|
||||
"period=86400&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"id=" . $module['id'] . "&" .
|
||||
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
|
||||
"refresh=600";
|
||||
"refresh=" . SECONDS_10MINUTES;
|
||||
}
|
||||
else if (!empty($server)) {
|
||||
$moduleGraphURL = ui_meta_get_url_console_child(
|
||||
$server, null, null, null, null,
|
||||
"operation/agentes/stat_win.php?" .
|
||||
"type=$graph_type&" .
|
||||
"period=86400&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"id=" . $module["id"] . "&" .
|
||||
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
|
||||
"refresh=600");
|
||||
"refresh=" . SECONDS_10MINUTES);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($moduleGraphURL)) {
|
||||
$module['moduleGraph'] = array(
|
||||
'url' => $moduleGraphURL,
|
||||
'handle' => $winHandle
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Alerts fired image
|
||||
$has_alerts = (bool) db_get_value('COUNT(DISTINCT(id_agent_module))', 'talert_template_modules', 'id_agent_module', $module['id']);
|
||||
|
||||
$has_alerts = (bool) db_get_value(
|
||||
'COUNT(DISTINCT(id_agent_module))',
|
||||
'talert_template_modules', 'id_agent_module', $module['id']);
|
||||
|
||||
if ($has_alerts) {
|
||||
$module['alertsImageHTML'] = html_print_image("images/bell.png", true, array("title" => __('Module alerts')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function processModules (&$modules, $server = false) {
|
||||
foreach ($modules as $iterator => $module) {
|
||||
$this->processModule($modules[$iterator], $server);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function processAgent (&$agent, $server = false) {
|
||||
global $config;
|
||||
|
||||
|
||||
$agent['type'] = 'agent';
|
||||
$agent['id'] = (int) $agent['id'];
|
||||
$agent['name'] = $agent['name'];
|
||||
|
||||
|
||||
$agent['rootID'] = $this->rootID;
|
||||
$agent['rootType'] = $this->rootType;
|
||||
|
||||
|
||||
if (defined("METACONSOLE") && !empty($server))
|
||||
$agent['serverID'] = $server['id'];
|
||||
|
||||
// Counters
|
||||
if (empty($agent['counters'])) {
|
||||
$agent['counters'] = array();
|
||||
|
||||
|
||||
if (isset($agent['unknown_count']))
|
||||
$agent['counters']['unknown'] = $agent['unknown_count'];
|
||||
else
|
||||
$agent['counters']['unknown'] = agents_monitor_unknown($agent['id']);
|
||||
|
||||
|
||||
if (isset($agent['critical_count']))
|
||||
$agent['counters']['critical'] = $agent['critical_count'];
|
||||
else
|
||||
$agent['counters']['critical'] = agents_monitor_critical($agent['id']);
|
||||
|
||||
|
||||
if (isset($agent['warning_count']))
|
||||
$agent['counters']['warning'] = $agent['warning_count'];
|
||||
else
|
||||
$agent['counters']['warning'] = agents_monitor_warning($agent['id']);
|
||||
|
||||
|
||||
if (isset($agent['notinit_count']))
|
||||
$agent['counters']['not_init'] = $agent['notinit_count'];
|
||||
else
|
||||
$agent['counters']['not_init'] = agents_monitor_notinit($agent['id']);
|
||||
|
||||
|
||||
if (isset($agent['normal_count']))
|
||||
$agent['counters']['ok'] = $agent['normal_count'];
|
||||
else
|
||||
$agent['counters']['ok'] = agents_monitor_ok($agent['id']);
|
||||
|
||||
|
||||
if (isset($agent['total_count']))
|
||||
$agent['counters']['total'] = $agent['total_count'];
|
||||
else
|
||||
$agent['counters']['total'] = agents_monitor_total($agent['id']);
|
||||
|
||||
|
||||
if (isset($agent['fired_count']))
|
||||
$agent['counters']['alerts'] = $agent['fired_count'];
|
||||
else
|
||||
$agent['counters']['alerts'] = agents_get_alerts_fired($agent['id']);
|
||||
}
|
||||
|
||||
|
||||
// Status image
|
||||
$agent['statusImageHTML'] = agents_tree_view_status_img_ball(
|
||||
$agent['counters']['critical'],
|
||||
|
@ -1302,14 +1304,14 @@ class Tree {
|
|||
$agent['counters']['unknown'],
|
||||
$agent['counters']['total'],
|
||||
$agent['counters']['not_init']);
|
||||
|
||||
|
||||
// Alerts fired image
|
||||
$agent["alertImageHTML"] = agents_tree_view_alert_img_ball($agent['counters']['alerts']);
|
||||
|
||||
|
||||
// Quiet image
|
||||
if (isset($agent['quiet']) && $agent['quiet'])
|
||||
$agent['quietImageHTML'] = html_print_image("/images/dot_green.disabled.png", true, array("title" => __('Quiet')));
|
||||
|
||||
|
||||
// Status
|
||||
$agent['statusRaw'] = agents_get_status($agent['id']);
|
||||
switch ($agent['statusRaw']) {
|
||||
|
@ -1343,7 +1345,7 @@ class Tree {
|
|||
break;
|
||||
case 'live':
|
||||
$agent['searchChildren'] = 0;
|
||||
|
||||
|
||||
// if ($searchChildren)
|
||||
// $agent['children'] = $this->getModules($agent['id'], $modulesFilter);
|
||||
break;
|
||||
|
@ -1361,7 +1363,7 @@ class Tree {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function processAgents (&$agents, $server = false) {
|
||||
if (!empty($agents)) {
|
||||
foreach ($agents as $iterator => $agent) {
|
||||
|
@ -1369,9 +1371,9 @@ class Tree {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getData() {
|
||||
|
||||
|
||||
if (! $this->strictACL) {
|
||||
switch ($this->type) {
|
||||
case 'os':
|
||||
|
@ -1408,17 +1410,17 @@ class Tree {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getDataExtended () {
|
||||
// Override this method to add new types
|
||||
}
|
||||
|
||||
|
||||
private function getDataAgent () {
|
||||
$processed_items = array();
|
||||
|
||||
|
||||
// Module names
|
||||
if ($this->id == -1) {
|
||||
|
||||
|
||||
}
|
||||
// Agents
|
||||
else {
|
||||
|
@ -1429,52 +1431,52 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$items = array();
|
||||
|
||||
|
||||
if ($this->serverID !== false) {
|
||||
|
||||
|
||||
$server = metaconsole_get_servers($this->serverID);
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$newItems = $this->getItems();
|
||||
$this->processModules($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($items))
|
||||
usort($items, array("Tree", "cmpSortNames"));
|
||||
|
||||
|
||||
$processed_items = $items;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->tree = $processed_items;
|
||||
}
|
||||
|
||||
|
||||
private function getDataStrict () {
|
||||
global $config;
|
||||
|
||||
|
||||
require_once($config['homedir']."/include/functions_groups.php");
|
||||
|
||||
|
||||
$processed_items = array();
|
||||
|
||||
|
||||
// Groups and tags
|
||||
if ($this->id == -1) {
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$items = group_get_data($config['id_user'], $this->strictACL, $this->acltags, false, 'tree');
|
||||
|
||||
|
||||
// Build the group and tag hierarchy
|
||||
$processed_items = array();
|
||||
foreach ($items as $key => $item) {
|
||||
if (empty($item['_parent_id_'])) {
|
||||
unset($items[$key]);
|
||||
|
||||
|
||||
$item['id'] = $item['_id_'];
|
||||
$item['name'] = $item['_name_'];
|
||||
|
||||
|
||||
if (isset($item['_is_tag_']) && $item['_is_tag_']) {
|
||||
$item['type'] = 'tag';
|
||||
$item['rootType'] = 'tag';
|
||||
|
@ -1483,11 +1485,11 @@ class Tree {
|
|||
$item['type'] = 'group';
|
||||
$item['rootType'] = 'group';
|
||||
$item['parent'] = $item['_parent_id_'];
|
||||
|
||||
|
||||
if (!empty($item['_iconImg_']))
|
||||
$item['iconHTML'] = $item['_iconImg_'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($item['_agents_unknown_']))
|
||||
$item['total_unknown_count'] = $item['_agents_unknown_'];
|
||||
if (isset($item['_agents_critical_']))
|
||||
|
@ -1502,9 +1504,9 @@ class Tree {
|
|||
$item['total_count'] = $item['_total_agents_'];
|
||||
if (isset($item['_monitors_alerts_fired_']))
|
||||
$item['total_fired_count'] = $item['_monitors_alerts_fired_'];
|
||||
|
||||
|
||||
$processed_item = $this->getProcessedItem($item, false, $items);
|
||||
|
||||
|
||||
if (!empty($processed_item)
|
||||
&& isset($processed_item['counters'])
|
||||
&& isset($processed_item['counters']['total'])
|
||||
|
@ -1516,24 +1518,24 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$unmerged_items = array();
|
||||
|
||||
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$items = group_get_data($config['id_user'], $this->strictACL, $this->acltags, false, 'tree');
|
||||
|
||||
|
||||
// Build the group hierarchy
|
||||
$processed_items = array();
|
||||
foreach ($items as $key => $item) {
|
||||
if (empty($item['_parent_id_'])) {
|
||||
unset($items[$key]);
|
||||
|
||||
|
||||
$item['id'] = $item['_id_'];
|
||||
$item['name'] = $item['_name_'];
|
||||
|
||||
|
||||
if (isset($item['_is_tag_']) && $item['_is_tag_']) {
|
||||
$item['type'] = 'tag';
|
||||
$item['rootType'] = 'tag';
|
||||
|
@ -1542,11 +1544,11 @@ class Tree {
|
|||
$item['type'] = 'group';
|
||||
$item['rootType'] = 'group';
|
||||
$item['parent'] = $item['_parent_id_'];
|
||||
|
||||
|
||||
if (!empty($item['_iconImg_']))
|
||||
$item['iconHTML'] = $item['_iconImg_'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($item['_agents_unknown_']))
|
||||
$item['total_unknown_count'] = $item['_agents_unknown_'];
|
||||
if (isset($item['_agents_critical_']))
|
||||
|
@ -1561,12 +1563,12 @@ class Tree {
|
|||
$item['total_count'] = $item['_total_agents_'];
|
||||
if (isset($item['_monitors_alerts_fired_']))
|
||||
$item['total_fired_count'] = $item['_monitors_alerts_fired_'];
|
||||
|
||||
|
||||
$processed_items[] = $this->getProcessedItem($item, $server, $items);
|
||||
}
|
||||
}
|
||||
$unmerged_items += $processed_items;
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
@ -1582,26 +1584,26 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$rootIDs = $this->rootID;
|
||||
|
||||
|
||||
$items = array();
|
||||
foreach ($rootIDs as $serverID => $rootID) {
|
||||
$server = metaconsole_get_servers($serverID);
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
$this->rootID = $rootIDs;
|
||||
|
||||
|
||||
if (!empty($items))
|
||||
usort($items, array("Tree", "cmpSortNames"));
|
||||
|
||||
|
||||
$processed_items = $items;
|
||||
}
|
||||
}
|
||||
|
@ -1611,19 +1613,19 @@ class Tree {
|
|||
|
||||
private function getDataGroup() {
|
||||
$processed_items = array();
|
||||
|
||||
|
||||
// Groups
|
||||
if ($this->id == -1) {
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$items = $this->getItems();
|
||||
|
||||
|
||||
// Build the group hierarchy
|
||||
foreach ($items as $key => $item) {
|
||||
if (empty($item['parent'])) {
|
||||
|
||||
|
||||
unset($items[$key]);
|
||||
$processed_item = $this->getProcessedItem($item, false, $items);
|
||||
|
||||
|
||||
if (!empty($processed_item)
|
||||
&& isset($processed_item['counters'])
|
||||
&& isset($processed_item['counters']['total'])
|
||||
|
@ -1634,7 +1636,7 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$servers = metaconsole_get_servers();
|
||||
|
||||
|
||||
$item_list = array();
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
|
@ -1654,7 +1656,7 @@ class Tree {
|
|||
}
|
||||
|
||||
$item_list = array_merge($item_list, $processed_items);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
@ -1670,19 +1672,19 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$rootIDs = $this->rootID;
|
||||
|
||||
|
||||
$items = array();
|
||||
foreach ($rootIDs as $serverID => $rootID) {
|
||||
$server = metaconsole_get_servers($serverID);
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
$this->rootID = $rootIDs;
|
||||
|
@ -1696,57 +1698,57 @@ class Tree {
|
|||
|
||||
$this->tree = $processed_items;
|
||||
}
|
||||
|
||||
|
||||
private function getDataTag() {
|
||||
$processed_items = array();
|
||||
|
||||
|
||||
// Tags
|
||||
if ($this->id == -1) {
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$items = $this->getItems();
|
||||
|
||||
|
||||
foreach ($items as $key => $item) {
|
||||
|
||||
|
||||
$counters = $this->getCounters($item['id']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$processed_item = $this->getProcessedItem($item);
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$servers = metaconsole_get_servers();
|
||||
|
||||
|
||||
$item_list = array();
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$items = $this->getItems();
|
||||
|
||||
$processed_items = array();
|
||||
foreach ($items as $key => $item) {
|
||||
|
||||
|
||||
$counters = $this->getCounters($item['id']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$processed_item = $this->getProcessedItem($item, $server);
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
$item_list = array_merge($item_list, $processed_items);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
$processed_items = $this->getMergedItems($item_list);
|
||||
}
|
||||
}
|
||||
|
@ -1759,26 +1761,26 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$rootIDs = $this->rootID;
|
||||
|
||||
|
||||
$items = array();
|
||||
foreach ($rootIDs as $serverID => $rootID) {
|
||||
$server = metaconsole_get_servers($serverID);
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
$this->rootID = $rootIDs;
|
||||
|
||||
|
||||
if (!empty($items))
|
||||
usort($items, array("Tree", "cmpSortNames"));
|
||||
|
||||
|
||||
$processed_items = $items;
|
||||
}
|
||||
}
|
||||
|
@ -1788,21 +1790,21 @@ class Tree {
|
|||
|
||||
private function getDataModules() {
|
||||
$processed_items = array();
|
||||
|
||||
|
||||
// Module names
|
||||
if ($this->id == -1) {
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$items = $this->getItems();
|
||||
|
||||
|
||||
foreach ($items as $key => $item) {
|
||||
|
||||
|
||||
$counters = $this->getCounters($item['name']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$name = str_replace(array(' ','#','/','.','(',')','¿','?','¡','!'),
|
||||
array( '_articapandora_'.ord(' ').'_pandoraartica_',
|
||||
'_articapandora_'.ord('#').'_pandoraartica_',
|
||||
|
@ -1815,35 +1817,35 @@ class Tree {
|
|||
'_articapandora_'.ord('¡').'_pandoraartica_',
|
||||
'_articapandora_'.ord('!').'_pandoraartica_'),
|
||||
io_safe_output($item['name']));
|
||||
|
||||
|
||||
$processed_item = $this->getProcessedItem($item);
|
||||
$processed_item['id'] = $name;
|
||||
$processed_item['rootID'] = $name;
|
||||
|
||||
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$servers = metaconsole_get_servers();
|
||||
|
||||
|
||||
$item_list = array();
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$items = $this->getItems();
|
||||
|
||||
|
||||
$processed_items = array();
|
||||
foreach ($items as $key => $item) {
|
||||
|
||||
|
||||
$counters = $this->getCounters($item['name']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$name = str_replace(array(' ','#','/','.','(',')','¿','?','¡','!'),
|
||||
array( '_articapandora_'.ord(' ').'_pandoraartica_',
|
||||
'_articapandora_'.ord('#').'_pandoraartica_',
|
||||
|
@ -1856,18 +1858,18 @@ class Tree {
|
|||
'_articapandora_'.ord('¡').'_pandoraartica_',
|
||||
'_articapandora_'.ord('!').'_pandoraartica_'),
|
||||
io_safe_output($item['name']));
|
||||
|
||||
|
||||
$processed_item = $this->getProcessedItem($item, $server);
|
||||
$processed_item['id'] = $name;
|
||||
$processed_item['rootID'] = $name;
|
||||
|
||||
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
$item_list = array_merge($item_list, $processed_items);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
$processed_items = $this->getMergedItems($item_list);
|
||||
}
|
||||
}
|
||||
|
@ -1880,83 +1882,83 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$rootIDs = $this->rootID;
|
||||
|
||||
|
||||
$items = array();
|
||||
foreach ($rootIDs as $serverID => $rootID) {
|
||||
$server = metaconsole_get_servers($serverID);
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
$this->rootID = $rootIDs;
|
||||
|
||||
|
||||
if (!empty($items))
|
||||
usort($items, array("Tree", "cmpSortNames"));
|
||||
|
||||
|
||||
$processed_items = $items;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->tree = $processed_items;
|
||||
}
|
||||
|
||||
|
||||
private function getDataModuleGroup() {
|
||||
$processed_items = array();
|
||||
|
||||
|
||||
// Module groups
|
||||
if ($this->id == -1) {
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$items = $this->getItems();
|
||||
|
||||
|
||||
foreach ($items as $key => $item) {
|
||||
|
||||
|
||||
$counters = $this->getCounters($item['id']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$processed_item = $this->getProcessedItem($item);
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$servers = metaconsole_get_servers();
|
||||
|
||||
|
||||
$item_list = array();
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$items = $this->getItems();
|
||||
|
||||
|
||||
$processed_items = array();
|
||||
foreach ($items as $key => $item) {
|
||||
|
||||
|
||||
$counters = $this->getCounters($item['id']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$processed_item = $this->getProcessedItem($item, $server);
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
$item_list = array_merge($item_list, $processed_items);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
$processed_items = $this->getMergedItems($item_list);
|
||||
}
|
||||
}
|
||||
|
@ -1969,50 +1971,50 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$rootIDs = $this->rootID;
|
||||
|
||||
|
||||
$items = array();
|
||||
foreach ($rootIDs as $serverID => $rootID) {
|
||||
$server = metaconsole_get_servers($serverID);
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
$this->rootID = $rootIDs;
|
||||
|
||||
|
||||
if (!empty($items))
|
||||
usort($items, array("Tree", "cmpSortNames"));
|
||||
|
||||
|
||||
$processed_items = $items;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->tree = $processed_items;
|
||||
}
|
||||
|
||||
private function getDataOS() {
|
||||
$processed_items = array();
|
||||
|
||||
|
||||
// OS
|
||||
if ($this->id == -1) {
|
||||
if (! defined ('METACONSOLE')) {
|
||||
$items = $this->getItems();
|
||||
|
||||
|
||||
foreach ($items as $key => $item) {
|
||||
|
||||
|
||||
$counters = $this->getCounters($item['id']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$processed_item = $this->getProcessedItem($item);
|
||||
$processed_item['icon'] = $item['os_icon'];
|
||||
$processed_items[] = $processed_item;
|
||||
|
@ -2020,34 +2022,34 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$servers = metaconsole_get_servers();
|
||||
|
||||
|
||||
$item_list = array();
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$items = $this->getItems();
|
||||
|
||||
|
||||
$processed_items = array();
|
||||
foreach ($items as $key => $item) {
|
||||
|
||||
|
||||
$counters = $this->getCounters($item['id']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$processed_item = $this->getProcessedItem($item, $server);
|
||||
$processed_item['icon'] = $item['os_icon'];
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
$item_list = array_merge($item_list, $processed_items);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
$processed_items = $this->getMergedItems($item_list);
|
||||
}
|
||||
}
|
||||
|
@ -2060,30 +2062,30 @@ class Tree {
|
|||
}
|
||||
else {
|
||||
$rootIDs = $this->rootID;
|
||||
|
||||
|
||||
$items = array();
|
||||
foreach ($rootIDs as $serverID => $rootID) {
|
||||
$server = metaconsole_get_servers($serverID);
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
$this->rootID = $rootIDs;
|
||||
|
||||
|
||||
if (!empty($items))
|
||||
usort($items, array("Tree", "cmpSortNames"));
|
||||
|
||||
|
||||
$processed_items = $items;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->tree = $processed_items;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,47 +217,47 @@ define('VISUAL_MAP_WIZARD_PARENTS_AGENT_RELANTIONSHIP', 2);
|
|||
|
||||
/* Service constants */
|
||||
//Status
|
||||
define('SERVICE_STATUS_UNKNOWN', -1);
|
||||
define('SERVICE_STATUS_NORMAL', 0);
|
||||
define('SERVICE_STATUS_CRITICAL', 1);
|
||||
define('SERVICE_STATUS_WARNING', 2);
|
||||
define('SERVICE_STATUS_ALERT', 4);
|
||||
define('SERVICE_STATUS_UNKNOWN', -1);
|
||||
define('SERVICE_STATUS_NORMAL', 0);
|
||||
define('SERVICE_STATUS_CRITICAL', 1);
|
||||
define('SERVICE_STATUS_WARNING', 2);
|
||||
define('SERVICE_STATUS_ALERT', 4);
|
||||
//Default weights
|
||||
define('SERVICE_WEIGHT_CRITICAL', 1);
|
||||
define('SERVICE_WEIGHT_WARNING', 0.5);
|
||||
define('SERVICE_ELEMENT_WEIGHT_CRITICAL', 1);
|
||||
define('SERVICE_ELEMENT_WEIGHT_WARNING', 0.5);
|
||||
define('SERVICE_ELEMENT_WEIGHT_OK', 0);
|
||||
define('SERVICE_ELEMENT_WEIGHT_UNKNOWN', 0);
|
||||
define('SERVICE_WEIGHT_CRITICAL', 1);
|
||||
define('SERVICE_WEIGHT_WARNING', 0.5);
|
||||
define('SERVICE_ELEMENT_WEIGHT_CRITICAL', 1);
|
||||
define('SERVICE_ELEMENT_WEIGHT_WARNING', 0.5);
|
||||
define('SERVICE_ELEMENT_WEIGHT_OK', 0);
|
||||
define('SERVICE_ELEMENT_WEIGHT_UNKNOWN', 0);
|
||||
//Modes
|
||||
define('SERVICE_MODE_MANUAL', 0);
|
||||
define('SERVICE_MODE_AUTO', 1);
|
||||
define('SERVICE_MODE_SIMPLE', 2);
|
||||
define('SERVICE_MODE_MANUAL', 0);
|
||||
define('SERVICE_MODE_AUTO', 1);
|
||||
define('SERVICE_MODE_SIMPLE', 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');
|
||||
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_UNKNOWN', 'agent_unknown.png');
|
||||
define ('STATUS_AGENT_OK', 'agent_ok.png');
|
||||
define ('STATUS_AGENT_NO_DATA', 'agent_no_data.png');
|
||||
define ('STATUS_AGENT_NO_MONITORS', 'agent_no_monitors.png');
|
||||
define ('STATUS_AGENT_NOT_INIT', 'agent_notinit.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_UNKNOWN', 'agent_unknown.png');
|
||||
define ('STATUS_AGENT_OK', 'agent_ok.png');
|
||||
define ('STATUS_AGENT_NO_DATA', 'agent_no_data.png');
|
||||
define ('STATUS_AGENT_NO_MONITORS', 'agent_no_monitors.png');
|
||||
define ('STATUS_AGENT_NOT_INIT', 'agent_notinit.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');
|
||||
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');
|
||||
define ('STATUS_SERVER_OK', 'server_ok.png');
|
||||
define ('STATUS_SERVER_DOWN', 'server_down.png');
|
||||
|
||||
|
||||
/* Status images (ball) */
|
||||
|
|
|
@ -1374,7 +1374,7 @@ function oracle_get_system_time() {
|
|||
return $time;
|
||||
|
||||
if ($config["timesource"] == "sql") {
|
||||
$time = db_get_sql ("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) as dt FROM dual");
|
||||
$time = db_get_sql ("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) as dt FROM dual");
|
||||
if (empty ($time)) {
|
||||
return time ();
|
||||
}
|
||||
|
|
|
@ -399,10 +399,6 @@ function set_user_language() {
|
|||
*/
|
||||
function human_time_description_raw ($seconds, $exactly = false, $units = 'large') {
|
||||
|
||||
//Miguel: I think that I can kill this unicorns and magical numbers
|
||||
// because this function may call without loaded the
|
||||
// constants.php file.
|
||||
|
||||
switch ($units) {
|
||||
case 'large':
|
||||
$secondsString = __('seconds');
|
||||
|
@ -434,44 +430,44 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
|||
if ($exactly) {
|
||||
$returnDate = '';
|
||||
|
||||
$years = floor($seconds / 31104000);
|
||||
$years = floor($seconds / SECONDS_1YEAR);
|
||||
|
||||
if ($years != 0) {
|
||||
$seconds = $seconds - ($years * 31104000);
|
||||
$seconds = $seconds - ($years * SECONDS_1YEAR);
|
||||
|
||||
$returnDate .= "$years $yearsString ";
|
||||
}
|
||||
|
||||
$months = floor($seconds / 2592000);
|
||||
$months = floor($seconds / SECONDS_1MONTH);
|
||||
|
||||
if ($months != 0) {
|
||||
$seconds = $seconds - ($months * 2592000);
|
||||
$seconds = $seconds - ($months * SECONDS_1MONTH);
|
||||
|
||||
$returnDate .= "$months $monthsString ";
|
||||
}
|
||||
|
||||
$days = floor($seconds / 86400);
|
||||
$days = floor($seconds / SECONDS_1DAY);
|
||||
|
||||
if ($days != 0) {
|
||||
$seconds = $seconds - ($days * 86400);
|
||||
$seconds = $seconds - ($days * SECONDS_1DAY);
|
||||
|
||||
$returnDate .= "$days $daysString ";
|
||||
}
|
||||
|
||||
$returnTime = '';
|
||||
|
||||
$hours = floor($seconds / 3600);
|
||||
$hours = floor($seconds / SECONDS_1HOUR);
|
||||
|
||||
if ($hours != 0) {
|
||||
$seconds = $seconds - ($hours * 3600);
|
||||
$seconds = $seconds - ($hours * SECONDS_1HOUR);
|
||||
|
||||
$returnTime .= "$hours $hoursString ";
|
||||
}
|
||||
|
||||
$mins = floor($seconds / 60);
|
||||
$mins = floor($seconds / SECONDS_1MINUTE);
|
||||
|
||||
if ($mins != 0) {
|
||||
$seconds = $seconds - ($mins * 60);
|
||||
$seconds = $seconds - ($mins * SECONDS_1MINUTE);
|
||||
|
||||
if ($hours == 0) {
|
||||
$returnTime .= "$mins $minutesString ";
|
||||
|
@ -512,26 +508,26 @@ function human_time_description_raw ($seconds, $exactly = false, $units = 'large
|
|||
|
||||
}
|
||||
|
||||
if ($seconds < 60)
|
||||
if ($seconds < SECONDS_1MINUTE)
|
||||
return format_numeric ($seconds, 0)." " . $secondsString;
|
||||
|
||||
if ($seconds < 3600) {
|
||||
if ($seconds < SECONDS_1HOUR) {
|
||||
$minutes = floor($seconds / 60);
|
||||
$seconds = $seconds % 60;
|
||||
$seconds = $seconds % SECONDS_1MINUTE;
|
||||
if ($seconds == 0)
|
||||
return $minutes.' ' . $minutesString;
|
||||
$seconds = sprintf ("%02d", $seconds);
|
||||
return $minutes.' '. $minutesString . ' ' .$seconds.' ' . $secondsString;
|
||||
}
|
||||
|
||||
if ($seconds < 86400)
|
||||
return format_numeric ($seconds / 3600, 0)." " . $hoursString;
|
||||
if ($seconds < SECONDS_1DAY)
|
||||
return format_numeric ($seconds / SECONDS_1HOUR, 0)." " . $hoursString;
|
||||
|
||||
if ($seconds < 2592000)
|
||||
return format_numeric ($seconds / 86400, 0) . " " . $daysString;
|
||||
if ($seconds < SECONDS_1MONTH)
|
||||
return format_numeric ($seconds / SECONDS_1DAY, 0) . " " . $daysString;
|
||||
|
||||
if ($seconds < 15552000)
|
||||
return format_numeric ($seconds / 2592000, 0)." ". $monthsString;
|
||||
if ($seconds < SECONDS_6MONTHS)
|
||||
return format_numeric ($seconds / SECONDS_1MONTH, 0)." ". $monthsString;
|
||||
|
||||
return "+6 " . $monthsString;
|
||||
}
|
||||
|
@ -578,44 +574,44 @@ function human_time_description_alerts ($seconds, $exactly = false, $units = 'ti
|
|||
if ($exactly) {
|
||||
$returnDate = '';
|
||||
|
||||
$years = floor($seconds / 31104000);
|
||||
$years = floor($seconds / SECONDS_1YEAR);
|
||||
|
||||
if ($years != 0) {
|
||||
$seconds = $seconds - ($years * 31104000);
|
||||
$seconds = $seconds - ($years * SECONDS_1YEAR);
|
||||
|
||||
$returnDate .= "$years $yearsString ";
|
||||
}
|
||||
|
||||
$months = floor($seconds / 2592000);
|
||||
$months = floor($seconds / SECONDS_1MONTH);
|
||||
|
||||
if ($months != 0) {
|
||||
$seconds = $seconds - ($months * 2592000);
|
||||
$seconds = $seconds - ($months * SECONDS_1MONTH);
|
||||
|
||||
$returnDate .= "$months $monthsString ";
|
||||
}
|
||||
|
||||
$days = floor($seconds / 86400);
|
||||
$days = floor($seconds / SECONDS_1DAY);
|
||||
|
||||
if ($days != 0) {
|
||||
$seconds = $seconds - ($days * 86400);
|
||||
$seconds = $seconds - ($days * SECONDS_1DAY);
|
||||
|
||||
$returnDate .= "$days $daysString ";
|
||||
}
|
||||
|
||||
$returnTime = '';
|
||||
|
||||
$hours = floor($seconds / 3600);
|
||||
$hours = floor($seconds / SECONDS_1HOUR);
|
||||
|
||||
if ($hours != 0) {
|
||||
$seconds = $seconds - ($hours * 3600);
|
||||
$seconds = $seconds - ($hours * SECONDS_1HOUR);
|
||||
|
||||
$returnTime .= "$hours $hoursString ";
|
||||
}
|
||||
|
||||
$mins = floor($seconds / 60);
|
||||
$mins = floor($seconds / SECONDS_1MINUTE);
|
||||
|
||||
if ($mins != 0) {
|
||||
$seconds = $seconds - ($mins * 60);
|
||||
$seconds = $seconds - ($mins * SECONDS_1MINUTE);
|
||||
|
||||
if ($hours == 0) {
|
||||
$returnTime .= "$mins $minutesString ";
|
||||
|
@ -659,23 +655,23 @@ function human_time_description_alerts ($seconds, $exactly = false, $units = 'ti
|
|||
if ($seconds < 60)
|
||||
return format_numeric ($seconds, 0)." " . $secondsString;
|
||||
|
||||
if ($seconds < 3600) {
|
||||
$minutes = floor($seconds / 60);
|
||||
$seconds = $seconds % 60;
|
||||
if ($seconds < SECONDS_1HOUR) {
|
||||
$minutes = floor($seconds / SECONDS_1MINUTE);
|
||||
$seconds = $seconds % SECONDS_1MINUTE;
|
||||
if ($seconds == 0)
|
||||
return $minutes.' ' . $minutesString;
|
||||
$seconds = sprintf ("%02d", $seconds);
|
||||
return $minutes.' '. $minutesString . ' ' .$seconds.' ' . $secondsString;
|
||||
}
|
||||
|
||||
if ($seconds < 86400)
|
||||
return format_numeric ($seconds / 3600, 0)." " . $hoursString;
|
||||
if ($seconds < SECONDS_1DAY)
|
||||
return format_numeric ($seconds / SECONDS_1HOUR, 0)." " . $hoursString;
|
||||
|
||||
if ($seconds < 2592000)
|
||||
return format_numeric ($seconds / 86400, 0) . " " . $daysString;
|
||||
if ($seconds < SECONDS_1MONTH)
|
||||
return format_numeric ($seconds / SECONDS_1DAY, 0) . " " . $daysString;
|
||||
|
||||
if ($seconds < 15552000)
|
||||
return format_numeric ($seconds / 2592000, 0)." ". $monthsString;
|
||||
if ($seconds < SECONDS_6MONTHS)
|
||||
return format_numeric ($seconds / SECONDS_1MONTH, 0)." ". $monthsString;
|
||||
|
||||
return "+6 " . $monthsString;
|
||||
}
|
||||
|
|
|
@ -1637,7 +1637,7 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
|
|||
$status = db_get_value_filter ('count(*)',
|
||||
'tagente',
|
||||
array ('id_agente' => (int) $id_agent,
|
||||
'ceil((to_date(ultimo_contacto, \'YYYY-MM-DD HH24:MI:SS\') - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (86400)) > ' . $time));
|
||||
'ceil((to_date(ultimo_contacto, \'YYYY-MM-DD HH24:MI:SS\') - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (' . SECONDS_1DAY . ')) > ' . $time));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,17 +60,17 @@ function cron_next_execution ($cron) {
|
|||
}
|
||||
|
||||
// Move to the next day of the month
|
||||
$nex_time_wd += 86400;
|
||||
$nex_time_wd += SECONDS_1DAY;
|
||||
list ($nex_mon_wd, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
||||
}
|
||||
while ($mday == '*' && $nex_mon_wd == $nex_mon);
|
||||
|
||||
$count++;
|
||||
}
|
||||
while ($count < 60);
|
||||
while ($count < SECONDS_1MINUTE);
|
||||
|
||||
// Something went wrong, default to 5 minutes
|
||||
return 300;
|
||||
return SECONDS_5MINUTES;
|
||||
}
|
||||
|
||||
// Get the next execution date for the given cron entry in seconds since epoch.
|
||||
|
@ -134,13 +134,13 @@ function cron_next_execution_date ($cron, $cur_time = false) {
|
|||
return $next_time;
|
||||
}
|
||||
if ($min == '*' && $hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') {
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + 60));
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1MINUTE));
|
||||
}
|
||||
else if ($hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') {
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + 3600));
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1HOUR));
|
||||
}
|
||||
else if ($mday == '*' && $mon == '*') {
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + 86400));
|
||||
list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1DAY));
|
||||
}
|
||||
else if ($mon == '*') {
|
||||
$nex_mon = $nex_mon + 1;
|
||||
|
@ -154,10 +154,10 @@ function cron_next_execution_date ($cron, $cur_time = false) {
|
|||
}
|
||||
$count++;
|
||||
}
|
||||
while ($count < 86400);
|
||||
while ($count < SECONDS_1DAY);
|
||||
|
||||
// Something went wrong, default to 5 minutes
|
||||
return $cur_time + 300;
|
||||
return $cur_time + SECONDS_5MINUTES;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -734,7 +734,7 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
|
|||
unknown_instructions, source, tags, custom_data,
|
||||
server_id)
|
||||
VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d,
|
||||
ceil((sysdate - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (86400)),
|
||||
ceil((sysdate - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (' . SECONDS_1DAY . ')),
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
|
||||
"%s", "%s", %d)',
|
||||
$id_agent, $id_group, $event, $status, $id_user,
|
||||
|
@ -786,7 +786,7 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
|
|||
critical_instructions, warning_instructions,
|
||||
unknown_instructions, source, tags, custom_data)
|
||||
VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d,
|
||||
ceil((sysdate - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (86400)),
|
||||
ceil((sysdate - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (' . SECONDS_1DAY . ')),
|
||||
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
|
||||
"%s", "%s")',
|
||||
$id_agent, $id_group, $event, $status, $id_user,
|
||||
|
@ -2035,7 +2035,14 @@ function events_page_details ($event, $server = "") {
|
|||
if (isset($module["module_name"])) {
|
||||
$module_module_name = $module["module_name"];
|
||||
}
|
||||
$link ="winopeng('" . $serverstring . "operation/agentes/stat_win.php?type=" . $graph_type."&period=86400&id=" . $module["id_agente_modulo"] . "&label=" . rawurlencode(urlencode(base64_encode($module_module_name))) . $hashstring . "&refresh=600','day_".$win_handle."')";
|
||||
$link ="winopeng('" . $serverstring .
|
||||
"operation/agentes/stat_win.php?type=" . $graph_type."&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"id=" . $module["id_agente_modulo"] . "&" .
|
||||
"label=" . rawurlencode(
|
||||
urlencode(
|
||||
base64_encode($module_module_name))) . $hashstring . "&" .
|
||||
"refresh=" . SECONDS_10MINUTES . "','day_".$win_handle."')";
|
||||
|
||||
$data[1] = '<a href="javascript:'.$link.'">';
|
||||
$data[1] .= html_print_image('images/chart_curve.png',true);
|
||||
|
|
|
@ -604,7 +604,7 @@ function gis_add_path($layerName, $idAgent, $lastPosition = null, $history_time
|
|||
$where = 'start_timestamp >= to_timestamp(ceil(date_part("epoch", CURRENT_TIMESTAMP)) - ' . $history_time . ')';
|
||||
break;
|
||||
case "oracle":
|
||||
$where = 'start_timestamp >= to_timestamp(\'01-01-1970 00:00:00\', \'DD-MM-YYYY HH24:MI:SS\') + NUMTODSINTERVAL((ceil((sysdate - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (86400)) - ' . $history_time . '),\'SECOND\')';
|
||||
$where = 'start_timestamp >= to_timestamp(\'01-01-1970 00:00:00\', \'DD-MM-YYYY HH24:MI:SS\') + NUMTODSINTERVAL((ceil((sysdate - to_date(\'19700101000000\',\'YYYYMMDDHH24MISS\')) * (' . SECONDS_1DAY . ')) - ' . $history_time . '),\'SECOND\')';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ function gis_get_conection_conf($idConnection) {
|
|||
*
|
||||
* @return boolean True ok and false fail.
|
||||
*/
|
||||
function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $centerInAgent = true, $history_time = 86400) {
|
||||
function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $centerInAgent = true, $history_time = SECONDS_1DAY) {
|
||||
$defaultMap = db_get_all_rows_sql("
|
||||
SELECT t1.*, t3.conection_name, t3.connection_type,
|
||||
t3.conection_data, t3.num_zoom_levels
|
||||
|
|
|
@ -523,9 +523,9 @@ function servers_get_info ($id_server = -1) {
|
|||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil(date_part('epoch', CURRENT_TIMESTAMP)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
break;
|
||||
case "oracle":
|
||||
$server["lag"] = db_get_sql ("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp from trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
$server["lag"] = db_get_sql ("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - utimestamp from trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
|
||||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
$server["module_lag"] = db_get_sql ("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) > (utimestamp + interval_sweep) AND id_recon_server = ".$server["id_server"]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ function servers_get_info ($id_server = -1) {
|
|||
AND (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp) > current_interval");
|
||||
break;
|
||||
case "oracle":
|
||||
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
|
||||
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
|
||||
WHERE utimestamp > 0
|
||||
AND tagente.disabled = 0
|
||||
AND tagente.id_agente = tagente_estado.id_agente
|
||||
|
@ -574,8 +574,8 @@ function servers_get_info ($id_server = -1) {
|
|||
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND current_interval > 0
|
||||
AND running_by = ".$server["id_server"]."
|
||||
AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp) < ( current_interval * 10)
|
||||
AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) - utimestamp) * (86400)) > current_interval");
|
||||
AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - utimestamp) < ( current_interval * 10)
|
||||
AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) - utimestamp) * (" . SECONDS_1DAY . ")) > current_interval");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ function servers_get_info ($id_server = -1) {
|
|||
AND (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp) > (current_interval * 1.1)");
|
||||
break;
|
||||
case "oracle":
|
||||
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
|
||||
$result = db_get_row_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
|
||||
WHERE utimestamp > 0
|
||||
AND tagente.disabled = 0
|
||||
AND tagente.id_agente = tagente_estado.id_agente
|
||||
|
@ -617,9 +617,9 @@ function servers_get_info ($id_server = -1) {
|
|||
AND tagente_modulo.id_tipo_modulo < 5
|
||||
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND current_interval > 0
|
||||
AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp) < ( current_interval * 10)
|
||||
AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - utimestamp) < ( current_interval * 10)
|
||||
AND running_by = ".$server["id_server"]."
|
||||
AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - utimestamp) > (current_interval * 1.1)");
|
||||
AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - utimestamp) > (current_interval * 1.1)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -506,25 +506,27 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
|||
|
||||
// Blank space below title, DONT remove this, this
|
||||
// Breaks the layout when Flash charts are enabled :-o
|
||||
//echo '<div id="id_div" style="height: 10px"> </div>';
|
||||
//echo '<div id="id_div" style="height: 10px"> </div>';
|
||||
|
||||
if ($config["agentaccess"]) {
|
||||
$access_graph = '<div style="margin-left: 10px;">';
|
||||
$access_graph .= graphic_agentaccess($id_agente, 290, 110, 86400, true);
|
||||
$access_graph .= graphic_agentaccess($id_agente, 290, 110,
|
||||
SECONDS_1DAY, true);
|
||||
$access_graph .= '</div><br>';
|
||||
|
||||
|
||||
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
||||
}
|
||||
|
||||
$events_graph = '<div style="margin-left: 10px;">';
|
||||
$events_graph .= graph_graphic_agentevents ($id_agente, 290, 15, 86400, '', true);
|
||||
$events_graph .= graph_graphic_agentevents ($id_agente, 290, 15,
|
||||
SECONDS_1DAY, '', true);
|
||||
$events_graph .= '</div><br>';
|
||||
|
||||
ui_toggle($events_graph, __('Events (24h)'));
|
||||
|
||||
|
||||
// Table network interfaces
|
||||
$network_interfaces_by_agents = agents_get_network_interfaces(array($agent));
|
||||
|
||||
|
||||
$network_interfaces = array();
|
||||
if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agents[$id_agente])) {
|
||||
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
|
||||
|
@ -1604,89 +1606,3 @@ function treeview_getSecondBranchSQL ($fatherType, $id, $id_father) {
|
|||
return $sql;
|
||||
}
|
||||
?>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
|
||||
/*
|
||||
module_id = $('#text-id_module').val();
|
||||
id_agent = $('#text-id_agent').val();
|
||||
server_name = $('#text-server_name').val();
|
||||
|
||||
$("#submit-upd_button").click( function() {
|
||||
show_module_detail_dialog(module_id, id_agent, server_name, 0, 86400);
|
||||
});
|
||||
|
||||
$("#submit-updbutton_period").click( function() {
|
||||
//refresh_period_callback();
|
||||
|
||||
var period = $('#period').val();
|
||||
console.log(period);
|
||||
show_module_detail_dialog(module_id, id_agent, server_name, 0, period);
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
// Show the modal window of an module
|
||||
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period,
|
||||
dataType: "html",
|
||||
success: function(data){
|
||||
$("#module_details_window").hide ()
|
||||
.empty ()
|
||||
.append (data)
|
||||
.dialog ({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 620,
|
||||
height: 500
|
||||
})
|
||||
.show ();
|
||||
refresh_pagination_callback ();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function refresh_pagination_callback () {
|
||||
$(".pagination").click( function() {
|
||||
|
||||
var classes = $(this).attr('class');
|
||||
classes = classes.split(' ');
|
||||
var offset_class = classes[1];
|
||||
offset_class = offset_class.split('_');
|
||||
var offset = offset_class[1];
|
||||
|
||||
var period = $('#period').val();
|
||||
//console.log(period);
|
||||
|
||||
show_module_detail_dialog(module_id, id_agent, server_name, offset, period);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function refresh_period_callback () {
|
||||
|
||||
$("#submit-updbutton_period").click( function() {
|
||||
var period = $('#period').val();
|
||||
console.log(period);
|
||||
show_module_detail_dialog(module_id, id_agent, server_name, 0, period);
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -77,7 +77,7 @@ class Agent {
|
|||
$agent_id = $system->getRequest('agent_id', '0');
|
||||
$width = $system->getRequest('width', '400');
|
||||
graph_graphic_agentevents(
|
||||
$this->id, $width, 30, 86400, ui_get_full_url(false));
|
||||
$this->id, $width, 30, SECONDS_1DAY, ui_get_full_url(false));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ check_login();
|
|||
require_once('include/functions_modules.php');
|
||||
|
||||
$module_id = get_parameter_get ("id", 0);
|
||||
$period = get_parameter ("period", 86400);
|
||||
$period = get_parameter ("period", SECONDS_1DAY);
|
||||
$group = agents_get_agentmodule_group ($module_id);
|
||||
$agentId = get_parameter("id_agente");
|
||||
$freestring = get_parameter ("freestring");
|
||||
|
|
|
@ -471,14 +471,15 @@ $table->style = array_fill(0, 3, 'vertical-align: top;');
|
|||
|
||||
$data = array();
|
||||
$data[0] = html_print_table($table_agent, true);
|
||||
$data[0] .= '<fieldset class="databox" style="position: static;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Events (24h)') .
|
||||
'</legend>' .
|
||||
'<div style="margin: auto; text-align:center; width: 300px;">' .
|
||||
graph_graphic_agentevents ($id_agente, 300, 15, 86400, '', true) .
|
||||
'</div>' .
|
||||
'</fieldset>';
|
||||
$data[0] .=
|
||||
'<fieldset class="databox" style="position: static;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Events (24h)') .
|
||||
'</legend>' .
|
||||
'<div style="margin: auto; text-align:center; width: 300px;">' .
|
||||
graph_graphic_agentevents ($id_agente, 300, 15, SECONDS_1DAY, '', true) .
|
||||
'</div>' .
|
||||
'</fieldset>';
|
||||
|
||||
// ACCESS RATE GRAPH
|
||||
$access_agent = db_get_value_sql("SELECT COUNT(id_agent)
|
||||
|
@ -486,14 +487,15 @@ $access_agent = db_get_value_sql("SELECT COUNT(id_agent)
|
|||
WHERE id_agent = " . $id_agente);
|
||||
|
||||
if ($config["agentaccess"] && $access_agent > 0) {
|
||||
$data[0] .= '<fieldset class="databox" style="position: static;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Agent access rate (24h)') .
|
||||
'</legend>' .
|
||||
'<div style="margin: auto; text-align:center; width: 300px;">' .
|
||||
graphic_agentaccess($id_agente, 300, 100, 86400, true) .
|
||||
'</div>' .
|
||||
'</fieldset>';
|
||||
$data[0] .=
|
||||
'<fieldset class="databox" style="position: static;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Agent access rate (24h)') .
|
||||
'</legend>' .
|
||||
'<div style="margin: auto; text-align:center; width: 300px;">' .
|
||||
graphic_agentaccess($id_agente, 300, 100, SECONDS_1DAY, true) .
|
||||
'</div>' .
|
||||
'</fieldset>';
|
||||
}
|
||||
|
||||
$data[1] = html_print_table($table_contact, true);
|
||||
|
|
|
@ -299,15 +299,19 @@ if (empty($export_btn) || $show_form) {
|
|||
//Start date selector
|
||||
$table->data[3][0] = '<b>'.__('Begin date').'</b>';
|
||||
|
||||
$table->data[3][1] = html_print_input_text ('start_date', date ("Y-m-d", get_system_time () - 86400), false, 10, 10, true);
|
||||
$table->data[3][1] = html_print_input_text ('start_date',
|
||||
date ("Y-m-d", get_system_time () - SECONDS_1DAY), false, 10, 10, true);
|
||||
$table->data[3][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-start_date'),this);"));
|
||||
$table->data[3][1] .= html_print_input_text ('start_time', date ("H:i", get_system_time () - 86400), false, 10, 5, true);
|
||||
$table->data[3][1] .= html_print_input_text ('start_time',
|
||||
date ("H:i", get_system_time () - SECONDS_1DAY), false, 10, 5, true);
|
||||
|
||||
//End date selector
|
||||
$table->data[4][0] = '<b>'.__('End date').'</b>';
|
||||
$table->data[4][1] = html_print_input_text ('end_date', date ("Y-m-d", get_system_time ()), false, 10, 10, true);
|
||||
$table->data[4][1] = html_print_input_text ('end_date',
|
||||
date ("Y-m-d", get_system_time ()), false, 10, 10, true);
|
||||
$table->data[4][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-end_date'),this);"));
|
||||
$table->data[4][1] .= html_print_input_text ('end_time', date ("H:i", get_system_time ()), false, 10, 5, true);
|
||||
$table->data[4][1] .= html_print_input_text ('end_time',
|
||||
date ("H:i", get_system_time ()), false, 10, 5, true);
|
||||
|
||||
//Export type
|
||||
$table->data[5][0] = '<b>'.__('Export type').'</b>';
|
||||
|
|
|
@ -31,7 +31,7 @@ require_once ($config['homedir'].'/include/functions_agents.php');
|
|||
ui_require_javascript_file('openlayers.pandora');
|
||||
|
||||
/* Get the parameters */
|
||||
$period = (int)get_parameter ("period", 86400);
|
||||
$period = (int)get_parameter ("period", SECONDS_1DAY);
|
||||
$agentId = (int)get_parameter('id_agente');
|
||||
$agent_name = agents_get_name($id_agente);
|
||||
$agentData = gis_get_data_last_position_agent($id_agente);
|
||||
|
@ -74,7 +74,7 @@ switch ($config["dbtype"]) {
|
|||
break;
|
||||
case "oracle":
|
||||
$timestampLastOperation = db_get_value_sql(
|
||||
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) from dual");
|
||||
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) from dual");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ $label = base64_decode(get_parameter('label', ''));
|
|||
if ($show_other) {
|
||||
$avg_only = 0;
|
||||
}
|
||||
$period = get_parameter ("period", 86400);
|
||||
$period = get_parameter ("period", SECONDS_1DAY);
|
||||
$id = get_parameter ("id", 0);
|
||||
$width = get_parameter ("width", 555);
|
||||
$height = get_parameter ("height", 245);
|
||||
|
|
|
@ -1152,9 +1152,28 @@ foreach ($result as $row) {
|
|||
$win_handle=dechex(crc32($row["id_agente_modulo"].$row["module_name"]));
|
||||
|
||||
if (defined('METACONSOLE'))
|
||||
$link ="winopeng('" . $row['server_url'] . "operation/agentes/stat_win.php?type=$graph_type&period=86400&loginhash=auto&loginhash_data=" . $row["hashdata"] . "&loginhash_user=" . str_rot13($row["user"]) . "&id=".$row["id_agente_modulo"]."&label=".rawurlencode(urlencode(base64_encode($row["module_name"])))."&refresh=600','day_".$win_handle."')";
|
||||
$link ="winopeng('" .
|
||||
$row['server_url'] . "operation/agentes/stat_win.php?" .
|
||||
"type=$graph_type&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"loginhash=auto&" .
|
||||
"loginhash_data=" . $row["hashdata"] . "&" .
|
||||
"loginhash_user=" . str_rot13($row["user"]) . "&" .
|
||||
"id=" . $row["id_agente_modulo"] . "&" .
|
||||
"label=" . rawurlencode(
|
||||
urlencode(
|
||||
base64_encode($row["module_name"]))) . "&" .
|
||||
"refresh=" . SECONDS_10MINUTES . "', 'day_".$win_handle."')";
|
||||
else
|
||||
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$row["id_agente_modulo"]."&label=".rawurlencode(urlencode(base64_encode($row["module_name"])))."&refresh=600','day_".$win_handle."')";
|
||||
$link ="winopeng('" .
|
||||
"operation/agentes/stat_win.php?" .
|
||||
"type=$graph_type&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"id=".$row["id_agente_modulo"]."&" .
|
||||
"label=" . rawurlencode(
|
||||
urlencode(
|
||||
base64_encode($row["module_name"]))) . "&" .
|
||||
"refresh=" . SECONDS_10MINUTES . "', 'day_".$win_handle."')";
|
||||
|
||||
$data[7] = '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a>';
|
||||
|
||||
|
@ -1162,13 +1181,15 @@ foreach ($result as $row) {
|
|||
"show_module_detail_dialog(" .
|
||||
$row["id_agente_modulo"] . ", ".
|
||||
$row['id_agent'] . ", \"" .
|
||||
$row['server_name'] . "\", 0, 86400)'>" .
|
||||
$row['server_name'] . "\", 0, " . SECONDS_1DAY . ")'>" .
|
||||
html_print_image ("images/binary.png", true,
|
||||
array ("border" => "0", "alt" => "")) . "</a>";
|
||||
|
||||
}
|
||||
|
||||
$data[8] = ui_print_module_warn_value($row['max_warning'], $row['min_warning'], $row['str_warning'], $row['max_critical'], $row['min_critical'], $row['str_critical']);
|
||||
$data[8] = ui_print_module_warn_value($row['max_warning'],
|
||||
$row['min_warning'], $row['str_warning'], $row['max_critical'],
|
||||
$row['min_critical'], $row['str_critical']);
|
||||
|
||||
if (is_numeric($row["datos"])) {
|
||||
$salida = format_numeric($row["datos"]);
|
||||
|
|
|
@ -182,7 +182,7 @@ if ($layers != false) {
|
|||
break;
|
||||
case "oracle":
|
||||
$timestampLastOperation = db_get_value_sql(
|
||||
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) FROM dual");
|
||||
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) FROM dual");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ if ($layers != false) {
|
|||
break;
|
||||
case "oracle":
|
||||
$timestampLastOperation = db_get_value_sql(
|
||||
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) FROM dual");
|
||||
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) FROM dual");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ $filter['advanced_filter'] = get_parameter('advanced_filter','');
|
|||
// Read chart configuration
|
||||
$chart_type = get_parameter('chart_type', 'netflow_area');
|
||||
$max_aggregates = (int) get_parameter('max_aggregates', 0);
|
||||
$period = (int) get_parameter('period', '86400');
|
||||
$period = (int) get_parameter('period', SECONDS_1DAY);
|
||||
$update_date = (int) get_parameter('update_date', 0);
|
||||
$date = get_parameter_post ('date', date (DATE_FORMAT, get_system_time ()));
|
||||
$time = get_parameter_post ('time', date (TIME_FORMAT, get_system_time ()));
|
||||
|
@ -104,7 +104,7 @@ $start_date = $end_date - $period;
|
|||
if (! defined ('METACONSOLE')) {
|
||||
//Header
|
||||
ui_print_page_header (__('Netflow live view'), "images/op_netflow.png", false, "", false, array ());
|
||||
|
||||
|
||||
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
||||
if ($is_windows) {
|
||||
ui_print_error_message(__('Not supported in Windows systems'));
|
||||
|
@ -124,7 +124,7 @@ if (! defined ('METACONSOLE')) {
|
|||
ui_print_error_message(sprintf(__('Make sure nfdump version 1.6.8 or newer is installed!')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
$nav_bar = array(array('link' => 'index.php?sec=main', 'text' => __('Main')),
|
||||
|
@ -179,7 +179,7 @@ enterprise_hook('open_meta_frame');
|
|||
|
||||
echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&sec2=operation/netflow/nf_live_view&pure='.$pure.'">';
|
||||
echo "<table class='databox' width='99%'>";
|
||||
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
$list_servers = array();
|
||||
|
||||
|
@ -208,10 +208,12 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
|
|||
|
||||
echo "<tr>";
|
||||
echo "<td>" . '<b>'.__('Connection').'</b>' . "</td>";
|
||||
echo "<td>" . html_print_select($list_servers, 'connection_name', $connection_name, '', '', 0, true, false, false) . "</td>";
|
||||
echo "<td>" . html_print_select($list_servers,
|
||||
'connection_name', $connection_name, '', '', 0, true, false,
|
||||
false) . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
|
||||
echo "<tr>";
|
||||
|
||||
echo "<td>" .
|
||||
|
|
|
@ -53,7 +53,7 @@ $datetime = strtotime ($date . ' ' . $time);
|
|||
$report["datetime"] = $datetime;
|
||||
|
||||
// Calculations in order to modify init date of the report
|
||||
$date_init_less = strtotime(date('Y-m-j')) - 86400;
|
||||
$date_init_less = strtotime(date('Y-m-j')) - SECONDS_1DAY;
|
||||
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
|
||||
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
|
||||
$datetime_init = strtotime ($date_init.' '.$time_init);
|
||||
|
@ -67,18 +67,22 @@ $options = array();
|
|||
|
||||
$options['list_reports'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">' .
|
||||
html_print_image("images/report_list.png", true, array ("title" => __('Report list'))) .'</a>');
|
||||
|
||||
html_print_image("images/report_list.png", true,
|
||||
array("title" => __('Report list'))) .'</a>');
|
||||
|
||||
if (check_acl ($config['id_user'], 0, "RW")) {
|
||||
$options['main']['text'] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=edit&id_report=' . $id_report . '&pure='.$pure.'">' .
|
||||
html_print_image("images/op_reporting.png", true, array ("title" => __('Main data'))) .'</a>';
|
||||
|
||||
html_print_image("images/op_reporting.png", true,
|
||||
array("title" => __('Main data'))) .'</a>';
|
||||
|
||||
$options['list_items']['text'] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $id_report . '&pure='.$pure.'">' .
|
||||
html_print_image("images/list.png", true, array ("title" => __('List items'))) .'</a>';
|
||||
|
||||
html_print_image("images/list.png", true,
|
||||
array("title" => __('List items'))) .'</a>';
|
||||
|
||||
$options['item_editor']['text'] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=new&id_report=' . $id_report . '&pure='.$pure.'">' .
|
||||
html_print_image("images/pen.png", true, array ("title" => __('Item editor'))) .'</a>';
|
||||
|
||||
html_print_image("images/pen.png", true,
|
||||
array("title" => __('Item editor'))) .'</a>';
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$options = reporting_enterprise_add_Tabs($options, $id_report);
|
||||
}
|
||||
|
|
|
@ -148,10 +148,28 @@ else {
|
|||
$url = 'include/procesos.php?agente=' . $module["id_agente_modulo"];
|
||||
$win_handle = dechex(crc32($module["id_agente_modulo"] . $module["module_name"]));
|
||||
|
||||
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$module["id_agente_modulo"]."&label=".rawurlencode(urlencode(base64_encode($module["module_name"])))."&refresh=600','day_".$win_handle."')";
|
||||
$link ="winopeng('" .
|
||||
"operation/agentes/stat_win.php?" .
|
||||
"type=$graph_type&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"id=" . $module["id_agente_modulo"] . "&" .
|
||||
"label=" . rawurlencode(
|
||||
urlencode(
|
||||
base64_encode($module["module_name"]))) . "&" .
|
||||
"refresh=" . SECONDS_10MINUTES . "', " .
|
||||
"'day_" . $win_handle . "')";
|
||||
|
||||
$graphCell = '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => 0, "alt" => "")) . '</a>';
|
||||
$graphCell .= " <a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$module["id_agente"]."&tab=data_view&period=86400&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/binary.png', true, array("border" => "0", "alt" => "")) . "</a>";
|
||||
$graphCell .= " " .
|
||||
"<a href='index.php?" .
|
||||
"sec=estado&" .
|
||||
"sec2=operation/agentes/ver_agente&" .
|
||||
"id_agente=" . $module["id_agente"] . "&" .
|
||||
"tab=data_view&" .
|
||||
"period=" . SECONDS_1DAY . "&" .
|
||||
"id=" . $module["id_agente_modulo"] . "'>" .
|
||||
html_print_image('images/binary.png', true,
|
||||
array("border" => "0", "alt" => "")) . "</a>";
|
||||
}
|
||||
|
||||
if (is_numeric($module["datos"])) {
|
||||
|
|
Loading…
Reference in New Issue