]> git.evergreen-ils.org Git - contrib/equinox.git/blob - monitoring/nagios/check_pound_rotation
errant line sending a copy of the row
[contrib/equinox.git] / monitoring / nagios / check_pound_rotation
1 #!/bin/bash\r
2 # Copyright (C) 2012  Equinox Software, Inc.\r
3 # Written by Michael Tate <mtate@esilibrary.com>\r
4 #\r
5 # This program is free software; you can redistribute it and/or\r
6 # modify it under the terms of the GNU General Public License\r
7 # as published by the Free Software Foundation; either version 2\r
8 # of the License, or (at your option) any later version.\r
9 #\r
10 # This program is distributed in the hope that it will be useful,\r
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 # GNU General Public License for more details.\r
14 #\r
15 #\r
16 # Author       : Michael Tate, Sys Admin, ESI\r
17 # Purpose      : Check number of DISABLED pound forwarders\r
18 USAGE="check_pound_rotation (WARN if 1 brick, CRIT if 2 or more)"\r
19 if [[ $1 == *help* ]]; then\r
20   echo "Usage: $USAGE"\r
21   exit 0\r
22 fi\r
23 \r
24 \r
25 PCOUNT=`sudo poundctl -c /var/run/pound/poundctl.socket | grep -c DISABLED`\r
26 PDETAIL=`sudo poundctl -c /var/run/pound/poundctl.socket | grep DISABLED |cut -d":" -f1|cut -c18-|sort|uniq`\r
27 \r
28 if [[ $1 == *help* ]]; then\r
29   echo "Usage: $USAGE"\r
30 else\r
31  if [ $PCOUNT -gt 0 ]; then\r
32    EXITSTATUS="WARN: $PCOUNT Services disabled; "\r
33    EXITCODE=1\r
34  elif [ $PCOUNT -gt 2 ]; then\r
35    EXITSTATUS="CRIT: $PCOUNT Services disabled; "\r
36    EXITCODE=2\r
37  elif [ $PCOUNT -lt 1 ]; then\r
38    EXITSTATUS="OK: $PCOUNT Services disabled."\r
39    EXITCODE=0\r
40  fi\r
41 fi\r
42 \r
43 \r
44 echo -n $EXITSTATUS\r
45 echo $PDETAIL\r
46 exit $EXITCODE\r
47 \r
48 \r