' . PHP_EOL;
$string .= ' | ' . PHP_EOL;
if ($events['short']) {
$string .= ' ';
$string .= generate_tooltip_time($entry['timestamp']) . ' | ' . PHP_EOL;
} else {
$string .= ' ';
$string .= format_timestamp($entry['timestamp']) . ' | ' . PHP_EOL;
}
if ($list['device']) {
$dev = device_by_id_cache($entry['device_id']);
$device_vars = [
'page' => 'device',
'device' => $entry['device_id'],
'tab' => 'logs',
'section' => 'alertlog'
];
$string .= ' ' . generate_device_link_short($dev, $device_vars) . ' | ' . PHP_EOL;
}
if ($list['alert_test_id']) {
$string .= ' ' . escape_html($alert_rule['alert_name']) . ' | ';
}
if ($list['entity']) {
$string .= ' ';
if ($list['entity_type']) {
$string .= get_icon($GLOBALS['config']['entities'][$entry['entity_type']]['icon']) . ' ';
}
if ($events['short']) {
$string .= ' ' . generate_entity_link($entry['entity_type'], $entry['entity_id'], NULL, NULL, NULL, TRUE) . ' | ' . PHP_EOL;
} else {
$string .= ' ' . generate_entity_link($entry['entity_type'], $entry['entity_id']) . '' . PHP_EOL;
}
}
$string .= '' . escape_html($entry['message']) . ' | ' . PHP_EOL;
if (!$vars['short']) {
$string .= '' . escape_html($entry['log_type']) . ' | ' . PHP_EOL;
/*
$string .= '';
if ($entry['notified'])
{
$string .= 'OK';
} else if (!stristr($entry['log_type'], 'notify')) {
$string .= 'SKIP';
} else {
$string .= 'NO';
}
$string .= ' | ' . PHP_EOL;
*/
}
if ($list['info']) {
$state = '';
if ($log_state = safe_json_decode($entry['log_state'])) {
// Metrics
$state = generate_box_open(['title' => 'Polled values', 'header-border' => TRUE,
//'body-style' => 'padding: 0px !important;',
'box-style' => 'margin-bottom: 0px;']);
$state .= '';
$state .= 'Metric | Value |
';
$state .= '';
$failed = [];
foreach ($log_state['failed'] as $metric) {
$failed[$metric['metric']] = $metric['metric'];
}
//r($log_state['failed']);
foreach ($log_state['metrics'] as $metric => $value) {
$value = format_value($value);
if (isset($failed[$metric])) {
$value = '' . $value . '';
}
$state .= "$metric | $value |
";
}
$state .= '
';
$state = generate_tooltip_link(NULL, get_icon('info'), $state);
$state .= generate_box_close();
}
$string .= '' . $state . ' | ' . PHP_EOL;
}
$string .= '
' . PHP_EOL;
}
$string .= '