Tuesday, May 7, 2013
Sys Admin things...: Keeping your NetApp in check with Nagios
Sys Admin things...: Keeping your NetApp in check with Nagios: Recently we took delivery of a new NetApp. Two 3210′s with roughly 50TB of storage across five disk shelves. For monitoring we use Nagios ...
Thursday, May 2, 2013
Script to check the Forward/Reverse DNS entries are sane for host
#! /bin/bashname=`hostname -f`ip=$(ifconfig eth0 | grep "inet addr" | awk -F '[: ]' '{print $13}')forward=$(host $name | awk -F " address " '{print $2}')reverse=$(host $ip | awk -F "pointer " '{print $2}' | sed 's/\.$//g')if [ "$ip" = "$forward" ]; thenecho -e "Forward Lookup is ok"elseecho -e "\nForward lookup does not match with assigned IP address.IP address is $ip while DNS ponits to $forward."fiif [ "$name" = "$reverse" ]; thenecho -e "\nReverse Lookup is ok"elseecho -e "\nReverse lookup does not match with hostname.Hostname is $name while Reverse DNS ponits to $reverse."fi
Using multiple Field Separators in AWK
Most of the time working with awk we require multiple field separators, e.g. from the o/p of ifconfig you require ip address , BCast address as well netmask you can get all these details in one go as below
Here I am using the white space and colon both as field Separators
ifconfig eth0 | grep 'inet addr:' | awk -F '[: ]' '{print $13,$16,$19}'
Here I am using the white space and colon both as field Separators
Subscribe to:
Posts (Atom)