Hi everyone,

I have a simple script that runs every hour and dumps the current hostnames 
into a MySQL table (to reconcile with our asset database).

cat /usr/local/Nagios/var/objects.cache | grep -i host_name | cut -f 3 | sort | 
uniq > $HOSTLIST
cat $HOSTLIST |while true
do read LINE || break
echo "INSERT INTO $SQLTBL VALUES ('$LINE');"\
|mysql -u$SQLUSER -p$SQLPASS $SQLDB
done;
exit 0

As is always the case in IT now we want to extend this and insert the IP 
addresses into this table (so we can build a DNS zone with our Nagios hosts).

Does anyone know a way I can easily grab the IP address of a given hostname? Or 
else an easier way to get all the hostnames/IPs?

Any help would be greatly appreciated!

Cheers
Gareth
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to