/** * @return mixed */ public function getServicesProblems() { // Obtenemos los bloques que corresponden al estado de los servicios preg_match_all('/servicestatus {.*}/isU', $this->fileData, $servicesData); $events = array(); foreach ($this->getItemsArray($servicesData) as $event) { $Event = new Service(); $Event->setAcknowledged($event['problem_has_been_acknowledged']); $Event->setActiveChecksEnabled($event['active_checks_enabled']); $Event->setCheckCommand($event['check_command']); $Event->setCurrentAttempt($event['current_attempt']); $Event->setDisplayName($event['service_description']); $Event->setHostAlias($event['host_name']); $Event->setHostDisplayName($event['host_name']); $Event->setFlapping($event['is_flapping']); $Event->setLastCheck($event['last_check']); $Event->setLastHardState($event['last_hard_state']); $Event->setLastHardStateChange($event['last_hard_state_change']); $Event->setPluginOutput($event['plugin_output']); $Event->setState($event['current_state']); $Event->setStateType($event['state_type']); $Event->setScheduledDowntimeDepth($event['scheduled_downtime_depth']); $Event->setMaxCheckAttempts($event['max_attempts']); $Event->setNotificationsEnabled($event['notifications_enabled']); $Event->setBackendAlias($this->backend->getAlias()); $Event->setBackendUrl($this->backend->getUrl()); $Event->setBackendLevel($this->backend->getLevel()); $events[] = $Event; } return $events; }
/** * Obtener el listado de servicios * * @return mixed */ public function getServicesProblems() { $fields = array('acknowledged', 'active_checks_enabled', 'check_command', 'current_attempt', 'display_name', 'host_alias', 'host_last_time_unreachable', 'host_last_time_up', 'host_state', 'host_display_name', 'host_scheduled_downtime_depth', 'is_flapping', 'last_check', 'last_hard_state', 'last_hard_state_change', 'last_time_critical', 'last_time_ok', 'last_time_unknown', 'plugin_output', 'state', 'state_type', 'scheduled_downtime_depth', 'max_check_attempts', 'pnpgraph_present'); $data = $this->getJsonFromSocket($this->getServicesFilter($fields)); $events = array(); foreach ($data as $event) { $Event = new Service(); $Event->setAcknowledged($event[0]); $Event->setActiveChecksEnabled($event[1]); $Event->setCheckCommand($event[2]); $Event->setCurrentAttempt($event[3]); $Event->setDisplayName($event[4]); $Event->setHostAlias($event[5]); $Event->setHostLastTimeUnreachable($event[6]); $Event->setHostLastTimeUp($event[7]); $Event->setHostState($event[8]); $Event->setHostDisplayName($event[9]); $Event->setHostScheduledDowntimeDepth($event[10]); $Event->setFlapping($event[11]); $Event->setLastCheck($event[12]); $Event->setLastHardState($event[13]); $Event->setLastHardStateChange($event[14]); $Event->setLastTimeDown($event[15]); $Event->setLastTimeUp($event[16]); $Event->setLastTimeUnreachable($event[17]); $Event->setPluginOutput($event[18]); $Event->setState($event[19]); $Event->setStateType($event[20]); $Event->setScheduledDowntimeDepth($event[21]); $Event->setMaxCheckAttempts($event[22]); $Event->setBackendAlias($this->backend->getAlias()); $Event->setBackendUrl($this->backend->getUrl()); $Event->setBackendLevel($this->backend->getLevel()); $events[] = $Event; } return $this->isAllHeaders() === false ? $events : $data; }