/**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     // fetch hosts
     $hosts = API::Host()->get(['output' => ['hostid', 'status'], 'selectGraphs' => $this->screenitem['style'] == STYLE_LEFT ? API_OUTPUT_COUNT : null, 'selectScreens' => $this->screenitem['style'] == STYLE_LEFT ? API_OUTPUT_COUNT : null, 'groupids' => $this->screenitem['resourceid'], 'preservekeys' => true]);
     $hostids = array_keys($hosts);
     $options = ['output' => ['triggerid', 'expression', 'description', 'url', 'value', 'priority', 'lastchange', 'flags'], 'selectHosts' => ['hostid', 'name', 'status'], 'selectItems' => ['itemid', 'hostid', 'name', 'key_', 'value_type'], 'hostids' => $hostids, 'monitored' => true, 'skipDependent' => true, 'sortfield' => 'description', 'preservekeys' => true];
     // application filter
     if ($this->screenitem['application'] !== '') {
         $applications = API::Application()->get(['output' => [], 'hostids' => $hostids, 'search' => ['name' => $this->screenitem['application']], 'preservekeys' => true]);
         $options['applicationids'] = array_keys($applications);
     }
     $triggers = API::Trigger()->get($options);
     $triggers = CMacrosResolverHelper::resolveTriggerUrls($triggers);
     /*
      * Each screen cell with "Triggers overview" depends on one specific group which in this case is 'resourceid'.
      * Pass it as 'groupid' to menu pop-up "Events" link.
      */
     foreach ($triggers as &$trigger) {
         $trigger['groupid'] = $this->screenitem['resourceid'];
     }
     unset($trigger);
     $groups = API::HostGroup()->get(['output' => ['name'], 'groupids' => [$this->screenitem['resourceid']]]);
     $header = (new CDiv([new CTag('h4', true, _('Triggers overview')), (new CList())->addItem([_('Group'), ':', SPACE, $groups[0]['name']])]))->addClass(ZBX_STYLE_DASHBRD_WIDGET_HEAD);
     $table = getTriggersOverview($hosts, $triggers, $this->pageFile, $this->screenitem['style'], $this->screenid);
     $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
     return $this->getOutput(new CUiWidget(uniqid(), [$header, $table, $footer]));
 }
示例#2
0
function local_generateHeader($data)
{
    // only needed for zbx_construct_menu
    global $page;
    header('Content-Type: text/html; charset=UTF-8');
    // construct menu
    $main_menu = [];
    $sub_menus = [];
    zbx_construct_menu($main_menu, $sub_menus, $page, $data['controller']['action']);
    $pageHeader = new CView('layout.htmlpage.header', ['javascript' => ['files' => $data['javascript']['files']], 'page' => ['title' => $data['page']['title']], 'user' => ['lang' => CWebUser::$data['lang'], 'theme' => CWebUser::$data['theme']]]);
    echo $pageHeader->getOutput();
    if ($data['fullscreen'] == 0) {
        global $ZBX_SERVER_NAME;
        $pageMenu = new CView('layout.htmlpage.menu', ['server_name' => isset($ZBX_SERVER_NAME) ? $ZBX_SERVER_NAME : '', 'menu' => ['main_menu' => $main_menu, 'sub_menus' => $sub_menus, 'selected' => $page['menu']], 'user' => ['is_guest' => CWebUser::isGuest(), 'alias' => CWebUser::$data['alias'], 'name' => CWebUser::$data['name'], 'surname' => CWebUser::$data['surname']]]);
        echo $pageMenu->getOutput();
    }
    echo '<div class="' . ZBX_STYLE_ARTICLE . '">';
    // should be replaced with addPostJS() at some point
    zbx_add_post_js('initMessages({});');
    // if a user logs in after several unsuccessful attempts, display a warning
    if ($failedAttempts = CProfile::get('web.login.attempt.failed', 0)) {
        $attempt_ip = CProfile::get('web.login.attempt.ip', '');
        $attempt_date = CProfile::get('web.login.attempt.clock', 0);
        $error_msg = _n('%4$s failed login attempt logged. Last failed attempt was from %1$s on %2$s at %3$s.', '%4$s failed login attempts logged. Last failed attempt was from %1$s on %2$s at %3$s.', $attempt_ip, zbx_date2str(DATE_FORMAT, $attempt_date), zbx_date2str(TIME_FORMAT, $attempt_date), $failedAttempts);
        error($error_msg);
        CProfile::update('web.login.attempt.failed', 0, PROFILE_TYPE_INT);
    }
    show_messages();
}
示例#3
0
 public function getCanvas()
 {
     $date = zbx_date2str(DATE_TIME_FORMAT_SECONDS);
     imagestring($this->canvas, 1, $this->width - 120, $this->height - 12, $date, $this->getColor('gray'));
     imagestringup($this->canvas, 1, $this->width - 10, $this->height - 50, ZABBIX_HOMEPAGE, $this->getColor('gray'));
     return $this->canvas;
 }
示例#4
0
/**
 * Get acknowledgement table.
 *
 * @param array $acknowledges
 * @param array $acknowledges['clock']
 * @param array $acknowledges['alias']
 * @param array $acknowledges['name']
 * @param array $acknowledges['surname']
 * @param array $acknowledges['message']
 *
 * @return CTableInfo
 */
function makeAckTab($acknowledges)
{
    $table = (new CTableInfo())->setHeader([_('Time'), _('User'), _('Message')]);
    foreach ($acknowledges as $acknowledge) {
        $table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $acknowledge['clock']), getUserFullname($acknowledge), zbx_nl2br($acknowledge['message'])]);
    }
    return $table;
}
示例#5
0
 public function getCanvas()
 {
     $grey = get_color($this->canvas, '969696', 50);
     $date = zbx_date2str(DATE_TIME_FORMAT_SECONDS);
     imagestring($this->canvas, 1, $this->width - 120, $this->height - 12, $date, $grey);
     imagestringup($this->canvas, 1, $this->width - 10, $this->height - 50, ZABBIX_HOMEPAGE, $grey);
     return $this->canvas;
 }
 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     global $page;
     // rewrite page file
     $page['file'] = $this->pageFile;
     $table = make_system_status(['groupids' => null, 'hostids' => null, 'maintenance' => null, 'trigger_name' => '', 'severity' => null, 'limit' => null, 'extAck' => 0], $this->pageFile . '?screenid=' . $this->screenid);
     $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
     return $this->getOutput((new CUiWidget('hat_syssum', [$table, $footer]))->setHeader(_('Status of Zabbix')));
 }
示例#7
0
 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     global $page;
     // rewrite page file
     $page['file'] = $this->pageFile;
     $item = new CUIWidget('hat_syssum', make_system_status(array('groupids' => null, 'hostids' => null, 'maintenance' => null, 'severity' => null, 'limit' => null, 'extAck' => 0, 'screenid' => $this->screenid)));
     $item->setHeader(_('Status of Zabbix'), SPACE);
     $item->setFooter(_s('Updated: %s', zbx_date2str(_('H:i:s'))));
     return $this->getOutput($item);
 }
 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     // if screen is defined in template, then 'real_resourceid' is defined and should be used
     if (!empty($this->screenitem['real_resourceid'])) {
         $this->screenitem['resourceid'] = $this->screenitem['real_resourceid'];
     }
     if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) {
         $newitemid = get_same_item_for_host($this->screenitem['resourceid'], $this->hostid);
         $this->screenitem['resourceid'] = !empty($newitemid) ? $newitemid : 0;
     }
     if ($this->screenitem['resourceid'] == 0) {
         $table = (new CTableInfo())->setHeader([_('Timestamp'), _('Item')]);
         return $this->getOutput($table);
     }
     $items = CMacrosResolverHelper::resolveItemNames([get_item_by_itemid($this->screenitem['resourceid'])]);
     $item = reset($items);
     switch ($item['value_type']) {
         case ITEM_VALUE_TYPE_TEXT:
         case ITEM_VALUE_TYPE_LOG:
             $orderField = 'id';
             break;
         case ITEM_VALUE_TYPE_FLOAT:
         case ITEM_VALUE_TYPE_UINT64:
         default:
             $orderField = ['itemid', 'clock'];
     }
     $host = get_host_by_itemid($this->screenitem['resourceid']);
     $table = (new CTableInfo())->setHeader([_('Timestamp'), _('Value')]);
     $stime = zbxDateToTime($this->timeline['stime']);
     $histories = API::History()->get(['history' => $item['value_type'], 'itemids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN, 'sortfield' => $orderField, 'limit' => $this->screenitem['elements'], 'time_from' => $stime, 'time_till' => $stime + $this->timeline['period']]);
     foreach ($histories as $history) {
         switch ($item['value_type']) {
             case ITEM_VALUE_TYPE_FLOAT:
                 sscanf($history['value'], '%f', $value);
                 break;
             case ITEM_VALUE_TYPE_TEXT:
             case ITEM_VALUE_TYPE_STR:
             case ITEM_VALUE_TYPE_LOG:
                 $value = $this->screenitem['style'] ? new CJsScript($history['value']) : $history['value'];
                 break;
             default:
                 $value = $history['value'];
                 break;
         }
         if ($item['valuemapid'] > 0) {
             $value = applyValueMap($value, $item['valuemapid']);
         }
         if ($this->screenitem['style'] == 0) {
             $value = new CPre($value);
         }
         $table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $history['clock']), $value]);
     }
     $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
     return $this->getOutput((new CUiWidget(uniqid(), [$table, $footer]))->setHeader($host['name'] . NAME_DELIMITER . $item['name_expanded']));
 }
示例#9
0
/**
 * Get acknowledgement table.
 *
 * @param array $event
 * @param array $event['acknowledges']
 * @param array $event['acknowledges']['clock']
 * @param array $event['acknowledges']['alias']
 * @param array $event['acknowledges']['message']
 *
 * @return CTableInfo
 */
function makeAckTab($event)
{
    $acknowledgeTable = new CTableInfo(_('No acknowledges found.'));
    $acknowledgeTable->setHeader(array(_('Time'), _('User'), _('Comments')));
    if (!empty($event['acknowledges']) && is_array($event['acknowledges'])) {
        foreach ($event['acknowledges'] as $acknowledge) {
            $acknowledgeTable->addRow(array(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $acknowledge['clock']), getUserFullname($acknowledge), new CCol(zbx_nl2br($acknowledge['message']), 'wraptext')));
        }
    }
    return $acknowledgeTable;
}
示例#10
0
 protected static function createDOMDocument()
 {
     $doc = new DOMDocument('1.0', 'UTF-8');
     $doc->preserveWhiteSpace = false;
     $doc->formatOutput = true;
     $root = $doc->appendChild(new DOMElement('zabbix_export'));
     $root->setAttributeNode(new DOMAttr('version', '1.0'));
     $root->setAttributeNode(new DOMAttr('date', zbx_date2str(XML_DATE_DATE_FORMAT)));
     $root->setAttributeNode(new DOMAttr('time', zbx_date2str(XML_TIME_DATE_FORMAT)));
     return $root;
 }
 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     // if screen is defined in template, then 'real_resourceid' is defined and should be used
     if (!empty($this->screenitem['real_resourceid'])) {
         $this->screenitem['resourceid'] = $this->screenitem['real_resourceid'];
     }
     if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) {
         $newitemid = get_same_item_for_host($this->screenitem['resourceid'], $this->hostid);
         $this->screenitem['resourceid'] = !empty($newitemid) ? $newitemid : 0;
     }
     if ($this->screenitem['resourceid'] == 0) {
         $table = new CTableInfo(_('No values found.'));
         $table->setHeader(array(_('Timestamp'), _('Item')));
         return $this->getOutput($table);
     }
     $items = CMacrosResolverHelper::resolveItemNames(array(get_item_by_itemid($this->screenitem['resourceid'])));
     $item = reset($items);
     switch ($item['value_type']) {
         case ITEM_VALUE_TYPE_TEXT:
         case ITEM_VALUE_TYPE_LOG:
             $orderField = 'id';
             break;
         case ITEM_VALUE_TYPE_FLOAT:
         case ITEM_VALUE_TYPE_UINT64:
         default:
             $orderField = array('itemid', 'clock');
     }
     $host = get_host_by_itemid($this->screenitem['resourceid']);
     $table = new CTableInfo(_('No values found.'));
     $table->setHeader(array(_('Timestamp'), $host['name'] . NAME_DELIMITER . $item['name_expanded']));
     $stime = zbxDateToTime($this->timeline['stime']);
     $histories = API::History()->get(array('history' => $item['value_type'], 'itemids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN, 'sortfield' => $orderField, 'limit' => $this->screenitem['elements'], 'time_from' => $stime, 'time_till' => $stime + $this->timeline['period']));
     foreach ($histories as $history) {
         switch ($item['value_type']) {
             case ITEM_VALUE_TYPE_FLOAT:
                 sscanf($history['value'], '%f', $value);
                 break;
             case ITEM_VALUE_TYPE_TEXT:
             case ITEM_VALUE_TYPE_STR:
             case ITEM_VALUE_TYPE_LOG:
                 $value = $this->screenitem['style'] ? new CJsScript($history['value']) : $history['value'];
                 break;
             default:
                 $value = $history['value'];
                 break;
         }
         if ($item['valuemapid'] > 0) {
             $value = applyValueMap($value, $item['valuemapid']);
         }
         $class = $this->screenitem['style'] ? null : 'pre';
         $table->addRow(array(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $history['clock']), new CCol($value, $class)));
     }
     return $this->getOutput($table);
 }
/**
 * Generate acknowledgement table
 *
 * @param array $event
 * @param array $event['acknowledges']
 * @param array $event['acknowledges']['clock']
 * @param array $event['acknowledges']['alias']
 * @param array $event['acknowledges']['message']
 *
 * @return CTableInfo
 */
function makeAckTab($event)
{
    $table = new CTableInfo(_('No acknowledges defined.'));
    $table->setHeader(array(_('Time'), _('User'), _('Comments')));
    if (!empty($event['acknowledges']) && is_array($event['acknowledges'])) {
        foreach ($event['acknowledges'] as $ack) {
            $table->addRow(array(zbx_date2str(_('d M Y H:i:s'), $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
        }
    }
    return $table;
}
 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $header = (new CDiv([new CTag('h4', true, _('Triggers info'))]))->addClass(ZBX_STYLE_DASHBRD_WIDGET_HEAD);
     if ($this->screenitem['resourceid'] != 0) {
         $groups = API::HostGroup()->get(['output' => ['name'], 'groupids' => [$this->screenitem['resourceid']]]);
         $header->addItem((new CList())->addItem([_('Host'), ':', SPACE, $groups[0]['name']]));
     }
     $table = (new CTriggersInfo($this->screenitem['resourceid']))->setOrientation($this->screenitem['style']);
     $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
     return $this->getOutput(new CUiWidget(uniqid(), [$header, $table, $footer]));
 }
示例#14
0
function make_acktab_by_eventid($eventid)
{
    $table = new CTableInfo();
    $table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
    $acks = get_acknowledges_by_eventid($eventid);
    while ($ack = DBfetch($acks)) {
        //$users = CUser::get(array('userids' => $ack['userid'],  'output' => API_OUTPUT_EXTEND));
        //$user = reset($users);
        $table->addRow(array(zbx_date2str(S_ACKNOWINC_BY_EVENTS_DATE_FORMAT, $ack['clock']), $ack['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
    }
    return $table;
}
示例#15
0
 public function bodyToString()
 {
     $this->cleanItems();
     $status = get_status();
     $server = $status['zabbix_server'] == _('Yes') ? new CSpan(_('running'), 'off') : new CSpan(_('not running'), 'on');
     $serverLink = CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN ? new CLink(_('Zabbix server'), 'report1.php') : _('Zabbix server');
     $this->addRow(new CCol(_('Zabbix server info'), 'nowrap ui-corner-all ui-widget-header'));
     $this->addRow(_('Updated') . NAME_DELIMITER . zbx_date2str(SERVER_INFO_DATE_FORMAT, time()));
     $this->addRow(_('Users (online)') . NAME_DELIMITER . $status['users_count'] . '(' . $status['users_online'] . ')');
     $this->addRow(new CCol(array(_('Logged in as') . SPACE, new CLink(CWebUser::$data['alias'], 'profile.php'))));
     $this->addRow(new CCol(array($serverLink, SPACE . _('is') . SPACE, $server)), 'status');
     $this->addRow(new CCol(array(_('Hosts (m/n/t)') . NAME_DELIMITER . $status['hosts_count'] . '(', new CSpan($status['hosts_count_monitored'], 'off'), '/', new CSpan($status['hosts_count_not_monitored'], 'on'), '/', new CSpan($status['hosts_count_template'], 'unknown'), ')')));
     $this->addRow(new CCol(array(_('Items (m/d/n)') . NAME_DELIMITER . $status['items_count'] . '(', new CSpan($status['items_count_monitored'], 'off'), '/', new CSpan($status['items_count_disabled'], 'on'), '/', new CSpan($status['items_count_not_supported'], 'unknown'), ')')));
     $this->addRow(new CCol(array(_('Triggers (e/d)[p/o]') . NAME_DELIMITER . $status['triggers_count'] . '(' . $status['triggers_count_enabled'] . '/' . $status['triggers_count_disabled'] . ')[', new CSpan($status['triggers_count_on'], 'on'), '/', new CSpan($status['triggers_count_off'], 'off'), ']')));
     return parent::bodyToString();
 }
示例#16
0
 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $options = array('monitored' => true, 'value' => array(TRIGGER_VALUE_TRUE, TRIGGER_VALUE_FALSE), 'triggerLimit' => $this->screenitem['elements'], 'eventLimit' => $this->screenitem['elements']);
     $item = new CTableInfo(_('No events found.'));
     $item->setHeader(array(_('Time'), is_show_all_nodes() ? _('Node') : null, _('Host'), _('Description'), _('Value'), _('Severity')));
     $events = getLastEvents($options);
     foreach ($events as $event) {
         $trigger = $event['trigger'];
         $host = $event['host'];
         $statusSpan = new CSpan(trigger_value2str($event['value']));
         // add colors and blinking to span depending on configuration and trigger parameters
         addTriggerValueStyle($statusSpan, $event['value'], $event['clock'], $event['acknowledged']);
         $item->addRow(array(zbx_date2str(_('d M Y H:i:s'), $event['clock']), get_node_name_by_elid($event['objectid']), $host['name'], new CLink($trigger['description'], 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid']), $statusSpan, getSeverityCell($trigger['priority'])));
     }
     return $this->getOutput($item);
 }
示例#17
0
 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $total = 0;
     // fetch accessible host ids
     $hosts = API::Host()->get(['output' => ['hostid'], 'preservekeys' => true]);
     $hostids = array_keys($hosts);
     if ($this->screenitem['resourceid'] != 0) {
         $cond_from = ',hosts_groups hg';
         $cond_where = ' AND hg.hostid=h.hostid AND hg.groupid=' . zbx_dbstr($this->screenitem['resourceid']);
     } else {
         $cond_from = '';
         $cond_where = '';
     }
     $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_TRUE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostids) . $cond_where);
     $host_cnt = DBfetch($db_host_cnt);
     $avail = $host_cnt['cnt'];
     $total += $host_cnt['cnt'];
     $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_FALSE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostids) . $cond_where);
     $host_cnt = DBfetch($db_host_cnt);
     $notav = $host_cnt['cnt'];
     $total += $host_cnt['cnt'];
     $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_UNKNOWN . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostids) . $cond_where);
     $host_cnt = DBfetch($db_host_cnt);
     $uncn = $host_cnt['cnt'];
     $total += $host_cnt['cnt'];
     $avail = (new CCol($avail . '  ' . _('Available')))->addClass(ZBX_STYLE_GREEN);
     $notav = (new CCol($notav . '  ' . _('Not available')))->addClass(ZBX_STYLE_RED);
     $uncn = (new CCol($uncn . '  ' . _('Unknown')))->addClass(ZBX_STYLE_GREY);
     $total = new CCol($total . '  ' . _('Total'));
     $header = (new CDiv([new CTag('h4', true, _('Hosts info'))]))->addClass(ZBX_STYLE_DASHBRD_WIDGET_HEAD);
     if ($this->screenitem['resourceid'] != 0) {
         $groups = API::HostGroup()->get(['output' => ['name'], 'groupids' => [$this->screenitem['resourceid']]]);
         $header->addItem((new CList())->addItem([_('Group'), ':', SPACE, $groups[0]['name']]));
     }
     $table = new CTableInfo();
     if ($this->screenitem['style'] == STYLE_HORIZONTAL) {
         $table->addRow([$avail, $notav, $uncn, $total]);
     } else {
         $table->addRow($avail);
         $table->addRow($notav);
         $table->addRow($uncn);
         $table->addRow($total);
     }
     $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
     return $this->getOutput(new CUiWidget(uniqid(), [$header, $table, $footer]));
 }
 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $hostids = [];
     $dbHostGroups = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . zbx_dbstr($this->screenitem['resourceid']));
     while ($dbHostGroup = DBfetch($dbHostGroups)) {
         $hostids[$dbHostGroup['hostid']] = $dbHostGroup['hostid'];
     }
     // application filter
     $applicationIds = null;
     if ($this->screenitem['application'] !== '') {
         $applications = API::Application()->get(['output' => ['applicationid'], 'hostids' => $hostids, 'search' => ['name' => $this->screenitem['application']]]);
         $applicationIds = zbx_objectValues($applications, 'applicationid');
     }
     $groups = API::HostGroup()->get(['output' => ['name'], 'groupids' => [$this->screenitem['resourceid']]]);
     $header = (new CDiv([new CTag('h4', true, _('Data overview')), (new CList())->addItem([_('Group'), ':', SPACE, $groups[0]['name']])]))->addClass(ZBX_STYLE_DASHBRD_WIDGET_HEAD);
     $table = getItemsDataOverview($hostids, $applicationIds, $this->screenitem['style']);
     $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
     return $this->getOutput(new CUiWidget(uniqid(), [$header, $table, $footer]));
 }
示例#19
0
 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $status = get_status();
     $server = $status['zabbix_server'] == _('Yes') ? (new CSpan(_('running')))->addClass(ZBX_STYLE_GREEN) : (new CSpan(_('not running')))->addClass(ZBX_STYLE_RED);
     $user_link = CWebUser::$data['alias'];
     if (!CWebUser::isGuest()) {
         $user_link = new CLink($user_link, 'profile.php');
     }
     $server_link = _('Zabbix server');
     if (CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN) {
         $server_link = new CLink($server_link, 'zabbix.php?action=report.status');
     }
     $table = new CTableInfo();
     $table->addRow(_('Users (online)') . NAME_DELIMITER . $status['users_count'] . '(' . $status['users_online'] . ')');
     $table->addRow(new CCol([_('Logged in as'), SPACE, $user_link]));
     $table->addRow(new CCol([$server_link, SPACE, _('is'), SPACE, $server]));
     $table->addRow(new CCol([_('Hosts (m/n/t)') . NAME_DELIMITER . $status['hosts_count'] . '(', (new CSpan($status['hosts_count_monitored']))->addClass(ZBX_STYLE_GREEN), '/', (new CSpan($status['hosts_count_not_monitored']))->addClass(ZBX_STYLE_RED), '/', (new CSpan($status['hosts_count_template']))->addClass(ZBX_STYLE_GREY), ')']));
     $table->addRow(new CCol([_('Items (m/d/n)') . NAME_DELIMITER . $status['items_count'] . '(', (new CSpan($status['items_count_monitored']))->addClass(ZBX_STYLE_GREEN), '/', (new CSpan($status['items_count_disabled']))->addClass(ZBX_STYLE_RED), '/', (new CSpan($status['items_count_not_supported']))->addClass(ZBX_STYLE_GREY), ')']));
     $table->addRow(new CCol([_('Triggers (e/d)[p/o]') . NAME_DELIMITER . $status['triggers_count'] . '(' . $status['triggers_count_enabled'] . '/' . $status['triggers_count_disabled'] . ')[', (new CSpan($status['triggers_count_on']))->addClass(ZBX_STYLE_GREEN), '/', (new CSpan($status['triggers_count_off']))->addClass(ZBX_STYLE_RED), ']']));
     $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT);
     return $this->getOutput((new CUiWidget(uniqid(), [$table, $footer]))->setHeader(_('Zabbix server info')));
 }
示例#20
0
 $httpTests = API::HttpTest()->get(array('httptestids' => zbx_objectValues($httpTests, 'httptestid'), 'preservekeys' => true, 'output' => API_OUTPUT_EXTEND, 'selectHosts' => array('name', 'status'), 'selectSteps' => API_OUTPUT_COUNT));
 foreach ($httpTests as &$httpTest) {
     $httpTest['host'] = reset($httpTest['hosts']);
     $httpTest['hostname'] = $httpTest['host']['name'];
     unset($httpTest['hosts']);
 }
 unset($httpTest);
 $httpTests = resolveHttpTestMacros($httpTests, true, false);
 order_result($httpTests, getPageSortField('name'), getPageSortOrder());
 // fetch the latest results of the web scenario
 $lastHttpTestData = Manager::HttpTest()->getLastData(array_keys($httpTests));
 foreach ($httpTests as $httpTest) {
     $lastData = isset($lastHttpTestData[$httpTest['httptestid']]) ? $lastHttpTestData[$httpTest['httptestid']] : null;
     // test has history data
     if ($lastData) {
         $lastcheck = zbx_date2str(_('d M Y H:i:s'), $lastData['lastcheck']);
         if ($lastData['lastfailedstep'] != 0) {
             $step_data = get_httpstep_by_no($httpTest['httptestid'], $lastData['lastfailedstep']);
             $status['msg'] = _s('Step "%1$s" [%2$s of %3$s] failed: %4$s', $step_data['name'], $lastData['lastfailedstep'], $httpTest['steps'], $lastData['error']);
             $status['style'] = 'disabled';
         } else {
             $status['msg'] = _('OK');
             $status['style'] = 'enabled';
         }
     } else {
         $lastcheck = _('Never');
         $status['msg'] = _('Unknown');
         $status['style'] = 'unknown';
     }
     $cpsan = new CSpan($httpTest['hostname'], $httpTest['host']['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : '');
     $table->addRow(new CRow(array($displayNodes ? get_node_name_by_elid($httpTest['httptestid'], true) : null, $_REQUEST['hostid'] > 0 ? null : $cpsan, new CLink($httpTest['name'], 'httpdetails.php?httptestid=' . $httpTest['httptestid']), $httpTest['steps'], $lastcheck, new CSpan($status['msg'], $status['style']))));
示例#21
0
function make_discovery_status()
{
    $options = array('filter' => array('status' => DHOST_STATUS_ACTIVE), 'selectDHosts' => array('druleid', 'dhostid', 'status'), 'output' => API_OUTPUT_EXTEND);
    $drules = API::DRule()->get($options);
    foreach ($drules as &$drule) {
        $drule['nodename'] = get_node_name_by_elid($drule['druleid']);
    }
    unset($drule);
    // we need natural sort
    $sortFields = array(array('field' => 'nodename', 'order' => ZBX_SORT_UP), array('field' => 'name', 'order' => ZBX_SORT_UP));
    CArrayHelper::sort($drules, $sortFields);
    foreach ($drules as $drnum => $drule) {
        $drules[$drnum]['up'] = 0;
        $drules[$drnum]['down'] = 0;
        foreach ($drule['dhosts'] as $dhost) {
            if (DRULE_STATUS_DISABLED == $dhost['status']) {
                $drules[$drnum]['down']++;
            } else {
                $drules[$drnum]['up']++;
            }
        }
    }
    $header = array(is_show_all_nodes() ? new CCol(_('Node'), 'center') : null, new CCol(_('Discovery rule'), 'center'), new CCol(_x('Up', 'discovery results in dashboard')), new CCol(_x('Down', 'discovery results in dashboard')));
    $table = new CTableInfo();
    $table->setHeader($header, 'header');
    foreach ($drules as $drule) {
        $table->addRow(array($drule['nodename'], new CLink($drule['nodename'] . ($drule['nodename'] ? NAME_DELIMITER : '') . $drule['name'], 'discovery.php?druleid=' . $drule['druleid']), new CSpan($drule['up'], 'green'), new CSpan($drule['down'], $drule['down'] > 0 ? 'red' : 'green')));
    }
    $script = new CJSScript(get_js("jQuery('#hat_dscvry_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')"));
    return new CDiv(array($table, $script));
}
示例#22
0
 private function drawMainPeriod($new_time, $new_pos)
 {
     if (date('H', $new_time) == 0) {
         if (date('Hi', $new_time) == 0) {
             $date_format = S_CCHARTS_TIMELINE_MAINPERIOD_MONTHDAYS_FORMAT;
         } else {
             $date_format = S_CCHARTS_TIMELINE_MAINPERIOD_FULL_DAY_TIME_FORMAT;
         }
         $color = $this->graphtheme['highlightcolor'];
     } else {
         $date_format = S_CCHARTS_TIMELINE_MAINPERIOD_HOURS_FORMAT;
         $color = $this->graphtheme['highlightcolor'];
     }
     $str = zbx_date2str($date_format, $new_time);
     $dims = imageTextSize(8, 90, $str);
     imageText($this->im, 8, 90, $this->shiftXleft + $new_pos + round($dims['width'] / 2), $this->sizeY + $this->shiftY + $dims['height'] + 6, $this->getColor($color, 0), $str);
     dashedline($this->im, $this->shiftXleft + $new_pos, $this->shiftY, $this->shiftXleft + $new_pos, $this->sizeY + $this->shiftY, $this->getColor($this->graphtheme['maingridcolor'], 0));
 }
示例#23
0
function shedule2str($timeperiod)
{
    $timeperiod['hour'] = floor($timeperiod['start_time'] / SEC_PER_HOUR);
    $timeperiod['minute'] = floor(($timeperiod['start_time'] - $timeperiod['hour'] * SEC_PER_HOUR) / SEC_PER_MIN);
    if ($timeperiod['hour'] < 10) {
        $timeperiod['hour'] = '0' . $timeperiod['hour'];
    }
    if ($timeperiod['minute'] < 10) {
        $timeperiod['minute'] = '0' . $timeperiod['minute'];
    }
    if ($timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_ONETIME) {
        $str = zbx_date2str(DATE_TIME_FORMAT, $timeperiod['start_date']);
    } elseif ($timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_DAILY) {
        $str = _n('At %1$s:%2$s on every day', 'At %1$s:%2$s on every %3$s days', $timeperiod['hour'], $timeperiod['minute'], $timeperiod['every']);
    } elseif ($timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_WEEKLY) {
        $days = '';
        $dayofweek = zbx_num2bitstr($timeperiod['dayofweek'], true);
        $length = strlen($dayofweek);
        for ($i = 0; $i < $length; $i++) {
            if ($dayofweek[$i] == 1) {
                if (!zbx_empty($days)) {
                    $days .= ', ';
                }
                $days .= getDayOfWeekCaption($i + 1);
            }
        }
        $str = _n('At %1$s:%2$s on every %3$s of every week', 'At %1$s:%2$s on every %3$s of every %4$s weeks', $timeperiod['hour'], $timeperiod['minute'], $days, $timeperiod['every']);
    } elseif ($timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_MONTHLY) {
        $months = '';
        $month = zbx_num2bitstr($timeperiod['month'], true);
        $length = strlen($month);
        for ($i = 0; $i < $length; $i++) {
            if ($month[$i] == 1) {
                if (!zbx_empty($months)) {
                    $months .= ', ';
                }
                $months .= getMonthCaption($i + 1);
            }
        }
        if ($timeperiod['dayofweek'] > 0) {
            $days = '';
            $dayofweek = zbx_num2bitstr($timeperiod['dayofweek'], true);
            $length = strlen($dayofweek);
            for ($i = 0; $i < $length; $i++) {
                if ($dayofweek[$i] == 1) {
                    if (!zbx_empty($days)) {
                        $days .= ', ';
                    }
                    $days .= getDayOfWeekCaption($i + 1);
                }
            }
            $every = '';
            switch ($timeperiod['every']) {
                case 1:
                    $every = _('First');
                    break;
                case 2:
                    $every = _('Second');
                    break;
                case 3:
                    $every = _('Third');
                    break;
                case 4:
                    $every = _('Fourth');
                    break;
                case 5:
                    $every = _('Last');
                    break;
            }
            $str = _s('At %1$s:%2$s on %3$s %4$s of every %5$s', $timeperiod['hour'], $timeperiod['minute'], $every, $days, $months);
        } else {
            $str = _s('At %1$s:%2$s on day %3$s of every %4$s', $timeperiod['hour'], $timeperiod['minute'], $timeperiod['day'], $months);
        }
    }
    return $str;
}
$userGroupListForm->addItem(array(_('User group') . SPACE, $userGroupComboBox));
$usersWidget->addHeader(_('Users'), $userGroupListForm);
$usersWidget->addHeaderRowNumber();
// create form
$usersForm = new CForm();
$usersForm->setName('userForm');
// create users table
$usersTable = new CTableInfo(_('No users found.'));
$usersTable->setHeader(array(new CCheckBox('all_users', null, "checkAll('" . $usersForm->getName() . "', 'all_users', 'group_userid');"), make_sorting_header(_('Alias'), 'alias', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_x('Name', 'user first name'), 'name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Surname'), 'surname', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('User type'), 'type', $this->data['sort'], $this->data['sortorder']), _('Groups'), _('Is online?'), _('Login'), _('Frontend access'), _('Debug mode'), _('Status')));
foreach ($this->data['users'] as $user) {
    $userId = $user['userid'];
    $session = $this->data['usersSessions'][$userId];
    // online time
    if ($session['lastaccess']) {
        $onlineTime = $user['autologout'] == 0 || ZBX_USER_ONLINE_TIME < $user['autologout'] ? ZBX_USER_ONLINE_TIME : $user['autologout'];
        $online = $session['lastaccess'] + $onlineTime >= time() ? new CCol(_('Yes') . ' (' . zbx_date2str(DATE_TIME_FORMAT_SECONDS, $session['lastaccess']) . ')', 'enabled') : new CCol(_('No') . ' (' . zbx_date2str(DATE_TIME_FORMAT_SECONDS, $session['lastaccess']) . ')', 'disabled');
    } else {
        $online = new CCol(_('No'), 'disabled');
    }
    // blocked
    $blocked = $user['attempt_failed'] >= ZBX_LOGIN_ATTEMPTS ? new CLink(_('Blocked'), 'users.php?action=user.massunblock&group_userid[]=' . $userId, 'on') : new CSpan(_('Ok'), 'green');
    // user groups
    order_result($user['usrgrps'], 'name');
    $usersGroups = array();
    $i = 0;
    foreach ($user['usrgrps'] as $userGroup) {
        $i++;
        if ($i > $this->data['config']['max_in_table']) {
            $usersGroups[] = ' &hellip;';
            break;
        }
示例#25
0
 function format_time($t)
 {
     return zbx_date2str(DATE_TIME_FORMAT, $t);
 }
示例#26
0
function make_latest_issues($params = array())
{
    global $USER_DETAILS;
    $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY);
    $available_triggers = get_accessible_triggers(PERM_READ_ONLY, array());
    $scripts_by_hosts = get_accessible_scripts_by_hosts($available_hosts);
    $config = select_config();
    $sql_select = '';
    $sql_from = '';
    $sql_where = '';
    $limit = 20;
    if (!empty($params)) {
        if (isset($params['limit'])) {
            $limit = $params['limit'];
        }
        if (isset($params['groupid']) && $params['groupid'] > 0) {
            $sql_select .= ',g.name ';
            $sql_from .= ',groups g ';
            $sql_where .= ' AND g.groupid=hg.groupid ' . ' AND hg.groupid=' . $params['groupid'];
        }
        if (isset($params['hostid']) && $params['hostid'] > 0) {
            $sql_where .= ' AND h.hostid=' . $params['hostid'];
        }
    }
    $table = new CTableInfo();
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, isset($params['groupid']) && $params['groupid'] > 0 ? S_GROUP : null, S_HOST, S_ISSUE, S_LAST_CHANGE, 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 ' . $sql_select . ' FROM triggers t,hosts h,items i,functions f,hosts_groups hg ' . $sql_from . ' WHERE f.itemid=i.itemid ' . ' 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 . $sql_where . ' ORDER BY t.lastchange DESC';
    $result = DBselect($sql, $limit);
    while ($row = DBfetch($result)) {
        // Check for dependencies
        if (trigger_dependent($row["triggerid"])) {
            continue;
        }
        $host = null;
        $menus = '';
        $host_nodeid = id2nodeid($row['hostid']);
        foreach ($scripts_by_hosts[$row['hostid']] as $id => $script) {
            $script_nodeid = id2nodeid($script['scriptid']);
            if (bccomp($host_nodeid, $script_nodeid) == 0) {
                $menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $row['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
            }
        }
        $menus .= "[" . zbx_jsvalue(S_LINKS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
        $menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?groupid=0&hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        $menus = rtrim($menus, ',');
        $menus = "show_popup_menu(event,[[" . zbx_jsvalue(S_TOOLS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
        $host = new CSpan($row['host'], 'link');
        $host->setAttribute('onclick', 'javascript: ' . $menus);
        $host->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
        $event_sql = 'SELECT DISTINCT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type, t.url ' . ' FROM events e, triggers t ' . ' WHERE e.object=' . EVENT_SOURCE_TRIGGERS . ' AND e.objectid=' . $row['triggerid'] . ' AND t.triggerid=e.objectid ' . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
        $res_events = DBSelect($event_sql, 1);
        while ($row_event = DBfetch($res_events)) {
            $ack = NULL;
            if ($config['event_ack_enable']) {
                if ($row_event['acknowledged'] == 1) {
                    $ack_info = make_acktab_by_eventid($row_event['eventid']);
                    $ack_info->setAttribute('style', 'width: auto;');
                    $ack = new CLink(S_YES, 'acknow.php?eventid=' . $row_event['eventid'], 'action');
                    $ack->setHint($ack_info);
                } else {
                    $ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_event['eventid'], 'on');
                }
            }
            //			$description = expand_trigger_description($row['triggerid']);
            $description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
            //actions
            $actions = get_event_actions_stat_hints($row_event['eventid']);
            $clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'events.php?triggerid=' . $row['triggerid'] . '&source=0&show_unknown=1&nav_time=' . $row_event['clock'], 'action');
            if ($row_event['url']) {
                $description = new CLink($description, $row_event['url'], 'action', null, true);
            } else {
                $description = new CSpan($description, 'pointer');
            }
            $description = new CCol($description, get_severity_style($row["priority"]));
            $description->setHint(make_popup_eventlist($row_event['eventid'], $row['type']));
            $table->addRow(array(get_node_name_by_elid($row['triggerid']), $host, $description, $clock, zbx_date2age($row_event['clock']), $ack, $actions));
        }
        unset($row, $description, $actions, $alerts, $hint);
    }
    $table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time())));
    return $table;
}
示例#27
0
                    if ($row_event['acknowledged'] == 1) {
                        $acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid=' . $row_event['eventid']));
                        $ack = array(new CSpan(S_YES, 'off'), SPACE . '(' . $acks_cnt['cnt'] . SPACE, new CLink(S_SHOW, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file']), ')');
                    } else {
                        $ack = new CLink(S_NOT_ACKNOWLEDGED, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file'], 'on');
                    }
                } else {
                    $ack = SPACE;
                }
            }
            if ($row_event['acknowledged'] == 0 && $row_event['value'] == TRIGGER_VALUE_TRUE) {
                $ack_cb = new CCheckBox('events[' . $row_event['eventid'] . ']', 'no', NULL, $row_event['eventid']);
            } else {
                $ack_cb = SPACE;
            }
            $clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'tr_events.php?triggerid=' . $trigger['triggerid'] . '&eventid=' . $row_event['eventid']);
            $next_clock = isset($trigger['events'][$enum - 1]) ? $trigger['events'][$enum - 1]['clock'] : time();
            $empty_col = new CCol(SPACE);
            $empty_col->setColSpan(3);
            $ack_cb_col = new CCol($ack_cb);
            $ack_cb_col->setColSpan(2);
            $row = new CRow(array(SPACE, $config['event_ack_enable'] ? $ack_cb_col : null, $status, $clock, zbx_date2age($row_event['clock']), zbx_date2age($next_clock, $row_event['clock']), $config['event_ack_enable'] ? $ack : NULL, is_show_all_nodes() ? SPACE : null, $empty_col), 'odd_row');
            $row->setAttribute('data-parentid', $trigger['triggerid']);
            $row->addStyle('display: none;');
            $table->addRow($row);
            if ($i > $config['event_show_max']) {
                break;
            }
        }
    }
}
示例#28
0
        if ($host['proxy_hostid']) {
            $proxyHostIds[$host['proxy_hostid']] = $host['proxy_hostid'];
        }
    }
    if ($proxyHostIds) {
        $proxies = API::Proxy()->get(['proxyids' => $proxyHostIds, 'output' => ['proxyid', 'host'], 'preservekeys' => true]);
    }
    $table->setHeader([_('Scheduled check'), _('Delayed by'), _('Host'), _('Name')]);
    $i = 0;
    foreach ($queueData as $itemData) {
        if (!isset($items[$itemData['itemid']])) {
            continue;
        }
        // display only the first 500 items
        $i++;
        if ($i > QUEUE_DETAIL_ITEM_COUNT) {
            break;
        }
        $item = $items[$itemData['itemid']];
        $host = reset($item['hosts']);
        $table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $itemData['nextcheck']), zbx_date2age($itemData['nextcheck']), isset($proxies[$hosts[$item['hostid']]['proxy_hostid']]) ? $proxies[$hosts[$item['hostid']]['proxy_hostid']]['host'] . NAME_DELIMITER . $host['name'] : $host['name'], $item['name_expanded']]);
    }
}
// display the table footer
if ($config == QUEUE_OVERVIEW_BY_PROXY) {
    $table->setFooter(new CCol(_('Total') . ': ' . $table->getNumRows()));
} elseif ($config == QUEUE_DETAILS) {
    $table->setFooter(new CCol(_('Total') . ': ' . $table->getNumRows() . (count($queueData) > QUEUE_DETAIL_ITEM_COUNT ? ' (' . _('Truncated') . ')' : '')));
}
$widget->addItem($table)->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
示例#29
0
文件: latest.php 项目: rennhak/zabbix
while ($db_item = DBfetch($db_items)) {
    $description = item_description($db_item);
    if (!empty($_REQUEST['select']) && !zbx_stristr($description, $_REQUEST['select'])) {
        continue;
    }
    $db_host =& $db_hosts[$db_item['hostid']];
    if (!isset($tab_rows[$db_host['hostid']])) {
        $tab_rows[$db_host['hostid']] = array();
    }
    $app_rows =& $tab_rows[$db_host['hostid']];
    $db_host['item_cnt']++;
    if (!uint_in_array(0, $_REQUEST['applications']) && !isset($show_all_apps)) {
        continue;
    }
    if (isset($db_item['lastclock'])) {
        $lastclock = zbx_date2str(S_DATE_FORMAT_YMDHMS, $db_item['lastclock']);
    } else {
        $lastclock = new CCol(' - ');
    }
    $lastvalue = format_lastvalue($db_item);
    if (isset($db_item['lastvalue']) && isset($db_item['prevvalue']) && ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) && $db_item['lastvalue'] - $db_item['prevvalue'] != 0) {
        if ($db_item['lastvalue'] - $db_item['prevvalue'] < 0) {
            $change = convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']);
            $change = nbsp($change);
        } else {
            $change = '+' . convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']);
            $change = nbsp($change);
        }
    } else {
        $change = new CCol(' - ');
    }
示例#30
0
                    $ack = new CLink(S_YES, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $page['file']);
                } else {
                    $ack = new CLink(S_NO, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $page['file'], 'on');
                }
            }
            $description = expand_trigger_description_by_data(zbx_array_merge($trigger, array('clock' => $event['clock'])), ZBX_FLAG_EVENT);
            $tr_desc = new CSpan($description, 'pointer');
            $tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " new Array({'triggerid': '" . $trigger['triggerid'] . "', 'lastchange': '" . $event['clock'] . "'})," . zbx_jsvalue($items, true) . ");");
            // Duration
            $tr_event = $event + $trigger;
            if ($next_event = get_next_event($tr_event, $events, $_REQUEST['hide_unknown'])) {
                $event['duration'] = zbx_date2age($tr_event['clock'], $next_event['clock']);
            } else {
                $event['duration'] = zbx_date2age($tr_event['clock']);
            }
            $table->addRow(array(new CLink(zbx_date2str(S_EVENTS_ACTION_TIME_FORMAT, $event['clock']), 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid'], 'action'), is_show_all_nodes() ? get_node_name_by_elid($event['objectid']) : null, $_REQUEST['hostid'] == 0 ? $host['host'] : null, new CSpan($tr_desc, 'link_menu'), new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value'])), new CCol(get_severity_description($trigger['priority']), get_severity_style($trigger['priority'], $event['value'])), $event['duration'], $config['event_ack_enable'] ? $ack : NULL, $actions));
        }
    }
    $table = array($paging, $table, $paging);
    $jsmenu = new CPUMenu(null, 170);
    $jsmenu->InsertJavaScript();
}
$events_wdgt->addItem($table);
// NAV BAR
$timeline = array('period' => $effectiveperiod, 'starttime' => date('YmdHis', $starttime), 'usertime' => date('YmdHis', $till));
$dom_graph_id = 'scroll_events_id';
$objData = array('id' => 'timeline_1', 'loadSBox' => 0, 'loadImage' => 0, 'loadScroll' => 1, 'dynamic' => 0, 'mainObject' => 1);
zbx_add_post_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
zbx_add_post_js('timeControl.processObjects();');
$events_wdgt->show();
include_once 'include/page_footer.php';