djmuk wrote:
> hmm
> 
> FWIW - in my environment I might look at setting up the reverse DNS lookups 
> so I can get 'friendly names' for the devices...  I might have to tweak the 
> ordering in the model script as I think that is a last resort after looking 
> at the snmpname.


Ok I think I have a solve for this one

Replace these lines in $ZENHOME/Products/ZenModel/Device.py

 
Code:
   if discoverProto == "snmp": 
           zSnmpCommunity, zSnmpPort, zSnmpVer, snmpname = \ 
                           findCommunity(context, ip, devicePath, 
                                         zSnmpCommunity, zSnmpPort, zSnmpVer) 
           log.debug("device community = %s", zSnmpCommunity) 
           log.debug("device version = %s", zSnmpVer) 
           log.debug("device name = %s", snmpname) 
           if not deviceName: 
               try: 
                   if snmpname and socket.gethostbyname(snmpname): 
                       deviceName = snmpname 
               except socket.error: pass 
               try: 
                   if (not deviceName and ipobj and ipobj.ptrName 
                       and socket.gethostbyname(ipobj.ptrName)): 
                       deviceName = ipobj.ptrName 
               except socket.error: pass 
               if not deviceName and snmpname: 
                   deviceName = snmpname 
               if not deviceName: 
                   log.warn("unable to name device using ip '%s'", ip) 
                   deviceName = ip 




With 


Code:

    if discoverProto == "snmp":
        zSnmpCommunity, zSnmpPort, zSnmpVer, snmpname = \
                        findCommunity(context, ip, devicePath,
                                      zSnmpCommunity, zSnmpPort, zSnmpVer)
        log.debug("device community = %s", zSnmpCommunity)
        log.debug("device version = %s", zSnmpVer)
        log.debug("device name = %s", snmpname)
        if not deviceName:
            try:
                if  snmpname and socket.gethostbyname(snmpname):
                    deviceName = snmpname
            except socket.error: pass
            try:
                if (not deviceName and ipobj and ipobj.ptrName
                and socket.gethostbyname(ipobj.ptrName)):
                    deviceName = ipobj.ptrName
            except socket.error: pass
            # This fixes devices that report a space for snmpname which  
            # really trips out zenoss
            snmpname = snmpname.strip()
            if not deviceName and snmpname:
                # Checks to see if there is a device using snmpname
                # if so defaults to ip address
                # and puts a warning
                if context.getDmdRoot("Devices").findDevice(snmpname):
                   log.warn("unable to name device '%s' device exists", 
snmpname)
                   deviceName = ip
                else:
                   deviceName = snmpname
            if not deviceName:
                log.warn("unable to name device using ip '%s'", ip)
                deviceName = ip




if someone knows how to make this into a patch please attach it to ticket 2815. 
Thanks,
Jason




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=17054#17054

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to