public function exists($object) { $keyFields = array(array('dserviceid')); $options = array('filter' => zbx_array_mintersect($keyFields, $object), 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => 1, 'limit' => 1); if (isset($object['node'])) { $options['nodeids'] = getNodeIdByNodeName($object['node']); } elseif (isset($object['nodeids'])) { $options['nodeids'] = $object['nodeids']; } $objs = $this->get($options); return !empty($objs); }
public function exists($object) { $options = array('filter' => array('name' => $object['name']), 'output' => array('usrgrpid'), 'nopermissions' => 1, 'limit' => 1); if (isset($object['node'])) { $options['nodeids'] = getNodeIdByNodeName($object['node']); } elseif (isset($object['nodeids'])) { $options['nodeids'] = $object['nodeids']; } $objs = $this->get($options); return !empty($objs); }
public function exists(array $object) { $options = array('filter' => array(), 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => 1, 'limit' => 1); if (isset($object['name'])) { $options['filter']['name'] = $object['name']; } if (isset($object['hostids'])) { $options['druleids'] = zbx_toArray($object['druleids']); } if (isset($object['node'])) { $options['nodeids'] = getNodeIdByNodeName($object['node']); } elseif (isset($object['nodeids'])) { $options['nodeids'] = $object['nodeids']; } $objs = $this->get($options); return !empty($objs); }
/** * Check if item exists. * * @param array $object * * @return bool */ public function exists(array $object) { $options = array('filter' => array('key_' => $object['key_']), 'webitems' => true, 'output' => array('itemid'), 'nopermissions' => true, 'limit' => 1); if (isset($object['hostid'])) { $options['hostids'] = $object['hostid']; } if (isset($object['host'])) { $options['filter']['host'] = $object['host']; } if (isset($object['node'])) { $options['nodeids'] = getNodeIdByNodeName($object['node']); } elseif (isset($object['nodeids'])) { $options['nodeids'] = $object['nodeids']; } $objs = $this->get($options); return !empty($objs); }
/** * Is interface exist. * * @param array $object * * @return bool */ public function exists(array $object) { $keyFields = array('interfaceid', 'hostid', 'ip', 'dns'); $options = array('filter' => zbx_array_mintersect($keyFields, $object), 'output' => array('interfaceid'), 'nopermissions' => true, 'limit' => 1); if (isset($object['node'])) { $options['nodeids'] = getNodeIdByNodeName($object['node']); } elseif (isset($object['nodeids'])) { $options['nodeids'] = $object['nodeids']; } $objs = $this->get($options); return !empty($objs); }
/** * @param $object * * @return bool */ public function exists(array $object) { $keyFields = array(array('hostid', 'host'), 'description'); $result = false; if (!isset($object['hostid']) && !isset($object['host'])) { $expressionData = new CTriggerExpression(); if (!$expressionData->parse($object['expression'])) { return false; } $expressionHosts = $expressionData->getHosts(); $object['host'] = reset($expressionHosts); } $options = array('filter' => array_merge(zbx_array_mintersect($keyFields, $object), array('flags' => null)), 'output' => API_OUTPUT_EXTEND, 'nopermissions' => true); if (isset($object['node'])) { $options['nodeids'] = getNodeIdByNodeName($object['node']); } elseif (isset($object['nodeids'])) { $options['nodeids'] = $object['nodeids']; } $triggers = $this->get($options); foreach ($triggers as $trigger) { $tmpExp = explode_exp($trigger['expression']); if (strcmp($tmpExp, $object['expression']) == 0) { $result = true; break; } } return $result; }
public function exists($data) { $keyFields = array(array('screenid', 'name'), 'templateid'); $options = array('filter' => zbx_array_mintersect($keyFields, $data), 'preservekeys' => true, 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => true, 'limit' => 1); if (isset($data['node'])) { $options['nodeids'] = getNodeIdByNodeName($data['node']); } elseif (isset($data['nodeids'])) { $options['nodeids'] = $data['nodeids']; } $screens = $this->get($options); return !empty($screens); }
public static function exists($object) { $keyFields = array('name', 'groupid'); $options = array('filter' => zbx_array_mintersect($keyFields, $object), 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => 1, 'limit' => 1); if (isset($object['node'])) { $options['nodeids'] = getNodeIdByNodeName($object['node']); } else { if (isset($object['nodeids'])) { $options['nodeids'] = $object['nodeids']; } } $objs = self::get($options); return !empty($objs); }
/** * Get graphid by graph name. * * params: hostids, name * * @param array $graphData * * @return array */ public function getObjects($graphData) { $options = array('filter' => $graphData, 'output' => API_OUTPUT_EXTEND); if (isset($graphData['node'])) { $options['nodeids'] = getNodeIdByNodeName($graphData['node']); } elseif (isset($graphData['nodeids'])) { $options['nodeids'] = $graphData['nodeids']; } return $this->get($options); }
public static function exists($object) { $options = array('filter' => array('key_' => $object['key_']), 'webitems' => 1, 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => 1, 'limit' => 1); if (isset($object['hostid'])) { $options['hostids'] = $object['hostid']; } if (isset($object['host'])) { $options['filter']['host'] = $object['host']; } if (isset($object['node'])) { $options['nodeids'] = getNodeIdByNodeName($object['node']); } else { if (isset($object['nodeids'])) { $options['nodeids'] = $object['nodeids']; } } $objs = self::get($options); return !empty($objs); }
public static function exists($data) { $keyFields = array(array('screenid', 'name')); $options = array('filter' => zbx_array_mintersect($keyFields, $data), 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => 1, 'limit' => 1); if (isset($data['node'])) { $options['nodeids'] = getNodeIdByNodeName($data['node']); } else { if (isset($data['nodeids'])) { $options['nodeids'] = $data['nodeids']; } } $sysmaps = self::get($options); return !empty($sysmaps); }
public static function exists($object) { $keyFields = array(array('hostid', 'host'), 'description'); $result = false; if (!isset($object['hostid']) && !isset($object['host'])) { $expr = new CTriggerExpression($object); $expression = $object['expression']; if (!empty($expr->errors)) { return false; } if (empty($expr->data['hosts'])) { return false; } $object['host'] = reset($expr->data['hosts']); } $options = array('filter' => zbx_array_mintersect($keyFields, $object), 'output' => API_OUTPUT_EXTEND, 'nopermissions' => 1); if (isset($object['node'])) { $options['nodeids'] = getNodeIdByNodeName($object['node']); } else { if (isset($object['nodeids'])) { $options['nodeids'] = $object['nodeids']; } } $triggers = self::get($options); foreach ($triggers as $tnum => $trigger) { $tmp_exp = explode_exp($trigger['expression'], false); if (strcmp($tmp_exp, $object['expression']) == 0) { $result = true; break; } } return $result; }