Mittwoch, 26. Juni 2013

check_nginx_status - nagios-plugin to monitor output from HttpStubStatusModule

check_nginx_status is a Nagios-Plugin
to monitor nginx status and alerts on various values to test for


Active Connections / 24hrs

Requests per Second / 24hrs


    check_nginx_status [-H|--HOST] [-p|--port] [-u|--url] [-a|--auth] [-s|--ssl]
                       [-t|--test] [-w|--warning] [-c|--critical]
                       [-o|--output] [-r|--resultfile]
                       [-h|--help] [-v|--version] [-d|--debug]


    print check_nginx_status help

    Sets nginx host
    Default: localhost

    Sets connection-port
    Default: 80/http, 443/https

    Turns on SSL
    Default: off

    Sets nginx status url path.
    Default: /nginx_status

    Sets nginx status BasicAuth user:password.
    Default: off

    Sets the test(check)_value for w/c
    if used, -w/-c is mandatory
    Default: checktime
    possible Values:

        active_conns    -> active connections
        accepts_err     -> difference between accepted and
                           handled requests (should be 0)
        requests        -> check for requests/connection
        reading         -> actual value for reading headers
        writing         -> value for active requests
        waiting         -> actual keep-alive-connections
        checktime       -> checks if this check need more than
                           given -w/-c milliseconds
    --calculated checks ---------------
        rps             -> requests per seconds
        cps             -> connections per second
        dreq            -> delta requests to the previous one
        dcon            -> delta connections to the previous one
        these checks are calculated at runtime with a timeframe
        between the latest and the current check; time is
        extracted from the timestamp of the result_file
        to disable calculation (no files are written) use -n;
        you cannot use -t [rps,cps,dreq,dcon] with -n; this
        will raise an error and the plugin returns UNKNOWN

        see -r - option for an alternate filepath for temporary results
    Sets a warning level for selected test(check)
    Default: off

    Sets a critical level for selected test(check)
    Default: off
    turn on debugging - messages (use this for manual testing,
    never via nagios-checks; beware of the messy output
    Default: off
    display version and exit

    output only values from selected tests in perfdata; if used w/out -t
    the check returns the value for active connections

    please note, beside the values from the actual check
    (eg.g check_nginx.results) a second
    file is created, if not existent, and written on each plugin-run
    (check_nginx.results.csv), containign a historic view on all
    extracted values
    default: /tmp/check_nginx.results{.csv}

    never write a results-file; CANNOT be used with calculated checks
    -t [rps|cps|dreq|dcon]
    default: off
    *** ) -> please dont use this option, not implemented or not functional


    just get all perfdata, url is default (/nginx_status)
    ./check_nginx_status --HOST

    just get active connections perfdata
    ./check_nginx_status -H -o
    check for plugin_checktime, error > 10ms (warning) or 50ms (error) and output
    only perfdata for that values
    ./check_nginx_status -H -u /status  -w 10 -c 50 -o
    check for active connections, alert on > 500/2000 active connections
    ./check_nginx_status -H -u /status -t active_conn -w 500 -c 2000

    Check for accepts_errors
    ./check_nginx_status -H -t accepts_err -w 1 -c 50


    NginxStatus.Check OK | ac=1;acc=64; han=64; req=64; err=0; rpc=1; rps=0; cps=0; dreq=1; dcon=1; read=0; writ=1; wait=0; ct=6ms;

        ac      -> active connections
        acc     -> totally accepted connections
        han     -> totally handled connections
        req     -> total requests
        err     -> diff between acc - han, thus errors
        rpc     -> requests per connection (req/han)
        rps     -> requests per second (calculated) from last checkrun vs actual values
        cps     -> connections per (calculated) from last checkrun vs actual values
        dreq    -> request-delta from last checkrun vs actual values
        dcon    -> accepted-connection-delta from last checkrun vs actual values
        read    -> reading requests from clients
        writ    -> reading request body, processes request, or writes response to a client
        wait    -> keep-alive connections, actually it is ac - (read + writ)
        ct      -> checktime (connection time) for this check

    rpc/rps/dreq/dcon are always set to 0 if -n is used

    be sure to have your nginx compiled with Status-Module
    (--with-http_stub_status_module), you might want to test
    your installation with nginx -V     

    location /nginx_status {
        stub_status on;
        access_log   off;
        deny all;

    nginx compiled with HttpStubStatusModule (see Nginx-Config)

    python 2.x
    this plugin is not yet compatible with python 3.x, but it should be
    easy to convert, using 2to3

Docs & Download:

Keine Kommentare:

Kommentar veröffentlichen