You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hillebrand 31ee66fc23 changed interpreter 7 months ago
COPYING first commit 7 months ago
README added installation to readme 7 months ago
check_nginx_log changed interpreter 7 months ago

README

This is a tool for reading and parsing NGINX log files and using them in the Nagios monitoring software.

The script is messy, but it has worked for me for some time now.

USAGE

check-nginx-log
-h --help Show usage (what you're reading right now)
--logdir=/var/log/nginx The location of logfiles
--last_run_location=/tmp/nagios_nginx_log_last_run The location where a file containing the last (unix epoch) time this script was run will be stored
--warning_percentage=3 The percentage of 5xx errors that wil result in a WARNING
--critical_percentage=10 The percentage of 5xx errors that will result in a CRITICAL

REQUIREMENTS

Although the script itself is written in bash, some requirements (may) need to be installed.

- bc: Used for floating point calculations (percentages)

In addition, the user running the script will need write access to last_run_location and (the files located in) logdir.

INSTALLATION

Clone the repository to a directory that is readable and executable by the user running Nagios/NRPE.

Create a symlink for check-nginx-log to the directory that contains Nagios plugins.

Add check-nginx-log to your Nagios and/or NRPE configuration.

EXAMPLE OUTPUT

./check_nginx_log.sh
WARNING - 3.91330523780854906600% of requests failing with HTTP 5xx! | 2xx: 71.42283764800321091700%, 4xx: 24.66385711418824001600%

./check_nginx_log.sh
OK | 2xx: 50.00000000000000000000%, 4xx: 50.00000000000000000000%, 5xx: 0%