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


PHP API::DCheck方法代码示例

本文整理汇总了PHP中API::DCheck方法的典型用法代码示例。如果您正苦于以下问题:PHP API::DCheck方法的具体用法?PHP API::DCheck怎么用?PHP API::DCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API的用法示例。


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

示例1: get

 /**
 * Get drule data
 *
 * @param array $options
 * @return array
 */
 public function get(array $options = array())
 {
     $result = array();
     $nodeCheck = false;
     $userType = self::$userData['type'];
     // allowed columns for sorting
     $sortColumns = array('druleid', 'name');
     // allowed output options for [ select_* ] params
     $subselectsAllowedOutputs = array(API_OUTPUT_REFER, API_OUTPUT_EXTEND);
     $sqlParts = array('select' => array('drules' => 'dr.druleid'), 'from' => array('drules' => 'drules dr'), 'where' => array(), 'group' => array(), 'order' => array(), 'limit' => null);
     $defOptions = array('nodeids' => null, 'druleids' => null, 'dhostids' => null, 'dserviceids' => null, 'dcheckids' => null, 'editable' => null, 'selectDHosts' => null, 'selectDServices' => null, 'selectDChecks' => null, 'filter' => null, 'search' => null, 'searchByAny' => null, 'startSearch' => null, 'excludeSearch' => null, 'searchWildcardsEnabled' => null, 'output' => API_OUTPUT_REFER, 'countOutput' => null, 'groupCount' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null, 'limitSelects' => null);
     $options = zbx_array_merge($defOptions, $options);
     // editable + PERMISSION CHECK
     if (USER_TYPE_SUPER_ADMIN == $userType) {
     } elseif (is_null($options['editable']) && self::$userData['type'] == USER_TYPE_ZABBIX_ADMIN) {
     } elseif (!is_null($options['editable']) && self::$userData['type'] != USER_TYPE_SUPER_ADMIN) {
         return array();
     }
     // nodeids
     $nodeids = !is_null($options['nodeids']) ? $options['nodeids'] : get_current_nodeid();
     // druleids
     if (!is_null($options['druleids'])) {
         zbx_value2array($options['druleids']);
         $sqlParts['where']['druleid'] = dbConditionInt('dr.druleid', $options['druleids']);
         if (!$nodeCheck) {
             $nodeCheck = true;
             $sqlParts['where'][] = DBin_node('dr.druleid', $nodeids);
         }
     }
     // dhostids
     if (!is_null($options['dhostids'])) {
         zbx_value2array($options['dhostids']);
         if ($options['output'] != API_OUTPUT_SHORTEN) {
             $sqlParts['select']['dhostid'] = 'dh.dhostid';
         }
         $sqlParts['from']['dhosts'] = 'dhosts dh';
         $sqlParts['where']['dhostid'] = dbConditionInt('dh.dhostid', $options['dhostids']);
         $sqlParts['where']['dhdr'] = 'dh.druleid=dr.druleid';
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['dhostid'] = 'dh.dhostid';
         }
         if (!$nodeCheck) {
             $nodeCheck = true;
             $sqlParts['where'][] = DBin_node('dh.dhostid', $nodeids);
         }
     }
     // dserviceids
     if (!is_null($options['dserviceids'])) {
         zbx_value2array($options['dserviceids']);
         if ($options['output'] != API_OUTPUT_SHORTEN) {
             $sqlParts['select']['dserviceid'] = 'ds.dserviceid';
         }
         $sqlParts['from']['dhosts'] = 'dhosts dh';
         $sqlParts['from']['dservices'] = 'dservices ds';
         $sqlParts['where']['dserviceid'] = dbConditionInt('ds.dserviceid', $options['dserviceids']);
         $sqlParts['where']['dhdr'] = 'dh.druleid=dr.druleid';
         $sqlParts['where']['dhds'] = 'dh.dhostid=ds.dhostid';
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['dserviceid'] = 'ds.dserviceid';
         }
         if (!$nodeCheck) {
             $nodeCheck = true;
             $sqlParts['where'][] = DBin_node('ds.dserviceid', $nodeids);
         }
     }
     // node check !!!!!
     // should be last, after all ****IDS checks
     if (!$nodeCheck) {
         $nodeCheck = true;
         $sqlParts['where'][] = DBin_node('dr.druleid', $nodeids);
     }
     // output
     if ($options['output'] == API_OUTPUT_EXTEND) {
         $sqlParts['select']['drules'] = 'dr.*';
     }
     // countOutput
     if (!is_null($options['countOutput'])) {
         $options['sortfield'] = '';
         $sqlParts['select'] = array('count(DISTINCT dr.druleid) as rowscount');
         //groupCount
         if (!is_null($options['groupCount'])) {
             foreach ($sqlParts['group'] as $key => $fields) {
                 $sqlParts['select'][$key] = $fields;
             }
         }
     }
     // search
     if (!is_null($options['search'])) {
         zbx_db_search('drules dr', $options, $sqlParts);
     }
     // filter
     if (is_array($options['filter'])) {
         $this->dbFilter('drules dr', $options, $sqlParts);
     }
//.........这里部分代码省略.........
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:101,代码来源:CDRule.php

示例2: addRelatedObjects

 protected function addRelatedObjects(array $options, array $result)
 {
     $result = parent::addRelatedObjects($options, $result);
     $druleids = array_keys($result);
     // Adding Discovery Checks
     if (!is_null($options['selectDChecks'])) {
         if ($options['selectDChecks'] != API_OUTPUT_COUNT) {
             $relationMap = $this->createRelationMap($result, 'druleid', 'dcheckid', 'dchecks');
             $dchecks = API::DCheck()->get(array('output' => $options['selectDChecks'], 'dcheckids' => $relationMap->getRelatedIds(), 'nopermissions' => true, 'preservekeys' => true));
             if (!is_null($options['limitSelects'])) {
                 order_result($dchecks, 'dcheckid');
             }
             $result = $relationMap->mapMany($result, $dchecks, 'dchecks', $options['limitSelects']);
         } else {
             $dchecks = API::DCheck()->get(array('druleids' => $druleids, 'nopermissions' => true, 'countOutput' => true, 'groupCount' => true));
             $dchecks = zbx_toHash($dchecks, 'druleid');
             foreach ($result as $druleid => $drule) {
                 if (isset($dchecks[$druleid])) {
                     $result[$druleid]['dchecks'] = $dchecks[$druleid]['rowscount'];
                 } else {
                     $result[$druleid]['dchecks'] = 0;
                 }
             }
         }
     }
     // Adding Discovery Hosts
     if (!is_null($options['selectDHosts'])) {
         if ($options['selectDHosts'] != API_OUTPUT_COUNT) {
             $relationMap = $this->createRelationMap($result, 'druleid', 'dhostid', 'dhosts');
             $dhosts = API::DHost()->get(array('output' => $options['selectDHosts'], 'dhostids' => $relationMap->getRelatedIds(), 'preservekeys' => true));
             if (!is_null($options['limitSelects'])) {
                 order_result($dhosts, 'dhostid');
             }
             $result = $relationMap->mapMany($result, $dhosts, 'dhosts', $options['limitSelects']);
         } else {
             $dhosts = API::DHost()->get(array('druleids' => $druleids, 'countOutput' => true, 'groupCount' => true));
             $dhosts = zbx_toHash($dhosts, 'druleid');
             foreach ($result as $druleid => $drule) {
                 if (isset($dhosts[$druleid])) {
                     $result[$druleid]['dhosts'] = $dhosts[$druleid]['rowscount'];
                 } else {
                     $result[$druleid]['dhosts'] = 0;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:48,代码来源:CDRule.php

示例3: validateConditions


//.........这里部分代码省略.........
                     if (!$timePeriodValidator->validate($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, $timePeriodValidator->getError());
                     }
                     break;
                 case CONDITION_TYPE_DHOST_IP:
                     if (zbx_empty($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty action condition.'));
                     } else {
                         if (!validate_ip_range($condition['value'])) {
                             self::exception(ZBX_API_ERROR_PARAMETERS, _s('Incorrect action condition ip "%1$s".', $condition['value']));
                         }
                     }
                     break;
                 case CONDITION_TYPE_DSERVICE_TYPE:
                     if (zbx_empty($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty action condition.'));
                     } elseif (!$discoveryCheckTypeValidator->validate($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery check.'));
                     }
                     break;
                 case CONDITION_TYPE_DSERVICE_PORT:
                     if (zbx_empty($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty action condition.'));
                     } elseif (!validate_port_list($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _s('Incorrect action condition port "%1$s".', $condition['value']));
                     }
                     break;
                 case CONDITION_TYPE_DSTATUS:
                     if (zbx_empty($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty action condition.'));
                     } elseif (!$discoveryObjectStatusValidator->validate($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery status.'));
                     }
                     break;
                 case CONDITION_TYPE_MAINTENANCE:
                     if (!zbx_empty($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Maintenance action condition value must be empty.'));
                     }
                     break;
                 case CONDITION_TYPE_TRIGGER_SEVERITY:
                     if (zbx_empty($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty action condition.'));
                     } elseif (!$triggerSeverityValidator->validate($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition trigger severity.'));
                     }
                     break;
                 case CONDITION_TYPE_TRIGGER_VALUE:
                     if (zbx_empty($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty action condition.'));
                     } elseif (!$triggerValueValidator->validate($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition trigger value.'));
                     }
                     break;
                 case CONDITION_TYPE_EVENT_TYPE:
                     if (zbx_empty($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty action condition.'));
                     } elseif (!$eventTypeValidator->validate($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition event type.'));
                     }
                     break;
                 case CONDITION_TYPE_TRIGGER_NAME:
                 case CONDITION_TYPE_NODE:
                 case CONDITION_TYPE_DUPTIME:
                 case CONDITION_TYPE_DVALUE:
                 case CONDITION_TYPE_APPLICATION:
                 case CONDITION_TYPE_HOST_NAME:
                 case CONDITION_TYPE_HOST_METADATA:
                     if (zbx_empty($condition['value'])) {
                         self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty action condition.'));
                     }
                     break;
                 default:
                     self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition type.'));
                     break;
             }
         }
     }
     if (!API::HostGroup()->isWritable($hostGroupIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition host group. Host group does not exist or you have no access to it.'));
     }
     if (!API::Host()->isWritable($hostIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition host. Host does not exist or you have no access to it.'));
     }
     if (!API::Template()->isWritable($templateIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition template. Template does not exist or you have no access to it.'));
     }
     if (!API::Trigger()->isWritable($triggerIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition trigger. Trigger does not exist or you have no access to it.'));
     }
     if (!API::DRule()->isWritable($discoveryRuleIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery rule. Discovery rule does not exist or you have no access to it.'));
     }
     if (!API::DCheck()->isWritable($proxyIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery check. Discovery check does not exist or you have no access to it.'));
     }
     if (!API::Proxy()->isWritable($proxyidsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition proxy. Proxy does not exist or you have no access to it.'));
     }
     return true;
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:101,代码来源:CAction.php

示例4: actionConditionValueToString


//.........这里部分代码省略.........
                    $dRuleIds[$condition['value']] = $condition['value'];
                    break;
                case CONDITION_TYPE_DCHECK:
                    $dCheckIds[$condition['value']] = $condition['value'];
                    break;
                case CONDITION_TYPE_DOBJECT:
                    $result[$i][$j] = discovery_object2str($condition['value']);
                    break;
                case CONDITION_TYPE_DSERVICE_TYPE:
                    $result[$i][$j] = discovery_check_type2str($condition['value']);
                    break;
                case CONDITION_TYPE_DSTATUS:
                    $result[$i][$j] = discovery_object_status2str($condition['value']);
                    break;
                case CONDITION_TYPE_EVENT_TYPE:
                    $result[$i][$j] = eventType($condition['value']);
                    break;
            }
        }
    }
    $groups = [];
    $triggers = [];
    $hosts = [];
    $templates = [];
    $proxies = [];
    $dRules = [];
    $dChecks = [];
    if ($groupIds) {
        $groups = API::HostGroup()->get(['output' => ['name'], 'groupids' => $groupIds, 'preservekeys' => true]);
    }
    if ($triggerIds) {
        $triggers = API::Trigger()->get(['output' => ['description'], 'triggerids' => $triggerIds, 'expandDescription' => true, 'selectHosts' => ['name'], 'preservekeys' => true]);
    }
    if ($hostIds) {
        $hosts = API::Host()->get(['output' => ['name'], 'hostids' => $hostIds, 'preservekeys' => true]);
    }
    if ($templateIds) {
        $templates = API::Template()->get(['output' => ['name'], 'templateids' => $templateIds, 'preservekeys' => true]);
    }
    if ($proxyIds) {
        $proxies = API::Proxy()->get(['output' => ['host'], 'proxyids' => $proxyIds, 'preservekeys' => true]);
    }
    if ($dRuleIds) {
        $dRules = API::DRule()->get(['output' => ['name'], 'druleids' => $dRuleIds, 'preservekeys' => true]);
    }
    if ($dCheckIds) {
        $dChecks = API::DCheck()->get(['output' => ['type', 'key_', 'ports'], 'dcheckids' => $dCheckIds, 'selectDRules' => ['name'], 'preservekeys' => true]);
    }
    if ($groups || $triggers || $hosts || $templates || $proxies || $dRules || $dChecks) {
        foreach ($actions as $i => $action) {
            foreach ($action['filter']['conditions'] as $j => $condition) {
                $id = $condition['value'];
                switch ($condition['conditiontype']) {
                    case CONDITION_TYPE_HOST_GROUP:
                        if (isset($groups[$id])) {
                            $result[$i][$j] = $groups[$id]['name'];
                        }
                        break;
                    case CONDITION_TYPE_TRIGGER:
                        if (isset($triggers[$id])) {
                            $host = reset($triggers[$id]['hosts']);
                            $result[$i][$j] = $host['name'] . NAME_DELIMITER . $triggers[$id]['description'];
                        }
                        break;
                    case CONDITION_TYPE_HOST:
                        if (isset($hosts[$id])) {
                            $result[$i][$j] = $hosts[$id]['name'];
                        }
                        break;
                    case CONDITION_TYPE_TEMPLATE:
                        if (isset($templates[$id])) {
                            $result[$i][$j] = $templates[$id]['name'];
                        }
                        break;
                    case CONDITION_TYPE_PROXY:
                        if (isset($proxies[$id])) {
                            $result[$i][$j] = $proxies[$id]['host'];
                        }
                        break;
                    case CONDITION_TYPE_DRULE:
                        if (isset($dRules[$id])) {
                            $result[$i][$j] = $dRules[$id]['name'];
                        }
                        break;
                    case CONDITION_TYPE_DCHECK:
                        if (isset($dChecks[$id])) {
                            $drule = reset($dChecks[$id]['drules']);
                            $type = $dChecks[$id]['type'];
                            $key_ = $dChecks[$id]['key_'];
                            $ports = $dChecks[$id]['ports'];
                            $dCheck = discovery_check2str($type, $key_, $ports);
                            $result[$i][$j] = $drule['name'] . NAME_DELIMITER . $dCheck;
                        }
                        break;
                }
            }
        }
    }
    return $result;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:101,代码来源:actions.inc.php

示例5: validateConditionsPermissions

 /**
  * Check permissions to DB entities referenced by action conditions.
  *
  * @param array $conditions   conditions for which permissions to referenced DB entities will be checked
  */
 protected function validateConditionsPermissions(array $conditions)
 {
     $hostGroupIdsAll = array();
     $templateIdsAll = array();
     $triggerIdsAll = array();
     $hostIdsAll = array();
     $discoveryRuleIdsAll = array();
     $discoveryCheckIdsAll = array();
     $proxyIdsAll = array();
     foreach ($conditions as $condition) {
         $conditionValue = $condition['value'];
         // validate condition values depending on condition type
         switch ($condition['conditiontype']) {
             case CONDITION_TYPE_HOST_GROUP:
                 $hostGroupIdsAll[$conditionValue] = $conditionValue;
                 break;
             case CONDITION_TYPE_TEMPLATE:
                 $templateIdsAll[$conditionValue] = $conditionValue;
                 break;
             case CONDITION_TYPE_TRIGGER:
                 $triggerIdsAll[$conditionValue] = $conditionValue;
                 break;
             case CONDITION_TYPE_HOST:
                 $hostIdsAll[$conditionValue] = $conditionValue;
                 break;
             case CONDITION_TYPE_DRULE:
                 $discoveryRuleIdsAll[$conditionValue] = $conditionValue;
                 break;
             case CONDITION_TYPE_DCHECK:
                 $discoveryCheckIdsAll[$conditionValue] = $conditionValue;
                 break;
             case CONDITION_TYPE_PROXY:
                 $proxyIdsAll[$conditionValue] = $conditionValue;
                 break;
         }
     }
     if (!API::HostGroup()->isWritable($hostGroupIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition host group. Host group does not exist or you have no access to it.'));
     }
     if (!API::Host()->isWritable($hostIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition host. Host does not exist or you have no access to it.'));
     }
     if (!API::Template()->isWritable($templateIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition template. Template does not exist or you have no access to it.'));
     }
     if (!API::Trigger()->isWritable($triggerIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition trigger. Trigger does not exist or you have no access to it.'));
     }
     if (!API::DRule()->isWritable($discoveryRuleIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery rule. Discovery rule does not exist or you have no access to it.'));
     }
     if (!API::DCheck()->isWritable($discoveryCheckIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery check. Discovery check does not exist or you have no access to it.'));
     }
     if (!API::Proxy()->isWritable($proxyIdsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition proxy. Proxy does not exist or you have no access to it.'));
     }
 }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:63,代码来源:CAction.php

示例6: validateConditions


//.........这里部分代码省略.........
     $triggeridsAll = array();
     $hostidsAll = array();
     $discoveryRuleidsAll = array();
     $discoveryCheckidsAll = array();
     $proxyidsAll = array();
     $discoveryCheckTypes = discovery_check_type2str();
     $discoveryObjectStatuses = discovery_object_status2str();
     $timePeriodValidator = new CTimePeriodValidator();
     foreach ($conditions as $condition) {
         switch ($condition['conditiontype']) {
             case CONDITION_TYPE_HOST_GROUP:
                 $hostGroupidsAll[$condition['value']] = $condition['value'];
                 break;
             case CONDITION_TYPE_HOST_TEMPLATE:
                 $templateidsAll[$condition['value']] = $condition['value'];
                 break;
             case CONDITION_TYPE_TRIGGER:
                 $triggeridsAll[$condition['value']] = $condition['value'];
                 break;
             case CONDITION_TYPE_HOST:
                 $hostidsAll[$condition['value']] = $condition['value'];
                 break;
             case CONDITION_TYPE_DRULE:
                 $discoveryRuleidsAll[$condition['value']] = $condition['value'];
                 break;
             case CONDITION_TYPE_DCHECK:
                 $discoveryCheckidsAll[$condition['value']] = $condition['value'];
                 break;
             case CONDITION_TYPE_PROXY:
                 $proxyidsAll[$condition['value']] = $condition['value'];
                 break;
             case CONDITION_TYPE_TIME_PERIOD:
                 if (!$timePeriodValidator->validate($condition['value'])) {
                     self::exception(ZBX_API_ERROR_PARAMETERS, _s('Incorrect action condition period "%s".', $condition['value']));
                 }
                 break;
             case CONDITION_TYPE_DHOST_IP:
                 if (!validate_ip_range($condition['value'])) {
                     self::exception(ZBX_API_ERROR_PARAMETERS, _s('Incorrect action condition ip "%s".', $condition['value']));
                 }
                 break;
             case CONDITION_TYPE_DSERVICE_TYPE:
                 if (!isset($discoveryCheckTypes[$condition['value']])) {
                     self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery check.'));
                 }
                 break;
             case CONDITION_TYPE_DSERVICE_PORT:
                 if (!validate_port_list($condition['value'])) {
                     self::exception(ZBX_API_ERROR_PARAMETERS, _s('Incorrect action condition port "%s".', $condition['value']));
                 }
                 break;
             case CONDITION_TYPE_DSTATUS:
                 if (!isset($discoveryObjectStatuses[$condition['value']])) {
                     self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery status.'));
                 }
                 break;
             case CONDITION_TYPE_MAINTENANCE:
                 // maintenance condition has no value...
                 break;
             case CONDITION_TYPE_TRIGGER_NAME:
             case CONDITION_TYPE_TRIGGER_VALUE:
             case CONDITION_TYPE_TRIGGER_SEVERITY:
             case CONDITION_TYPE_NODE:
             case CONDITION_TYPE_DOBJECT:
             case CONDITION_TYPE_DUPTIME:
             case CONDITION_TYPE_DVALUE:
             case CONDITION_TYPE_APPLICATION:
             case CONDITION_TYPE_HOST_NAME:
                 if (zbx_empty($condition['value'])) {
                     self::exception(ZBX_API_ERROR_PARAMETERS, _('Empty action condition.'));
                 }
                 break;
             default:
                 self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition type.'));
                 break;
         }
     }
     if (!API::HostGroup()->isWritable($hostGroupidsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition host group. Host group does not exist or you have no access to it.'));
     }
     if (!API::Host()->isWritable($hostidsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition host. Host does not exist or you have no access to it.'));
     }
     if (!API::Template()->isWritable($templateidsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition template. Template does not exist or you have no access to it.'));
     }
     if (!API::Trigger()->isWritable($triggeridsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition trigger. Trigger does not exist or you have no access to it.'));
     }
     if (!API::DRule()->isWritable($discoveryRuleidsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery rule. Discovery rule does not exist or you have no access to it.'));
     }
     if (!API::DCheck()->isWritable($discoveryCheckidsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition discovery check. Discovery check does not exist or you have no access to it.'));
     }
     if (!API::Proxy()->isWritable($proxyidsAll)) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect action condition proxy. Proxy does not exist or you have no access to it.'));
     }
     return true;
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:101,代码来源:CAction.php


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