Examples of Items for Zabbix

In this article I will give some examples of items for Zabbix agent and server.

Here is an example of counting the number of active processes (Element type is Zabbix agent, so I often count the number of processes nginx, apache2, sshd, named, radiusd, etc., and for a value of 0 you can make a trigger that the process does not work):

proc.num[,mysql]
proc.num[httpd]
proc.num[<name>,<user>,<state>,<cmdline>,<zone>]

Traffic on the network interface (Element type – Zabbix agent, User multiplier – 8, Value storage: Delta (speed per second), where ens1f0 is the name of the network interface):

net.if.in[ens1f0,bytes]
net.if.out[ens1f0,bytes]

Errors and dropped packets per second on the network interface (Element type – Zabbix agent, Value storage – Delta (simple change)):

net.if.in[ens1f0,errors]
net.if.out[ens1f0,errors]
net.if.in[ens1f0,dropped]
net.if.out[ens1f0,dropped]

Traffic on the network interface (Element type – SNMPv2 agent, User multiplier – 8, Storage value: Delta (speed per second), ifInOctets and ifOutOctets for 100 megabit ports, ifHCInOctets and ifHCOutOctets – for gigabit and more):

ifInOctets.1
ifOutOctets.1
ifHCInOctets.1
ifHCOutOctets.1

Disk read / write statistics (Type – sectors, operations, bytes, sps, ops, bps. Mode – avg1 (average for 1 minute – by default), avg5, avg15:

vfs.dev.write[device, type, mode]

vfs.dev.read[/dev/md2,ops,avg1]
vfs.dev.write[/dev/md2,ops,avg1]

The sum of the number of rows in the MySQL table (Element type is Zabbix agent, the key is as specified in the – sqlcount parameter, the line must be added to the Zabbix agent configuration and restarted):

UserParameter=sqlcount,mysql -u root -D database_name -e "SELECT count(*) FROM table_name;" -s -N

MySQL database size (where DBNAME is the name of the database):

UserParameter=size_database_dbname,mysql -u root -e "SELECT SUM( data_length + index_length ) AS 'size' FROM information_schema.TABLES WHERE table_schema = 'DBNAME' LIMIT 1;" -s -N

The number of active connections on the ports (Element type is Zabbix agent, keys such as specified in the parameters, the lines need to be added to the Zabbix agent configuration and restarted):

UserParameter=count_active_connections_all,netstat -an | wc -l
UserParameter=count_active_connections_http,netstat -na | grep :80 | wc -l
UserParameter=count_active_connections_https,netstat -na | grep :443 | wc -l
UserParameter=dns.udp,netstat -nua | grep :53 | wc -l
UserParameter=dns.tcp,netstat -nta | grep :53 | wc -l

In this way, one can observe everything that only the soul desires, for example, here are some more of my examples:

UserParameter=nf_conntrack_count,cat /proc/sys/net/netfilter/nf_conntrack_count
UserParameter=nf_conntrack_max,cat /proc/sys/net/netfilter/nf_conntrack_max
UserParameter=count_max_in_apache_error_log,cat /var/log/apache2/error.log |grep Max |wc -l
UserParameter=count_vlan,ip a | grep ': vlan' | wc -l
UserParameter=count_iptables_192_168_5_5,iptables-save | grep 192.168.5.5 | wc -l

How many times the process is run:

ps ax | grep web | grep -v grep | wc -l

See also my articles:
Custom intervals
Configuring low-level discovery
Examples of Zabbix Triggers
Tracking file changes via Zabbix

Leave a comment

Leave a Reply