This is a bash script made to work with nagios and to automaticly check Amazon AWS status
based on the RSS from http://status.aws.amazon.com/
I did find something similar in Ruby
I tried to keep it simple as possible…
Here is the code

p>Here is the code:

#!/bin/bash
#
# Check if aws has any errors today, KISS(Keeping it Simple :)
# Used with nagios
#
# by Felipe Ferreira Set/2015
D=`date +"%a, %d %b %Y"`
CHECK=0
T=$1
C=$2
if [ -z $T ]; then
   echo "Unkown Parameter, please check http://status.aws.amazon.com/ for all options."
   echo "Examples:"
   echo "autoscaling-us-east-1"
   echo "elb-us-east-1"
   exit 2
fi
if [ -z $C ]; then
   C=1
fi
CMD="curl --connect-timeout 5 --retry 3 -s 'http://status.aws.amazon.com/rss/${T}.rss' |grep -B4 '${D}' |grep -c text"
#cho $CMD
CHECK=`eval $CMD`
CHECK=`expr $CHECK - 1` #Disconsider default text from beginig
if [ $CHECK -ge $C ]; then
   echo "CRITICAL - Found $CHECK erros on $T $D |errors=$CHECK"
   exit 2
else
   echo "OK - Found $CHECK erros on $T $D |errors=$CHECK"
   exit 0
fi

Tags: , , , ,

1 thought on “script to check aws status

  1. Hi,
    I seem to get the same status back what ever I put into the script. Does this still work? I can’t see why it wouldn’t… No matter what I put as the parameter (real or not) I get the following:
    OK – Found -1 erros on route53 Fri, 03 Jun 2016 |errors=-1
    Any ideas?
    Thanks
    Michael

Leave a Reply

Your email address will not be published. Required fields are marked *