} } $ip_cidr = Asset_host_ips::valid_ip($agent_idm_ip) ? $agent_idm_ip : $agent['ip']; } $data = array(); if (!preg_match('/Never connected/i', $agent['status']) && Asset_host_ips::valid_ip($ip_cidr)) { $data = Ossec_utilities::SIEM_trends_hids($conn, $ip_cidr); } $trend_plot = "<div style='color:gray; margin:15px; text-align:center;'>" . _('Trend chart not available') . "</div>"; if (is_array($data) && !empty($data)) { $trend = ''; $max = 7; for ($ii = $max - 1; $ii >= 0; $ii--) { $d = gmdate("j M", $timetz - 86400 * $ii); $trend[$d] = $data[$d] != '' ? $data[$d] : 0; } $i = 0; foreach ($trend as $k => $v) { $x[$k] = $i; $i++; } $y = $trend; $xticks = $x; foreach ($trend as $k => $v) { $xlabels[$k] = $k; } $trend_plot = "<div id='plotarea_" . $agent_id . "'>" . Ossec_utilities::plot_graphic('plotarea_' . $agent_id, 40, 250, $x, $y, $xticks, $xlabels, FALSE) . '</div>'; } $db->close(); echo $trend_plot; }