Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $Hosts = $XML->hosts;
- $Services = $XML->services;
- //Loop XML Records for non-zero current status
- //current_states:
- //1 - WARNING
- //2 - CRITICAL
- //3 - UNKNOWN
- foreach($Hosts->host as $host){
- if($host->current_state > 0 ){
- switch($host->current_state){
- case 1:
- $HostOutages['' . $host->host_name . '']['status']='WARNING';
- break;
- case 2:
- $HostOutages['' . $host->host_name . '']['status']='CRITICAL';
- break;
- default:
- $HostOutages['' . $host->host_name . '']['status']='UNKOWN';
- break;
- }
- $HostOutages['' . $host->host_name . '']['details']= $host->plugin_output;
- $HostOutages['' . $host->host_name . '']['attempts']= $host->current_attempt . "/" . $host->max_attempts;
- $HostOutages['' . $host->host_name . '']['duration']= duration($host->last_state_change);
- }
- }
- print_r($HostOutages);exit;
Add Comment
Please, Sign In to add comment