INT 21h

Hi, I am Vladimir Smagin, SysAdmin, DevOps and barely good guy. Telegram Email / GIT / Микроблог / Thingiverse / 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 *


Микроблог перейти

# 2019-12-23 09:14:01

Очень интересная концепция, docker-compose для kubernetes #devops #kubernetes #docker

# 2019-12-16 17:21:18

Надо будет почитать для общего развития как оживить кластер в случае проеба сертов #kubernetes #devops

# 2019-12-12 17:33:46

js bootstrap с интерфейсом как в DOS

© Vladimir Smagin, 2005-2019. Копирование материалов без разрешения запрещено. GPG DA4CD0F5E222EA727D6A40C413BCE12E5618F071 *

Fortune cookie: Today's spam: Have pork of fiduciary