Thursday, September 04, 2008

Nagios Plug-In for Veritas Netbackup Scartch Pool check

To monitor the tapes in our library wich is a t a remote data center, we had a script running wich each morning mails us a report with the tapes count for each "Volume Pool" in our netbackup infrastructure. But as you may know sysadmins like to make their life easier so I wanted to be informed by our Nagios monitoring system when our Scratch pool was reaching certain tape counts so we could take action accordingly wihtout having to look to those mails each morning. So I came up with this little script.

#!/bin/bash

WARN_COUNT=$1
CRIT_COUNT=$2


SCRATCH_TMP=`/usr/openv/volmgr/bin/vmquery -b -pn Scratch_pool | wc -l`
SCRATCH_COUNT=$[$SCRATCH_TMP - 3]


if [ $SCRATCH_COUNT -lt $WARN_COUNT ];then
if [ $SCRATCH_COUNT -lt $CRIT_COUNT ];then
echo "Scratch count CRITICAL : availbale scratch tapes $SCRATCH_COUNT less then $CRIT_COUNT|scratch=$SCRATCH_COUNT;$WARN_COUNT;$CRIT_COUNT"
exit 2
else
echo "Scratch count WARNING : available scratch tapes $SCRATCH_COUNT less then $WARN_COUNT|scratch=$SCRATCH_COUNT;$WARN_COUNT;$CRIT_COUNT"
exit 1
fi
else
echo "Scratch count OK : available scratch tapes $SCRATCH_COUNT|scratch=$SCRATCH_COUNT;$WARN_COUNT;$CRIT_COUNT"
exit 0
fi
exit 3



Now our nice nagios installation will warn me when I need to do something , so I just need to wait for a mail to take action, instead of having to remember each morning to look at those mails. find the "Scratch pool" look at the tape count.

VM-Ware VM uptime check

Trying to know which VM was active on a VM-Ware server (Free edition) I first opened to VM-Ware console and connected to the VM-Server and then checked every VM one by one to see if they were up.
But since the VM-server is running on a CentOS I decided to create me a small shell script to ask VM-Server to provide me the details by just issuing a simple command. Here's the source of this script for the those interested.


#!/bin/bash

NEEDED_VM=$1
VMWARECMD="/usr/bin/vmware-cmd"

VM_CONFIG=`$VMWARECMD -l 2> /dev/null | sed -e "s/ /#/g"` # Get all registered Vitual machines configuration files

if [ "$VM_CONFIG" != "" ];then

for TMPCONFIG in $VM_CONFIG ; do
CONFIG=`echo $TMPCONFIG | sed -e "s/#/ /g"`
VM_STATE=`/usr/bin/vmware-cmd "$CONFIG" getstate 2> /dev/null | cut -d \ -f 3` #Get VM state
VM_UPTIME=`/usr/bin/vmware-cmd "$CONFIG" getuptime 2> /dev/null | cut -d \ -f 3` #Get VM uptime in seconds
UP_HOURS=`perl -e "print ( (($VM_UPTIME-($VM_UPTIME%3600))/3600).' h '.((($VM_UPTIME%3600)-(($VM_UPTIME%3600)%60))/60).' m '.($VM_UPTIME%60) . ' s')" ` #Convert uptime into a string H:m:s
VM_NAME=`/usr/bin/vmware-cmd "$CONFIG" getconfig displayName 2> /dev/null | grep "displayName" | cut -d = -f 2` #Get the VM name from its configuration file


echo -n "VM $VM_NAME is $VM_STATE "
if [ "$VM_STATE" == "on" ]; then
echo -n "for $UP_HOURS"
fi
echo ""

done
fi


The output is like this:
VM  Zenoss is off
VM ZCS ZIMBRA DEMO is off
VM CUSTER is on for 194 h 19 m 25 s

Tuesday, September 02, 2008

Light is comming

If you're a regular reader of my blog you'll be aware I entered in a dark period in my life about 2 months ago. Well since then I made some changes in my life as I wrote in previous posts, which helped me to keep my head up and going on. But now I can say that the darkness is starting to fade away steadily leaving space for heavenly light, and that light was brought to me by that splendid person I met. Somehow we seem to compliment eachother , just with our looks we seem to understand what the other is thinking. She makes my weekends fly by and makes me feel ... well I don't have words to describe how I feel ... Some times I'd like to possess the power to stop time to have these weekends last forever. But unfortunatelly that's something out of my reach, I can only hope weeks go by in seconds so that I can enjoy another weekend.I consider myself a fortunate guy for having found such a splendid person. I wish this will continue .....

M$ Vista & Wifi Part II

As I wrote in my previous post I have a strange behaviour of Vista with my Wifi, well seemed I found a work around, to have it connected. I need to open the utility program delivered with my Wifi card (Realtek RTL8185) and Disable the wifi card and reenable it and as by magic it connects wihtout a hassle. It's a bit of a nessy workaround but it makes my Wifi work, so I'm happy with it.