catinello / nagios-check-graylog2

Nagios Graylog2 checks via REST API the availability of the service.
BSD 2-Clause "Simplified" License
9 stars 10 forks source link
graylog2 monitoring nagios

nagios-check-graylog2

Nagios Graylog2 checks via REST API the availability of the service.

This plugin is written in standard Go which means there are no third party libraries used and it is plattform independant. It can compile on all available Go architectures and operating systems (Linux, *BSD, Mac OS X, Windows, ...).

Installation:

Just download the source and build it yourself using the go-tools.

$ go get github.com/catinello/nagios-check-graylog2
$ mv $GOPATH/bin/nagios-check-graylog2 check_graylog2

Usage:

check_graylog2
  -c string
        Index error critical limit. (optional)
  -insecure
        Accept insecure SSL/TLS certificates. (optional)
  -l string
        Graylog API URL (default "http://localhost:12900")
  -p string
        API password
  -u string
        API username
  -version
        Display version and license information. (info)
  -w string
        Index error warning limit. (optional)

Debugging:

Please try your command with the environment variable set as NCG2=debug or prefixing your command for example on linux like this.

NCG2=debug /usr/local/nagios/libexec/check_graylog2 -l http://localhost:9000/api/ -u USERNAME -p PASSWORD -w 10 -c 20

Examples:

$ ./check_graylog2 -l http://localhost:12900 -u USERNAME -p PASSWORD -w 10 -c 20
OK - Service is running!
768764376 total events processed
0 index failures
297 throughput
1 sources
Check took 94ms
|time=0.0094;;;; total=768764376;;;; sources=1;;;; throughput=297;;;; index_failures=0;;;;

$ ./check_graylog2 -l http://localhost:12900 -u USERNAME -p PASSWORD -w 10 -c 20
CRITICAL - Can not connect to Graylog2 API|time=0.000000;;;; total=0;;;; sources=0;;;; throughput=0;;;; index_failures=0;;;;

$ ./check_graylog2 -l https://localhost -insecure -u USERNAME -p PASSWORD -w 10 -c 20
UNKNOWN - Port number is missing. Try https://hostname:port|time=0.000000;;;; total=0;;;; sources=0;;;; throughput=0;;;; index_failures=0;;;;

 $ ./check_graylog2 -l http://localhost:12900 -u USERNAME -p PASSWORD -w 10 -c 20
CRITICAL - Index Failure above Critical Limit!
Service is running
533732628 total events processed
21 index failures
297 throughput
1 sources
Check took 94ms
|time=0.0094;;;; total=533732628;;;; sources=1;;;; throughput=297;;;; index_failures=21;;;;

Return Values:

Nagios return codes are used.

0 = OK
1 = WARNING
2 = CRITICAL
3 = UNKNOWN

License:

© Antonino Catinello - BSD-License