Nginx statistics in cacti


    Based on the previous article , only this time we collect statistics for the nginx web server .

    First you need to install nginx with the module http_stub_status_module . And turn it on, for this we add the lines in /usr/local/etc/nginx/nginx.conf (for freebsd):

    location / nginx_status {
       stub_status on;
       # disable access_log if requared
       access_log off;
       #allow XX.YY.AA.ZZ; better resolved only for
       #deny all;

    Now, when requesting http: // localhost / nginx_status, the server will output something like this:

    Active connections: 1
    server accepts handled requests
    2 2 4
    Reading: 0 Writing: 1 Waiting: 0

    Now download the script for Cacti from here: "href =" Unzip it

    and put it in / usr / local / share / cacti / scripts / files and

    Now open cacti, go to Import Templates and import cacti_graph_template_nginx_clients_stat.xml and cacti_graph_template_nginx_sockets_stat.xml

    There should be 2 new templates for graphs:


    We create graphs, prescribe the URL from which statistics will be taken and observe them =)

    (the graphs are not mine)

    PS the PERL LWP :: UserAgent module is required, it is put simply:

    perl -MCPAN -e 'install "LWP :: UserAgent"'

    Based on:
    A similar article for lighttpd:

    UPD :
    Legend to the first schedule :
    Active connections - how many clients are served.
    Reading - how many connections are in read state.
    Writing - how many connections are in the recording state.
    Waiting - keep-alive connections or in a state of processing a request.

    Legend to the second schedule :
    server accepts - how many connections were accepted;
    handled- how many of them were processed, but not closed immediately, the connection immediately closes if the connection table is full.
    requests - how many requests are served. With keep-alive, there can be multiple requests on the same connection

    Also popular now: