$host) { /* if the service check is not 0 then tag the host for display */ /* Also count the number category items */ foreach($host_ar[$name] as $sname => $host_item) { switch($host_item['last_hard_state']) { case 1: $host_d++; break; case 2: $host_u++; break; case 3: $host_p++; break; } } foreach($service_ar[$name] as $sname => $service_item) { switch($service_item['last_hard_state']) { case 1: $service_w++; break; case 2: $service_c++; break; case 3: $service_u++; break; case 4: $service_p++; break; } if($service_item['last_hard_state'] > 0) { $status_msgs[$name]['hoststatus'] = $host_ar[$name]; $status_msgs[$name]['servicestatus'] = $service_ar[$name]; } } $i++; } $service_o = $services_count - $service_w - $service_c - $service_u - $service_p; $info['hosts'] = array("Up" => $hosts_count, "Down" => $host_d, "Unreachable" => $host_u, "Pending" => $host_p); $info['services'] = array("Ok" => $service_o, "Warning" => $service_w, "Unknown" => $service_u, "Critical" => $service_c, "Pending" => $service_p); $nagios_status['info'] = $info; $nagios_status['process'] = $status; $nagios_status['status'] = $status_msgs; return($nagios_status); } $status_file = "/usr/local/nagios/var/status.dat"; $nagios_arr = process_status_file($status_file); $nagios_status = array(); $nagios_status = $nagios_arr['status']; ?>
| \n"; print " | |
| $fontopenb"; print "{$service_top_fields[$f]} $fontcloseb | "; $f++; } print " |
| $fontopenb"; print "{$service_top_detail[$service_top_fields[$f]]}$fontcloseb | "; $f++; } print " |