Hooray! I' ve just completed another nagios script to help you find if some of your network hosts aren't logging well in graylog2. This script is using graylog2 API ex. http://graylog2.somehost.com:12900/api-browser and exchange JSON data. To understand the logic behind the script you are going to query the graylog2 api to send to you all the hosts for the last n hours.
for example: ./check_graylog2_sources.pl -H 192.168.1.1 -P 12900 -u admin -p password -t 24 -s 60 -w 1 -c 2 -v is checking host 192.168.1.1 on port 12900 with username admin and password "password" for the last 24h to see all the hosts are logging. -s switch is telling to script "You must see 60 total hosts" and if you get less than 60 hosts alert me with warning if missing 1 hosts or with critical if missing 2 or more hosts.
You can download the script here
:)
for example: ./check_graylog2_sources.pl -H 192.168.1.1 -P 12900 -u admin -p password -t 24 -s 60 -w 1 -c 2 -v is checking host 192.168.1.1 on port 12900 with username admin and password "password" for the last 24h to see all the hosts are logging. -s switch is telling to script "You must see 60 total hosts" and if you get less than 60 hosts alert me with warning if missing 1 hosts or with critical if missing 2 or more hosts.
You can download the script here
:)