mars/monitoring/zabbix/mars-cron-job

29 lines
922 B
Plaintext
Raw Normal View History

#!/bin/bash
2014-02-05 13:37:35 +00:00
# v 0.02
# modify by jms at Fri Jan 31 14:11:36 CET 2014
# zabbix mars
2014-02-05 13:37:35 +00:00
TEMPFILE="/tmp/zabbix.mars"
echo -n >$TEMPFILE
2014-02-05 13:37:35 +00:00
if [ "`lsmod|grep mars|grep -v grep`" == "" ]; then
exit 0
else
# statistic
find /proc/sys/mars -name "*" -nowarn -exec echo -n {}" " \; -exec cat {} \; >$TEMPFILE 2>&1
# status
HOSTNAME="`/bin/hostname`"
ls -ld /mars/resource-*|awk '{print $9}'|sed -e 's!.*resource-!!g' | \
while read RESNAME; do
#echo "-> $HOSTNAME - $RESNAME"
echo "# actual $RESNAME $HOSTNAME" >>$TEMPFILE
ls -ld /mars/resource-$RESNAME/actual-$HOSTNAME/* | sed -e 's!.*/actual-.*/!!g' | awk '{print "status '$RESNAME' " $1 " " $3}' >>$TEMPFILE
echo "# todo $RESNAME $HOSTNAME" >>$TEMPFILE
ls -ld /mars/resource-$RESNAME/todo-$HOSTNAME/* | sed -e 's!.*/todo-.*/!!g' | awk '{print "status '$RESNAME' " $1 " " $3}' >>$TEMPFILE
done
2014-02-05 13:37:35 +00:00
fi