3 # Copyright (C) 2017 Georgia Public Library Service
4 # Chris Sharp <csharp@georgialibraries.org>
6 # Nagios/Icinga check for OpenSRF Diagnostic
8 # Returns OK as long as all configured services are running.
12 # Copy to your Nagios plugins directory (typically /usr/lib/nagios/plugins) on
13 # the remote server. Create the command in npre_local.cfg with sudo. Example:
15 # command[check_osrf]=sudo /usr/lib/nagios/plugins/check_osrf
17 # Then allow the nagios user to run the command on opensrf's behalf by adding
18 # the following line using visudo:
20 # nagios ALL=(root) NOPASSWD: /usr/lib/nagios/plugins/check_osrf
22 # adjusting for the actual location of your Nagios plugins.
28 my $osrf_bindir = "/openils/bin";
29 my $osrf_user = "opensrf";
33 GetOptions( 'localhost' => \$localhost );
36 $command = "\"$osrf_bindir/osrf_control --localhost --diagnostic | grep ERR\"";
38 $command = "\"$osrf_bindir/osrf_control --diagnostic | grep ERR\"";
41 @errors = `su - $osrf_user -c $command`;
44 print "CRITICAL: At least one configured OpenSRF service not running!:\n@errors\n";
47 print "OK: All configured OpenSRF services running.\n";