コード例 #1
0
ファイル: load_trend.php プロジェクト: jackpf/ossim-arc
     if (Asset_host::is_in_db($conn, $asset_id)) {
         $data = Ossec_utilities::hids_trend_by_id($conn, $asset_id);
     } else {
         if ($ip_cidr == '127.0.0.1') {
             // Getting default sensor IP
             $sensor_ip = Av_sensor::get_ip_by_id($conn, $sensor_id);
             $ip_cidr = empty($sensor_ip) ? $ip_cidr : $sensor_ip;
         } else {
             try {
                 $agent = array('name' => $agent_name, 'ip_cidr' => $ip_cidr);
                 $ip_cidr = Ossec_agent::get_last_ip($sensor_id, $agent);
             } catch (Exception $e) {
             }
         }
         if (Asset_host_ips::valid_ip($ip_cidr)) {
             $data = Ossec_utilities::hids_trend_by_ip($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++;