--- /dev/null
+#!/bin/bash\r
+# Copyright (C) 2008-2013 Equinox Software, Inc.\r
+# Written by Michael Tate <mtate@esilibrary.com>\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+#\r
+# Author : Michael Tate, Sys Admin, ESI\r
+# Purpose : Check to see if any Apache processes are consuming 100% of CPU, and ennumerate them.\r
+USAGE="check_apachecpu (WARN 1, CRIT 2+)"\r
+if [[ $1 == *help* ]]; then\r
+ echo "Usage: $USAGE"\r
+ exit 0\r
+fi\r
+\r
+HIGHESTPROC=`ps -Ao pcpu,pid,args | grep -i apache | grep -v grep | sort -rn|cut -d"." -f1|head -n1`\r
+TOPPROCLIST=`ps -Ao pcpu,pid,args | grep -i apache | grep -v grep | sort -rn|cut -d"." -f1|head -n4`\r
+HIGPPROCS=0\r
+\r
+for i in `ps -Ao pcpu,pid,args | grep -i apache | grep -v grep | sort -rn|cut -d"." -f1|head -n4`; do\r
+ if [ "$i" -gt "80" ]; then\r
+ HIGPPROCS=$((HIGHPROCS++))\r
+ fi\r
+done\r
+\r
+\r
+if [ "$HIGHPROCS" -gt "1" ]; then\r
+ EXITSTATUS="CRIT: $HIGHPROCS High CPU Apache processes; Highest: $HIGHESTPROC%"\r
+ EXITCODE="2"\r
+elif [ "$HIGHPROCS" -gt "0" ]; then\r
+ EXITSTATUS="WARN: $HIGHPROCS High CPU Apache process; Usage: $HIGHESTPROC%"\r
+ EXITCODE="1"\r
+else\r
+ EXITSTATUS="OK: Highest CPU usage $HIGHESTPROC%"\r
+ EXITCODE="0"\r
+fi\r
+\r
+echo "$EXITSTATUS"\r
+exit $EXITCODE\r
+\r
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
# GNU General Public License for more details.\r
#\r
-#\r
-# Author : MTate, Sys Admin, ESI\r
# Purpose : Count AT pending events\r
-# Usage : check_at_pending <db; default to "evergreen" if empty> <username; default "evergreen"> <port database runs on, default "5432">\r
+USAGE="check_at_pending <db; default to 'evergreen' if empty> <username; default 'evergreen'> <port database runs on, default '5432'>"\r
\r
if [[ $1 == *help* ]]; then\r
- echo "Usage: check_dbquery <db; default to 'evergreen' if empty> <username; default 'evergreen'> <port database runs on, default '5432'>"\r
+ echo "Usage: $USAGE"\r
exit 0\r
fi\r
\r
-# SET/GET VARIABLES\r
- # database name\r
- if [ -n "$1" ]; then\r
- DBNAME="$1"\r
- else\r
- DBNAME="evergreen"\r
- fi\r
\r
- # database user name\r
- if [ -n "$2" ]; then\r
- DBUSER="$1"\r
- else\r
- DBUSER="evergreen"\r
- fi\r
+## GET/SET Variables ##\r
+# The values below are arbitrary, change them to match your environment.\r
+CTWARN=900000 # How many pending transactions to WARN at\r
+CTCRIT=1000000 # How many pending transactions to CRIT at\r
+\r
+# database name\r
+if [ -n "$1" ]; then\r
+ dbname="$1"\r
+else\r
+ dbname="evergreen"\r
+fi\r
\r
- # port database runs on\r
- if [ -n "$3" ]; then\r
- DBPORT="$3"\r
- else\r
- DBPORT=5432\r
- fi\r
\r
-# Execute AT Pending Count\r
-ATPENDING=`PGUSER=postgres psql -U $DBUSER -d $DBNAME -p $DBPORT -c "select count(*) from action_trigger.event where state ='pending';"|sed -n '3'p`\r
+# database user name\r
+if [ -n "$2" ]; then\r
+ dbuser="$1"\r
+else\r
+ dbuser="evergreen"\r
+fi\r
+\r
+# port database runs on\r
+if [ -n "$3" ]; then\r
+ dbport="$3"\r
+else\r
+ dbport=5432\r
+fi\r
\r
-CTWARN=900000 # These values will need modification\r
-CTCRIT=1000000 # to what is normal for your environment.\r
- # Run the check manually for two weeks \r
- # to gather the needed info\r
+## Execute Plugin ##\r
+# DB Query Count\r
+ATPENDING=`PGUSER=postgres psql -U $dbuser -d $dbname -p $dbport -c "select count(*) from action_trigger.event where state ='pending';"|sed -n '3'p`\r
\r
-# Result Analysis\r
- if [ $ATPENDING -gt $CTCRIT ]; then\r
- EXITSTATUS="CRITICAL: $ATPENDING AT events pending"\r
- EXITCODE=2\r
- elif [ $ATPENDING -gt $CTWARN ]; then\r
- EXITSTATUS="WARNING: $ATPENDING AT events pending"\r
- EXITCODE=1\r
- elif [ $ATPENDING -gt 0 ]; then\r
- EXITSTATUS="OK: $ATPENDING AT events pending"\r
+## Return results ##\r
+if [[ $ATPENDING == "-00" ]]; then\r
+ EXITSTATUS="OK: No AT events pending"\r
EXITCODE=0\r
- else\r
- if [[ $ATPENDING == "-00" ]]; then\r
- EXITSTATUS="OK: No AT events pending"\r
- EXITCODE=0\r
- fi\r
- fi\r
+else\r
+ if [ $ATPENDING -gt $CTCRIT ]; then\r
+ EXITSTATUS="CRITICAL: $ATPENDING AT events pending"\r
+ EXITCODE=2\r
+ elif [ $ATPENDING -gt $CTWARN ]; then\r
+ EXITSTATUS="WARNING: $ATPENDING AT events pending"\r
+ EXITCODE=1\r
+ else\r
+ EXITSTATUS="OK: $ATPENDING AT events pending"\r
+ EXITCODE=0\r
+ fi\r
+fi\r
\r
-# Return results\r
echo "$EXITSTATUS"\r
exit $EXITCODE\r
+\r
+\r
+\r
--- /dev/null
+#!/bin/bash\r
+# Copyright (C) 2008-2010 Equinox Software, Inc.\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+# postgres Backend Count\r
+# Written by: Equinox Software, September 22, 2010 - Lee Dickens\r
+# Modified by: Equinox Software, March 13, 2014 - Michael Tate\r
+USAGE="check_backends2 <max_connnections (default 800 if empty)> <pool|pg (default pg if empty)>"\r
+if [[ $1 == *help* ]]; then\r
+ echo "Usage: $USAGE"\r
+ exit 0\r
+fi\r
+\r
+## GET/SET Variables ##\r
+# Use "max_connections" from postgresql.conf\r
+if [ -n "$1" ]; then\r
+ MAXCX=$1\r
+else\r
+ MAXCX="800"\r
+# MAXCX=`grep max_connections $(find /etc/postgresql/ -name postgresql.conf|tail -n1)` | grep -v "^#"|tr -cd '[[:digit:]]{}'`\r
+fi\r
+\r
+# Platform: plain postgres or pgpool\r
+if [ -n "$2" ]; then\r
+ PLATCX=$2\r
+else\r
+ PLATCX="pg"\r
+fi\r
+\r
+if [[ $PLATCX == "pg" ]]; then\r
+ PGCX=$MAXCX\r
+ # PG warn and crit, high and low\r
+ PGCXWL=$(($PGCX/10)) # PostgreSQL number of connections WARN level, low (10% of max)\r
+ PGCXCL=$(($PGCXWL/2)) # PostgreSQL number of connections CRIT level, low (5% of max)\r
+ PGCXC=$(($PGCX-$PGCXWL)) # PostgreSQL number of connections CRIT level, high (90% of max)\r
+ PGCXW=$(($PGCXC-$PGCXWL)) # PostgreSQL number of connections WARN level, high (80% of max)\r
+ PGACT=`ps ax|grep -v grep | grep -c postgres`\r
+\r
+ if [ $PGACT -lt $PGCXCL ]; then\r
+ EXITSTATUS="CRIT: postgresql backends = $PGACT/$PGCX"\r
+ EXITCODE=2\r
+ elif [ $PGACT -lt $PGCXWL ]; then\r
+ EXITSTATUS="WARN: postgresql backends = $PGACT/$PGCX"\r
+ EXITCODE=1\r
+ elif [ $PGACT -gt $PGCXW ]; then\r
+ EXITSTATUS="WARN: postgresql backends = $PGACT/$PGCX"\r
+ EXITCODE=1\r
+ elif [ $PGACT -gt $PGCXW ]; then\r
+ EXITSTATUS="CRIT: postgresql backends = $PGACT/$PGCX"\r
+ EXITCODE=2\r
+ else\r
+ EXITSTATUS="OK: postgresql backends = $PGACT/$PGCX"\r
+ EXITCODE=0\r
+ fi\r
+\r
+elif [[ $PLATCX == "pool" ]]; then\r
+ POOLCX=$MAXCX\r
+ # PGPOOL warn and crit, high and low\r
+ POOLCXWL=$(($PGCX/10)) # PostgreSQL number of connections WARN level, low (10% of max)\r
+ POOLCXCL=$(($PGCXWL/2)) # PostgreSQL number of connections CRIT level, low (5% of max)\r
+ POOLCXC=$(($PGCX-$PGCXWL)) # PostgreSQL number of connections CRIT level, high (90% of max)\r
+ POOLCXW=$(($PGCXC-$PGCXWL)) # PostgreSQL number of connections WARN level, high (80% of max)\r
+ POOLACT=`ps ax|grep -v "wait\|grep" | grep -c pgpool`\r
+\r
+ if [ $POOLACT -lt $POOLACTCXCL ]; then\r
+ EXITSTATUS="CRIT: postgresql backends = $PGACT/$PGCX and pgpool backends = $POOLACT/$POOLACTCX"\r
+ EXITCODE=2\r
+ elif [ $POOLACT -lt $POOLACTCXWL ]; then\r
+ EXITSTATUS="WARN: postgresql backends = $PGACT/$PGCX and pgpool backends = $POOLACT/$POOLACTCX"\r
+ EXITCODE=1\r
+ elif [ $POOLACT -gt $POOLACTCXC ]; then\r
+ EXITSTATUS="CRIT: postgresql backends = $PGACT/$PGCX and pgpool backends = $POOLACT/$POOLACTCX"\r
+ EXITCODE=2\r
+ elif [ $POOLACT -gt $POOLACTCXW ]; then\r
+ EXITSTATUS="WARN: postgresql backends = $PGACT/$PGCX and pgpool backends = $POOLACT/$POOLACTCX"\r
+ EXITCODE=1\r
+ else\r
+ EXITSTATUS="OK: pgpool backends = $POOLACT/$POOLACTCX"\r
+ EXITCODE=0\r
+ fi\r
+\r
+else\r
+ echo "Usage: $USAGE"\r
+ exit 0\r
+fi\r
+\r
+\r
+echo "$EXITSTATUS"\r
+exit $EXITCODE\r
+\r
--- /dev/null
+#!/bin/bash\r
+# Copyright (C) 2008-2010 Equinox Software, Inc.\r
+# Written by Lee Dickens <leed@esilibrary.com>\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+#\r
+# Author : Lee Dickens, Sys Admin, ESI\r
+# Updated : 07-MAR-2011, Michael Tate, Sys Admin, ESI: Added arguments\r
+# Purpose : Look for long-running queries: Warn when older than 5 hours, Critical at 7.\r
+USAGE="check_dbquery <db (default 'evergreen' if empty)> <username (default 'evergreen')> <port database runs on (default '5432')>"\r
+\r
+if [[ $1 == *help* ]]; then\r
+ echo "Usage: $USAGE"\r
+ exit 0\r
+fi\r
+\r
+## GET/SET Variables ##\r
+# database name\r
+if [ -n "$1" ]; then\r
+ dbname="$1"\r
+else\r
+ dbname="evergreen"\r
+fi\r
+\r
+# database user name\r
+if [ -n "$2" ]; then\r
+ dbuser="$1"\r
+else\r
+ dbuser="evergreen"\r
+fi\r
+\r
+# port database runs on\r
+if [ -n "$3" ]; then\r
+ dbport="$3"\r
+else\r
+ dbport=5432\r
+fi\r
+\r
+\r
+## Execute DB Query Count ##\r
+count=`PGUSER=postgres psql -U $dbuser -d $dbname -p $dbport -c "select now()-query_start from pg_stat_activity where current_query NOT LIKE '<IDL%' AND current_query NOT LIKE '%vacuum%' order by query_start asc limit 1;"|sed -n 3p|cut -d: -f1|sed 's/^[ \t]*//'`\r
+\r
+\r
+## Return results ##\r
+if [[ $count == "-00" ]]; then\r
+ echo "OK: No long running queries"\r
+ exit 0\r
+else \r
+\r
+ if [ $count -gt "07" ]; then\r
+ echo "CRITICAL: Longest query running for over $count hours"\r
+ exit 2\r
+\r
+ elif [ $count -gt "05" ]; then \r
+ echo "WARNING: Longest query running for over $count hours"\r
+ exit 1\r
+\r
+ else \r
+ echo "OK: Longest query running for over $count hours"\r
+ exit 0\r
+ fi \r
+fi\r
+\r
--- /dev/null
+#!/bin/sh\r
+#\r
+# Copyright (C) 2008-2009 Equinox Software, Inc.\r
+# Written by Dave Brown <dbrown@esilibrary.com>\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+#\r
+# Author : Dave Brown, Sys Admin, ESI\r
+# Last Updated : Sept 5, 2009\r
+# Purpose : Check status of file name and process from CL variables.\r
+# Usage : check_lock <filename> <process>\r
+\r
+\r
+scriptname=$0\r
+filetocheck=$1\r
+proctocheck=$2\r
+\r
+if [ -f $filetocheck ]; then\r
+ if [ "$(ps aux | grep -i $proctocheck | grep -v grep | grep -v $scriptname | wc -l)" -gt 0 ]; then\r
+ echo "OK: $filetocheck exists and $proctocheck running"\r
+ exit 0\r
+ else\r
+ echo "CRIT: $filetocheck exists but $proctocheck not running"\r
+ exit 2\r
+ fi\r
+else\r
+ echo "OK: $filetocheck not found"\r
+ exit 0\r
+fi\r
+\r
--- /dev/null
+#!/bin/bash\r
+# Copyright (C) 2008-2013 Equinox Software, Inc.\r
+# Written by Michael Tate <mtate@esilibrary.com>\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+#\r
+# Author : Michael Tate, Sys Admin, ESI\r
+# Purpose : Compare available MEM to SWAP\r
+USAGE="check_mem_swap (CRIT if swapuse > freemem)"\r
+if [[ $1 == *help* ]]; then\r
+ echo "Usage: $USAGE"\r
+ exit 0\r
+fi\r
+\r
+# RULE: avail + buffers + cache == freemem\r
+# mem + buffers\r
+MFREE=`free -m|grep Mem|cut -c30-41`\r
+read -rd '' MFREE <<< "$MFREE"\r
+BCFREE=`free -m|grep buffers|grep -v cached|cut -c30-41`\r
+read -rd '' BCFREE <<< "$BCFREE"\r
+# swap\r
+SWUSE=`free -m|grep Swap|cut -c19-30`\r
+read -rd '' SWUSE <<< "$SWUSE"\r
+SWTOT=$(free -m|grep Swap|cut -c12-19)\r
+read -rd '' SWTOT <<< "$SWTOT"\r
+SWPCT=$((($SWUSE*100)/($SWTOT)))\r
+scale=2\r
+\r
+MFREETOT=$(($MFREE + $BCFREE))\r
+MFREENET=$(($MFREETOT - $SWUSE))\r
+MFREEWARN=$((($MFREETOT * 66)/100))\r
+\r
+if [ $SWPCT -ge 66 ]; then\r
+ if [ $SWUSE -ge $MFREETOT ]; then\r
+ EXITSTATE="CRIT: Swap use: $[SWUSE]MB ($[SWPCT]%); Mem Free: $[MFREETOT]MB"\r
+ EXITCODE=2\r
+ elif [ $(($SWUSE * 100)) -ge $(($MFREETOT * 66)) ]; then\r
+ EXITSTATE="WARN: Swap use: $[SWUSE]MB ($[SWPCT]%); Mem Free: $[MFREETOT]MB"\r
+ EXITCODE=1\r
+ fi\r
+else\r
+ EXITSTATE="OK: Swap use: $[SWUSE]MB ($[SWPCT]%); Mem Free: $[MFREETOT]MB"\r
+ EXITCODE=0\r
+fi\r
+\r
+echo "$EXITSTATE"\r
+exit $EXITCODE\r
+\r
-#!/bin/sh
-# Copyright (C) 2008-2013 Equinox Software, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# Author : Michael Tate, Sys Admin, ESI, to allow for a path from the command line
-# Based on code written by Don McMorris <dmcmorris@esilibrary.com>; see check_null
-# Purpose : Look for excessive NOT CONNECTEDS in the osrfsys logs
-
-USAGE="check_notconnected <LOG PATH>"
-# <LOG PATH> : The path to the log location.
-# : This plugin assumes that the logs will be dropped into folders for
-# : year (4 char), month (2 char), and day (2 char).
-# : If no path is entered, it will default to "/var/log/evergreen/prod/"
-
-
-if [ -n "$1" ]; then
- if [[ $1 == *help* ]]; then
- EXITSTATUS="$USAGE"
- EXITCODE="0"
- else
-
-
- if [ -n "$1" ]; then
- LOGPATH="$1/$(date +%Y/%m/%d)"
- else
- LOGPATH="/var/log/evergreen/prod/$(date +%Y/%m/%d)"
- fi
-
-LOGFILE="$LOGPATH/osrfsys.$(date +%H).log"
-
-
-NCCOUNT=`grep -c 'IS NOT CONNECTED TO THE NETWORK' $LOGFILE`
-
- if [ "$NCCOUNT" -gt "0" ]; then
- TOPSERVER=$(grep "IS NOT CONNECTED TO THE NETWORK" $LOGFILE | cut -d" " -f3 | sort | uniq -c | sort -nr | head -1)
- SVRMSG=" (Top server this hour: $TOPSERVER)"
- else
- SVRMSG="."
- fi
-
- if [ "$NCCOUNT" -ge "4" ]; then
- EXITSTATUS="CRIT: $NCCOUNT NOT CONNECTEDs returned this hour:$SVRMSG"
- EXITCODE="2"
- elif [ "$NCCOUNT" -ge "2" ]; then
- EXITSTATUS="WARN: $NCCOUNT NOT CONNECTEDs returned this hour:$SVRMSG"
- EXITCODE="1"
- elif [ "$NCCOUNT" -lt "2" ]; then
- EXITSTATUS="OK: $NCCOUNT NOT CONNECTEDs returned this hour$SVRMSG"
- EXITCODE="0"
- else
- EXITSTATUS="WARN: An error has occurred in the plugin"
- EXITCODE="1"
- fi
-
- fi
-fi
-
-echo "$EXITSTATUS"
-exit $EXITCODE
-
+#!/bin/sh\r
+# Copyright (C) 2008-2010 Equinox Software, Inc.\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+#\r
+# Author : Michael Tate, Sys Admin, ESI\r
+# Purpose : Look for excessive NOT CONNECTEDS in the osrfsys logs in the current hour\r
+USAGE="check_notconnected <logpath (default to /var/log/evergreen/prod/, assumes central logging)>"\r
+if [[ $1 == *help* ]]; then\r
+ echo "Usage: $USAGE"\r
+ exit 0\r
+fi\r
+\r
+## GET/SET Variables ##\r
+CRITLIMIT=20\r
+WARNLIMIT=12\r
+\r
+# logfile path\r
+if [ -n "$1" ]; then\r
+ LOGPATH="$1"\r
+else\r
+ LOGPATH="/var/log/evergreen/prod"\r
+fi\r
+\r
+NCCOUNT=`grep -c "IS NOT CONNECTED TO THE NETWORK" $LOGPATH/$(date +%Y/%m/%d)/osrfsys.$(date +%H).log`\r
+if [ $NCCOUNT -ge $CRITLIMIT ]; then\r
+ TOPSERVER=$(grep "IS NOT CONNECTED TO THE NETWORK" $LOGFILE | cut -d" " -f3 | sort | uniq -c | sort -nr | head -1)\r
+ SVRMSG=" (Top server this hour: $TOPSERVER)"\r
+ EXITSTATUS="CRIT"\r
+ EXITCODE=2\r
+elif [ $NCCOUNT -ge $WARNLIMIT ]; then\r
+ TOPSERVER=$(grep "IS NOT CONNECTED TO THE NETWORK" $LOGFILE | cut -d" " -f3 | sort | uniq -c | sort -nr | head -1)\r
+ SVRMSG=" (Top server this hour: $TOPSERVER)"\r
+ EXITSTATUS="WARN"\r
+ EXITCODE=1\r
+elif [[ $NCCOUNT -lt $WARNLIMIT ]; then\r
+ EXITSTATUS="OK"\r
+ EXITCODE=0\r
+ SVRMSG="."\r
+else\r
+ EXITSTATUS="WARN: An error has occurred $PREVTOT $PERIOD"\r
+ EXITCODE=1\r
+fi\r
+\r
+echo "$EXITSTATUS: $NCCOUNT NOT CONNECTEDs returned this hour$SVRMSG"\r
+exit $EXITCODE\r
+\r
+\r
-#!/bin/sh
-# Copyright (C) 2008-2010 Equinox Software, Inc.
-# Written by Don McMorris <dmcmorris@esilibrary.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-#
-# Author : Don McMorris, Sys Admin, ESI
-# Modified : Michael Tate, Sys Admin, ESI, to allow for a path from the command line
-# Purpose : Look for excessive NULLS in the gateway logs
-
-USAGE="check_null <# mins to check> <WARNLIMIT> <CRITLIMIT> <LOG PATH>"
-# <# mins to check> : Check for errors in the last # minutes
-# <WARNLIMIT> : The number of NULLS in the logs at which to present a warning condition.
-# <CRITLIMIT> : The number of NULLS on the logs at which to present a critical condition.
-# <LOG PATH> : The path to the log location.
-# : This plugin assumes that the logs will be dropped into folders for
-# : year (4 char), month (2 char), and day (2 char).
-# : If no path is entered, it will default to "/var/log/evergreen/prod/"
-
-if [ -n "$1" ]; then
- if [[ $1 == *help* ]]; then
- else
-
-PERIOD=$1
-WARNLIMIT=$2
-CRITLIMIT=$3
- if [ -n "$4" ]; then
- LOGPATH="$4/$(date +%Y/%m/%d)"
- else
- LOGPATH="/var/log/evergreen/prod/$(date +%Y/%m/%d)"
- fi
-
-PREVTOT=0
-LOGFILE="$LOGPATH/gateway.$(date +%H).log"
-
-if [ $(date +%H | cut -b1) = 0 ]; then
- CURRHOUR=$(date +%H | cut -b2)
-else
- CURRHOUR=$(date +%H)
-fi
-
-if [ $(date +%M | cut -b1) = 0 ]; then
- CURRMIN=$(date +%M | cut -b2 )
-else
- CURRMIN=$(date +%M)
-fi
-
-if [ $CURRMIN -lt $PERIOD ]; then
- # How many minutes of the last hour do we need to check?
- TMPDIFFM2=$((60 - $(($PERIOD - $CURRMIN))))
-
- # This logic will mean that "Returning NULL"'s logged at the late 2300 hour will not be counted during the early Midnight hour check.
- # This is acceptable for now.
- if [ $CURRHOUR -gt 0 ]; then
- # define LOGFILE2 (last hours' log)
- if [ $CURRHOUR -gt 11 ]; then
- LOGFILE2="$LOGPATH/gateway.$(($CURRHOUR - 1)).log"
- else
- LOGFILE2="$LOGPATH/gateway.0$(($CURRHOUR - 1)).log"
- fi
-
- while [ $TMPDIFFM2 -lt 60 ]; do
- PREVTOT=$(($PREVTOT + $(grep "Returning NULL" $LOGFILE2 | cut -d":" -f2 | grep -c $TMPDIFFM2)))
- TMPDIFFM2=$(($TMPDIFFM2 + 1))
- done
- fi
- while [ $TMPDIFF1 -le $CURRMIN ]; do
- PREVTOT=$(($PREVTOT + $(grep "Returning NULL" $LOGFILE | cut -d":" -f2 | grep -c $TMPDIFF1)))
- TMPDIFF1=$(($TMPDIFF1 + 1))
- done
-else
- TMPDIFF1=$(($CURRMIN-$PERIOD))
- while [ $TMPDIFF1 -le $CURRMIN ]; do
- PREVTOT=$(($PREVTOT + $(grep "Returning NULL" $LOGFILE | cut -d":" -f2 | grep -c $TMPDIFF1)))
- TMPDIFF1=$(($TMPDIFF1 + 1))
- done
-
-fi
-
-
-TOPSERVER=$(grep "Returning NULL" $LOGFILE | cut -d" " -f3 | sort | uniq -c | sort -nr | head -1)
-
-if [ "$TOPSERVER" != null ]; then
- SVRMSG=" (Top server this hour: $TOPSERVER)"
-else
- SVRMSG="."
-fi
-
-if [ $PREVTOT -ge $CRITLIMIT ]; then
- echo "CRIT: $PREVTOT NULLs returned in past $PERIOD minutes$SVRMSG"
- exit 2
-elif [ $PREVTOT -ge $WARNLIMIT ]; then
- echo "WARN: $PREVTOT NULLs returned in the past $PERIOD minutes$SVRMSG"
- exit 1
-elif [ $PREVTOT -lt $WARNLIMIT ]; then
- echo "OK: $PREVTOT NULLs returned in the past $PERIOD minutes$SVRMSG"
- exit 0
-else
- echo "WARN: An error has occurred $PREVTOT $PERIOD"
- exit 1
-fi
-
-
-fi
-
+#!/bin/sh\r
+# Copyright (C) 2008-2010 Equinox Software, Inc.\r
+# Written by Don McMorris <dmcmorris@esilibrary.com>\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+#\r
+# Author : Don McMorris, Sys Admin, ESI\r
+# Purpose : Look for excessive NULLS in the gateway logs\r
+# Usage : check_null <# mins to check> <WARNLIMIT> <CRITLIMIT>\r
+\r
+\r
+WARNLIMIT=$2\r
+CRITLIMIT=$3\r
+PERIOD=$1\r
+# Note: These should really be checked to ensure they are defined and within range...\r
+\r
+PREVTOT=0\r
+LOGFILE="/var/log/evergreen/prod/$(date +%Y/%m/%d)/gateway.$(date +%H).log"\r
+\r
+if [ $(date +%H | cut -b1) = 0 ]; then\r
+ CURRHOUR=$(date +%H | cut -b2)\r
+else\r
+ CURRHOUR=$(date +%H)\r
+fi\r
+\r
+if [ $(date +%M | cut -b1) = 0 ]; then\r
+ CURRMIN=$(date +%M | cut -b2 )\r
+else\r
+ CURRMIN=$(date +%M)\r
+fi\r
+\r
+if [ $CURRMIN -lt $PERIOD ]; then\r
+ # How many minutes of the last hour do we need to check?\r
+ TMPDIFFM2=$((60 - $(($PERIOD - $CURRMIN))))\r
+\r
+ # This logic will mean that "Returning NULL"'s logged at the late 2300 hour will not be counted during the early Midnight hour check.\r
+ # This is acceptable for now.\r
+ if [ $CURRHOUR -gt 0 ]; then\r
+ # define LOGFILE2 (last hours' log)\r
+ if [ $CURRHOUR -gt 11 ]; then\r
+ LOGFILE2="/var/log/evergreen/prod/$(date +%Y/%m/%d)/gateway.$(($CURRHOUR - 1)).log"\r
+ else\r
+ LOGFILE2="/var/log/evergreen/prod/$(date +%Y/%m/%d)/gateway.0$(($CURRHOUR - 1)).log"\r
+ fi\r
+\r
+ while [ $TMPDIFFM2 -lt 60 ]; do\r
+ PREVTOT=$(($PREVTOT + $(grep "Returning NULL" $LOGFILE2 | cut -d":" -f2 | grep -c $TMPDIFFM2)))\r
+ TMPDIFFM2=$(($TMPDIFFM2 + 1))\r
+ done\r
+ fi\r
+ while [ $TMPDIFF1 -le $CURRMIN ]; do\r
+ PREVTOT=$(($PREVTOT + $(grep "Returning NULL" $LOGFILE | cut -d":" -f2 | grep -c $TMPDIFF1)))\r
+ TMPDIFF1=$(($TMPDIFF1 + 1))\r
+ done\r
+else\r
+ TMPDIFF1=$(($CURRMIN-$PERIOD))\r
+ while [ $TMPDIFF1 -le $CURRMIN ]; do\r
+ PREVTOT=$(($PREVTOT + $(grep "Returning NULL" $LOGFILE | cut -d":" -f2 | grep -c $TMPDIFF1)))\r
+ TMPDIFF1=$(($TMPDIFF1 + 1))\r
+ done\r
+\r
+fi\r
+\r
+\r
+TOPSERVER=$(grep "Returning NULL" $LOGFILE | cut -d" " -f3 | sort | uniq -c | sort -nr | head -1)\r
+\r
+if [ "$TOPSERVER" != null ]; then\r
+ SVRMSG=" (Top server this hour: $TOPSERVER)"\r
+else\r
+ SVRMSG="."\r
+fi\r
+\r
+if [ $PREVTOT -ge $CRITLIMIT ]; then\r
+ echo "CRIT: $PREVTOT NULLs returned in past $PERIOD minutes$SVRMSG"\r
+ exit 2\r
+elif [ $PREVTOT -ge $WARNLIMIT ]; then\r
+ echo "WARN: $PREVTOT NULLs returned in the past $PERIOD minutes$SVRMSG"\r
+ exit 1\r
+elif [ $PREVTOT -lt $WARNLIMIT ]; then\r
+ echo "OK: $PREVTOT NULLs returned in the past $PERIOD minutes$SVRMSG"\r
+ exit 0\r
+else\r
+ echo "WARN: An error has occurred $PREVTOT $PERIOD"\r
+ exit 1\r
+fi\r
+\r
--- /dev/null
+#!/bin/bash\r
+# Copyright (C) 2012 Equinox Software, Inc.\r
+# Written by Michael Tate <mtate@esilibrary.com>\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+#\r
+# Author : Michael Tate, Sys Admin, ESI\r
+# Purpose : Check number of DISABLED pound forwarders\r
+USAGE="check_pound_rotation (WARN if 1 brick, CRIT if 2 or more)"\r
+if [[ $1 == *help* ]]; then\r
+ echo "Usage: $USAGE"\r
+ exit 0\r
+fi\r
+\r
+\r
+PCOUNT=`sudo poundctl -c /var/run/pound/poundctl.socket | grep -c DISABLED`\r
+PDETAIL=`sudo poundctl -c /var/run/pound/poundctl.socket | grep DISABLED |cut -d":" -f1|cut -c18-|sort|uniq`\r
+\r
+if [[ $1 == *help* ]]; then\r
+ echo "Usage: $USAGE"\r
+else\r
+ if [ $PCOUNT -gt 0 ]; then\r
+ EXITSTATUS="WARN: $PCOUNT Services disabled; "\r
+ EXITCODE=1\r
+ elif [ $PCOUNT -gt 2 ]; then\r
+ EXITSTATUS="CRIT: $PCOUNT Services disabled; "\r
+ EXITCODE=2\r
+ elif [ $PCOUNT -lt 1 ]; then\r
+ EXITSTATUS="OK: $PCOUNT Services disabled."\r
+ EXITCODE=0\r
+ fi\r
+fi\r
+\r
+\r
+echo -n $EXITSTATUS\r
+echo $PDETAIL\r
+exit $EXITCODE\r
+\r
+\r
--- /dev/null
+#!/bin/sh\r
+# Copyright (C) 2008-2010 Equinox Software, Inc.\r
+#\r
+# This program is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU General Public License\r
+# as published by the Free Software Foundation; either version 2\r
+# of the License, or (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+# Slony replication status nagios check\r
+# Written by: Equinox Software, April 19, 2010 - Lee Dickens\r
+. /etc/profile\r
+count=`PGUSER=postgres psql -U evergreen evergreen -c "select st_lag_num_events from _replication.sl_status;"|sed -n 3p|sed 's/^[ \t]*//'`\r
+if [ $count -gt 200 ]; then\r
+ echo "CRITICAL: Slony Replication Lag: st_lag_num_events = $count"\r
+ exit 2\r
+fi\r
+if [ $count -gt 150 ]; then \r
+ echo "WARNING: Slony Replication Lag: st_lag_num_events = $count"\r
+ exit 1\r
+fi\r
+echo "OK: Slony Replication In Sync: st_lag_num_events = $count"\r
+exit 0\r
+\r