Monitor Nginx with ZTC and Zabbix
Hello.
I was a little surprised that on the hub just once and casually mentioned about ZTC templates for Zabbix. Let's try to fix this misunderstanding.
The author of these python scripts is Vladimir Rusinov, all the information about the versions, you can give feedback and more on the green mouse website greenmice.info .
Today I will tell you how you can use these templates to monitor nginx, which I think is relevant for many Habrovites.
Download the archive with scripts:
or
You can also find rpm packages. For us, this is not relevant, we will consider the process at Debian.
Unzip:
Install:
We run through the output in search of errors, we don’t find any, go ahead, edit the nginx config. Add:
Restart nginx:
Edit the nginx.conf config in /etc/ztc/nginx.conf!:
Check the operation of our scripts:
Oops ... we do:
Try again:
Well, that means our scripts are ready to work with the server.
We prepare the agent config /etc/zabbix/zabbix_agentd.conf:
Restart zabbix-agent:
The console part is done. We go to the Zabbix server web, import the xml template from the ./ztc/templates folder. We bind the necessary host to it, and we observe two new graphs:


Also, who will be interested in the article on configuring Zabbix for php-fpm or memcache, unsubscribe in comments.
I was a little surprised that on the hub just once and casually mentioned about ZTC templates for Zabbix. Let's try to fix this misunderstanding.
The author of these python scripts is Vladimir Rusinov, all the information about the versions, you can give feedback and more on the green mouse website greenmice.info .
Today I will tell you how you can use these templates to monitor nginx, which I think is relevant for many Habrovites.
Download the archive with scripts:
cd /opt
wget https://bitbucket.org/rvs/ztc/downloads/ztc-11.11.3.tar.gz
or
hg clone https://bitbucket.org/rvs/ztc
You can also find rpm packages. For us, this is not relevant, we will consider the process at Debian.
Unzip:
tar zxfv ztc-11.11.3.tar.gz
Install:
cd /opt/ztc-11.11.3
python setup.py install
We run through the output in search of errors, we don’t find any, go ahead, edit the nginx config. Add:
server {
listen localhost;
server_name nginx_status.localhost;
location /server-status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
Restart nginx:
/etc/init.d/nginx restart
Edit the nginx.conf config in /etc/ztc/nginx.conf!:
proto=http
host=localhost
port=80
resource=/server-status
Check the operation of our scripts:
/opt/ztc/bin/nginx.py ping
IOError: [Errno 2] No such file or directory: '/var/log/zabbix/ztc.log'
Oops ... we do:
mkdir /var/log/zabbix/
Try again:
/opt/ztc/bin/nginx.py ping
0.00252890586853
/opt/ztc/bin/nginx.py requests
35990037
Well, that means our scripts are ready to work with the server.
We prepare the agent config /etc/zabbix/zabbix_agentd.conf:
UserParameter=nginx[*],/opt/ztc/bin/nginx.py $1
Restart zabbix-agent:
/etc/init.d/zabbix-agent restart
The console part is done. We go to the Zabbix server web, import the xml template from the ./ztc/templates folder. We bind the necessary host to it, and we observe two new graphs:


Also, who will be interested in the article on configuring Zabbix for php-fpm or memcache, unsubscribe in comments.