9555-Groups, agents counters
This commit is contained in:
parent
7b57607149
commit
d144d77128
|
@ -77,7 +77,7 @@ function html_debug_print($var, $file='', $oneline=false)
|
|||
fprintf($f, '%s', $output);
|
||||
fclose($f);
|
||||
} else {
|
||||
echo '<pre class="bg_white pdd_1em zindex10000">'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info."\n";
|
||||
echo '<pre class="bg_white pdd_1em zindex10000 relative-mobile">'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info."\n";
|
||||
print_r($var);
|
||||
echo '</pre>';
|
||||
}
|
||||
|
|
|
@ -510,6 +510,30 @@ table.event_details td.cell_event_name {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.color-red {
|
||||
color: #c00 !important;
|
||||
}
|
||||
|
||||
.color-green {
|
||||
color: #5a8629 !important;
|
||||
}
|
||||
|
||||
.color-orange {
|
||||
color: #fd7304 !important;
|
||||
}
|
||||
|
||||
.color-yellow {
|
||||
color: #f3c500 !important;
|
||||
}
|
||||
|
||||
.color-grey {
|
||||
color: #808080 !important;
|
||||
}
|
||||
|
||||
.color-blue {
|
||||
color: #4a83f3 !important;
|
||||
}
|
||||
|
||||
.green,
|
||||
.orange,
|
||||
.yellow,
|
||||
|
@ -1732,3 +1756,23 @@ body.login-background
|
|||
height: 12px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
table#list_servers span.data a {
|
||||
pointer-events: none;
|
||||
color: inherit;
|
||||
text-decoration: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
.zindex10000 {
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.relative-mobile {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
span.agents-counter {
|
||||
float: right;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
|
|
@ -121,6 +121,45 @@ class Groups
|
|||
$status_image = ui_print_status_image('agent_no_data_ball.png', '', true);
|
||||
}
|
||||
|
||||
// Show agent counter by states.
|
||||
$agents_counter = '['.$group['_total_agents_'];
|
||||
|
||||
if ($group['_monitors_alerts_fired_'] > 0) {
|
||||
$agents_counter .= ':';
|
||||
$agents_counter .= '<span class="color-orange">'.$group['_monitors_alerts_fired_'].'</span>';
|
||||
}
|
||||
|
||||
if ($group['_monitors_critical_'] > 0) {
|
||||
$agents_counter .= ':';
|
||||
$agents_counter .= '<span class="color-red">'.$group['_monitors_critical_'].'</span>';
|
||||
}
|
||||
|
||||
if ($group['_agents_warning_'] > 0) {
|
||||
$agents_counter .= ':';
|
||||
$agents_counter .= '<span class="color-yellow">'.$group['_agents_warning_'].'</span>';
|
||||
}
|
||||
|
||||
if ($group['_agents_unknown_'] > 0) {
|
||||
$agents_counter .= ':';
|
||||
$agents_counter .= '<span class="color-grey">'.$group['_agents_unknown_'].'</span>';
|
||||
}
|
||||
|
||||
if ($group['_agents_not_init_'] > 0) {
|
||||
$agents_counter .= ':';
|
||||
$agents_counter .= '<span class="color-blue">'.$group['_agents_not_init_'].'</span>';
|
||||
}
|
||||
|
||||
if ($group['_agents_ok_'] > 0) {
|
||||
$agents_counter .= ':';
|
||||
$agents_counter .= '<span class="color-green">'.$group['_agents_ok_'].'</span>';
|
||||
}
|
||||
|
||||
$agents_counter .= ']';
|
||||
|
||||
if ($group['_iconImg_'] !== null) {
|
||||
$img_group = html_print_image('images/'.$group['_iconImg_'], true, false, false, false, false, true);
|
||||
}
|
||||
|
||||
$group['_iconImg_'] = ($group['_iconImg_'] == '') ? 'world.png' : $group['_iconImg_'];
|
||||
$ui->contentAddHtml(
|
||||
'
|
||||
|
@ -138,40 +177,40 @@ class Groups
|
|||
'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<div data-collapsed-icon="group_'.$count.'" '.'data-expanded-icon="group_'.$count.'" '.'data-iconpos="right" data-role="collapsible" '.'data-collapsed="true" data-theme="'.$color_class.'" data-content-theme="d">'
|
||||
'<div data-collapsed-icon="group_'.$count.'" '.'data-expanded-icon="group_'.$count.'" data-iconpos="right" data-role="collapsible" data-collapsed="true" data-theme="'.$color_class.'" data-content-theme="d">'
|
||||
);
|
||||
$ui->contentAddHtml('<h4>'.$group['_name_'].'</h4>');
|
||||
$ui->contentAddHtml('<h4>'.$img_group.' '.$group['_name_'].'<span class="agents-counter">'.$agents_counter.'</span></h4>');
|
||||
$ui->contentAddHtml('<ul data-role="listview" class="groups_sublist">');
|
||||
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="'.sprintf($url_agent, $group['_id_'], AGENT_STATUS_ALL).'">'.'<span class="name_count">'.html_print_image('images/agent.png', true, ['class' => 'invert_filter'], false, false, false, true).__('Total agents').'</span>'.'<span class="number_count">'.$group['_total_agents_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href="'.sprintf($url_agent, $group['_id_'], AGENT_STATUS_ALL).'"><span class="name_count">'.html_print_image('images/agent.png', true, ['class' => 'invert_filter'], false, false, false, true).__('Total agents').'</span><span class="number_count">'.$group['_total_agents_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="'.sprintf($url_agent, $group['_id_'], AGENT_STATUS_NOT_INIT).'">'.'<span class="name_count">'.html_print_image('images/agent_notinit.png', true, false, false, false, false, true).__('Agents not init').'</span>'.'<span class="number_count">'.$group['_agents_not_init_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href="'.sprintf($url_agent, $group['_id_'], AGENT_STATUS_NOT_INIT).'"><span class="name_count">'.html_print_image('images/agent_notinit.png', true, false, false, false, false, true).__('Agents not init').'</span><span class="number_count">'.$group['_agents_not_init_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="'.sprintf($url_agent, $group['_id_'], AGENT_STATUS_CRITICAL).'">'.'<span class="name_count">'.html_print_image('images/agent_critical.png', true, false, false, false, false, true).__('Agents critical').'</span>'.'<span class="number_count">'.$group['_agents_critical_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href="'.sprintf($url_agent, $group['_id_'], AGENT_STATUS_CRITICAL).'"><span class="name_count">'.html_print_image('images/agent_critical.png', true, false, false, false, false, true).__('Agents critical').'</span><span class="number_count">'.$group['_agents_critical_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="'.sprintf($url_agent, $group['_id_'], AGENT_STATUS_UNKNOWN).'">'.'<span class="name_count">'.html_print_image('images/agent_unknown.png', true, false, false, false, false, true).__('Agents unknown').'</span>'.'<span class="number_count">'.$group['_agents_unknown_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href="'.sprintf($url_agent, $group['_id_'], AGENT_STATUS_UNKNOWN).'"><span class="name_count">'.html_print_image('images/agent_unknown.png', true, false, false, false, false, true).__('Agents unknown').'</span><span class="number_count">'.$group['_agents_unknown_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_UNKNOWN).'">'.'<span class="name_count">'.html_print_image('images/module_unknown.png', true, false, false, false, false, true).__('Unknown modules').'</span>'.'<span class="number_count">'.$group['_monitors_unknown_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_UNKNOWN).'"><span class="name_count">'.html_print_image('images/module_unknown.png', true, false, false, false, false, true).__('Unknown modules').'</span><span class="number_count">'.$group['_monitors_unknown_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_NOT_INIT).'">'.'<span class="name_count">'.html_print_image('images/module_notinit.png', true, false, false, false, false, true).__('Not init modules').'</span>'.'<span class="number_count">'.$group['_monitors_not_init_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_NOT_INIT).'"><span class="name_count">'.html_print_image('images/module_notinit.png', true, false, false, false, false, true).__('Not init modules').'</span><span class="number_count">'.$group['_monitors_not_init_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_NORMAL).'">'.'<span class="name_count">'.html_print_image('images/module_ok.png', true, false, false, false, false, true).__('Normal modules').'</span>'.'<span class="number_count">'.$group['_monitors_ok_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_NORMAL).'"><span class="name_count">'.html_print_image('images/module_ok.png', true, false, false, false, false, true).__('Normal modules').'</span><span class="number_count">'.$group['_monitors_ok_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_WARNING).'">'.'<span class="name_count">'.html_print_image('images/module_warning.png', true, false, false, false, false, true).__('Warning modules').'</span>'.'<span class="number_count">'.$group['_monitors_warning_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_WARNING).'"><span class="name_count">'.html_print_image('images/module_warning.png', true, false, false, false, false, true).__('Warning modules').'</span><span class="number_count">'.$group['_monitors_warning_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_CRITICAL_BAD).'">'.'<span class="name_count">'.html_print_image('images/module_critical.png', true, false, false, false, false, true).__('Critical modules').'</span>'.'<span class="number_count">'.$group['_monitors_critical_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href="'.sprintf($url_modules, $group['_id_'], AGENT_MODULE_STATUS_CRITICAL_BAD).'"><span class="name_count">'.html_print_image('images/module_critical.png', true, false, false, false, false, true).__('Critical modules').'</span><span class="number_count">'.$group['_monitors_critical_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml(
|
||||
'<li data-icon="false"><a href="">'.'<span class="name_count">'.html_print_image('images/bell_error.png', true, false, false, false, false, true).__('Alerts fired').'</span>'.'<span class="number_count">'.$group['_monitors_alerts_fired_'].'</span>'.'</a></li>'
|
||||
'<li data-icon="false"><a href=""><span class="name_count">'.html_print_image('images/bell_error.png', true, false, false, false, false, true).__('Alerts fired').'</span><span class="number_count">'.$group['_monitors_alerts_fired_'].'</span></a></li>'
|
||||
);
|
||||
$ui->contentAddHtml('</ul>');
|
||||
$ui->contentAddHtml('</div>');
|
||||
|
|
|
@ -354,6 +354,12 @@ class ServerStatus
|
|||
}
|
||||
}
|
||||
|
||||
echo "<script>
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
document.querySelector('table#list_servers span.data a').href = '#';
|
||||
});
|
||||
</script>";
|
||||
|
||||
return [
|
||||
'servers' => $servers,
|
||||
'total' => $total,
|
||||
|
|
Loading…
Reference in New Issue