Sidebar

manual:appendix:api:drule

This is an old revision of the document!


DRule

Methods

Class containing methods for operations with Discovery Rules.

MethodsDescription
get() Get discovery rule details
exists() Check if discovery rule exists
create() Create discovery rules
update() Update discovery rule details
delete() Delete discovery rules

Object details

discovery rule
ParameterTypeDescriptionDetails
druleidintegerDiscovery Rule ID
proxy_hostidintegerProxy Host ID.
namestringDiscovery Rule name.
iprangestringIp range.
delayintegerDelay between checks
nextcheckintegerNext check date Zabbix internal field
statusintegerStatus
unique_dcheckidstringUnique discovery check ID
discovery check
ParameterTypeOptionalDescriptionDetails
typeint Discovery check type0:SVC_SSH
1:SVC_LDAP
2:SVC_SMTP
3:SVC_FTP
4:SVC_HTTP
5:SVC_POP
6:SVC_NNTP
7:SVC_IMAP
8:SVC_TCP
9:SVC_AGENT
10:SVC_SNMPv1
11:SVC_SNMPv2
12:SVC_ICMPPING
13:SVC_SNMPv3
14:SVC_HTTPS
15:SVC_TELNET
key_string For type it's item key, for it's SNMP OIDRequired for check types SVC_AGENT, SVC_SNMPv1, SVC_SNMPv2, SVC_SNMPv3
snmp_communitystring
portsstring Comma separated ports ranges
snmpv3_securitynamestring
snmpv3_securitylevelint 0:ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV
1:ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV
2:ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV
snmpv3_authpassphrasestring
snmpv3_privpassphrasestring
uniqint If check defines uniqueness of discovered host

Common tasks

The table contains list of common discovery rule-related tasks and possible implementation using Zabbix API

TaskHOWTO
Add a bunch of new discovery rules Use method discovery rule.create with array of Discovery Rule objects
Enable a discovery rule Use method drule.update, set “status”:0
Disable a discovery rule Use method drule.update, set “status”:1
Retrieve discovery rule details by Discovery Rule IDs Use method drule.get with parameter druleids
Retrieve discovery rule details by Discovery Rule name Use method drule.get with parameter filter, specify “name”:“<your discovery rule>“