|
@@ -6,11 +6,17 @@ if [ ! -f /var/cache/salt/state_apply ] ; then echo "Statefile does not exist" ;
|
|
|
# Check age of statefile. If it's older than 2 hours, exit with unknown
|
|
|
if [ $(($(date +%s) - $(date -r /var/cache/salt/state_apply +%s))) -gt 25200 ] ; then echo "Statefile too old" ; exit 3 ; fi
|
|
|
|
|
|
-if egrep "Succeeded:.*changed=[^0]\)|Failed: [^0]" /var/cache/salt/state_apply > /dev/null ; then
|
|
|
- cat /var/cache/salt/state_apply
|
|
|
- exit 1 # warning
|
|
|
-fi
|
|
|
+if grep -o ' changed=\([0-9]\+\)' /var/cache/salt/state_apply > /dev/null ; then
|
|
|
+
|
|
|
+ ANZ_CHANGED=$(grep -o ' changed=\([0-9]\+\)' /var/cache/salt/state_apply | cut -d= -f2)
|
|
|
|
|
|
+ if [ $ANZ_CHANGED -gt 0 ] ; then
|
|
|
+ echo "IDs with changes:"
|
|
|
+ cat /var/cache/salt/state_apply | grep "ID:"
|
|
|
+ exit 1 # warning
|
|
|
+ fi
|
|
|
+
|
|
|
+fi
|
|
|
echo "Nothing to do"
|
|
|
exit 0 # ok
|
|
|
|