CHips L MINI SHELL

CHips L pro

Current Path : /proc/self/root/proc/2/root/proc/2/root/usr/lib64/nagios/plugins/
Upload File :
Current File : //proc/self/root/proc/2/root/proc/2/root/usr/lib64/nagios/plugins/check_nodewatch.sh

#!/bin/bash
# Icinga Plugin to alert Nodewatch alerts.
# Author : Priya Agni
ALERT=$(find /var/log/nodewatch -cmin -60 -name alert)
LAST_ALERT=$(cat /var/log/nodewatch_lastalert)
if [ -z "$ALERT" ]
  then
  echo "All Containers OK"
  >/var/log/nodewatch_lastalert
  exit 0
elif [ -z "$(echo $ALERT |grep $LAST_ALERT)" ]
  then
  echo "WARNING : `cat $ALERT` "
  echo $ALERT |awk -F/ '{print $(NF-1)}' > /var/log/nodewatch_lastalert
  exit 1
  else
  {
  ALERT=$(echo $ALERT |sed -n -e "s/^.*$LAST_ALERT\/alert//p")
  if [ -z "$ALERT" ]
  then
  echo "All Containers OK"
  exit 0
  else
  echo "WARNING : `cat $ALERT` "
  echo $ALERT |awk -F/ '{print $(NF-1)}' > /var/log/nodewatch_lastalert
  exit 1
  fi
  }
fi

Copyright 2K16 - 2K18 Indonesian Hacker Rulez