iostat & awk shortcuts (snippets for solaris)

-bash-3.00$ iostat -x extended device statistics device r/s w/s kr/s kw/s wait actv svc_t %w %b md10 5.3 5.2 331.3 329.9 0.0 0.0 3.5 0 4 md11 5.3 0.0 331.3 0.2 0.0 0.0 0.7 0 0 md12 0.0 5.2 0.0 332.0 0.0 0.0 6.5 0 3 md13 5.2 5.2 329.8 329.8 0.0 0.0 3.4 0 … Read More

using mrtg to monitor iowait on a solaris (10) machine (quick)

just as the name reads – this command, when run with ssh (or any other method of choice) will output just iowait – can be changed to anything else #!/bin/bash OUT=`su – user -c “ssh user@10.13.128.15 \”iostat -Xpnc | tail -n 1 \”” | awk ‘{print $3}’` echo $OUT echo $OUT the reason i used … Read More

update to solaris file system check

#!/bin/bash TMP_FILE=/tmp/disk_usage.tmp.$$ df -h | grep ‘%’ | grep -v “/cdrom/” | tr -d ‘%’ | awk ‘{ if (NR != 1) { if (NF == 6 && $5 >= 95) print $2,$3,$4,$5″%”,$6; else if (NF == 5 && $4 >= 95) print $1,$2,$3,$4″%”,$5; } }’ >$TMP_FILE if [ -s $TMP_FILE ]; then cat $TMP_FILE … Read More

slight spin on nagios file system check

here is a slight spin on the nagios disk check function – this is for when it is not critical for you to check free/used space on the fs but you still want to be alerted when something is wrong works both in linux and solaris #!/bin/bash TMP_FILE=/tmp/disk_usage.tmp.$$ df -h | tr -d ‘%’ | … Read More

nagios ram check for solaris and linux

these scripts work when checking nagios services over ssh (check_by_ssh) linux: #!/bin/bash TMP_FILE1=/tmp/ram.free.tmp1.$$ top -b -n1 |head -4 |tail -1 | awk ‘{free = $4 / $2 * 100; if (free >= 90.0) print $0 }’ >$TMP_FILE1 if [ -s $TMP_FILE1 ]; then cat $TMP_FILE1 rm -f $TMP_FILE1 exit 1 fi solaris: #!/bin/bash TMP_FILE1=/tmp/ram_free.tmp1.$$ TMP_FILE2=/tmp/ram_free.tmp2.$$ … Read More

simple nagios script to check disk usage in solaris

i know that there already is a command in nagios to check file system usage, but it gives you the percentage in the wrong format (it says there is 21% free when i am used to it saying that 79% is being used) this will give you the format in basic df per device usage … Read More

simple nagios script for exp match in solaris

we just needed something on the fly to monitor /var/adm/messages for certain output in nagios. this does the trick rather nicely and its not that big of a script either. tested with nagios versions 2.3 – 2.5 #!/bin/bash TMPFILE=/tmp/tmpfile.$$ #GREP=/usr/bin/egrep egrep “(ALERT|EMERG|ERR|WARN|NOTICE|panic|halt)” /var/adm/messages > $TMPFILE egrep “\\(sd[0-9]+\\):” /var/adm/messages >> $TMPFILE egrep “su:.*su\ root.*failed” /var/adm/messages >> … Read More