--- /dev/null
+#!/usr/bin/perl
+
+# Copyright (C) 2017 Georgia Public Library Service
+# Chris Sharp <csharp@georgialibraries.org>
+#
+# Nagios/Icinga check for OpenSRF Diagnostic
+#
+# Returns OK as long as all configured services are running.
+#
+# Installation:
+#
+# Copy to your Nagios plugins directory (typically /usr/lib/nagios/plugins) on
+# the remote server. Create the command in npre_local.cfg with sudo. Example:
+#
+# command[check_osrf]=sudo /usr/lib/nagios/plugins/check_osrf
+#
+# Then allow the nagios user to run the command on opensrf's behalf by adding
+# the following line using visudo:
+#
+# nagios ALL=(root) NOPASSWD: /usr/lib/nagios/plugins/check_osrf
+#
+# adjusting for the actual location of your Nagios plugins.
+
+use warnings;
+use strict;
+use Getopt::Long;
+
+my $osrf_bindir = "/openils/bin";
+my $osrf_user = "opensrf";
+my $localhost = '';
+my $command;
+my @errors;
+GetOptions( 'localhost' => \$localhost );
+
+if ($localhost) {
+ $command = "\"$osrf_bindir/osrf_control --localhost --diagnostic | grep ERR\"";
+} else {
+ $command = "\"$osrf_bindir/osrf_control --diagnostic | grep ERR\"";
+}
+
+@errors = `su - $osrf_user -c $command`;
+
+if (@errors) {
+ print "CRITICAL: At least one configured OpenSRF service not running!:\n@errors\n";
+} else {
+ print "OK: All configured OpenSRF services running.\n";
+}
+