当前位置: 首页>>代码示例>>PHP>>正文


PHP zbx_date2age函数代码示例

本文整理汇总了PHP中zbx_date2age函数的典型用法代码示例。如果您正苦于以下问题:PHP zbx_date2age函数的具体用法?PHP zbx_date2age怎么用?PHP zbx_date2age使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了zbx_date2age函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _

            $table->setHeader(array(_('Next check'), _('Delayed by'), is_show_all_nodes() ? _('Node') : null, _('Host'), _('Name')));
            while ($row = DBfetch($result)) {
                $res = calculateItemNextcheck($row['interfaceid'], $row['itemid'], $row['type'], $row['delay'], $row['delay_flex'], $row['lastclock']);
                if (0 != $row['proxy_hostid'] && 0 != $res['delay']) {
                    $res['nextcheck'] = $row['lastclock'] + $res['delay'];
                }
                $diff = $now - $res['nextcheck'];
                if ($diff <= 5) {
                    continue;
                }
                $arr[] = array($res['nextcheck'], $row['hostid'], $row['hostname'], itemName($row));
            }
            $rows = 0;
            sort($arr);
            foreach ($arr as $r) {
                $rows++;
                if ($rows > 500) {
                    $truncated = true;
                    break;
                }
                $table->addRow(array(zbx_date2str(QUEUE_NODES_DATE_FORMAT, $r[0]), zbx_date2age($r[0]), get_node_name_by_elid($r[1]), $r[2], $r[3]));
            }
        }
    }
}
$queue_wdgt->addItem($table);
$queue_wdgt->Show();
if ($_REQUEST['config'] != 0) {
    show_table_header(_('Total') . ": " . $table->GetNumRows() . ($truncated ? ' (' . _('Truncated') . ')' : ''));
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:queue.php

示例2: CCheckBox

                } 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;
            }
        }
    }
}
//----- GO ------
$footer = null;
if ($config['event_ack_enable']) {
    $goBox = new CComboBox('go');
    $goBox->addItem('bulkacknowledge', S_BULK_ACKNOWLEDGE);
    // goButton name is necessary!!!
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:tr_status.php

示例3: get


//.........这里部分代码省略.........
         $services[$service_name] = 1;
     }
     ksort($services);
     // discovery services to hash
     $dservices = zbx_toHash($dservices, 'dserviceid');
     // discovery hosts
     $dhosts = API::DHost()->get(['druleids' => zbx_objectValues($drules, 'druleid'), 'selectDServices' => ['dserviceid', 'ip', 'dns', 'type', 'status', 'key_'], 'output' => ['dhostid', 'lastdown', 'lastup', 'druleid']]);
     $dhosts = zbx_toHash($dhosts, 'dhostid');
     $header = [make_sorting_header(_('Discovered device'), 'ip', $sort_field, $sort_order, 'zabbix.php?action=discovery.view'), _('Monitored host'), _('Uptime') . '/' . _('Downtime')];
     foreach ($services as $name => $foo) {
         $header[] = (new CColHeader($name))->addClass('vertical_rotation');
     }
     // create table
     $table = (new CTableInfo())->makeVerticalRotation()->setHeader($header);
     foreach ($drules as $drule) {
         $discovery_info = [];
         foreach ($drule['dhosts'] as $dhost) {
             if ($dhost['status'] == DHOST_STATUS_DISABLED) {
                 $hclass = 'disabled';
                 $htime = $dhost['lastdown'];
             } else {
                 $hclass = 'enabled';
                 $htime = $dhost['lastup'];
             }
             // $primary_ip stores the primary host ip of the dhost
             $primary_ip = '';
             foreach ($dhosts[$dhost['dhostid']]['dservices'] as $dservice) {
                 $dservice = $dservices[$dservice['dserviceid']];
                 $hostName = '';
                 $host = reset($dservices[$dservice['dserviceid']]['hosts']);
                 if (!is_null($host)) {
                     $hostName = $host['name'];
                 }
                 if ($primary_ip !== '') {
                     if ($primary_ip === $dservice['ip']) {
                         $htype = 'primary';
                     } else {
                         $htype = 'slave';
                     }
                 } else {
                     $primary_ip = $dservice['ip'];
                     $htype = 'primary';
                 }
                 if (!array_key_exists($dservice['ip'], $discovery_info)) {
                     $discovery_info[$dservice['ip']] = ['ip' => $dservice['ip'], 'dns' => $dservice['dns'], 'type' => $htype, 'class' => $hclass, 'host' => $hostName, 'time' => $htime];
                 }
                 if ($dservice['status'] == DSVC_STATUS_DISABLED) {
                     $class = ZBX_STYLE_INACTIVE_BG;
                     $time = 'lastdown';
                 } else {
                     $class = ZBX_STYLE_ACTIVE_BG;
                     $time = 'lastup';
                 }
                 $key_ = $dservice['key_'];
                 if ($key_ !== '') {
                     if (array_key_exists($key_, $macros)) {
                         $key_ = $macros[$key_]['value'];
                     }
                     $key_ = NAME_DELIMITER . $key_;
                 }
                 $service_name = discovery_check_type2str($dservice['type']) . discovery_port2str($dservice['type'], $dservice['port']) . $key_;
                 $discovery_info[$dservice['ip']]['services'][$service_name] = ['class' => $class, 'time' => $dservice[$time]];
             }
         }
         if ($druleid == 0 && $discovery_info) {
             $col = new CCol([bold($drule['name']), SPACE . '(' . _n('%d device', '%d devices', count($discovery_info)) . ')']);
             $col->setColSpan(count($services) + 3);
             $table->addRow($col);
         }
         order_result($discovery_info, $sort_field, $sort_order);
         foreach ($discovery_info as $ip => $h_data) {
             $dns = $h_data['dns'] == '' ? '' : ' (' . $h_data['dns'] . ')';
             $row = [$h_data['type'] == 'primary' ? (new CSpan($ip . $dns))->addClass($h_data['class']) : new CSpan(SPACE . SPACE . $ip . $dns), new CSpan(array_key_exists('host', $h_data) ? $h_data['host'] : ''), (new CSpan($h_data['time'] == 0 || $h_data['type'] === 'slave' ? '' : convert_units(['value' => time() - $h_data['time'], 'units' => 'uptime'])))->addClass($h_data['class'])];
             foreach ($services as $name => $foo) {
                 $class = null;
                 $time = SPACE;
                 $hint = (new CDiv(SPACE))->addClass($class);
                 $hint_table = null;
                 if (array_key_exists($name, $h_data['services'])) {
                     $class = $h_data['services'][$name]['class'];
                     $time = $h_data['services'][$name]['time'];
                     $hint_table = (new CTableInfo())->setAttribute('style', 'width: auto;');
                     if ($class == ZBX_STYLE_ACTIVE_BG) {
                         $hint_table->setHeader(_('Uptime'));
                     } else {
                         $hint_table->setHeader(_('Downtime'));
                     }
                     $hint_table->addRow((new CCol(zbx_date2age($h_data['services'][$name]['time'])))->addClass($class));
                 }
                 $column = (new CCol($hint))->addClass($class);
                 if (!is_null($hint_table)) {
                     $column->setHint($hint_table);
                 }
                 $row[] = $column;
             }
             $table->addRow($row);
         }
     }
     return $this->getOutput($table, true, $this->data);
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:101,代码来源:CScreenDiscovery.php

示例4: array

        $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);
    }
}
$discoveryWidget->addItem($discoveryTable);
return $discoveryWidget;
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:monitoring.discovery.php

示例5: elseif

            if ($host['status'] == HOST_STATUS_MONITORED) {
                $style = 'off';
            } elseif ($host['status'] == HOST_STATUS_TEMPLATE) {
                $style = 'unknown';
            } else {
                $style = 'on';
            }
            if ($hosts) {
                $hosts[] = ', ';
            }
            $hosts[] = new CLink($host['name'], 'hosts.php?form=update&hostid=' . $host['hostid'], $style);
        }
    }
    $lastAccess = '-';
    if (isset($proxy['lastaccess'])) {
        $lastAccess = $proxy['lastaccess'] == 0 ? '-' : zbx_date2age($proxy['lastaccess']);
    }
    $proxyTable->addRow(array(new CCheckBox('hosts[' . $proxy['proxyid'] . ']', null, null, $proxy['proxyid']), isset($proxy['host']) ? new CLink($proxy['host'], 'proxies.php?form=update&proxyid=' . $proxy['proxyid']) : '', isset($proxy['status']) && $proxy['status'] == HOST_STATUS_PROXY_ACTIVE ? _('Active') : _('Passive'), $lastAccess, isset($proxy['host']) ? count($proxy['hosts']) : '', isset($proxy['item_count']) ? $proxy['item_count'] : 0, isset($proxy['perf']) ? $proxy['perf'] : '-', new CCol(empty($hosts) ? '-' : $hosts, 'wraptext')));
}
// create go buttons
$goComboBox = new CComboBox('action');
$goOption = new CComboItem('proxy.massenable', _('Enable selected'));
$goOption->setAttribute('confirm', _('Enable hosts monitored by selected proxies?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('proxy.massdisable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable hosts monitored by selected proxies?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('proxy.massdelete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected proxies?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:administration.proxy.list.php

示例6: make_popup_eventlist

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;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:23,代码来源:events.inc.php

示例7: get_request

         $form->addVar('config', get_request('config', 0));
         $table = new CTableInfo(S_NO_PROXIES_DEFINED);
         $table->setHeader(array(array(new CCheckBox('all_hosts', NULL, "CheckAll('" . $form->GetName() . "','all_hosts');"), SPACE, make_sorting_link(S_NAME, 'g.name')), S_LASTSEEN_AGE, ' # ', S_MEMBERS));
         $db_proxies = DBselect('SELECT hostid,host,lastaccess ' . ' FROM hosts' . ' WHERE status IN (' . HOST_STATUS_PROXY . ') ' . ' AND ' . DBin_node('hostid') . order_by('host'));
         while ($db_proxy = DBfetch($db_proxies)) {
             $count = 0;
             $hosts = array();
             $sql = 'SELECT DISTINCT host,status ' . ' FROM hosts' . ' WHERE proxy_hostid=' . $db_proxy['hostid'] . ' AND ' . DBcondition('hostid', $available_hosts) . ' AND status in (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' ORDER BY host';
             $db_hosts = DBselect($sql);
             while ($db_host = DBfetch($db_hosts)) {
                 $style = $db_host['status'] == HOST_STATUS_MONITORED ? NULL : ($db_host['status'] == HOST_STATUS_TEMPLATE ? 'unknown' : 'on');
                 array_push($hosts, empty($hosts) ? '' : ', ', new CSpan($db_host['host'], $style));
                 $count++;
             }
             if ($db_proxy['lastaccess'] != 0) {
                 $lastclock = zbx_date2age($db_proxy['lastaccess']);
             } else {
                 $lastclock = '-';
             }
             $table->addRow(array(array(new CCheckBox('hosts[' . $db_proxy['hostid'] . ']', NULL, NULL, $db_proxy['hostid']), SPACE, new CLink($db_proxy['host'], 'hosts.php?form=update&hostid=' . $db_proxy['hostid'] . url_param('config'), 'action')), $lastclock, $count, new CCol(empty($hosts) ? '-' : $hosts, 'wraptext')));
             $row_count++;
         }
         $table->setFooter(new CCol(array(new CButtonQMessage('activate', S_ACTIVATE_SELECTED, S_ACTIVATE_SELECTED_HOSTS_Q), SPACE, new CButtonQMessage('disable', S_DISABLE_SELECTED, S_DISABLE_SELECTED_HOSTS_Q), SPACE, new CButtonQMessage('delete', S_DELETE_SELECTED, S_DELETE_SELECTED_GROUPS_Q))));
         $form->addItem($table);
         $form->show();
     }
 } else {
     if ($_REQUEST['config'] == 6) {
         if (isset($_REQUEST["form"])) {
             $frmMaintenance = new CForm('hosts.php', 'post');
             $frmMaintenance->setName(S_MAINTENANCE);
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:hosts.php

示例8: foreach

        foreach ($trigger['events'] as $enum => $event) {
            $i++;
            $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']);
            $statusSpan = new CCol($eventStatusSpan);
            $statusSpan->setColSpan(2);
            $ack = getEventAckState($event, true);
            $ackCheckBox = $event['acknowledged'] == 0 && $event['value'] == TRIGGER_VALUE_TRUE ? new CCheckBox('events[' . $event['eventid'] . ']', 'no', null, $event['eventid']) : SPACE;
            $clock = new CLink(zbx_date2str(_('d M Y H:i:s'), $event['clock']), 'tr_events.php?triggerid=' . $trigger['triggerid'] . '&eventid=' . $event['eventid']);
            $nextClock = isset($trigger['events'][$enum - 1]) ? $trigger['events'][$enum - 1]['clock'] : time();
            $emptyColumn = new CCol(SPACE);
            $emptyColumn->setColSpan(3);
            $ackCheckBoxColumn = new CCol($ackCheckBox);
            $ackCheckBoxColumn->setColSpan(2);
            $row = new CRow(array(SPACE, $config['event_ack_enable'] ? $ackCheckBoxColumn : null, $statusSpan, $clock, zbx_date2age($event['clock']), zbx_date2age($nextClock, $event['clock']), $config['event_ack_enable'] ? $ack : null, $displayNodes ? SPACE : null, $emptyColumn), 'odd_row');
            $row->setAttribute('data-parentid', $trigger['triggerid']);
            $row->addStyle('display: none;');
            $triggerTable->addRow($row);
            if ($i > $config['event_show_max']) {
                break;
            }
        }
    }
}
/*
 * Go buttons
 */
$footer = null;
if ($config['event_ack_enable']) {
    $goComboBox = new CComboBox('go');
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:tr_status.php

示例9: foreach

 foreach ($proxy_items as $pitems) {
     if (!isset($proxies[$pitems['proxy_hostid']]['item_count'])) {
         $proxies[$pitems['proxy_hostid']]['item_count'] = 0;
     }
     $proxies[$pitems['proxy_hostid']]['item_count'] += $pitems['rowscount'];
 }
 // }}} CALCULATE ITEMS
 foreach ($proxies as $pnum => $proxy) {
     $hosts = array();
     foreach ($proxy['hosts'] as $host) {
         $style = $host['status'] == HOST_STATUS_MONITORED ? 'off' : ($host['status'] == HOST_STATUS_TEMPLATE ? 'unknown' : 'on');
         $hosts[] = new CLink($host['host'], 'hosts.php?form=update&hostid=' . $host['hostid'], $style);
         $hosts[] = ', ';
     }
     array_pop($hosts);
     $table->addRow(array(new CCheckBox('hosts[' . $proxy['proxyid'] . ']', NULL, NULL, $proxy['proxyid']), new CLink($proxy['host'], 'proxies.php?form=update&hostid=' . $proxy['proxyid']), $proxy['status'] == HOST_STATUS_PROXY_ACTIVE ? S_PROXY_ACTIVE : S_PROXY_PASSIVE, $proxy['lastaccess'] == 0 ? '-' : zbx_date2age($proxy['lastaccess']), count($proxy['hosts']), isset($proxy['item_count']) ? $proxy['item_count'] : 0, isset($proxy['perf']) ? $proxy['perf'] : '-', new CCol(empty($hosts) ? '-' : $hosts, 'wraptext')));
 }
 //----- GO ------
 $goBox = new CComboBox('go');
 $goOption = new CComboItem('activate', S_ACTIVATE_SELECTED);
 $goOption->setAttribute('confirm', S_ENABLE_SELECTED_PROXIES);
 $goBox->addItem($goOption);
 $goOption = new CComboItem('disable', S_DISABLE_SELECTED);
 $goOption->setAttribute('confirm', S_DISABLE_SELECTED_PROXIES);
 $goBox->addItem($goOption);
 $goOption = new CComboItem('delete', S_DELETE_SELECTED);
 $goOption->setAttribute('confirm', S_DELETE_SELECTED_PROXIES);
 $goBox->addItem($goOption);
 // goButton name is necessary!!!
 $goButton = new CButton('goButton', S_GO . ' (0)');
 $goButton->setAttribute('id', 'goButton');
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:proxies.php

示例10: CTableInfo

 // }}} MAINTENANCE FORM
 // MAINTENANCE PERIODS {{{
 $tblPeriod = new CTableInfo();
 if (isset($_REQUEST['maintenanceid']) && !isset($_REQUEST['form_refresh'])) {
     $timeperiods = array();
     $sql = 'SELECT DISTINCT mw.maintenanceid, tp.* ' . ' FROM timeperiods tp, maintenances_windows mw ' . ' WHERE mw.maintenanceid=' . $_REQUEST['maintenanceid'] . ' AND tp.timeperiodid=mw.timeperiodid ' . ' ORDER BY tp.timeperiod_type ASC';
     $db_timeperiods = DBselect($sql);
     while ($timeperiod = DBfetch($db_timeperiods)) {
         $timeperiods[] = $timeperiod;
     }
 } else {
     $timeperiods = get_request('timeperiods', array());
 }
 $tblPeriod->setHeader(array(new CCheckBox('all_periods', null, 'checkAll("' . S_PERIOD . '","all_periods","g_timeperiodid");'), S_PERIOD_TYPE, S_SCHEDULE, S_PERIOD, S_ACTION));
 foreach ($timeperiods as $id => $timeperiod) {
     $tblPeriod->addRow(array(new CCheckBox('g_timeperiodid[]', 'no', null, $id), timeperiod_type2str($timeperiod['timeperiod_type']), new CCol(shedule2str($timeperiod), 'wraptext'), zbx_date2age(0, $timeperiod['period']), new CButton('edit_timeperiodid[' . $id . ']', S_EDIT)));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][timeperiod_type]', $timeperiod['timeperiod_type']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][every]', $timeperiod['every']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][month]', $timeperiod['month']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][dayofweek]', $timeperiod['dayofweek']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][day]', $timeperiod['day']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][start_time]', $timeperiod['start_time']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][start_date]', $timeperiod['start_date']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][period]', $timeperiod['period']));
 }
 $footer = array();
 if (!isset($_REQUEST['new_timeperiod'])) {
     $footer[] = new CButton('new_timeperiod', S_NEW);
 }
 if ($tblPeriod->ItemsCount() > 0) {
     $footer[] = new CButton('del_timeperiod', S_DELETE_SELECTED);
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:maintenance.php

示例11: array

    $hostCount = $this->data['groupCounts'][$group['groupid']]['hosts'];
    $templateCount = $this->data['groupCounts'][$group['groupid']]['templates'];
    // name
    $name = array();
    if ($group['discoveryRule']) {
        $name[] = new CLink($group['discoveryRule']['name'], 'host_prototypes.php?parent_discoveryid=' . $group['discoveryRule']['itemid'], 'parent-discovery');
        $name[] = NAME_DELIMITER;
    }
    $name[] = new CLink($group['name'], 'hostgroups.php?form=update&groupid=' . $group['groupid']);
    // status
    if ($showStatus) {
        $status = array();
        // discovered item lifetime indicator
        if ($group['flags'] == ZBX_FLAG_DISCOVERY_CREATED && $group['groupDiscovery']['ts_delete']) {
            $deleteError = new CDiv(SPACE, 'status_icon iconwarning');
            $deleteError->setHint(_s('The host group is not discovered anymore and will be deleted in %1$s (on %2$s at %3$s).', zbx_date2age($group['groupDiscovery']['ts_delete']), zbx_date2str(_('d M Y'), $group['groupDiscovery']['ts_delete']), zbx_date2str(_('H:i:s'), $group['groupDiscovery']['ts_delete'])));
            $status[] = $deleteError;
        }
    }
    $hostGroupTable->addRow(array(new CCheckBox('groups[' . $group['groupid'] . ']', null, null, $group['groupid']), $this->data['displayNodes'] ? $group['nodename'] : null, $name, array(array(new CLink(_('Templates'), 'templates.php?groupid=' . $group['groupid'], 'unknown'), ' (' . $templateCount . ')'), BR(), array(new CLink(_('Hosts'), 'hosts.php?groupid=' . $group['groupid']), ' (' . $hostCount . ')')), new CCol(empty($hostsOutput) ? '-' : $hostsOutput, 'wraptext'), $showStatus ? $status : null));
}
// create go button
$goComboBox = new CComboBox('go');
$goOption = new CComboItem('activate', _('Enable selected'));
$goOption->setAttribute('confirm', _('Enable selected hosts?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('disable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable hosts in the selected host groups?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected host groups?'));
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:configuration.hostgroups.list.php

示例12: CCol

 $status = new CCol(new CLink(itemIndicator($item['status'], $item['state']), '?group_itemid=' . $item['itemid'] . '&hostid=' . $item['hostid'] . '&go=' . ($item['status'] ? 'activate' : 'disable'), itemIndicatorStyle($item['status'], $item['state'])));
 if ($data['showErrorColumn']) {
     $statusIcons = array();
     if ($item['status'] == ITEM_STATUS_ACTIVE) {
         if (zbx_empty($item['error'])) {
             $error = new CDiv(SPACE, 'status_icon iconok');
         } else {
             $error = new CDiv(SPACE, 'status_icon iconerror');
             $error->setHint($item['error'], '', 'on');
         }
         $statusIcons[] = $error;
     }
     // discovered item lifetime indicator
     if ($item['flags'] == ZBX_FLAG_DISCOVERY_CREATED && $item['itemDiscovery']['ts_delete']) {
         $deleteError = new CDiv(SPACE, 'status_icon iconwarning');
         $deleteError->setHint(_s('The item is not discovered anymore and will be deleted in %1$s (on %2$s at %3$s).', zbx_date2age($item['itemDiscovery']['ts_delete']), zbx_date2str(_('d M Y'), $item['itemDiscovery']['ts_delete']), zbx_date2str(_('H:i:s'), $item['itemDiscovery']['ts_delete'])));
         $statusIcons[] = $deleteError;
     }
 }
 $triggerHintTable = new CTableInfo();
 $triggerHintTable->setHeader(array(_('Severity'), _('Name'), _('Expression'), _('Status')));
 // triggers info
 foreach ($item['triggers'] as $num => &$trigger) {
     $trigger = $this->data['itemTriggers'][$trigger['triggerid']];
     $triggerDescription = array();
     if ($trigger['templateid'] > 0) {
         if (!isset($this->data['triggerRealHosts'][$trigger['triggerid']])) {
             $triggerDescription[] = new CSpan('HOST', 'unknown');
             $triggerDescription[] = ':';
         } else {
             $realHost = reset($this->data['triggerRealHosts'][$trigger['triggerid']]);
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:configuration.item.list.php

示例13: CSpan

    $in_encryption = '';
    $out_encryption = '';
    if ($proxy['status'] == HOST_STATUS_PROXY_PASSIVE) {
        // input encryption
        if ($proxy['tls_connect'] == HOST_ENCRYPTION_NONE) {
            $in_encryption = (new CSpan(_('None')))->addClass(ZBX_STYLE_STATUS_GREEN);
        } elseif ($proxy['tls_connect'] == HOST_ENCRYPTION_PSK) {
            $in_encryption = (new CSpan(_('PSK')))->addClass(ZBX_STYLE_STATUS_GREEN);
        } else {
            $in_encryption = (new CSpan(_('CERT')))->addClass(ZBX_STYLE_STATUS_GREEN);
        }
    } else {
        // output encryption
        $out_encryption_array = [];
        if (($proxy['tls_accept'] & HOST_ENCRYPTION_NONE) == HOST_ENCRYPTION_NONE) {
            $out_encryption_array[] = (new CSpan(_('None')))->addClass(ZBX_STYLE_STATUS_GREEN);
        }
        if (($proxy['tls_accept'] & HOST_ENCRYPTION_PSK) == HOST_ENCRYPTION_PSK) {
            $out_encryption_array[] = (new CSpan(_('PSK')))->addClass(ZBX_STYLE_STATUS_GREEN);
        }
        if (($proxy['tls_accept'] & HOST_ENCRYPTION_CERTIFICATE) == HOST_ENCRYPTION_CERTIFICATE) {
            $out_encryption_array[] = (new CSpan(_('CERT')))->addClass(ZBX_STYLE_STATUS_GREEN);
        }
        $out_encryption = (new CDiv($out_encryption_array))->addClass(ZBX_STYLE_STATUS_CONTAINER);
    }
    $proxyTable->addRow([new CCheckBox('proxyids[' . $proxy['proxyid'] . ']', $proxy['proxyid']), (new CCol($name))->addClass(ZBX_STYLE_NOWRAP), $proxy['status'] == HOST_STATUS_PROXY_ACTIVE ? _('Active') : _('Passive'), $proxy['status'] == HOST_STATUS_PROXY_ACTIVE ? $out_encryption : $in_encryption, $proxy['lastaccess'] == 0 ? (new CSpan(_('Never')))->addClass(ZBX_STYLE_RED) : zbx_date2age($proxy['lastaccess']), count($proxy['hosts']), array_key_exists('item_count', $proxy) ? $proxy['item_count'] : 0, array_key_exists('perf', $proxy) ? $proxy['perf'] : '', $hosts ? $hosts : '']);
}
// append table to form
$proxyForm->addItem([$proxyTable, $data['paging'], new CActionButtonList('action', 'proxyids', ['proxy.hostenable' => ['name' => _('Enable hosts'), 'confirm' => _('Enable hosts monitored by selected proxies?')], 'proxy.hostdisable' => ['name' => _('Disable hosts'), 'confirm' => _('Disable hosts monitored by selected proxies?')], 'proxy.delete' => ['name' => _('Delete'), 'confirm' => _('Delete selected proxies?')]])]);
// append form to widget
$widget->addItem($proxyForm)->show();
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:administration.proxy.list.php

示例14: make_latest_issues


//.........这里部分代码省略.........
        }
        $triggers_hosts = array_merge($triggers_hosts, $trigger['hosts']);
    }
    $triggers_hosts = zbx_toHash($triggers_hosts, 'hostid');
    $triggers_hostids = array_keys($triggers_hosts);
    // }}} GATHER HOSTS FOR SELECTED TRIGGERS
    $scripts_by_hosts = CScript::getScriptsByHosts($triggers_hostids);
    $table = new CTableInfo();
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST, S_ISSUE, S_LAST_CHANGE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
    $thosts_cache = array();
    foreach ($triggers as $tnum => $trigger) {
        // Check for dependencies
        $group = reset($trigger['groups']);
        $host = reset($trigger['hosts']);
        $trigger['hostid'] = $host['hostid'];
        $trigger['host'] = $host['host'];
        $host = null;
        $menus = '';
        $host_nodeid = id2nodeid($trigger['hostid']);
        foreach ($scripts_by_hosts[$trigger['hostid']] as $id => $script) {
            $script_nodeid = id2nodeid($script['scriptid']);
            if (bccomp($host_nodeid, $script_nodeid) == 0) {
                $menus .= "[" . zbx_jsvalue($script['name']) . ",\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $trigger['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']}],";
            }
        }
        if (!empty($scripts_by_hosts)) {
            $menus = "['" . S_TOOLS . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus;
        }
        if (isset($thosts_cache[$trigger['hostid']])) {
            $hprofile = $thosts_cache[$trigger['hostid']];
        } else {
            $hprofile = CHost::get(array('hostids' => $trigger['hostid'], 'output' => API_OUTPUT_SHORTEN, 'select_profile' => API_OUTPUT_EXTEND));
            $hprofile = reset($hprofile);
            $thosts_cache[$hprofile['hostid']] = $hprofile;
        }
        $menus .= "['" . S_LINKS . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
        $menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?groupid=" . $group['groupid'] . '&hostid=' . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        if (!empty($hprofile['profile'])) {
            $menus .= "['" . S_PROFILE . "',\"javascript: redirect('hostprofiles.php?hostid=" . $trigger['hostid'] . "&prof_type=0')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        }
        if (!empty($hprofile['profile_ext'])) {
            $menus .= "['" . S_EXTENDED_PROFILE . "',\"javascript: redirect('hostprofiles.php?hostid=" . $trigger['hostid'] . "&prof_type=1')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        }
        $menus = rtrim($menus, ',');
        $menus = 'show_popup_menu(event,[' . $menus . '],180);';
        $host = new CSpan($trigger['host'], 'link_menu pointer');
        $host->setAttribute('onclick', 'javascript: ' . $menus);
        //$host = new CSpan($trigger['host'],'link_menu pointer');
        //$host->setAttribute('onclick','javascript: '.$menus);
        // Maintenance {{{
        $trigger_host = $triggers_hosts[$trigger['hostid']];
        $text = null;
        $style = 'link_menu';
        if ($trigger_host['maintenance_status']) {
            $style .= ' orange';
            $options = array('maintenanceids' => $trigger_host['maintenanceid'], 'output' => API_OUTPUT_EXTEND);
            $maintenances = CMaintenance::get($options);
            $maintenance = reset($maintenances);
            $text = $maintenance['name'];
            $text .= ' [' . ($trigger_host['maintenance_type'] ? S_NO_DATA_MAINTENANCE : S_NORMAL_MAINTENANCE) . ']';
        }
        $host = new CSpan($trigger['host'], $style . ' pointer');
        $host->setAttribute('onclick', 'javascript: ' . $menus);
        if (!is_null($text)) {
            $host->setHint($text, '', '', false);
        }
        // }}} Maintenance
        $event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged' . ' FROM events e' . ' WHERE e.object=' . EVENT_OBJECT_TRIGGER . ' AND e.objectid=' . $trigger['triggerid'] . ' 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'] . '&backurl=' . $page['file'], 'off');
                    $ack->setHint($ack_info, '', '', false);
                } else {
                    $ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file'], 'on');
                }
            }
            //			$description = expand_trigger_description($row['triggerid']);
            $description = expand_trigger_description_by_data(zbx_array_merge($trigger, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
            //actions
            $actions = get_event_actions_stat_hints($row_event['eventid']);
            $clock = new CLink(zbx_date2str(S_BLOCKS_LATEST_ISSUES_DATE_FORMAT, $row_event['clock']), 'events.php?triggerid=' . $trigger['triggerid'] . '&source=0&show_unknown=1&nav_time=' . $row_event['clock']);
            if ($trigger['url']) {
                $description = new CLink($description, $trigger['url'], null, null, true);
            } else {
                $description = new CSpan($description, 'pointer');
            }
            $description = new CCol($description, get_severity_style($trigger['priority']));
            $description->setHint(make_popup_eventlist($row_event['eventid'], $trigger['type'], $trigger['triggerid']), '', '', false);
            $table->addRow(array(get_node_name_by_elid($trigger['triggerid']), $host, $description, $clock, zbx_date2age($row_event['clock']), $ack, $actions));
        }
        unset($trigger, $description, $actions);
    }
    $table->setFooter(new CCol(S_UPDATED . ': ' . zbx_date2str(S_BLOCKS_LATEST_ISSUES_TIME_FORMAT)));
    return $table;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:blocks.inc.php

示例15: array

 // info
 if ($data['showInfoColumn']) {
     $infoIcons = array();
     if ($item['status'] == ITEM_STATUS_ACTIVE && !zbx_empty($item['error'])) {
         $info = new CDiv(SPACE, 'status_icon iconerror');
         $info->setHint($item['error'], 'on');
         $infoIcons[] = $info;
     }
     // discovered item lifetime indicator
     if ($item['flags'] == ZBX_FLAG_DISCOVERY_CREATED && $item['itemDiscovery']['ts_delete']) {
         $deleteError = new CDiv(SPACE, 'status_icon iconwarning');
         // Check if item should've been deleted in the past.
         if ($currentTime > $item['itemDiscovery']['ts_delete']) {
             $deleteError->setHint(_s('The item is not discovered anymore and will be deleted the next time discovery rule is processed.'));
         } else {
             $deleteError->setHint(_s('The item is not discovered anymore and will be deleted in %1$s (on %2$s at %3$s).', zbx_date2age($item['itemDiscovery']['ts_delete']), zbx_date2str(DATE_FORMAT, $item['itemDiscovery']['ts_delete']), zbx_date2str(TIME_FORMAT, $item['itemDiscovery']['ts_delete'])));
         }
         $infoIcons[] = $deleteError;
     }
     if (!$infoIcons) {
         $infoIcons[] = '';
     }
 } else {
     $infoIcons = null;
 }
 // triggers info
 $triggerHintTable = new CTableInfo();
 $triggerHintTable->setHeader(array(_('Severity'), _('Name'), _('Expression'), _('Status')));
 foreach ($item['triggers'] as $num => &$trigger) {
     $trigger = $this->data['itemTriggers'][$trigger['triggerid']];
     $triggerDescription = array();
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:configuration.item.list.php


注:本文中的zbx_date2age函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。