Content added Content deleted
imported>DrOwl No edit summary |
imported>DrOwl |
||
Line 62: | Line 62: | ||
IFS=$MFS |
IFS=$MFS |
||
} |
} |
||
STATUS=`/usr/sbin/zoneadm list -ip |grep -v "^0:global"` |
STATUS=`/usr/sbin/zoneadm list -ip |grep -v "^0:global"` |
||
for ZONE in `echo ${STATUS}` |
for ZONE in `echo ${STATUS}` |
Latest revision as of 15:12, 30 November 2010
Solaris Zones check[edit]
this is to be run on Solaris Global zones (Solaris 10 servers which have zones on them)
Im not quite happy with the check but it will do for now.
Nagios service def[edit]
/opt/nagios/etc/global/services
# cat solaris_zones.cfg define service{ use generic-service service_description solaris_zones check_command check_nrpe!check_solaris_zones hostgroup_name solaris-global-zone }
NRPE Command defanition[edit]
Add this to the client in the commands folder '/opt/nagios/nrpe/nrpe-commands"
#cat > solaris_zones.cfg command[check_solaris_zones]=/opt/nagios/plugins/libexec/check_solaris_zones
check_solaris_zones script[edit]
#!/bin/sh # # By Aldo Fabi 01-09-2006 # LTP: 04-10-2006 # # Nagios zones Checker # ### Begin vars MFS=${IFS} exit_code=0 exit_text="" ### End vars errors_checker(){ IFS="<LF>" if [ ${exit_text} ] then exit_text=${exit_text}" $1" else exit_text="$1" fi if [ $2 -gt ${exit_code} ] then exit_code=$2 fi IFS=$MFS } STATUS=`/usr/sbin/zoneadm list -ip |grep -v "^0:global"` for ZONE in `echo ${STATUS}` do ZID=`echo ${ZONE} | cut -d":" -f1` ZNAME=`echo ${ZONE} | cut -d":" -f2` ZSTATE=`echo ${ZONE} | cut -d":" -f3` if [ $ZSTATE = 'running' ] then errors_checker "OK: zone $ZNAME is in running state" 0 else errors_checker "CRITICAL: Zone $ZNAME is in $ZSTATE state" 2 fi done echo ${exit_text} exit ${exit_code}