Beispiel #1
0
                     $event_data['object_data']['dns'] = _('Unknown');
                     $event_data['object_data']['type'] = _('Unknown');
                     $event_data['object_data']['port'] = _('Unknown');
                 }
                 $event_data['description'] = _('Service') . NAME_DELIMITER . discovery_check_type2str($event_data['object_data']['type']) . discovery_port2str($event_data['object_data']['type'], $event_data['object_data']['port']);
                 break;
             default:
                 continue;
         }
         if (!isset($event_data['object_data'])) {
             continue;
         }
         if ($csvExport) {
             $csvRows[] = [zbx_date2str(DATE_TIME_FORMAT_SECONDS, $event_data['clock']), $event_data['object_data']['ip'], $event_data['object_data']['dns'], $event_data['description'], discovery_value($event_data['value'])];
         } else {
             $table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $event_data['clock']), $event_data['object_data']['ip'], zbx_empty($event_data['object_data']['dns']) ? SPACE : $event_data['object_data']['dns'], $event_data['description'], (new CCol(discovery_value($event_data['value'])))->addClass(discovery_value_style($event_data['value']))]);
         }
     }
 } else {
     if ($csvExport || $pageFilter->hostsSelected || $triggerId != 0) {
         $knownTriggerIds = [];
         $validTriggerIds = [];
         $triggerOptions = ['output' => ['triggerid'], 'preservekeys' => true, 'monitored' => true];
         $allEventsSliceLimit = $config['search_limit'];
         $eventOptions = ['source' => EVENT_SOURCE_TRIGGERS, 'object' => EVENT_OBJECT_TRIGGER, 'time_from' => $from, 'time_till' => $till, 'output' => ['eventid', 'objectid'], 'sortfield' => ['clock', 'eventid'], 'sortorder' => ZBX_SORT_DOWN, 'limit' => $allEventsSliceLimit + 1];
         if ($triggerId) {
             $knownTriggerIds = [$triggerId => $triggerId];
             $validTriggerIds = $knownTriggerIds;
             $eventOptions['objectids'] = [$triggerId];
         } elseif ($pageFilter->hostid > 0) {
             $hostTriggers = API::Trigger()->get(['output' => ['triggerid'], 'hostids' => $pageFilter->hostid, 'monitored' => true, 'preservekeys' => true]);
Beispiel #2
0
                 if (isset($dservices[$event_data['objectid']])) {
                     $event_data['object_data'] = $dservices[$event_data['objectid']];
                 } else {
                     $event_data['object_data']['ip'] = S_UNKNOWN;
                     $event_data['object_data']['type'] = S_UNKNOWN;
                     $event_data['object_data']['port'] = S_UNKNOWN;
                 }
                 $event_data['description'] = S_SERVICE . ': ' . discovery_check_type2str($event_data['object_data']['type']) . '; ' . S_PORT . ': ' . $event_data['object_data']['port'];
                 break;
             default:
                 continue;
         }
         if (!isset($event_data['object_data'])) {
             continue;
         }
         $table->addRow(array(zbx_date2str(S_EVENTS_DISCOVERY_TIME_FORMAT, $event_data['clock']), $event_data['object_data']['ip'], $event_data['description'], new CCol(discovery_value($event_data['value']), discovery_value_style($event_data['value']))));
     }
 } else {
     $table->setHeader(array(S_TIME, is_show_all_nodes() ? S_NODE : null, $_REQUEST['hostid'] == 0 ? S_HOST : null, S_DESCRIPTION, S_STATUS, S_SEVERITY, S_DURATION, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
     $triggers = array();
     if ($pageFilter->hostid > 0 || $pageFilter->groupid > 0) {
         $trigOpt = array('nodeids' => get_current_nodeid(), 'output' => API_OUTPUT_SHORTEN);
         if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
             $trigOpt['triggerids'] = $_REQUEST['triggerid'];
         } else {
             if ($pageFilter->hostid > 0) {
                 $trigOpt['hostids'] = $pageFilter->hostid;
             } else {
                 if ($pageFilter->groupid > 0) {
                     $trigOpt['groupids'] = $pageFilter->groupid;
                 }
                     $event_data['object_data']['ip'] = _('Unknown');
                     $event_data['object_data']['dns'] = _('Unknown');
                     $event_data['object_data']['type'] = _('Unknown');
                     $event_data['object_data']['port'] = _('Unknown');
                 }
                 $event_data['description'] = _('Service') . ': ' . discovery_check_type2str($event_data['object_data']['type']) . discovery_port2str($event_data['object_data']['type'], $event_data['object_data']['port']);
                 break;
             default:
                 continue;
         }
         if (!isset($event_data['object_data'])) {
             continue;
         }
         $table->addRow(array(zbx_date2str(EVENTS_DISCOVERY_TIME_FORMAT, $event_data['clock']), $event_data['object_data']['ip'], zbx_empty($event_data['object_data']['dns']) ? SPACE : $event_data['object_data']['dns'], $event_data['description'], new CCol(discovery_value($event_data['value']), discovery_value_style($event_data['value']))));
         if ($CSV_EXPORT) {
             $csvRows[] = array(zbx_date2str(EVENTS_DISCOVERY_TIME_FORMAT, $event_data['clock']), $event_data['object_data']['ip'], $event_data['object_data']['dns'], $event_data['description'], discovery_value($event_data['value']));
         }
     }
 } else {
     $table->setHeader(array(_('Time'), is_show_all_nodes() ? _('Node') : null, $_REQUEST['hostid'] == 0 ? _('Host') : null, _('Description'), _('Status'), _('Severity'), _('Duration'), $config['event_ack_enable'] ? _('Ack') : null, _('Actions')));
     if ($CSV_EXPORT) {
         $csvRows[] = array(_('Time'), is_show_all_nodes() ? _('Node') : null, $_REQUEST['hostid'] == 0 ? _('Host') : null, _('Description'), _('Status'), _('Severity'), _('Duration'), $config['event_ack_enable'] ? _('Ack') : null, _('Actions'));
     }
     if ($pageFilter->hostsSelected) {
         $options = array('nodeids' => get_current_nodeid(), 'filter' => array('value_changed' => TRIGGER_VALUE_CHANGED_YES, 'object' => EVENT_OBJECT_TRIGGER), 'time_from' => $from, 'time_till' => $till, 'output' => API_OUTPUT_SHORTEN, 'sortfield' => 'eventid', 'sortorder' => ZBX_SORT_DOWN, 'limit' => $config['search_limit'] + 1);
         if ($_REQUEST['showUnknown']) {
             $options['filter']['value_changed'] = null;
         }
         // trigger options
         $trigOpt = array('nodeids' => get_current_nodeid(), 'output' => API_OUTPUT_SHORTEN);
         if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {