本文整理汇总了PHP中zbx_date2str函数的典型用法代码示例。如果您正苦于以下问题:PHP zbx_date2str函数的具体用法?PHP zbx_date2str怎么用?PHP zbx_date2str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zbx_date2str函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get
/**
* 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]));
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:32,代码来源:CScreenTriggersOverview.php
示例2: local_generateHeader
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();
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:29,代码来源:layout.htmlpage.php
示例3: getCanvas
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;
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:7,代码来源:CCanvas.php
示例4: makeAckTab
/**
* 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;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:20,代码来源:acknow.inc.php
示例5: getCanvas
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;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:8,代码来源:CCanvas.php
示例6: get
/**
* 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')));
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:14,代码来源:CScreenSystemStatus.php
示例7: get
/**
* 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);
}
开发者ID:itnihao,项目名称:Zabbix_,代码行数:15,代码来源:CScreenSystemStatus.php
示例8: get
/**
* 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']));
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:60,代码来源:CScreenPlainText.php
示例9: makeAckTab
/**
* 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;
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:22,代码来源:acknow.inc.php
示例10: createDOMDocument
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;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:11,代码来源:CXmlImport18.php
示例11: get
/**
* 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);
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:59,代码来源:CScreenPlainText.php
示例12: makeAckTab
/**
* 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;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:22,代码来源:acknow.inc.php
示例13: get
/**
* 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]));
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:16,代码来源:CScreenTriggersInfo.php
示例14: make_acktab_by_eventid
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;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:12,代码来源:acknow.inc.php
示例15: bodyToString
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();
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:16,代码来源:class.cserverinfo.php
示例16: get
/**
* 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);
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:21,代码来源:CScreenEvents.php
示例17: get
/**
* 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]));
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:51,代码来源:CScreenHostsInfo.php
示例18: get
/**
* 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]));
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:24,代码来源:CScreenDataOverview.php
示例19: get
/**
* 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')));
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:27,代码来源:CScreenServerInfo.php
示例20: zbx_objectValues
$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']))));
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:httpmon.php
注:本文中的zbx_date2str函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论