quick and dirty timestamp conversion

quick perl script to convert unix timestamp to human readable time #!/usr/bin/perl print scalar localtime(shift||time), “\n”; usage: ./script.pl <timestamp> example: ./unix_timestamp.pl 1175313600 Sat Mar 31 00:00:00 2007

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

rrd stuff part three

here is an updated rrd post. these scripts are all required to create, update and graph the required information. the twist on these scripts is that these are created for use with bonded nics in linux (can be changed for whatever uses) here is the create script here is the update script here is the … Read More

rrd stuff part two

here is the creation script that i talked about in the initial rrd post – this script will create the round robin databases and also do an initial populate enjoy download here

rrd stuff part one

here is an rrd script that i butchered so it can be used to monitor ifInOctets & ifOutOctets on 4 24 port cisco’s – it is a cpu hog so its not the kind of script to be run on an already bogged down machine. this is not the creation script – i will be … Read More

neat little perl trick

you ever have a shitload of files in a directory that needed one thing (the same in all) changed ?? here is this cool little perl trick to change that one object in all the files without having to edit them all by hand perl -pi.bak -e ‘s/foo/bar/i’ *.extention by running this with the -p … Read More