manual:appendix:api:drule

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:appendix:api:drule [2011/04/21 14:47]
Vedmak [discovery rule]
manual:appendix:api:drule [2014/09/26 11:29] (current)
sasha Links adapted because of a move operation
Line 1: Line 1:
-===== DRule ===== +===== Discovery rule =====
-==== Methods ​====+
  
-Class containing methods for operations ​with Discovery Rules. +This class is designed to work with network ​discovery rules. ​
-^Methods^Description^ +
-|[[2.0/​manual/​appendix/​api/​drule/​get|get()]] |Get discovery rule details | +
-|[[2.0/​manual/​appendix/​api/​drule/​exists|exists()]] |Check if discovery rule exists | +
-|[[2.0/​manual/​appendix/​api/​drule/​create|create()]] |Create ​discovery rules +
-|[[2.0/​manual/​appendix/​api/​drule/​update|update()]] |Update discovery rule details | +
-|[[2.0/​manual/​appendix/​api/​drule/​delete|delete()]] |Delete discovery rules |+
  
 +<note tip>This API is meant to work with network discovery rules. For the low-level discovery rules see the [[discoveryrule|LLD rule API]].</​note>​
  
-==== Object ​details ==== +Object ​references: \\ 
-== discovery rule == +  ​* [[manual:​appendix:​api:​drule:​definitions#​discovery_rule|Discovery ​rule]]
-^Parameter^Type^Description^Details^ +
-|druleid|//​integer//​|Discovery Rule ID | | +
-|proxy_hostid|//​integer//​|Proxy Host ID.  | | +
-|name|//​string//​|Discovery ​Rule name. | | +
-|iprange|//​string//​|Ip range. | | +
-|delay|//​integer//​|Delay between checks ​ | | +
-|nextcheck|//​integer//​|Next check date  | Zabbix internal field| +
-|status|//​integer//​|Status ​ | |+
  
-== discovery check == +Available methods: \\ 
-^Parameter^Type^Optional^Description^Details^ + 
-|**type**|int| |Discovery check type|0: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\\ ​| +  ''​[[manual:appendix:api:drule:create|drule.create]]''​ - create new discovery rules 
-|**key_**|string| |For type it's item key, for it's SNMP OID|Required for check types SVC_AGENT, SVC_SNMPv1, SVC_SNMPv2, SVC_SNMPv3| +  * ''​[[manual:appendix:api:drule:delete|drule.delete]]''​ - delete discovery rules 
-|**snmp_community**|string| | | | +  * ''​[[manual:appendix:api:drule:exists|drule.exists]]'' ​check if a discovery rule exists 
-|**ports**|string| |Comma separated ports ranges| | +  ''​[[manual:appendix:api:drule:get|drule.get]]'' ​retrieve ​discovery rules 
-|**snmpv3_securityname**|string| | | | +  ''​[[manual:​appendix:​api:​drule:isreadable|drule.isreadable]]''​ - check if discovery rules are readable 
-|**snmpv3_securitylevel**|int| | |0:ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV\\ 1:ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV\\ 2:ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV| +  ​''​[[manual:​appendix:​api:drule:​iswritable|drule.iswritable]]''​ - check if discovery rules are writable 
-|**snmpv3_authpassphrase**|string| | | | +  ''​[[manual:​appendix:​api:​drule:​update|drule.update]]''​ - update ​discovery ​rules
-|**snmpv3_privpassphrase**|string| | | | +
-|**uniq**|int| |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 +
-^Task^HOWTO^ +
-|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>"​** |+