$discoveryTable->addRow($col); } order_result($discovery_info, $this->data['sort'], $this->data['sortorder']); foreach ($discovery_info as $ip => $h_data) { $dns = $h_data['dns'] == '' ? '' : ' (' . $h_data['dns'] . ')'; $row = array($h_data['type'] == 'primary' ? new CSpan($ip . $dns, $h_data['class']) : new CSpan(SPACE . SPACE . $ip . $dns), new CSpan(empty($h_data['host']) ? '-' : $h_data['host']), new CSpan($h_data['time'] == 0 || $h_data['type'] === 'slave' ? '' : convert_units(array('value' => time() - $h_data['time'], 'units' => 'uptime')), $h_data['class'])); foreach ($this->data['services'] as $name => $foo) { $class = null; $time = SPACE; $hint = new CDiv(SPACE, $class); $hintTable = null; if (isset($h_data['services'][$name])) { $class = $h_data['services'][$name]['class']; $time = $h_data['services'][$name]['time']; $hintTable = new CTableInfo(); $hintTable->setAttribute('style', 'width: auto;'); if ($class == 'active') { $hintTable->setHeader(_('Uptime')); } elseif ($class == 'inactive') { $hintTable->setHeader(_('Downtime')); } $timeColumn = new CCol(zbx_date2age($h_data['services'][$name]['time']), $class); $hintTable->addRow($timeColumn); } $column = new CCol($hint, $class); if (!is_null($hintTable)) { $column->setHint($hintTable); } $row[] = $column; } $discoveryTable->addRow($row);
$status['msg'] = $httpTestData['error'] === null ? _('Unknown error') : _s('Error: %1$s', $httpTestData['error']); $status['style'] = 'disabled'; } else { $status['msg'] = _('OK'); $status['style'] = 'enabled'; } $httpdetailsTable->addRow(array(bold(_('TOTAL')), SPACE, bold($totalTime['value'] ? formatHistoryValue($totalTime['value'], $totalTime) : UNKNOWN_VALUE), SPACE, new CSpan($status['msg'], $status['style'] . ' bold'))); $httpdetailsWidget->addItem($httpdetailsTable); $httpdetailsWidget->show(); echo SBR; // create graphs widget $graphsWidget = new CWidget(); $graphsWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.httpdetails.filter.state', 0)); $graphsWidget->addItem(SPACE); $graphTable = new CTableInfo(); $graphTable->setAttribute('id', 'graph'); // dims $graphDims = getGraphDims(); $graphDims['shiftYtop'] += 1; $graphDims['width'] = -120; $graphDims['graphHeight'] = 150; /* * Graph in */ $graphInScreen = new CScreenBase(array('resourcetype' => SCREEN_RESOURCE_GRAPH, 'mode' => SCREEN_MODE_PREVIEW, 'dataId' => 'graph_in', 'profileIdx' => 'web.httptest', 'profileIdx2' => get_request('httptestid'), 'period' => get_request('period'), 'stime' => get_request('stime'))); $graphInScreen->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_itemid($itemIds)); $src = 'chart3.php?height=150' . '&name=' . $httpTest['name'] . '&http_item_type=' . HTTPSTEP_ITEM_TYPE_IN . '&httptestid=' . $httpTest['httptestid'] . '&graphtype=' . GRAPH_TYPE_STACKED . '&period=' . $graphInScreen->timeline['period'] . '&stime=' . $graphInScreen->timeline['stime'] . '&profileIdx=' . $graphInScreen->profileIdx . '&profileIdx2=' . $graphInScreen->profileIdx2; $graphInContainer = new CDiv(new CLink(null, $src), 'flickerfreescreen', 'flickerfreescreen_graph_in'); $graphInContainer->setAttribute('style', 'position: relative'); $graphInContainer->setAttribute('data-timestamp', time()); $graphTable->addRow(array(bold(_('Speed')), $graphInContainer));
function get_actions_hint_by_eventid($eventid, $status = null) { $tab_hint = new CTableInfo(_('No actions found.')); $tab_hint->setAttribute('style', 'width: 300px;'); $tab_hint->setHeader(array(is_show_all_nodes() ? _('Nodes') : null, _('User'), _('Details'), _('Status'))); $sql = 'SELECT a.alertid,mt.description,u.alias,u.name,u.surname,a.subject,a.message,a.sendto,a.status,a.retries,a.alerttype' . ' FROM events e,alerts a' . ' LEFT JOIN users u ON u.userid=a.userid' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE a.eventid=' . zbx_dbstr($eventid) . (is_null($status) ? '' : ' AND a.status=' . $status) . ' AND e.eventid=a.eventid' . ' AND a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . andDbNode('a.alertid') . ' ORDER BY a.alertid'; $result = DBselect($sql, 30); while ($row = DBfetch($result)) { if ($row['status'] == ALERT_STATUS_SENT) { $status = new CSpan(_('Sent'), 'green'); } elseif ($row['status'] == ALERT_STATUS_NOT_SENT) { $status = new CSpan(_('In progress'), 'orange'); } else { $status = new CSpan(_('not sent'), 'red'); } switch ($row['alerttype']) { case ALERT_TYPE_MESSAGE: $message = empty($row['description']) ? '-' : $row['description']; break; case ALERT_TYPE_COMMAND: $message = array(bold(_('Command') . NAME_DELIMITER)); $msg = explode("\n", $row['message']); foreach ($msg as $m) { array_push($message, BR(), $m); } break; default: $message = '-'; } if (!$row['alias']) { $row['alias'] = ' - '; } else { $fullname = ''; if ($row['name']) { $fullname = $row['name']; } if ($row['surname']) { $fullname .= $fullname ? ' ' . $row['surname'] : $row['surname']; } if ($fullname) { $row['alias'] .= ' (' . $fullname . ')'; } } $tab_hint->addRow(array(get_node_name_by_elid($row['alertid']), $row['alias'], $message, $status)); } return $tab_hint; }
function get_trigger_overview_cells(&$table_row, &$trhosts, &$hostname) { $css_class = NULL; unset($tr_ov_menu); $ack = null; if (isset($trhosts[$hostname])) { unset($ack_menu); switch ($trhosts[$hostname]['value']) { case TRIGGER_VALUE_TRUE: $css_class = get_severity_style($trhosts[$hostname]['priority']); if ($ack = get_last_event_by_triggerid($trhosts[$hostname]['triggerid'])) { $ack_menu = array(S_ACKNOWLEDGE, 'acknow.php?eventid=' . $ack['eventid'], array('tw' => '_blank')); } if (1 == $ack['acknowledged']) { $ack = new CImg('images/general/tick.png', 'ack'); } else { $ack = null; } break; case TRIGGER_VALUE_FALSE: $css_class = 'normal'; break; default: $css_class = 'unknown_trigger'; } $style = 'cursor: pointer; '; if (time(NULL) - $trhosts[$hostname]['lastchange'] < 300) { $style .= 'background-image: url(images/gradients/blink1.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;'; } else { if (time(NULL) - $trhosts[$hostname]['lastchange'] < 900) { $style .= 'background-image: url(images/gradients/blink2.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;'; } } unset($item_menu); $tr_ov_menu = array(array(S_TRIGGER, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(S_EVENTS, 'events.php?triggerid=' . $trhosts[$hostname]['triggerid'], array('tw' => '_blank'))); if (isset($ack_menu)) { $tr_ov_menu[] = $ack_menu; } $db_items = DBselect('select distinct i.itemid, i.description, i.key_, i.value_type ' . ' from items i, functions f ' . ' where f.itemid=i.itemid and f.triggerid=' . $trhosts[$hostname]['triggerid']); while ($item_data = DBfetch($db_items)) { $description = item_description($item_data); switch ($item_data['value_type']) { case ITEM_VALUE_TYPE_UINT64: case ITEM_VALUE_TYPE_FLOAT: $action = 'showgraph'; $status_bar = S_SHOW_GRAPH_OF_ITEM . ' \'' . $description . '\''; break; case ITEM_VALUE_TYPE_LOG: case ITEM_VALUE_TYPE_STR: case ITEM_VALUE_TYPE_TEXT: default: $action = 'showlatest'; $status_bar = S_SHOW_VALUES_OF_ITEM . ' \'' . $description . '\''; break; } if (strlen($description) > 25) { $description = substr($description, 0, 22) . '...'; } $item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item_data['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar)); } if (isset($item_menu['showgraph'])) { $tr_ov_menu[] = array(S_GRAPHS, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))); $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showgraph']); } if (isset($item_menu['showlatest'])) { $tr_ov_menu[] = array(S_VALUES, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))); $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showlatest']); } unset($item_menu); } // dependency // TRIGGERS ON WHICH DEPENDS THIS $desc = array(); if (isset($trhosts[$hostname])) { $triggerid = $trhosts[$hostname]['triggerid']; $dependency = false; $dep_table = new CTableInfo(); $dep_table->setAttribute('style', 'width: 200px;'); $dep_table->addRow(bold(S_DEPENDS_ON . ':')); $sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_down=' . $triggerid; $dep_res = DBselect($sql_dep); while ($dep_row = DBfetch($dep_res)) { $dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_up'])); $dependency = true; } if ($dependency) { $img = new Cimg('images/general/down_icon.png', 'DEP_DOWN'); $img->setAttribute('style', 'vertical-align: middle; border: 0px;'); $img->SetHint($dep_table); array_push($desc, $img); } unset($img, $dep_table, $dependency); // TRIGGERS THAT DEPEND ON THIS $dependency = false; $dep_table = new CTableInfo(); $dep_table->setAttribute('style', 'width: 200px;'); $dep_table->addRow(bold(S_DEPENDENT . ':')); $sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_up=' . $triggerid; $dep_res = DBselect($sql_dep); while ($dep_row = DBfetch($dep_res)) { $dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_down'])); $dependency = true; } if ($dependency) { $img = new Cimg('images/general/up_icon.png', 'DEP_UP'); $img->setAttribute('style', 'vertical-align: middle; border: 0px;'); $img->SetHint($dep_table); array_push($desc, $img); } unset($img, $dep_table, $dependency); } //------------------------ $status_col = new CCol(array($desc, $ack), $css_class); if (isset($style)) { $status_col->setAttribute('style', $style); } if (isset($tr_ov_menu)) { $tr_ov_menu = new CPUMenu($tr_ov_menu, 170); $status_col->OnClick($tr_ov_menu->GetOnActionJS()); $status_col->addAction('onmouseover', 'this.old_border=this.style.border; this.style.border=\'1px dotted #0C0CF0\''); $status_col->addAction('onmouseout', 'this.style.border=this.old_border;'); } array_push($table_row, $status_col); return $table_row; }
function make_popup_eventlist($triggerId, $eventId) { $config = select_config(); $table = new CTableInfo(); $table->setAttribute('style', 'width: 400px;'); // if acknowledges are turned on, we show 'ack' column if ($config['event_ack_enable']) { $table->setHeader(array(_('Time'), _('Status'), _('Duration'), _('Age'), _('Ack'))); } else { $table->setHeader(array(_('Time'), _('Status'), _('Duration'), _('Age'))); } $events = API::Event()->get(array('source' => EVENT_SOURCE_TRIGGERS, 'object' => EVENT_OBJECT_TRIGGER, 'output' => API_OUTPUT_EXTEND, 'objectids' => $triggerId, 'eventid_till' => $eventId, 'select_acknowledges' => API_OUTPUT_COUNT, 'sortfield' => array('clock', 'eventid'), 'sortorder' => ZBX_SORT_DOWN, 'limit' => ZBX_WIDGET_ROWS)); $lclock = time(); foreach ($events as $event) { $duration = zbx_date2age($lclock, $event['clock']); $lclock = $event['clock']; $eventStatusSpan = new CSpan(trigger_value2str($event['value'])); // add colors and blinking to span depending on configuration and trigger parameters addTriggerValueStyle($eventStatusSpan, $event['value'], $event['clock'], $event['acknowledged']); $table->addRow(array(zbx_date2str(_('d M Y H:i:s'), $event['clock']), $eventStatusSpan, $duration, zbx_date2age($event['clock']), getEventAckState($event, false, false))); } return $table; }
// DEPENDENCIES {{{ if (!empty($trigger['dependencies'])) { $dep_table = new CTableInfo(); $dep_table->setAttribute('style', 'width: 200px;'); $dep_table->addRow(bold(S_DEPENDS_ON . ':')); foreach ($trigger['dependencies'] as $dep) { $dep_table->addRow(' - ' . expand_trigger_description($dep['triggerid'])); } $img = new Cimg('images/general/down_icon.png', 'DEP_UP'); $img->setAttribute('style', 'vertical-align: middle; border: 0px;'); $img->setHint($dep_table); $description = array($img, SPACE, $description); } $dependency = false; $dep_table = new CTableInfo(); $dep_table->setAttribute('style', 'width: 200px;'); $dep_table->addRow(bold(S_DEPENDENT . ':')); $sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_up=' . $trigger['triggerid']; $dep_res = DBselect($sql_dep); while ($dep_row = DBfetch($dep_res)) { $dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_down'])); $dependency = true; } if ($dependency) { $img = new Cimg('images/general/up_icon.png', 'DEP_UP'); $img->setAttribute('style', 'vertical-align: middle; border: 0px;'); $img->setHint($dep_table); $description = array($img, SPACE, $description); } unset($img, $dep_table, $dependency); // }}} DEPENDENCIES
** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ zbx_add_post_js('jqBlink.blink();'); $overviewWidget = new CWidget(); $typeComboBox = new CComboBox('type', $this->data['type'], 'submit()'); $typeComboBox->addItem(SHOW_TRIGGERS, _('Triggers')); $typeComboBox->addItem(SHOW_DATA, _('Data')); $headerForm = new CForm('get'); $headerForm->addItem(array(_('Group'), SPACE, $this->data['pageFilter']->getGroupsCB(true))); $headerForm->addItem(array(SPACE, _('Application'), SPACE, $this->data['pageFilter']->getApplicationsCB(true))); $headerForm->addItem(array(SPACE, _('Type'), SPACE, $typeComboBox)); $overviewWidget->addHeader(_('Overview'), $headerForm); $hintTable = new CTableInfo(); $hintTable->setAttribute('style', 'width: 200px'); if ($this->data['type'] == SHOW_TRIGGERS) { $hintTable->addRow(array(new CCol(SPACE, 'normal'), _('OK'))); } for ($i = 0; $i < TRIGGER_SEVERITY_COUNT; $i++) { $hintTable->addRow(array(getSeverityCell($i), _('PROBLEM'))); } $config = select_config(); if ($this->data['type'] == SHOW_TRIGGERS) { // blinking preview in help popup (only if blinking is enabled) if ($config['blink_period'] > 0) { $row = new CRow(null); $row->addItem(new CCol(SPACE, 'normal')); for ($i = 0; $i < TRIGGER_SEVERITY_COUNT; $i++) { $row->addItem(new CCol(SPACE, getSeverityStyle($i))); }
function make_hoststat_summary($filter) { $table = new CTableInfo(); $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST_GROUP, S_WITHOUT_PROBLEMS, S_WITH_PROBLEMS, S_TOTAL)); // SELECT HOST GROUPS {{{ $options = array('nodeids' => get_current_nodeid(), 'groupids' => $filter['groupids'], 'monitored_hosts' => 1, 'output' => API_OUTPUT_EXTEND); $groups = CHostGroup::get($options); $groups = zbx_toHash($groups, 'groupid'); order_result($groups, 'name'); // }}} SELECT HOST GROUPS // SELECT HOSTS {{{ $options = array('nodeids' => get_current_nodeid(), 'groupids' => zbx_objectValues($groups, 'groupid'), 'monitored_hosts' => 1, 'filter' => array('maintenance_status' => $filter['maintenance']), 'output' => array('hostid', 'host')); $hosts = CHost::get($options); $hosts = zbx_toHash($hosts, 'hostid'); // }}} SELECT HOSTS // SELECT TRIGGERS {{{ $options = array('nodeids' => get_current_nodeid(), 'monitored' => 1, 'maintenance' => $filter['maintenance'], 'expandData' => 1, 'filter' => array('priority' => $filter['severity'], 'value' => TRIGGER_VALUE_TRUE), 'output' => API_OUTPUT_EXTEND); $triggers = CTrigger::get($options); if ($filter['extAck']) { $options = array('nodeids' => get_current_nodeid(), 'monitored' => 1, 'maintenance' => $filter['maintenance'], 'withLastEventUnacknowledged' => 1, 'select_hosts' => API_OUTPUT_REFER, 'filter' => array('priority' => $filter['severity'], 'value' => TRIGGER_VALUE_TRUE), 'output' => API_OUTPUT_REFER); $triggers_unack = CTrigger::get($options); $triggers_unack = zbx_toHash($triggers_unack, 'triggerid'); foreach ($triggers_unack as $tunack) { foreach ($tunack['hosts'] as $unack_host) { $hosts_with_unack_triggers[$unack_host['hostid']] = $unack_host['hostid']; } } } // }}} SELECT TRIGGERS $hosts_data = array(); $problematic_host_list = array(); $lastUnack_host_list = array(); $highest_severity = array(); $highest_severity2 = array(); foreach ($triggers as $tnum => $trigger) { foreach ($trigger['hosts'] as $thnum => $trigger_host) { if (!isset($hosts[$trigger_host['hostid']])) { continue; } else { $host = $hosts[$trigger_host['hostid']]; } if ($filter['extAck'] && isset($hosts_with_unack_triggers[$host['hostid']])) { if (!isset($lastUnack_host_list[$host['hostid']])) { $lastUnack_host_list[$host['hostid']] = array(); $lastUnack_host_list[$host['hostid']]['host'] = $host['host']; $lastUnack_host_list[$host['hostid']]['hostid'] = $host['hostid']; $lastUnack_host_list[$host['hostid']]['severities'] = array(); $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_DISASTER] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_HIGH] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_AVERAGE] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_WARNING] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_INFORMATION] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_NOT_CLASSIFIED] = 0; } if (isset($triggers_unack[$trigger['triggerid']])) { $lastUnack_host_list[$host['hostid']]['severities'][$trigger['priority']]++; } foreach ($host['groups'] as $gnum => $group) { if (!isset($highest_severity2[$group['groupid']])) { $highest_severity2[$group['groupid']] = 0; } if ($trigger['priority'] > $highest_severity2[$group['groupid']]) { $highest_severity2[$group['groupid']] = $trigger['priority']; } if (!isset($hosts_data[$group['groupid']])) { $hosts_data[$group['groupid']] = array('problematic' => 0, 'ok' => 0, 'lastUnack' => 0, 'hostids_all' => array(), 'hostids_unack' => array()); } if (!isset($hosts_data[$group['groupid']]['hostids_unack'][$host['hostid']])) { $hosts_data[$group['groupid']]['hostids_unack'][$host['hostid']] = $host['hostid']; $hosts_data[$group['groupid']]['lastUnack']++; } } } if (!isset($problematic_host_list[$host['hostid']])) { $problematic_host_list[$host['hostid']] = array(); $problematic_host_list[$host['hostid']]['host'] = $host['host']; $problematic_host_list[$host['hostid']]['hostid'] = $host['hostid']; $problematic_host_list[$host['hostid']]['severities'] = array(); $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_DISASTER] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_HIGH] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_AVERAGE] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_WARNING] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_INFORMATION] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_NOT_CLASSIFIED] = 0; } $problematic_host_list[$host['hostid']]['severities'][$trigger['priority']]++; foreach ($host['groups'] as $gnum => $group) { if (!isset($highest_severity[$group['groupid']])) { $highest_severity[$group['groupid']] = 0; } if ($trigger['priority'] > $highest_severity[$group['groupid']]) { $highest_severity[$group['groupid']] = $trigger['priority']; } if (!isset($hosts_data[$group['groupid']])) { $hosts_data[$group['groupid']] = array('problematic' => 0, 'ok' => 0, 'lastUnack' => 0, 'hostids_all' => array(), 'hostids_unack' => array()); } if (!isset($hosts_data[$group['groupid']]['hostids_all'][$host['hostid']])) { $hosts_data[$group['groupid']]['hostids_all'][$host['hostid']] = $host['hostid']; $hosts_data[$group['groupid']]['problematic']++; } } } } foreach ($hosts as $hnum => $host) { foreach ($host['groups'] as $gnum => $group) { if (!isset($groups[$group['groupid']]['hosts'])) { $groups[$group['groupid']]['hosts'] = array(); } $groups[$group['groupid']]['hosts'][$host['hostid']] = array('hostid' => $host['hostid']); if (!isset($highest_severity[$group['groupid']])) { $highest_severity[$group['groupid']] = 0; } if (!isset($hosts_data[$group['groupid']])) { $hosts_data[$group['groupid']] = array('problematic' => 0, 'ok' => 0, 'lastUnack' => 0); } if (!isset($problematic_host_list[$host['hostid']])) { $hosts_data[$group['groupid']]['ok']++; } } } foreach ($groups as $gnum => $group) { if (!isset($hosts_data[$group['groupid']])) { continue; } $group_row = new CRow(); if (is_show_all_nodes()) { $group_row->addItem(get_node_name_by_elid($group['groupid'])); } $name = new CLink($group['name'], 'tr_status.php?groupid=' . $group['groupid'] . '&hostid=0&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE); $group_row->addItem($name); $group_row->addItem(new CCol($hosts_data[$group['groupid']]['ok'], 'normal')); if ($filter['extAck']) { if ($hosts_data[$group['groupid']]['lastUnack']) { $table_inf = new CTableInfo(); $table_inf->setAttribute('style', 'width: 400px;'); $table_inf->setHeader(array(S_HOST, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_DISASTER]) ? S_DISASTER : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_HIGH]) ? S_HIGH : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_AVERAGE]) ? S_AVERAGE : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_WARNING]) ? S_WARNING : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_INFORMATION]) ? S_INFORMATION : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_NOT_CLASSIFIED]) ? S_NOT_CLASSIFIED : null)); $popup_rows = 0; foreach ($group['hosts'] as $hnum => $host) { $hostid = $host['hostid']; if (!isset($lastUnack_host_list[$hostid])) { continue; } if ($popup_rows >= ZBX_WIDGET_ROWS) { break; } $popup_rows++; $host_data = $lastUnack_host_list[$hostid]; $r = new CRow(); $r->addItem(new CLink($host_data['host'], 'tr_status.php?groupid=' . $group['groupid'] . '&hostid=' . $hostid . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE)); foreach ($lastUnack_host_list[$host['hostid']]['severities'] as $severity => $trigger_count) { if (!is_null($filter['severity']) && !isset($filter['severity'][$severity])) { continue; } $r->addItem(new CCol($trigger_count, get_severity_style($severity, $trigger_count))); } $table_inf->addRow($r); } $lastUnack_count = new CSpan($hosts_data[$group['groupid']]['lastUnack'], 'pointer red bold'); $lastUnack_count->setHint($table_inf); } else { $lastUnack_count = 0; } } // if hostgroup contains problematic hosts, hint should be built if ($hosts_data[$group['groupid']]['problematic']) { $table_inf = new CTableInfo(); $table_inf->setAttribute('style', 'width: 400px;'); $table_inf->setHeader(array(S_HOST, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_DISASTER]) ? S_DISASTER : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_HIGH]) ? S_HIGH : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_AVERAGE]) ? S_AVERAGE : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_WARNING]) ? S_WARNING : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_INFORMATION]) ? S_INFORMATION : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_NOT_CLASSIFIED]) ? S_NOT_CLASSIFIED : null)); $popup_rows = 0; foreach ($group['hosts'] as $hnum => $host) { $hostid = $host['hostid']; if (!isset($problematic_host_list[$hostid])) { continue; } if ($popup_rows >= ZBX_WIDGET_ROWS) { break; } $popup_rows++; $host_data = $problematic_host_list[$hostid]; $r = new CRow(); $r->addItem(new CLink($host_data['host'], 'tr_status.php?groupid=' . $group['groupid'] . '&hostid=' . $hostid . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE)); foreach ($problematic_host_list[$host['hostid']]['severities'] as $severity => $trigger_count) { if (!is_null($filter['severity']) && !isset($filter['severity'][$severity])) { continue; } $r->addItem(new CCol($trigger_count, get_severity_style($severity, $trigger_count))); } $table_inf->addRow($r); } $problematic_count = new CSpan($hosts_data[$group['groupid']]['problematic'], 'pointer'); $problematic_count->setHint($table_inf); } else { $problematic_count = 0; } switch ($filter['extAck']) { case EXTACK_OPTION_ALL: $group_row->addItem(new CCol($problematic_count, get_severity_style($highest_severity[$group['groupid']], $hosts_data[$group['groupid']]['problematic']))); $group_row->addItem($hosts_data[$group['groupid']]['problematic'] + $hosts_data[$group['groupid']]['ok']); break; case EXTACK_OPTION_UNACK: $group_row->addItem(new CCol($lastUnack_count, get_severity_style(isset($highest_severity2[$group['groupid']]) ? $highest_severity2[$group['groupid']] : 0, $hosts_data[$group['groupid']]['lastUnack']))); $group_row->addItem($hosts_data[$group['groupid']]['lastUnack'] + $hosts_data[$group['groupid']]['ok']); break; case EXTACK_OPTION_BOTH: $unackspan = $lastUnack_count ? new CSpan(array($lastUnack_count, SPACE . S_OF . SPACE)) : null; $group_row->addItem(new CCol(array($unackspan, $problematic_count), get_severity_style($highest_severity[$group['groupid']], $hosts_data[$group['groupid']]['problematic']))); $group_row->addItem($hosts_data[$group['groupid']]['problematic'] + $hosts_data[$group['groupid']]['ok']); break; } $table->addRow($group_row); } $table->setFooter(new CCol(S_UPDATED . ': ' . zbx_date2str(S_BLOCKS_HOSTSTAT_SUMMARY_TIME_FORMAT))); return $table; }
$exp_select = new CComboBox('expr_type'); $exp_select->setAttribute('id', 'expr_type'); $exp_select->addItem(REGEXP_INCLUDE, _('Include')); $exp_select->addItem(REGEXP_EXCLUDE, _('Exclude')); $ctb = new CTextBox('expression', '', 80); $ctb->setAttribute('id', 'logexpr'); $cb = new CButton('add_exp', _('Add'), 'javascript: add_logexpr();'); $cbAdd = new CButton('add_key_and', _('AND'), 'javascript: add_keyword_and();'); $cbOr = new CButton('add_key_or', _('OR'), 'javascript: add_keyword_or();'); $cbIregexp = new CCheckBox('iregexp', 'no', null, 1); $frmTRLog->addRow(_('Expression'), array($ctb, BR(), $cbIregexp, 'iregexp', SPACE, $cbAdd, SPACE, $cbOr, SPACE, $exp_select, SPACE, $cb)); $keyTable = new CTableInfo(null); $keyTable->setAttribute('id', 'key_list'); $keyTable->setHeader(array(_('Keyword'), _('Type'), _('Action'))); $table = new CTableInfo(null); $table->setAttribute('id', 'exp_list'); $table->setHeader(array(_('Expression'), _('Type'), _('Position'), _('Action'))); $maxid = 0; $bExprResult = true; $expressionData = new CTriggerExpression(); if (isset($_REQUEST['triggerid']) && !isset($_REQUEST['save_trigger']) && !$expressionData->parse(empty($expressions) ? '' : construct_expression($itemid, $expressions)) && !isset($_REQUEST['form_refresh'])) { info($expressionData->error); unset($expressions); $expressions[0]['value'] = $expr_incase; $expressions[0]['type'] = 0; $expressions[0]['view'] = $expr_incase; $bExprResult = false; } foreach ($expressions as $id => $expr) { $imgup = new CImg('images/general/arrow_up.png', 'up', 12, 14); $imgup->setAttribute('onclick', 'javascript: element_up("logtr' . $id . '");');
/** * Creates and returns a trigger status cell for the trigger overview table. * * @see get_triggers_overview() * * @param array $triggerHosts an array with the data about the trigger for each host * @param string $hostName the name of the cells corresponding host * @param string $screenId * * @return CCol */ function get_trigger_overview_cells($triggerHosts, $hostName, $screenId = null) { $ack = null; $css_class = null; $desc = array(); $config = select_config(); // for how long triggers should blink on status change (set by user in administration->general) if (isset($triggerHosts[$hostName])) { // problem trigger if ($triggerHosts[$hostName]['value'] == TRIGGER_VALUE_TRUE) { $css_class = getSeverityStyle($triggerHosts[$hostName]['priority']); $ack = null; if ($config['event_ack_enable'] == 1) { $event = get_last_event_by_triggerid($triggerHosts[$hostName]['triggerid']); if ($event) { if ($screenId) { global $page; $ack_menu = array(_('Acknowledge'), 'acknow.php?eventid=' . $event['eventid'] . '&screenid=' . $screenId . '&backurl=' . $page['file']); } else { $ack_menu = array(_('Acknowledge'), 'acknow.php?eventid=' . $event['eventid'] . '&backurl=overview.php', array('tw' => '_blank')); } if ($event['acknowledged'] == 1) { $ack = new CImg('images/general/tick.png', 'ack'); } } } } else { $css_class = 'normal'; } $style = 'cursor: pointer; '; // set blinking gif as background if trigger age is less then $config['blink_period'] if ($config['blink_period'] > 0 && time() - $triggerHosts[$hostName]['lastchange'] < $config['blink_period']) { $style .= 'background-image: url(images/gradients/blink.gif); background-position: top left; background-repeat: repeat;'; } unset($item_menu); $tr_ov_menu = array(array(_('Trigger'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('Events'), 'events.php?triggerid=' . $triggerHosts[$hostName]['triggerid'], array('tw' => '_blank'))); if (isset($ack_menu)) { $tr_ov_menu[] = $ack_menu; } $dbItems = DBselect('SELECT DISTINCT i.itemid,i.name,i.key_,i.value_type' . ' FROM items i,functions f' . ' WHERE f.itemid=i.itemid' . ' AND f.triggerid=' . $triggerHosts[$hostName]['triggerid']); while ($item = DBfetch($dbItems)) { $description = itemName($item); switch ($item['value_type']) { case ITEM_VALUE_TYPE_UINT64: case ITEM_VALUE_TYPE_FLOAT: $action = 'showgraph'; $status_bar = _('Show graph of item') . ' \'' . $description . '\''; break; case ITEM_VALUE_TYPE_LOG: case ITEM_VALUE_TYPE_STR: case ITEM_VALUE_TYPE_TEXT: default: $action = 'showlatest'; $status_bar = _('Show values of item') . ' \'' . $description . '\''; break; } if (zbx_strlen($description) > 25) { $description = zbx_substr($description, 0, 22) . '...'; } $item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar)); } if (isset($item_menu['showgraph'])) { $tr_ov_menu[] = array(_('Graphs'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))); $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showgraph']); } if (isset($item_menu['showlatest'])) { $tr_ov_menu[] = array(_('Values'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))); $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showlatest']); } unset($item_menu); // dependency: triggers on which depends this $triggerid = !empty($triggerHosts[$hostName]['triggerid']) ? $triggerHosts[$hostName]['triggerid'] : 0; $dep_table = new CTableInfo(); $dep_table->setAttribute('style', 'width: 200px;'); $dep_table->addRow(bold(_('Depends on') . ':')); $dependency = false; $dep_res = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . $triggerid); while ($dep_row = DBfetch($dep_res)) { $dep_table->addRow(SPACE . '-' . SPACE . CTriggerHelper::expandDescriptionById($dep_row['triggerid_up'])); $dependency = true; } if ($dependency) { $img = new Cimg('images/general/arrow_down2.png', 'DEP_DOWN'); $img->setAttribute('style', 'vertical-align: middle; border: 0px;'); $img->setHint($dep_table, '', '', false); array_push($desc, $img); } unset($img, $dep_table, $dependency); // triggers that depend on this $dep_table = new CTableInfo(); $dep_table->setAttribute('style', 'width: 200px;'); $dep_table->addRow(bold(_('Dependent') . ':')); $dependency = false; $dep_res = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_up=' . $triggerid); while ($dep_row = DBfetch($dep_res)) { $dep_table->addRow(SPACE . '-' . SPACE . CTriggerHelper::expandDescriptionById($dep_row['triggerid_down'])); $dependency = true; } if ($dependency) { $img = new Cimg('images/general/arrow_up2.png', 'DEP_UP'); $img->setAttribute('style', 'vertical-align: middle; border: 0px;'); $img->setHint($dep_table, '', '', false); array_push($desc, $img); } unset($img, $dep_table, $dependency); } if (is_array($desc) && count($desc) > 0 || $ack) { $tableColumn = new CCol(array($desc, $ack), $css_class . ' hosts'); } else { $tableColumn = new CCol(SPACE, $css_class . ' hosts'); } if (isset($style)) { $tableColumn->setAttribute('style', $style); } if (isset($tr_ov_menu)) { $tr_ov_menu = new CPUMenu($tr_ov_menu, 170); $tableColumn->onClick($tr_ov_menu->getOnActionJS()); $tableColumn->addAction('onmouseover', 'jQuery(this).css({border: "1px dotted #0C0CF0", padding: "0 2px"})'); $tableColumn->addAction('onmouseout', 'jQuery(this).css({border: "", padding: "1px 3px"})'); } return $tableColumn; }
function get_actions_hint_by_eventid($eventid, $status = NULL) { $hostids = array(); $sql = 'SELECT DISTINCT i.hostid ' . ' FROM events e, functions f, items i ' . ' WHERE e.eventid=' . $eventid . ' AND e.object=' . EVENT_SOURCE_TRIGGERS . ' AND f.triggerid=e.objectid ' . ' AND i.itemid=f.itemid'; if ($host = DBfetch(DBselect($sql, 1))) { $hostids[$host['hostid']] = $host['hostid']; } $available_triggers = get_accessible_triggers(PERM_READ_ONLY, $hostids); $tab_hint = new CTableInfo(S_NO_ACTIONS_FOUND); $tab_hint->setAttribute('style', 'width: 300px;'); $tab_hint->SetHeader(array(is_show_all_nodes() ? S_NODES : null, S_USER, S_DETAILS, S_STATUS)); /* $sql = 'SELECT DISTINCT a.alertid,mt.description,a.sendto,a.status,u.alias,a.retries '. ' FROM events e,users u,alerts a'. ' left join media_type mt on mt.mediatypeid=a.mediatypeid'. ' WHERE a.eventid='.$eventid. (is_null($status)?'':' AND a.status='.$status). ' AND e.eventid = a.eventid'. ' AND a.alerttype IN ('.ALERT_TYPE_MESSAGE.','.ALERT_TYPE_COMMAND.')'. ' AND '.DBcondition('e.objectid',$available_triggers). ' AND '.DBin_node('a.alertid'). ' AND u.userid=a.userid '. ' ORDER BY mt.description'; //*/ $sql = 'SELECT DISTINCT a.alertid,mt.description,u.alias,a.subject,a.message,a.sendto,a.status,a.retries,a.alerttype ' . ' FROM events e,alerts a ' . ' LEFT JOIN users u ON u.userid=a.userid ' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid' . ' WHERE a.eventid=' . $eventid . (is_null($status) ? '' : ' AND a.status=' . $status) . ' AND e.eventid = a.eventid' . ' AND a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND ' . DBcondition('e.objectid', $available_triggers) . ' AND ' . DBin_node('a.alertid') . ' ORDER BY a.alertid'; $result = DBselect($sql, 30); while ($row = DBfetch($result)) { if ($row["status"] == ALERT_STATUS_SENT) { $status = new CSpan(S_SENT, "green"); $retries = new CSpan(SPACE, "green"); } else { if ($row["status"] == ALERT_STATUS_NOT_SENT) { $status = new CSpan(S_IN_PROGRESS, "orange"); $retries = new CSpan(ALERT_MAX_RETRIES - $row["retries"], "orange"); } else { $status = new CSpan(S_NOT_SENT, "red"); $retries = new CSpan(0, "red"); } } switch ($row['alerttype']) { case ALERT_TYPE_MESSAGE: $message = empty($row['description']) ? '-' : $row['description']; break; case ALERT_TYPE_COMMAND: $message = array(bold(S_COMMAND . ':')); $msg = explode("\n", $row['message']); foreach ($msg as $m) { array_push($message, BR(), $m); } break; default: $message = '-'; } $tab_hint->addRow(array(get_node_name_by_elid($row['alertid']), empty($row['alias']) ? ' - ' : $row['alias'], $message, $status)); } return $tab_hint; }
function get_act_operations_form($action = null) { $tblOper = new CTableInfo(S_NO_OPERATIONS_DEFINED); $tblOper->setAttribute('style', 'background-color: #CCC;'); if (isset($_REQUEST['actionid']) && empty($action)) { $action = get_action_by_actionid($_REQUEST['actionid']); } $operations = get_request('operations', array()); if (isset($_REQUEST['actionid']) && !isset($_REQUEST['form_refresh'])) { $eventsource = $action['eventsource']; $evaltype = $action['evaltype']; $esc_period = $action['esc_period']; /* prepate operations */ $db_operations = DBselect('SELECT * ' . ' FROM operations' . ' WHERE actionid=' . $_REQUEST['actionid'] . ' ORDER BY esc_step_from,operationtype,object,operationid'); while ($operation_data = DBfetch($db_operations)) { $operation_data = array('operationtype' => $operation_data['operationtype'], 'operationid' => $operation_data['operationid'], 'object' => $operation_data['object'], 'objectid' => $operation_data['objectid'], 'shortdata' => $operation_data['shortdata'], 'longdata' => $operation_data['longdata'], 'esc_period' => $operation_data['esc_period'], 'esc_step_from' => $operation_data['esc_step_from'], 'esc_step_to' => $operation_data['esc_step_to'], 'default_msg' => $operation_data['default_msg'], 'evaltype' => $operation_data['evaltype']); $operation_data['opconditions'] = array(); $sql = 'SELECT * FROM opconditions WHERE operationid=' . $operation_data['operationid']; $db_opconds = DBselect($sql); while ($db_opcond = DBfetch($db_opconds)) { $operation_data['opconditions'][] = $db_opcond; } $sql = 'SELECT * from opmediatypes WHERE operationid=' . $operation_data['operationid']; $db_opmtypes = DBSelect($sql); if ($db_opmtype = DBfetch($db_opmtypes)) { $operation_data['mediatypeid'] = $db_opmtype['mediatypeid']; } if (str_in_array($operation_data, $operations)) { continue; } array_push($operations, $operation_data); } unset($db_operations, $operation_data); } else { $eventsource = get_request('eventsource'); $evaltype = get_request('evaltype'); $esc_period = get_request('esc_period'); } $esc_step_from = array(); $objects_tmp = array(); $objectids_tmp = array(); foreach ($operations as $key => $operation) { $esc_step_from[$key] = $operation['esc_step_from']; $objects_tmp[$key] = $operation['object']; $objectids_tmp[$key] = $operation['objectid']; } array_multisort($esc_step_from, SORT_ASC, SORT_NUMERIC, $objects_tmp, SORT_DESC, $objectids_tmp, SORT_ASC, $operations); $tblOper->SetHeader(array(new CCheckBox('all_operations', null, 'checkAll("' . S_ACTION . '","all_operations","g_operationid");'), isset($_REQUEST['escalation']) ? S_STEPS : null, S_DETAILS, isset($_REQUEST['escalation']) ? S_PERIOD . ' (' . S_SEC_SMALL . ')' : null, isset($_REQUEST['escalation']) ? S_DELAY : null, S_ACTION)); $allowed_operations = get_operations_by_eventsource($eventsource); $delay = count_operations_delay($operations, $esc_period); foreach ($operations as $id => $val) { if (!str_in_array($val['operationtype'], $allowed_operations)) { continue; } if (!isset($val['default_msg'])) { $val['default_msg'] = 0; } if (!isset($val['opconditions'])) { $val['opconditions'] = array(); } if (!isset($val['mediatypeid'])) { $val['mediatypeid'] = 0; } $oper_details = new CSpan(get_operation_desc(SHORT_DESCRITION, $val)); $oper_details->SetHint(nl2br(get_operation_desc(LONG_DESCRITION, $val))); $esc_steps_txt = null; $esc_period_txt = null; $esc_delay_txt = null; if ($val['esc_step_from'] < 1) { $val['esc_step_from'] = 1; } if (isset($_REQUEST['escalation'])) { $esc_steps_txt = $val['esc_step_from'] . ' - ' . $val['esc_step_to']; /* Display N-N as N */ $esc_steps_txt = $val['esc_step_from'] == $val['esc_step_to'] ? $val['esc_step_from'] : $val['esc_step_from'] . ' - ' . $val['esc_step_to']; $esc_period_txt = $val['esc_period'] ? $val['esc_period'] : S_DEFAULT; $esc_delay_txt = $delay[$val['esc_step_from']] ? convert_units($delay[$val['esc_step_from']], 'uptime') : S_IMMEDIATELY; } $tblOper->addRow(array(new CCheckBox("g_operationid[]", 'no', null, $id), $esc_steps_txt, $oper_details, $esc_period_txt, $esc_delay_txt, new CButton('edit_operationid[' . $id . ']', S_EDIT))); $tblOper->addItem(new CVar('operations[' . $id . '][operationtype]', $val['operationtype'])); $tblOper->addItem(new CVar('operations[' . $id . '][object]', $val['object'])); $tblOper->addItem(new CVar('operations[' . $id . '][objectid]', $val['objectid'])); $tblOper->addItem(new CVar('operations[' . $id . '][mediatypeid]', $val['mediatypeid'])); $tblOper->addItem(new CVar('operations[' . $id . '][shortdata]', $val['shortdata'])); $tblOper->addItem(new CVar('operations[' . $id . '][longdata]', $val['longdata'])); $tblOper->addItem(new CVar('operations[' . $id . '][esc_period]', $val['esc_period'])); $tblOper->addItem(new CVar('operations[' . $id . '][esc_step_from]', $val['esc_step_from'])); $tblOper->addItem(new CVar('operations[' . $id . '][esc_step_to]', $val['esc_step_to'])); $tblOper->addItem(new CVar('operations[' . $id . '][default_msg]', $val['default_msg'])); $tblOper->addItem(new CVar('operations[' . $id . '][evaltype]', $val['evaltype'])); foreach ($val['opconditions'] as $opcondid => $opcond) { foreach ($opcond as $field => $value) { $tblOper->addItem(new CVar('operations[' . $id . '][opconditions][' . $opcondid . '][' . $field . ']', $value)); } } } unset($operations); $tblOperFooter = new CTableInfo(null); $oper_buttons = array(); if (!isset($_REQUEST['new_operation'])) { $oper_buttons[] = new CButton('new_operation', S_NEW); } if ($tblOper->ItemsCount() > 0) { $oper_buttons[] = new CButton('del_operation', S_DELETE_SELECTED); } $td = new CCol($oper_buttons); $td->setAttribute('colspan', isset($_REQUEST['escalation']) ? 6 : 3); $td->setAttribute('style', 'text-align: right;'); $tblOperFooter->SetFooter($td); // end of condition list preparation return array($tblOper, $tblOperFooter); }
function make_popup_eventlist($eventid, $trigger_type) { $table = new CTableInfo(); $table->setHeader(array(S_TIME, S_STATUS, S_DURATION, S_AGE, S_ACK)); $table->setAttribute('style', 'width: 400px;'); $event_list = array(); $sql = 'SELECT * ' . ' FROM events ' . ' WHERE eventid<=' . $eventid . ' ORDER BY eventid DESC'; $db_events = DBselect($sql, 20); while ($event = DBfetch($db_events)) { if (!empty($event_list) && $event_list[$count]['value'] != $event['value']) { $count++; } else { if (!empty($event_list) && $event_list[$count]['value'] == $event['value'] && $trigger_type == TRIGGER_MULT_EVENT_ENABLED && $event['value'] == TRIGGER_VALUE_TRUE) { $count++; } } $event_list[$count] = $event; } $lclock = time(); foreach ($event_list as $id => $event) { $duration = zbx_date2age($lclock, $event['clock']); $lclock = $event['clock']; $value = new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value'])); // ack +++ $ack = new CSpan(S_NO, 'on'); if ($event['acknowledged']) { $ack = new CSpan(S_YES, 'action'); } // --- $table->addRow(array(zbx_date2str(S_DATE_FORMAT_YMDHMS, $event['clock']), $value, $duration, zbx_date2age($event['clock']), $ack)); } return $table; }
function make_popup_eventlist($eventid, $trigger_type, $triggerid) { $config = select_config(); $table = new CTableInfo(); //if acknowledges are turned on, we show 'ack' column if ($config['event_ack_enable']) { $table->setHeader(array(S_TIME, S_STATUS, S_DURATION, S_AGE, S_ACK)); } else { $table->setHeader(array(S_TIME, S_STATUS, S_DURATION, S_AGE)); } $table->setAttribute('style', 'width: 400px;'); $event_list = array(); $sql = 'SELECT * ' . ' FROM events ' . ' WHERE eventid<=' . $eventid . ' AND object=' . EVENT_OBJECT_TRIGGER . ' AND objectid=' . $triggerid . ' ORDER BY eventid DESC'; $db_events = DBselect($sql, ZBX_WIDGET_ROWS); $count = 0; while ($event = DBfetch($db_events)) { if (!empty($event_list) && $event_list[$count]['value'] != $event['value']) { $count++; } else { if (!empty($event_list) && $event_list[$count]['value'] == $event['value'] && $trigger_type == TRIGGER_MULT_EVENT_ENABLED && $event['value'] == TRIGGER_VALUE_TRUE) { $count++; } } $event_list[$count] = $event; } $lclock = time(); foreach ($event_list as $id => $event) { $duration = zbx_date2age($lclock, $event['clock']); $lclock = $event['clock']; $value = new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value'])); // ack +++ $ack = new CSpan(S_NO, 'on'); if ($event['acknowledged']) { $ack = new CSpan(S_YES, 'off'); } // --- $table->addRow(array(zbx_date2str(S_EVENTS_POPUP_EVENT_LIST_DATE_FORMAT, $event['clock']), $value, $duration, zbx_date2age($event['clock']), $config['event_ack_enable'] ? $ack : NULL)); } return $table; }
$slideWidget->addPageHeader(_('CONFIGURATION OF SLIDE SHOWS')); // create form $slideForm = new CForm(); $slideForm->setName('slideForm'); $slideForm->addVar('form', $this->data['form']); $slideForm->addVar('slides', $this->data['slides_without_delay']); if (!empty($this->data['slideshowid'])) { $slideForm->addVar('slideshowid', $this->data['slideshowid']); } // create slide form list $slideFormList = new CFormList('slideFormList'); $slideFormList->addRow(_('Name'), new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE)); $slideFormList->addRow(_('Default delay (in seconds)'), new CNumericBox('delay', $this->data['delay'], 5, 'no', false, false)); // append slide table $slideTable = new CTableInfo(_('No slides defined.'), 'formElementTable'); $slideTable->setAttribute('style', 'min-width: 500px;'); $slideTable->setAttribute('id', 'slideTable'); $slideTable->setHeader(array(new CCol(SPACE, null, null, '15'), new CCol(SPACE, null, null, '15'), new CCol(_('Screen'), null, null, '140'), new CCol(_('Delay'), null, null, '70'), new CCol(_('Action'), null, null, '50'))); $i = 1; foreach ($this->data['slides'] as $step => $slides) { $name = ''; if (!empty($slides['screenid'])) { $screen = get_screen_by_screenid($slides['screenid']); if (!empty($screen['name'])) { $name = $screen['name']; } } $delay = new CNumericBox('slides[' . $step . '][delay]', !empty($slides['delay']) ? $slides['delay'] : '', 5, 'no', true, false); $delay->setAttribute('placeholder', _('default')); $removeButton = new CButton('remove_' . $step, _('Remove'), 'javascript: removeSlide(this);', 'link_menu'); $removeButton->setAttribute('remove_slide', $step);
} if (!empty($trigger['dependencies'])) { $dependenciesTable = new CTableInfo(); $dependenciesTable->setAttribute('style', 'width: 200px;'); $dependenciesTable->addRow(bold(_('Depends on') . NAME_DELIMITER)); foreach ($trigger['dependencies'] as $dependency) { $dependenciesTable->addRow(' - ' . CMacrosResolverHelper::resolveTriggerNameById($dependency['triggerid'])); } $img = new Cimg('images/general/arrow_down2.png', 'DEP_UP'); $img->setAttribute('style', 'vertical-align: middle; border: 0px;'); $img->setHint($dependenciesTable); $description = array($img, SPACE, $description); } $dependency = false; $dependenciesTable = new CTableInfo(); $dependenciesTable->setAttribute('style', 'width: 200px;'); $dependenciesTable->addRow(bold(_('Dependent') . NAME_DELIMITER)); if (!empty($triggerIdsDown[$trigger['triggerid']])) { $depTriggers = CMacrosResolverHelper::resolveTriggerNameByIds($triggerIdsDown[$trigger['triggerid']]); foreach ($depTriggers as $depTrigger) { $dependenciesTable->addRow(SPACE . '-' . SPACE . $depTrigger['description']); $dependency = true; } } if ($dependency) { $img = new Cimg('images/general/arrow_up2.png', 'DEP_UP'); $img->setAttribute('style', 'vertical-align: middle; border: 0px;'); $img->setHint($dependenciesTable); $description = array($img, SPACE, $description); } unset($img, $dependenciesTable, $dependency);
/** * Creates and returns a trigger status cell for the trigger overview table. * * @see getTriggersOverview() * * @param array $trigger * @param string $pageFile the page where the element is displayed * @param string $screenId * * @return CCol */ function getTriggerOverviewCells($trigger, $pageFile, $screenId = null) { $ack = null; $css = null; $style = null; $desc = array(); $config = select_config(); // for how long triggers should blink on status change (set by user in administration->general) $menuPopup = array(); $triggerItems = array(); $acknowledge = array(); if ($trigger) { $style = 'cursor: pointer; '; // problem trigger if ($trigger['value'] == TRIGGER_VALUE_TRUE) { $css = getSeverityStyle($trigger['priority']); $ack = null; if ($config['event_ack_enable'] == 1) { if ($event = get_last_event_by_triggerid($trigger['triggerid'])) { if ($screenId) { $acknowledge = array('eventid' => $event['eventid'], 'screenid' => $screenId, 'backurl' => $pageFile); } else { $acknowledge = array('eventid' => $event['eventid'], 'backurl' => 'overview.php'); } if ($event['acknowledged'] == 1) { $ack = new CImg('images/general/tick.png', 'ack'); } } } } else { $css = 'normal'; } $dbItems = DBselect('SELECT DISTINCT i.itemid,i.name,i.key_,i.value_type' . ' FROM items i,functions f' . ' WHERE f.itemid=i.itemid' . ' AND f.triggerid=' . zbx_dbstr($trigger['triggerid'])); while ($item = DBfetch($dbItems)) { $triggerItems[] = array('name' => itemName($item), 'params' => array('action' => in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showlatest', 'itemid' => $item['itemid'], 'period' => 3600)); } // dependency: triggers on which depends this $triggerId = empty($trigger['triggerid']) ? 0 : $trigger['triggerid']; // trigger dependency DOWN $dependencyTable = new CTableInfo(); $dependencyTable->setAttribute('style', 'width: 200px;'); $dependencyTable->addRow(bold(_('Depends on') . NAME_DELIMITER)); $isDependencyFound = false; $dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . zbx_dbstr($triggerId)); while ($dbDependency = DBfetch($dbDependencies)) { $dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_up'])); $isDependencyFound = true; } if ($isDependencyFound) { $icon = new Cimg('images/general/arrow_down2.png', 'DEP_DOWN'); $icon->setAttribute('style', 'vertical-align: middle; border: 0px;'); $icon->setHint($dependencyTable, '', '', false); $desc[] = $icon; } // trigger dependency UP $dependencyTable = new CTableInfo(); $dependencyTable->setAttribute('style', 'width: 200px;'); $dependencyTable->addRow(bold(_('Dependent') . NAME_DELIMITER)); $isDependencyFound = false; $dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_up=' . zbx_dbstr($triggerId)); while ($dbDependency = DBfetch($dbDependencies)) { $dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_down'])); $isDependencyFound = true; } if ($isDependencyFound) { $icon = new Cimg('images/general/arrow_up2.png', 'DEP_UP'); $icon->setAttribute('style', 'vertical-align: middle; border: none;'); $icon->setHint($dependencyTable, '', '', false); $desc[] = $icon; } } $column = is_array($desc) && count($desc) > 0 || $ack ? new CCol(array($desc, $ack), $css . ' hosts') : new CCol(SPACE, $css . ' hosts'); $column->setAttribute('style', $style); if ($trigger && $config['blink_period'] > 0 && time() - $trigger['lastchange'] < $config['blink_period']) { $column->addClass('blink'); $column->setAttribute('data-toggle-class', $css); } if ($trigger) { $column->setMenuPopup(getMenuPopupTrigger($trigger, $triggerItems, $acknowledge)); } return $column; }
validate_group($PAGE_GROUPS, $PAGE_HOSTS); $form = new CForm(); $form->setMethod('get'); $available_groups = $PAGE_GROUPS['groupids']; $cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();'); foreach ($PAGE_GROUPS['groups'] as $groupid => $name) { $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name); } $form->addItem(array(S_GROUP . SPACE, $cmbGroups, SPACE)); $cmbType = new CComboBox('type', $_REQUEST['type'], 'submit()'); $cmbType->addItem(SHOW_TRIGGERS, S_TRIGGERS); $cmbType->addItem(SHOW_DATA, S_DATA); $form->addItem(array(S_TYPE . SPACE, $cmbType)); $help = new CHelp('web.view.php', 'right'); $help_table = new CTableInfo(); $help_table->setAttribute('style', 'width: 200px'); if ($_REQUEST['type'] == SHOW_TRIGGERS) { $help_table->addRow(array(new CCol(SPACE, 'normal'), S_DISABLED)); } foreach (array(1, 2, 3, 4, 5) as $tr_severity) { $help_table->addRow(array(new CCol(get_severity_description($tr_severity), get_severity_style($tr_severity)), S_ENABLED)); } $help_table->addRow(array(new CCol(SPACE, 'unknown_trigger'), S_UNKNOWN)); if ($_REQUEST['type'] == SHOW_TRIGGERS) { $col = new CCol(SPACE, 'unknown_trigger'); $col->setAttribute('style', 'background-image: url(images/gradients/blink1.gif); ' . 'background-position: top left; background-repeat: repeate;'); $help_table->addRow(array($col, S_5_MIN)); $col = new CCol(SPACE, 'unknown_trigger'); $col->setAttribute('style', 'background-image: url(images/gradients/blink2.gif); ' . 'background-position: top left; background-repeat: repeate;'); $help_table->addRow(array($col, S_15_MIN)); $help_table->addRow(array(new CCol(SPACE), S_NO_TRIGGER));
function make_system_summary($args = array()) { global $USER_DETAILS; $config = select_config(); $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY); $available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY); $available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_IDS_ARRAY); if (isset($args['hosts']) && !empty($args['hosts'])) { $available_hosts = zbx_uint_array_intersect($args['hosts'], $available_hosts); } if (isset($args['groups']) && !empty($args['groups'])) { $available_groups = zbx_uint_array_intersect($args['groups'], $available_groups); } $sql_where = ''; if (isset($args['severity']) && ctype_digit($args['severity'])) { $sql_where = ' AND t.priority>=' . $args['severity']; } $table = new CTableInfo(); $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST_GROUP, S_DISASTER, S_HIGH, S_AVERAGE, S_WARNING, S_INFORMATION, S_NOT_CLASSIFIED)); $sql = 'SELECT DISTINCT g.groupid,g.name ' . ' FROM groups g, hosts_groups hg, hosts h, items i, functions f, triggers t ' . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . ' AND ' . DBcondition('g.groupid', $available_groups) . ' AND hg.groupid=g.groupid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.itemid=f.itemid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' ORDER BY g.name'; $gr_result = DBselect($sql); while ($group = DBFetch($gr_result)) { $group_row = new CRow(); if (is_show_all_nodes()) { $group_row->addItem(get_node_name_by_elid($group['groupid'])); } $name = new CLink($group['name'], 'tr_status.php?groupid=' . $group['groupid'] . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE); $name->setTarget('blank'); $group_row->addItem($name); $tab_priority[TRIGGER_SEVERITY_DISASTER] = 0; $tab_priority[TRIGGER_SEVERITY_HIGH] = 0; $tab_priority[TRIGGER_SEVERITY_AVERAGE] = 0; $tab_priority[TRIGGER_SEVERITY_WARNING] = 0; $tab_priority[TRIGGER_SEVERITY_INFORMATION] = 0; $tab_priority[TRIGGER_SEVERITY_NOT_CLASSIFIED] = 0; $sql = 'SELECT count(DISTINCT t.triggerid) as tr_cnt,t.priority ' . ' FROM hosts h,items i,hosts_groups hg, functions f, triggers t ' . ' WHERE h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND hg.groupid=' . $group['groupid'] . ' AND hg.hostid=h.hostid' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.itemid=f.itemid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.value=' . TRIGGER_VALUE_TRUE . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' GROUP BY t.priority'; //SDI($sql); $tr_result = DBSelect($sql); while ($group_stat = DBFetch($tr_result)) { $tab_priority[$group_stat['priority']] = $group_stat['tr_cnt']; } foreach ($tab_priority as $key => $value) { $tr_count = 0; if ($value) { //* trigger list $table_inf = new CTableInfo(); $table_inf->setAttribute('style', 'width: 400px;'); $table_inf->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST, S_ISSUE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS)); $sql = 'SELECT DISTINCT t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.value,h.host,h.hostid ' . ' FROM triggers t,hosts h,items i,functions f, hosts_groups hg ' . ' WHERE f.itemid=i.itemid ' . ' AND hg.groupid=' . $group['groupid'] . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND t.value=' . TRIGGER_VALUE_TRUE . ' AND t.priority=' . $key . ' ORDER BY t.lastchange DESC'; $result = DBselect($sql); while ($row_inf = DBfetch($result)) { // Check for dependencies if (trigger_dependent($row_inf["triggerid"])) { continue; } $tr_count++; if ($tr_count > 30) { continue; } $host = new CSpan($row_inf['host']); $event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type ' . ' FROM events e, triggers t ' . ' WHERE e.object=' . EVENT_SOURCE_TRIGGERS . ' AND e.objectid=' . $row_inf['triggerid'] . ' AND t.triggerid=e.objectid ' . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC'; if ($row_inf_event = DBfetch(DBselect($event_sql, 1))) { if ($config['event_ack_enable']) { if ($row_inf_event['acknowledged'] == 1) { $ack = new CLink(S_YES, 'acknow.php?eventid=' . $row_inf_event['eventid'], 'action'); } else { $ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_inf_event['eventid'], 'on'); } } $description = expand_trigger_description_by_data(array_merge($row_inf, array('clock' => $row_inf_event['clock'])), ZBX_FLAG_EVENT); //actions $actions = get_event_actions_status($row_inf_event['eventid']); //-------- } else { $description = expand_trigger_description_by_data($row_inf, ZBX_FLAG_EVENT); $ack = '-'; $actions = S_NO_DATA_SMALL; $row_inf_event['clock'] = $row_inf['clock']; } $table_inf->addRow(array(get_node_name_by_elid($row_inf['triggerid']), $host, new CCol($description, get_severity_style($row_inf['priority'])), zbx_date2age($row_inf_event['clock']), $config['event_ack_enable'] ? new CCol($ack, 'center') : NULL, $actions)); unset($row_inf, $description, $actions); } $value = new CSpan($tr_count, 'pointer'); $value->setHint($table_inf); //-------------*/ } $group_row->AddItem(new CCol($value, get_severity_style($key, $tr_count))); unset($table_inf); } $table->addRow($group_row); } $table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time()))); return $table; }
if (!empty($value)) { $output .= "\t'" . zbx_strtoupper($key) . "'=>\t\t\t'" . $value . "',\n"; } } $output .= ' ); ?> '; print $output; die; } } if (isset($_REQUEST['next'])) { $help = new CHelp('web.view.php'); $help_table = new CTableInfo(); $help_table->setAttribute('style', 'width: 600px;'); if ($_REQUEST['extlang'] == 'new') { $help_table->addRow(array(S_STEP . SPACE . '1:', S_NEW_LOCALE_STEP_1)); $help_table->addRow(array(S_STEP . SPACE . '2:', S_NEW_LOCALE_STEP_2)); $help_table->addRow(array(S_STEP . SPACE . '3:', array(S_NEW_LOCALE_STEP_3_1, BR(), S_NEW_LOCALE_STEP_3_2))); $help_table->addRow(array(S_STEP . SPACE . '4:', array(S_NEW_LOCALE_STEP_4_1, BR(), S_NEW_LOCALE_STEP_4_2, BR(), S_NEW_LOCALE_STEP_4_3, BR(), S_NEW_LOCALE_STEP_4_4, BR(), S_NEW_LOCALE_STEP_4_5))); } else { $help_table->addRow(array(S_STEP . SPACE . '1:', S_UPDATE_LOCALE_1)); $help_table->addRow(array(S_STEP . SPACE . '2:', S_UPDATE_LOCALE_2)); $help_table->addRow(array(S_STEP . SPACE . '3:', S_UPDATE_LOCALE_3)); } $help->setHint($help_table); show_table_header(S_LOCALES); $frmLcls = new CFormTable(SPACE . S_CREATE . SPACE . S_LOCALE_SMALL . SPACE . S_FROM_SMALL . SPACE . $ZBX_LOCALES[$_REQUEST['srclang']], 'locales.php?action=1', 'post', null, 'form'); $frmLcls->setAttribute('id', 'locales'); $frmLcls->setHelp($help);
/** * Generate table for dashboard triggers popup. * * @see make_system_status * * @param array $triggers * @param array $ackParams * @param array $actions * * @return CTableInfo */ function makeTriggersPopup(array $triggers, array $ackParams, array $actions) { $config = select_config(); $popupTable = new CTableInfo(); $popupTable->setAttribute('style', 'width: 400px;'); $popupTable->setHeader(array(is_show_all_nodes() ? _('Node') : null, _('Host'), _('Issue'), _('Age'), _('Info'), $config['event_ack_enable'] ? _('Ack') : null, _('Actions'))); CArrayHelper::sort($triggers, array(array('field' => 'lastchange', 'order' => ZBX_SORT_DOWN))); foreach ($triggers as $trigger) { // unknown triggers $unknown = SPACE; if ($trigger['state'] == TRIGGER_STATE_UNKNOWN) { $unknown = new CDiv(SPACE, 'status_icon iconunknown'); $unknown->setHint($trigger['error'], '', 'on'); } // ack if ($config['event_ack_enable']) { $ack = isset($trigger['event']['eventid']) ? getEventAckState($trigger['event'], true, true, $ackParams) : _('No events'); } else { $ack = null; } // action $action = isset($trigger['event']['eventid']) && isset($actions[$trigger['event']['eventid']]) ? $actions[$trigger['event']['eventid']] : _('-'); $popupTable->addRow(array(get_node_name_by_elid($trigger['triggerid']), $trigger['hosts'][0]['name'], getSeverityCell($trigger['priority'], $trigger['description']), zbx_date2age($trigger['lastchange']), $unknown, $ack, $action)); } return $popupTable; }
if ($httptest_data['lastfailedstep'] > 0) { $status['msg'] = S_FAIL . ' - ' . S_ERROR . ': ' . $httptest_data['error']; $status['style'] = 'disabled'; } } } $table->AddRow(array(new CCol(S_TOTAL_BIG, 'bold'), new CCol(SPACE, 'bold'), new CCol(format_lastvalue($total_data[HTTPSTEP_ITEM_TYPE_TIME]), 'bold'), new CCol(SPACE, 'bold'), new CCol(new CSpan($status['msg'], $status['style']), 'bold'))); $table->Show(); echo SBR; if (isset($_REQUEST['period']) && $_REQUEST['period'] != ZBX_MIN_PERIOD) { update_profile('web.httptest.period', $_REQUEST['period'], PROFILE_TYPE_INT, $_REQUEST['httptestid']); } $_REQUEST['period'] = get_profile('web.httptest.period', ZBX_PERIOD_DEFAULT, PROFILE_TYPE_INT, $_REQUEST['httptestid']); show_table_header(array(S_HISTORY . ' "', bold($httptest_data['name']), '"')); $form = new CTableInfo(); $form->setAttribute('id', 'graph'); $form->AddRow(array(bold(S_SPEED), new CCol(get_dynamic_chart('graph_1', 'chart3.php?' . url_param('period') . url_param('from') . url_param($httptest_data['name'], false, 'name') . url_param(150, false, 'height') . url_param(get_request('stime', 0), false, 'stime') . url_param($items[HTTPSTEP_ITEM_TYPE_IN], false, 'items') . url_param(GRAPH_TYPE_STACKED, false, 'graphtype'), '-128'), 'center'))); $form->AddRow(array(bold(S_RESPONSE_TIME), new CCol(get_dynamic_chart('graph_2', 'chart3.php?' . url_param('period') . url_param('from') . url_param($httptest_data['name'], false, 'name') . url_param(150, false, 'height') . url_param(get_request('stime', 0), false, 'stime') . url_param($items[HTTPSTEP_ITEM_TYPE_TIME], false, 'items') . url_param(GRAPH_TYPE_STACKED, false, 'graphtype'), '-128'), 'center'))); $form->Show(); $period = get_request('period', 3600); //SDI(get_min_itemclock_by_itemid($items[HTTPSTEP_ITEM_TYPE_IN][0]['itemid'])); $mstime = min(get_min_itemclock_by_itemid($items[HTTPSTEP_ITEM_TYPE_IN][0]['itemid']), get_min_itemclock_by_itemid($items[HTTPSTEP_ITEM_TYPE_TIME][0]['itemid'])); $stime = $mstime ? $mstime : 0; $bstime = time() - $period; if (isset($_REQUEST['stime'])) { $bstime = $_REQUEST['stime']; $bstime = mktime(substr($bstime, 8, 2), substr($bstime, 10, 2), 0, substr($bstime, 4, 2), substr($bstime, 6, 2), substr($bstime, 0, 4)); } $script = 'scrollinit(0,' . $period . ',' . $stime . ',0,' . $bstime . '); showgraphmenu("graph"); graph_zoom_init("graph_1",' . $bstime . ',' . $period . ',ZBX_G_WIDTH, 150, false);