TECHZEN Zenoss User Community ARCHIVE  

Zenoss and DNS/IP refresh

Subject: Zenoss and DNS/IP refresh
Author: [Not Specified]
Posted: 2014-01-17 00:35

Hi All,

We use zenoss core 4.2.3 on test environment,

If I add a device by its hostname, it's stored by its IP. Zenoss doesn't do a DNS lookup on the hostname after this and just saves the IP forever and ever.

If for example, you are monitoring external feeds that occasionally change their backend datacenters, Zenoss doesn't notice this, but continues to monitor the original IP. This means that this monitor is giving us incorrect/invalid data.

I want Zenoss to automatically do a DNS lookup against each device and to reset the IP if necessary.

I'm using a python script provided in the following link http://community.zenoss.org/thread/18085

#!/usr/bin/python
import os, sys, getopt
import logging

# Perform Zenoss specific imports.
##import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
from transaction import commit

if len(sys.argv) < 3:
sys.exit('Usage: %s dev/id dev/manageIp ' % sys.argv[0])

name=sys.argv[1]
arg0=sys.argv[0]

print 'zeroth arg is ' + arg0
print 'DNS_CHECK :name is' + name

ip=sys.argv[2].strip()

# dig +short simply returns one or more IP addresses that DNS resolves for the supplied name

nameres = os.popen('dig +short %s' % (name) )

if ip in (i.strip() for i in nameres.readlines() ):
print 'No DNS change - OK | statusvar=0'
sys.exit(0)
else:
print 'Change in DNS - WARNING | statusvar=1'
# Get first response again from dig
nameres = os.popen('dig +short %s' % (name) )
dnsip = nameres.readline().strip()
print 'DNS IP identified is : ' + dnsip
dmd = ZenScriptBase(connect=True).dmd
dev=dmd.Devices.findDevice(name)
dev.setManageIp(dnsip)
commit()
sys.exit(0)

How to make Zenoss to do this as part of regular monitoring and checks.

Where can i check the logs , to confirm whether zenoss is running the script to reset the ip in regular internals along with the monitoring the device.

Please help me to resolve this issue.

Thanks in advance.



Subject: Zenoss absolutely should do a
Author: Jane Curry
Posted: 2014-01-20 12:39

Zenoss absolutely should do a DNS lookup if you provide a fully-qualified DNS name when you create the device - provided the Zenoss server can get an answer from DNS. In the Zenoss Zope database, you should then have the id field as the FQDN and this should be propagated to the title attribute. The manageIp attribute should be the IP address resulting from the DNS lookup.

If you navigate to the main page of any device, then you can use the Commands menu (bottom of the left-hand menu panel) to do a DNS Forward or DNS reverse lookup.


Cheers,

Jane

Email: jane.curry@skills-1st.co.uk    Web: https://www.skills-1st.co.uk



< Previous
graph traffic volume
  Next
Send one alert for multiple alerts
>