Kaptain.
Telegram /
LinkedIn /
Email /
GIT /
RSS /
GPG /
Заказ печатных плат

№ 9029 В разделе
Sysadmin
от June 15th, 2018,
В подшивках: Linux, Monitoring, Nginx, Zabbix
stub_status in nginx looks like this
root@boroda:~# curl -s blindage.org/status Active connections: 2 server accepts handled requests 231167 231167 496908 Reading: 0 Writing: 1 Waiting: 1
Counters helps you to understand some statistics of your server and you can monitor this metrics in Zabbix.
Open Nginx config file and add to server section with host’s name from zabbix:
location /status {
allow 127.0.0.1; #allow only local agent
deny all;
stub_status on;
access_log off;
}
Create file /etc/zabbix-agent/zabbix_agentd.d/nginx.conf:
UserParameter=nginx.active[*],wget -O- -q $1/status | awk '/^Active/ {print $NF}'
UserParameter=nginx.reading[*],wget -O- -q $1/status | awk '/Reading/ {print $$2}'
UserParameter=nginx.writing[*],wget -O- -q $1/status | awk '/Writing/ {print $$4}'
UserParameter=nginx.waiting[*],wget -O- -q $1/status | awk '/Waiting/ {print $$6}'
UserParameter=nginx.accepted[*],wget -O- -q $1/status | awk '/^[ \t]+[0-9]+[ \t]+[0-9]+[ \t]+[0-9]+/ {print $$1}'
UserParameter=nginx.handled[*],wget -O- -q $1/status | awk '/^[ \t]+[0-9]+[ \t]+[0-9]+[ \t]+[0-9]+/ {print $$2}'
UserParameter=nginx.requests[*],wget -O- -q $1/status | awk '/^[ \t]+[0-9]+[ \t]+[0-9]+[ \t]+[0-9]+/ {print $$3}'
Woohoo! You on a right way! Create template and items inside like this one
Create new graphic, all loves graphics!
Ok, you created cool monitoring for your Nginx, now look how to calculate rate in Zabbix.
Fortune cookie: Today's spam: Win a turbocharged Jaguar XP in our casino !
Leave a Reply