Archive for the ‘Linux’ Category

It’s always handy to have a script to create the reverse lookup records from a forward lookup zone file. So here its goes…

#!/bin/sh
#@Author Daysen — daysenv@gmail.com

#———–
>rev

cp /var/lib/named/master/de.daysen.com.hosts fwd
sed -e ‘/^;/d’ fwd | sed -e ‘/^$/d’ > f1

while read line
do
RD_=`echo $line | awk ‘{print $3}’`
IN_=`echo $line | awk ‘{print $2}’`

if [ “$IN_” = “IN” ] && [ “$RD_” != “SOA” ]
then

if [ “$RD_” != “SRV” ]
then
if [ “$RD_” = “CNAME” ] || [ “$RD_” = “NS” ]
then
CN_=`echo $line | awk ‘{print $4}’`
if [ “$RD_” = “NS” ]
then
c=`nslookup $CN_ | grep -v “127.0.0.1” | grep “Address” | awk ‘{print $2}’ | awk -F . ‘{print $2″.”$1}’`
a=”$c.in-addr.arpa. IN NS     “
b=`echo $line | awk ‘{print $4}’`
else

c=`nslookup $CN_ | grep -v “127.0.0.1” | grep “Address” | awk ‘{print $2}’`
a=`echo $c | awk -F . ‘{print $4″.”$3″.”$2″.”$1″.in-addr.arpa.        IN        PTR     “}’`
b=`echo $line | awk ‘{print $1}’`
fi
else

c=`echo $line | awk ‘{print $4}’`
a=`echo $c | awk -F . ‘{print $4″.”$3″.”$2″.”$1″.in-addr.arpa.        IN        PTR     “}’`
b=`echo $line | awk ‘{print $1}’`
fi

echo $a”        “$b >> rev
sort -k3,4 rev > f2
mv f2 rev
fi
fi

done < f1

rm -f f1

The Hobbit

Posted: August 18, 2010 in Linux
Tags: , ,

Let’s talk a bit about Hobbit. Well, am not talking about the famous novel of J.R.R Tolkien, but about the Hobbit Monitoring Tool. Hobbit can monitor servers, networks, applications etc…;Just to name a few. More about Hobbit can be found at the Hobbit project page  at http://xymon.sourceforge.net/docs/about.html. I’ve been using Hobbit for quite a few years now to monitors most of equipment in the Company data centers. Some of my Hobbit extensions are on Launchpad at https://code.launchpad.net/hobbit-mon. I will gradually post more extensions when time permits.