Why should I customize the OID?
In the previous article we've talked about how Zabbix uses SNMP to monitor the server, but he has one obvious limitation: only the well-defined OID project can be monitored, if we want to know if the nginx process is running? What should we do without the Zabbix agent? Next, use this power to explain the custom OID .
Confirm that the SNMP OID is present
First we need to find out if an OID is being taken over by the system, such as. 1.3.6.1.4.1.2021.5000
| # snmpwalk-v 2c-c public www.ttlsa.com. 1.3.6.1.4.1.2021.5000 |
| ucd-snmp-mib::ucdavis.5000 = No Such Object available on the This agent in this OID |
As stated above does not exist
To increase the custom SNMP OID
Writing scripts
| # cat/root/scripts/check_nginx.sh |
| Nginxnum= '/bin/psaux | /bin/grepnginx |wc-l ' |
Modify Configuration
| # vim/etc/snmp/snmpd.conf |
| Extend. 1.3.6.1.4.1.2021.5000 check_nginx/root/scripts/check_nginx.sh//Add this line |
Get SNMP Information
The following gets all the data for the custom OID, the first line is the data we need to get, then write the OID in Zabbix. 1.3.6.1.4.1.2021.5000.4.1.2.11.99.104.101.99.107.95.110.103.105.110.120.1
| # snmpwalk-v 1-c public 173.219.255.122.1.3.6.1.4.1.2021.5000 |
| ucd-snmp-mib::ucdavis.5000.1.0 = integer:1 |
| ucd-snmp-mib::ucdavis.5000.2.1.2.11.99.104.101.99.107.95.110.103.105.110.120 = STRING: "/root/scripts/check_ Nginx.sh " |
| ucd-snmp-mib::ucdavis.5000.2.1.3.11.99.104.101.99.107.95.110.103.105.110.120 = "" |
| ucd-snmp-mib::ucdavis.5000.2.1.4.11.99.104.101.99.107.95.110.103.105.110.120 = "" |
| ucd-snmp-mib::ucdavis.5000.2.1.5.11.99.104.101.99.107.95.110.103.105.110.120 = Integer:5 |
| ucd-snmp-mib::ucdavis.5000.2.1.6.11.99.104.101.99.107.95.110.103.105.110.120 = integer:1 |
| ucd-snmp-mib::ucdavis.5000.2.1.7.11.99.104.101.99.107.95.110.103.105.110.120 = integer:1 |
| ucd-snmp-mib::ucdavis.5000.2.1.20.11.99.104.101.99.107.95.110.103.105.110.120 = Integer:4 |
| ucd-snmp-mib::ucdavis.5000.2.1.21.11.99.104.101.99.107.95.110.103.105.110.120 = integer:1 |
| ucd-snmp-mib::ucdavis.5000.3.1.1.11.99.104.101.99.107.95.110.103.105.110.120 = STRING: "6" |
| ucd-snmp-mib::ucdavis.5000.3.1.2.11.99.104.101.99.107.95.110.103.105.110.120 = STRING: "6" |
| ucd-snmp-mib::ucdavis.5000.3.1.3.11.99.104.101.99.107.95.110.103.105.110.120 = integer:1 |
| ucd-snmp-mib::ucdavis.5000.3.1.4.11.99.104.101.99.107.95.110.103.105.110.120 = integer:0 |
| ucd-snmp-mib::ucdavis.5000.4.1.2.11.99.104.101.99.107.95.110.103.105.110.120.1 = STRING: "6" |
Create SNMP Item
Snmp-oid
Get the latest data
SNMP gets nginx data
Next create the trigger and alarm, I will not say more, you can refer to the "Zabbix trigger"
Zabbix SNMP Custom OID Nginx Monitor instance (55)