Monitor Nginx with ZTC and Zabbix


    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 .
    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

    hg clone

    You can also find rpm packages. For us, this is not relevant, we will consider the process at Debian.

    tar zxfv ztc-11.11.3.tar.gz 

    cd /opt/ztc-11.11.3
    python 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;
                    deny all;

    Restart nginx:
    /etc/init.d/nginx restart

    Edit the nginx.conf config in /etc/ztc/nginx.conf!:

    Check the operation of our scripts:

    /opt/ztc/bin/ 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/ ping
    /opt/ztc/bin/ requests

    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/ $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.

    Also popular now: