Nagios list of devices/IP addresses
Gareth Fletcher
gareth.fletcher at onenet.co.nz
Mon Nov 2 23:05:41 CET 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20091103/666db3c9/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
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
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at 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
More information about the Users
mailing list