本文整理汇总了PHP中zbx_objectValues函数 的典型用法代码示例。如果您正苦于以下问题:PHP zbx_objectValues函数的具体用法?PHP zbx_objectValues怎么用?PHP zbx_objectValues使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zbx_objectValues函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* Validates the given condition formula and checks if the given conditions match the formula.
*
* @param array $object
*
* @return bool
*/
public function validate($object)
{
// validate only custom expressions
if ($object['evaltype'] != CONDITION_EVAL_TYPE_EXPRESSION) {
return true;
}
// check if the formula is valid
$parser = new CConditionFormula();
if (!$parser->parse($object['formula'])) {
$this->error($this->messageInvalidFormula, $object['formula'], $parser->error);
return false;
}
// check that all conditions used in the formula are defined in the "conditions" array
$conditions = zbx_toHash($object['conditions'], 'formulaid');
$constants = array_unique(zbx_objectValues($parser->constants, 'value'));
foreach ($constants as $constant) {
if (!array_key_exists($constant, $conditions)) {
$this->error($this->messageMissingCondition, $constant, $object['formula']);
return false;
}
unset($conditions[$constant]);
}
// check that the "conditions" array has no unused conditions
if ($conditions) {
$condition = reset($conditions);
$this->error($this->messageUnusedCondition, $condition['formulaid'], $object['formula']);
return false;
}
return true;
}
开发者ID:omidmt, 项目名称:zabbix-greenplum, 代码行数:37, 代码来源:CConditionValidator.php
示例2: doAction
protected function doAction()
{
$mediatype = [];
$this->getInputs($mediatype, ['mediatypeid', 'type', 'description']);
$mediatype['status'] = $this->getInput('status', MEDIA_TYPE_STATUS_DISABLED);
switch ($mediatype['type']) {
case MEDIA_TYPE_EMAIL:
$this->getInputs($mediatype, ['smtp_server', 'smtp_port', 'smtp_helo', 'smtp_email', 'smtp_security', 'smtp_authentication', 'passwd']);
if ($this->hasInput('smtp_username')) {
$mediatype['username'] = $this->getInput('smtp_username');
}
$mediatype['smtp_verify_peer'] = $this->getInput('smtp_verify_peer', 0);
$mediatype['smtp_verify_host'] = $this->getInput('smtp_verify_host', 0);
break;
case MEDIA_TYPE_EXEC:
$this->getInputs($mediatype, ['exec_path']);
$mediatype['exec_params'] = '';
if ($this->hasInput('exec_params')) {
$exec_params = zbx_objectValues($this->getInput('exec_params'), 'exec_param');
foreach ($exec_params as $exec_param) {
$mediatype['exec_params'] .= $exec_param . "\n";
}
}
break;
case MEDIA_TYPE_SMS:
$this->getInputs($mediatype, ['gsm_modem']);
break;
case MEDIA_TYPE_JABBER:
$this->getInputs($mediatype, ['passwd']);
if ($this->hasInput('jabber_username')) {
$mediatype['username'] = $this->getInput('jabber_username');
}
break;
case MEDIA_TYPE_EZ_TEXTING:
$this->getInputs($mediatype, ['passwd']);
if ($this->hasInput('eztext_username')) {
$mediatype['username'] = $this->getInput('eztext_username');
}
if ($this->hasInput('eztext_limit')) {
$mediatype['exec_path'] = $this->getInput('eztext_limit');
}
break;
}
DBstart();
$result = API::Mediatype()->update($mediatype);
if ($result) {
add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_MEDIA_TYPE, 'Media type [' . $mediatype['description'] . ']');
}
$result = DBend($result);
if ($result) {
$response = new CControllerResponseRedirect('zabbix.php?action=mediatype.list&uncheck=1');
$response->setMessageOk(_('Media type updated'));
} else {
$response = new CControllerResponseRedirect('zabbix.php?action=mediatype.edit');
$response->setFormData($this->getInputAll());
$response->setMessageError(_('Cannot update media type'));
}
$this->setResponse($response);
}
开发者ID:jbfavre, 项目名称:debian-zabbix, 代码行数:59, 代码来源:CControllerMediatypeUpdate.php
示例3: doAction
protected function doAction()
{
// default values
$data = ['sid' => $this->getUserSID(), 'proxyid' => 0, 'host' => '', 'status' => HOST_STATUS_PROXY_ACTIVE, 'dns' => 'localhost', 'ip' => '127.0.0.1', 'useip' => '1', 'port' => '10051', 'proxy_hostids' => [], 'description' => '', 'tls_accept' => HOST_ENCRYPTION_NONE, 'tls_connect' => HOST_ENCRYPTION_NONE, 'tls_issuer' => '', 'tls_psk' => '', 'tls_psk_identity' => '', 'tls_subject' => '', 'form_refresh' => 0];
// get values from the dabatase
if ($this->hasInput('proxyid')) {
$data['proxyid'] = $this->getInput('proxyid');
$proxies = API::Proxy()->get(['output' => ['host', 'status', 'description', 'tls_connect', 'tls_accept', 'tls_issuer', 'tls_subject', 'tls_psk_identity', 'tls_psk'], 'selectHosts' => ['hostid'], 'selectInterface' => ['interfaceid', 'dns', 'ip', 'useip', 'port'], 'proxyids' => $data['proxyid']]);
$proxy = $proxies[0];
$data['host'] = $proxy['host'];
$data['status'] = $proxy['status'];
$data['tls_accept'] = $proxy['tls_accept'];
$data['tls_connect'] = $proxy['tls_connect'];
$data['tls_issuer'] = $proxy['tls_issuer'];
$data['tls_psk'] = $proxy['tls_psk'];
$data['tls_psk_identity'] = $proxy['tls_psk_identity'];
$data['tls_subject'] = $proxy['tls_subject'];
if ($data['status'] == HOST_STATUS_PROXY_PASSIVE) {
$data['interfaceid'] = $proxy['interface']['interfaceid'];
$data['dns'] = $proxy['interface']['dns'];
$data['ip'] = $proxy['interface']['ip'];
$data['useip'] = $proxy['interface']['useip'];
$data['port'] = $proxy['interface']['port'];
}
$data['proxy_hostids'] = zbx_objectValues($proxy['hosts'], 'hostid');
$data['description'] = $proxy['description'];
}
// overwrite with input variables
$data['host'] = $this->getInput('host', $data['host']);
$data['status'] = $this->getInput('status', $data['status']);
$data['dns'] = $this->getInput('dns', $data['dns']);
$data['ip'] = $this->getInput('ip', $data['ip']);
$data['useip'] = $this->getInput('useip', $data['useip']);
$data['port'] = $this->getInput('port', $data['port']);
$data['proxy_hostids'] = $this->getInput('proxy_hostids', $data['proxy_hostids']);
$data['description'] = $this->getInput('description', $data['description']);
$data['tls_accept'] = $this->getInput('tls_accept', $data['tls_accept']);
$data['tls_connect'] = $this->getInput('tls_connect', $data['tls_connect']);
$data['tls_issuer'] = $this->getInput('tls_issuer', $data['tls_issuer']);
$data['tls_psk'] = $this->getInput('tls_psk', $data['tls_psk']);
$data['tls_psk_identity'] = $this->getInput('tls_psk_identity', $data['tls_psk_identity']);
$data['tls_subject'] = $this->getInput('tls_subject', $data['tls_subject']);
$data['form_refresh'] = $this->getInput('form_refresh', $data['form_refresh']);
if ($data['status'] == HOST_STATUS_PROXY_PASSIVE && $this->hasInput('interfaceid')) {
$data['interfaceid'] = $this->getInput('interfaceid');
}
// fetch available hosts, skip host prototypes
$data['all_hosts'] = DBfetchArray(DBselect('SELECT h.hostid,h.proxy_hostid,h.name,h.flags' . ' FROM hosts h' . ' WHERE h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND h.flags<>' . ZBX_FLAG_DISCOVERY_PROTOTYPE));
order_result($data['all_hosts'], 'name');
$response = new CControllerResponseData($data);
$response->setTitle(_('Configuration of proxies'));
$this->setResponse($response);
}
开发者ID:jbfavre, 项目名称:debian-zabbix, 代码行数:53, 代码来源:CControllerProxyEdit.php
示例4: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
// fetch hosts
$hosts = API::Host()->get(array('output' => array('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 = array('output' => array('description', 'expression', 'priority', 'url', 'value', 'triggerid', 'lastchange', 'flags'), 'selectHosts' => array('hostid', 'name', 'status'), 'hostids' => $hostIds, 'monitored' => true, 'skipDependent' => true, 'sortfield' => 'description');
// application filter
if ($this->screenitem['application'] !== '') {
$applications = API::Application()->get(array('output' => array('applicationid'), 'hostids' => $hostIds, 'search' => array('name' => $this->screenitem['application'])));
$options['applicationids'] = zbx_objectValues($applications, 'applicationid');
}
$triggers = API::Trigger()->get($options);
return $this->getOutput(getTriggersOverview($hosts, $triggers, $this->pageFile, $this->screenitem['style'], $this->screenid));
}
开发者ID:TonywalkerCN, 项目名称:Zabbix, 代码行数:19, 代码来源:CScreenTriggersOverview.php
示例5: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$hostids = array();
$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(array('output' => array('applicationid'), 'hostids' => $hostids, 'search' => array('name' => $this->screenitem['application'])));
$applicationIds = zbx_objectValues($applications, 'applicationid');
}
return $this->getOutput(getItemsDataOverview($hostids, $applicationIds, $this->screenitem['style']));
}
开发者ID:omidmt, 项目名称:zabbix-greenplum, 代码行数:20, 代码来源:CScreenDataOverview.php
示例6: doAction
protected function doAction()
{
$filter = ['groupids' => null, 'maintenance' => null, 'severity' => null, 'trigger_name' => '', 'extAck' => 0];
if (CProfile::get('web.dashconf.filter.enable', 0) == 1) {
// groups
if (CProfile::get('web.dashconf.groups.grpswitch', 0) == 0) {
// null mean all groups
$filter['groupids'] = null;
} else {
$filter['groupids'] = zbx_objectValues(CFavorite::get('web.dashconf.groups.groupids'), 'value');
$hideHostGroupIds = zbx_objectValues(CFavorite::get('web.dashconf.groups.hide.groupids'), 'value');
if ($hideHostGroupIds) {
// get all groups if no selected groups defined
if (!$filter['groupids']) {
$dbHostGroups = API::HostGroup()->get(['output' => ['groupid']]);
$filter['groupids'] = zbx_objectValues($dbHostGroups, 'groupid');
}
$filter['groupids'] = array_diff($filter['groupids'], $hideHostGroupIds);
// get available hosts
$dbAvailableHosts = API::Host()->get(['groupids' => $filter['groupids'], 'output' => ['hostid']]);
$availableHostIds = zbx_objectValues($dbAvailableHosts, 'hostid');
$dbDisabledHosts = API::Host()->get(['groupids' => $hideHostGroupIds, 'output' => ['hostid']]);
$disabledHostIds = zbx_objectValues($dbDisabledHosts, 'hostid');
$filter['hostids'] = array_diff($availableHostIds, $disabledHostIds);
} else {
if (!$filter['groupids']) {
// null mean all groups
$filter['groupids'] = null;
}
}
}
// hosts
$maintenance = CProfile::get('web.dashconf.hosts.maintenance', 1);
$filter['maintenance'] = $maintenance == 0 ? 0 : null;
// triggers
$severity = CProfile::get('web.dashconf.triggers.severity', null);
$filter['severity'] = zbx_empty($severity) ? null : explode(';', $severity);
$filter['severity'] = zbx_toHash($filter['severity']);
$filter['trigger_name'] = CProfile::get('web.dashconf.triggers.name', '');
$config = select_config();
$filter['extAck'] = $config['event_ack_enable'] ? CProfile::get('web.dashconf.events.extAck', 0) : 0;
}
$this->setResponse(new CControllerResponseData(['filter' => $filter, 'user' => ['debug_mode' => $this->getDebugMode()]]));
}
开发者ID:jbfavre, 项目名称:debian-zabbix, 代码行数:44, 代码来源:CControllerWidgetSystemView.php
示例7: validate
/**
* Validates the given condition formula and checks if the given conditions match the formula.
*
* @param array $object
*
* @return bool
*/
public function validate($object)
{
if ($object['evaltype'] == CONDITION_EVAL_TYPE_AND) {
// get triggers count in formula
$trigger_count = 0;
foreach ($object['conditions'] as $condition) {
if (array_key_exists('conditiontype', $condition) && array_key_exists('operator', $condition) && $condition['conditiontype'] == CONDITION_TYPE_TRIGGER && $condition['operator'] == CONDITION_OPERATOR_EQUAL) {
$trigger_count++;
}
}
// check if multiple triggers are compared with AND
if ($trigger_count > 1) {
$this->error($this->messageAndWithSeveralTriggers);
return false;
}
}
// validate only custom expressions
if ($object['evaltype'] != CONDITION_EVAL_TYPE_EXPRESSION) {
return true;
}
// check if the formula is valid
$parser = new CConditionFormula();
if (!$parser->parse($object['formula'])) {
$this->error($this->messageInvalidFormula, $object['formula'], $parser->error);
return false;
}
// check that all conditions used in the formula are defined in the "conditions" array
$conditions = zbx_toHash($object['conditions'], 'formulaid');
$constants = array_unique(zbx_objectValues($parser->constants, 'value'));
foreach ($constants as $constant) {
if (!array_key_exists($constant, $conditions)) {
$this->error($this->messageMissingCondition, $constant, $object['formula']);
return false;
}
unset($conditions[$constant]);
}
// check that the "conditions" array has no unused conditions
if ($conditions) {
$condition = reset($conditions);
$this->error($this->messageUnusedCondition, $condition['formulaid'], $object['formula']);
return false;
}
return true;
}
开发者ID:jbfavre, 项目名称:debian-zabbix, 代码行数:51, 代码来源:CConditionValidator.php
示例8: 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
示例9: get
/**
* Get screen item data.
*
* @param array $options
* @param array $options['hostid'] Use hostid to get real resource id
* @param array $options['screenitemids'] Search by screen item IDs
* @param array $options['screenids'] Search by screen IDs
* @param array $options['filter'] Result filter
* @param array $options['limit'] The size of the result set
*
* @return array
*/
public function get(array $options = [])
{
$options = zbx_array_merge($this->getOptions, $options);
// build and execute query
$sql = $this->createSelectQuery($this->tableName(), $options);
$res = DBselect($sql, $options['limit']);
// fetch results
$result = [];
while ($row = DBfetch($res)) {
// count query, return a single result
if ($options['countOutput'] !== null) {
$result = $row['rowscount'];
} else {
if ($options['preservekeys'] !== null) {
$result[$row['screenitemid']] = $row;
} else {
$result[] = $row;
}
}
}
// fill result with real resourceid
if ($options['hostids'] && $result) {
if (empty($options['screenitemid'])) {
$options['screenitemid'] = zbx_objectValues($result, 'screenitemid');
}
$dbTemplateScreens = API::TemplateScreen()->get(['output' => ['screenitemid'], 'screenitemids' => $options['screenitemid'], 'hostids' => $options['hostids'], 'selectScreenItems' => API_OUTPUT_EXTEND]);
if ($dbTemplateScreens) {
foreach ($result as &$screenItem) {
foreach ($dbTemplateScreens as $dbTemplateScreen) {
foreach ($dbTemplateScreen['screenitems'] as $dbScreenItem) {
if ($screenItem['screenitemid'] == $dbScreenItem['screenitemid'] && isset($dbScreenItem['real_resourceid']) && $dbScreenItem['real_resourceid']) {
$screenItem['real_resourceid'] = $dbScreenItem['real_resourceid'];
}
}
}
}
unset($screenItem);
}
}
return $result;
}
开发者ID:jbfavre, 项目名称:debian-zabbix, 代码行数:53, 代码来源:CTemplateScreenItem.php
示例10: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
// fetch hosts
$hosts = API::Host()->get(array('output' => array('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 = array('output' => array('description', 'expression', 'priority', 'url', 'value', 'triggerid', 'lastchange', 'flags'), 'selectHosts' => array('hostid', 'name', 'status'), 'selectItems' => array('itemid', 'hostid', 'name', 'key_', 'value_type'), 'hostids' => $hostIds, 'monitored' => true, 'skipDependent' => true, 'sortfield' => 'description');
// application filter
if ($this->screenitem['application'] !== '') {
$applications = API::Application()->get(array('output' => array('applicationid'), 'hostids' => $hostIds, 'search' => array('name' => $this->screenitem['application'])));
$options['applicationids'] = zbx_objectValues($applications, 'applicationid');
}
$triggers = API::Trigger()->get($options);
/*
* 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);
return $this->getOutput(getTriggersOverview($hosts, $triggers, $this->pageFile, $this->screenitem['style'], $this->screenid));
}
开发者ID:omidmt, 项目名称:zabbix-greenplum, 代码行数:27, 代码来源:CScreenTriggersOverview.php
示例11: doAction
protected function doAction()
{
$eventids = $this->getInput('eventids');
$acknowledge_type = $this->getInput('acknowledge_type');
$result = true;
if ($acknowledge_type == ZBX_ACKNOWLEDGE_PROBLEM || $acknowledge_type == ZBX_ACKNOWLEDGE_ALL) {
$events = API::Event()->get(['output' => ['objectid'], 'source' => EVENT_SOURCE_TRIGGERS, 'object' => EVENT_OBJECT_TRIGGER, 'eventids' => $eventids]);
$triggerids = zbx_objectValues($events, 'objectid');
$filter = ['acknowledged' => EVENT_NOT_ACKNOWLEDGED];
if ($acknowledge_type == ZBX_ACKNOWLEDGE_PROBLEM) {
$filter['value'] = TRIGGER_VALUE_TRUE;
}
while ($result) {
$events = API::Event()->get(['output' => [], 'source' => EVENT_SOURCE_TRIGGERS, 'object' => EVENT_OBJECT_TRIGGER, 'objectids' => $triggerids, 'filter' => $filter, 'preservekeys' => true, 'limit' => ZBX_DB_MAX_INSERTS]);
if ($events) {
foreach ($eventids as $i => $eventid) {
if (array_key_exists($eventid, $events)) {
unset($eventids[$i]);
}
}
$result = API::Event()->acknowledge(['eventids' => array_keys($events), 'message' => $this->getInput('message', '')]);
} else {
break;
}
}
}
if ($result && $eventids) {
$result = API::Event()->acknowledge(['eventids' => $eventids, 'message' => $this->getInput('message', '')]);
}
if ($result) {
$response = new CControllerResponseRedirect($this->getInput('backurl', 'tr_status.php'));
$response->setMessageOk(_n('Event acknowledged', 'Events acknowledged', count($eventids)));
} else {
$response = new CControllerResponseRedirect('zabbix.php?action=acknowledge.edit');
$response->setFormData($this->getInputAll());
$response->setMessageError(_n('Cannot acknowledge event', 'Cannot acknowledge events', count($eventids)));
}
$this->setResponse($response);
}
开发者ID:jbfavre, 项目名称:debian-zabbix, 代码行数:39, 代码来源:CControllerAcknowledgeCreate.php
示例12: doAction
protected function doAction()
{
$filter = ['groupids' => null, 'maintenance' => null];
if (CProfile::get('web.dashconf.filter.enable', 0) == 1) {
// groups
if (CProfile::get('web.dashconf.groups.grpswitch', 0) == 0) {
// null mean all groups
$filter['groupids'] = null;
} else {
$filter['groupids'] = zbx_objectValues(CFavorite::get('web.dashconf.groups.groupids'), 'value');
$hideHostGroupIds = zbx_objectValues(CFavorite::get('web.dashconf.groups.hide.groupids'), 'value');
if ($hideHostGroupIds) {
// get all groups if no selected groups defined
if (!$filter['groupids']) {
$dbHostGroups = API::HostGroup()->get(['output' => ['groupid']]);
$filter['groupids'] = zbx_objectValues($dbHostGroups, 'groupid');
}
$filter['groupids'] = array_diff($filter['groupids'], $hideHostGroupIds);
// get available hosts
$dbAvailableHosts = API::Host()->get(['groupids' => $filter['groupids'], 'output' => ['hostid']]);
$availableHostIds = zbx_objectValues($dbAvailableHosts, 'hostid');
$dbDisabledHosts = API::Host()->get(['groupids' => $hideHostGroupIds, 'output' => ['hostid']]);
$disabledHostIds = zbx_objectValues($dbDisabledHosts, 'hostid');
$filter['hostids'] = array_diff($availableHostIds, $disabledHostIds);
} else {
if (!$filter['groupids']) {
// null mean all groups
$filter['groupids'] = null;
}
}
}
// hosts
$maintenance = CProfile::get('web.dashconf.hosts.maintenance', 1);
$filter['maintenance'] = $maintenance == 0 ? 0 : null;
}
$this->setResponse(new CControllerResponseData(['filter' => $filter, 'user' => ['debug_mode' => $this->getDebugMode()]]));
}
开发者ID:jbfavre, 项目名称:debian-zabbix, 代码行数:37, 代码来源:CControllerWidgetWebView.php
示例13: getIndependentTemplates
/**
* Get templates that don't have not existing linked templates i.e. all templates that must be linked to these templates exist.
* Returns array with template names (host).
*
* @param array $templates
*
* @return array
*/
protected function getIndependentTemplates(array $templates)
{
foreach ($templates as $num => $template) {
if (empty($template['templates'])) {
continue;
}
foreach ($template['templates'] as $linkedTpl) {
if (!$this->referencer->resolveTemplate($linkedTpl['name'])) {
unset($templates[$num]);
continue 2;
}
}
}
return zbx_objectValues($templates, 'host');
}
开发者ID:jbfavre, 项目名称:debian-zabbix, 代码行数:23, 代码来源:CTemplateImporter.php
示例14: get_request
$dashForm->addVar('form_refresh', 1);
$dashForm->setName('dashconf');
$dashForm->setAttribute('id', 'dashform');
if (isset($_REQUEST['form_refresh'])) {
$filterEnable = get_request('filterEnable', 0);
$groupids = get_request('groupids', array());
$groupids = zbx_toHash($groupids);
$grpswitch = get_request('grpswitch', 0);
$maintenance = get_request('maintenance', 0);
$extAck = get_request('extAck', 0);
$severity = get_request('trgSeverity', array());
$severity = array_keys($severity);
} else {
$filterEnable = CProfile::get('web.dashconf.filter.enable', 0);
$groupids = get_favorites('web.dashconf.groups.groupids');
$groupids = zbx_objectValues($groupids, 'value');
$groupids = zbx_toHash($groupids);
$grpswitch = CProfile::get('web.dashconf.groups.grpswitch', 0);
$maintenance = CProfile::get('web.dashconf.hosts.maintenance', 1);
$extAck = CProfile::get('web.dashconf.events.extAck', 0);
$severity = CProfile::get('web.dashconf.triggers.severity', '0;1;2;3;4;5');
$severity = zbx_empty($severity) ? array() : explode(';', $severity);
}
$dashForm->addVar('filterEnable', $filterEnable);
if ($filterEnable) {
$cbFilter = new CSpan(S_ENABLED, 'green underline pointer');
$cbFilter->setAttribute('onclick', "create_var('" . $dashForm->getName() . "', 'filterEnable', 0, true);");
} else {
$cbFilter = new CSpan(S_DISABLED, 'red underline pointer');
$cbFilter->setAttribute('onclick', "\$('dashform').enable(); create_var('" . $dashForm->getName() . "', 'filterEnable', 1, true);");
}
开发者ID:songyuanjie, 项目名称:zabbix-stats, 代码行数:31, 代码来源:dashconf.php
示例15: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$this->dataId = 'discovery';
$sort_field = $this->data['sort'];
$sort_order = $this->data['sortorder'];
$druleid = $this->data['druleid'];
// discovery rules
$options = ['output' => ['druleid', 'name'], 'selectDHosts' => ['dhostid', 'status', 'lastup', 'lastdown'], 'filter' => ['status' => DRULE_STATUS_ACTIVE]];
if ($druleid > 0) {
$options['druleids'] = $druleid;
// set selected discovery rule id
}
$drules = API::DRule()->get($options);
if ($drules) {
order_result($drules, 'name');
}
// discovery services
$options = ['selectHosts' => ['hostid', 'name', 'status'], 'output' => ['dserviceid', 'type', 'key_', 'port', 'status', 'lastup', 'lastdown', 'ip', 'dns'], 'sortfield' => $sort_field, 'sortorder' => $sort_order, 'limitSelects' => 1];
if ($druleid > 0) {
$options['druleids'] = $druleid;
} else {
$options['druleids'] = zbx_objectValues($drules, 'druleid');
}
$dservices = API::DService()->get($options);
// user macros
$macros = API::UserMacro()->get(['output' => ['macro', 'value'], 'globalmacro' => true]);
$macros = zbx_toHash($macros, 'macro');
// services
$services = [];
foreach ($dservices as $dservice) {
$key_ = $dservice['key_'];
if ($key_ !== '') {
if (array_key_exists($key_, $macros)) {
$key_ = $macros[$key_]['value'];
}
$key_ = ': ' . $key_;
}
$service_name = discovery_check_type2str($dservice['type']) . discovery_port2str($dservice['type'], $dservice['port']) . $key_;
$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'];
//.........这里部分代码省略.........
开发者ID:jbfavre, 项目名称:debian-zabbix, 代码行数:101, 代码来源:CScreenDiscovery.php
示例16: array
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/graphs.inc.php';
$page['file'] = 'chart7.php';
// $page['title'] = "S_CHART";
$page['type'] = PAGE_TYPE_IMAGE;
include_once 'include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('period' => array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD, ZBX_MAX_PERIOD), null), 'from' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'stime' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'border' => array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), 'name' => array(T_ZBX_STR, O_OPT, NULL, null, null), 'width' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 65535), null), 'height' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 65535), null), 'graphtype' => array(T_ZBX_INT, O_OPT, NULL, IN('2,3'), null), 'graph3d' => array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), 'legend' => array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), 'items' => array(T_ZBX_STR, O_OPT, NULL, null, null));
check_fields($fields);
$items = get_request('items', array());
asort_by_key($items, 'sortorder');
$options = array('webitems' => 1, 'itemids' => zbx_objectValues($items, 'itemid'), 'nodeids' => get_current_nodeid(true));
$db_data = CItem::get($options);
$db_data = zbx_toHash($db_data, 'itemid');
foreach ($items as $id => $gitem) {
if (!isset($db_data[$gitem['itemid']])) {
access_deny();
}
}
$effectiveperiod = navigation_bar_calc();
$graph = new CPie(get_request('graphtype', GRAPH_TYPE_NORMAL));
$graph->setHeader(get_request('name', ''));
$graph3d = get_request('graph3d', 0);
$legend = get_request('legend', 0);
if ($graph3d == 1) {
$graph->switchPie3D();
}
开发者ID:songyuanjie, 项目名称:zabbix-stats, 代码行数:31, 代码来源:chart7.php
示例17: array
$fields = array('period' => array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD, ZBX_MAX_PERIOD), null), 'stime' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'httptestid' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'http_item_type' => array(T_ZBX_INT, O_OPT, null, null, null), 'name' => array(T_ZBX_STR, O_OPT, null, null, null), 'width' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'height' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'ymin_type' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), null), 'ymax_type' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), null), 'ymin_itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'ymax_itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'legend' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'showworkperiod' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'showtriggers' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'graphtype' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'yaxismin' => array(T_ZBX_DBL, O_OPT, null, null, null), 'yaxismax' => array(T_ZBX_DBL, O_OPT, null, null, null), 'percent_left' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(0, 100), null), 'percent_right' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(0, 100), null), 'items' => array(T_ZBX_STR, O_OPT, null, null, null));
$isDataValid = check_fields($fields);
if ($httptestid = get_request('httptestid', false)) {
$color = array('current' => 0, 0 => array('next' => '1'), 1 => array('color' => 'Red', 'next' => '2'), 2 => array('color' => 'Dark Green', 'next' => '3'), 3 => array('color' => 'Blue', 'next' => '4'), 4 => array('color' => 'Dark Yellow', 'next' => '5'), 5 => array('color' => 'Cyan', 'next' => '6'), 6 => array('color' => 'Gray', 'next' => '7'), 7 => array('color' => 'Dark Red', 'next' => '8'), 8 => array('color' => 'Green', 'next' => '9'), 9 => array('color' => 'Dark Blue', 'next' => '10'), 10 => array('color' => 'Yellow', 'next' => '11'), 11 => array('color' => 'Black', 'next' => '1'));
$items = array();
$dbItems = DBselect('SELECT i.itemid' . ' FROM httpstepitem hi,items i,httpstep hs' . ' WHERE i.itemid=hi.itemid' . ' AND hs.httptestid=' . $httptestid . ' AND hs.httpstepid=hi.httpstepid' . ' AND hi.type=' . get_request('http_item_type', HTTPSTEP_ITEM_TYPE_TIME) . ' ORDER BY hs.no DESC');
while ($item = DBfetch($dbItems)) {
$itemColor = $color[$color['current'] = $color[$color['current']]['next']]['color'];
$items[] = array('itemid' => $item['itemid'], 'color' => $itemColor);
}
$httptest = get_httptest_by_httptestid($httptestid);
$name = $httptest['name'];
} else {
$items = get_request('items', array());
asort_by_key($items, 'sortorder');
$dbItems = API::Item()->get(array('webitems' => true, 'itemids' => zbx_objectValues($items, 'itemid'), 'nodeids' => get_current_nodeid(true), 'output' => API_OUTPUT_SHORTEN, 'preservekeys' => true, 'filter' => array('flags' => null)));
$dbItems = zbx_toHash($dbItems, 'itemid');
foreach ($items as $item) {
if (!isset($dbItems[$item['itemid']])) {
access_deny();
}
}
$name = get_request('name', '');
}
/*
* Display
*/
if ($isDataValid) {
$graph = new CChart(get_request('graphtype', GRAPH_TYPE_NORMAL));
$graph->setHeader($name);
navigation_bar_calc();
开发者ID:quanta-computing, 项目名称:debian-packages, 代码行数:31, 代码来源:chart3.php
示例18: mktime
$period_start = mktime(0, 0, 0, date('n'), 1, date('Y'));
break;
case 'year':
$period_start = mktime(0, 0, 0, 1, 1, date('Y'));
break;
case 24:
case 24 * 7:
case 24 * 30:
case 24 * DAY_IN_YEAR:
$period_start = $period_end - $period * 3600;
break;
}
// fetch services
$services = API::Service()->get(array('output' => array('name', 'serviceid', 'showsla', 'goodsla', 'algorithm'), 'selectParent' => array('serviceid'), 'selectDependencies' => array('servicedownid', 'soft', 'linkid'), 'selectTrigger' => array('description', 'triggerid', 'expression'), 'preservekeys' => true, 'sortfield' => 'sortorder', 'sortorder' => ZBX_SORT_UP));
// expand trigger descriptions
$triggers = zbx_objectValues($services, 'trigger');
$triggers = CMacrosResolverHelper::resolveTriggerNames($triggers);
foreach ($services as &$service) {
if ($service['trigger']) {
$service['trigger'] = $triggers[$service['trigger']['triggerid']];
}
}
unset($service);
// fetch sla
$slaData = API::Service()->getSla(array('intervals' => array(array('from' => $period_start, 'to' => $period_end))));
// expand problem trigger descriptions
foreach ($slaData as &$serviceSla) {
foreach ($serviceSla['problems'] as &$problemTrigger) {
$problemTrigger['description'] = $triggers[$problemTrigger['triggerid']]['description'];
}
unset($problemTrigger);
开发者ID:omidmt, 项目名称:zabbix-greenplum, 代码行数:31, 代码来源:srv_status.php
krishnaik06/Machine-Learning-in-90-days
阅读:1062| 2022-08-18
joaomh/curso-de-matlab
阅读:1149| 2022-08-17
在美元的英文“dollar”里面明明没有字母“s”,为什么美元的符号($)是一条竖线穿过字
阅读:1063| 2022-11-06
问题来源:http://www.cnblogs.com/del/archive/2009/03/09/1284244.html#1472084{函数
阅读:1317| 2022-07-18
rugk/mastodon-simplified-federation: Simplifies following and interacting with r
阅读:1081| 2022-08-17
Zulip is an open-source team collaboration tool. Zulip Server versions 2.1.0 abo
阅读:647| 2022-07-29
Gabriella439/Haskell-Optparse-Generic-Library: Auto-generate a command-line pars
阅读:958| 2022-08-15
Tangshitao/Dense-Scene-Matching: Learning Camera Localization via Dense Scene Ma
阅读:763| 2022-08-16
长沙城南,有一所以“环保”为名的学校,从1979年创立以来,四易归属、五更其名。 这
阅读:757| 2022-11-06
//校验手机号 function IsMobileNumber( num:string ):boolean; begin
阅读:480| 2022-07-18
请发表评论