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


PHP zbx_objectValues函数代码示例

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


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


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