INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram Email / GIT / Thingiverse / RSS / GPG

Zabbix: nginx stub_status monitoring

№ 9029 В разделе "Sysadmin" от June 15th, 2018,
В подшивках: , , ,

stub_status in nginx looks like this

root@boroda:~# curl -s 
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; #allow only local agent
        deny all;
        stub_status on;
        access_log off;

Create file /etc/zabbix-agent/zabbix_agentd.d/nginx.conf:[*],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.

Нет комментариев »

Leave a Reply

Your email address will not be published. Required fields are marked *



Fortune cookie: The three faithful things in life are money, a dog and an old woman.