Monday, May 6, 2013

shell script for Generate the service.cfg for monitoring network device interfaces

#Purpose : TO generate interface monitoring services.cfg

while read devicelist

ip=`echo $devicelist | awk '{print $2}'`
devicename=`echo $devicelist | awk '{print $1}'`

`snmpwalk -Os -c communitystring -v 1 $ip IfDescr | awk '{print $4}' > /tmp/interface.txt`

while read interfacename


echo "define service{
        host_name                       $devicename
        service_description             $interfacename
        use                             service
        check_command                   check_ifoperstatus!$interfacename!communitystring

done < /tmp/interface.txt

done < /tmp/deviceip

No comments:

Post a Comment