Package Products :: Package DataCollector :: Module zendisc :: Class ZenDisc
[hide private]
[frames] | no frames]

Class ZenDisc

source code

                 object --+                
                          |                
   ZenUtils.CmdBase.CmdBase --+            
                              |            
   ZenUtils.ZenDaemon.ZenDaemon --+        
                                  |        
twisted.spread.pb.Referenceable --+        
                                  |        
           ZenHub.PBDaemon.PBDaemon --+    
                                      |    
                  zenmodeler.ZenModeler --+
                                          |
                                         ZenDisc

Scan networks and routes looking for devices to add to the ZODB

Instance Methods [hide private]
 
__init__(self, single=True)
Initalizer
source code
 
ping(self, ip)
Given an IP address, return a deferred that pings the address.
source code
function
config(self)
Get the DiscoverService
source code
Twisted deferred
discoverIps(self, nets)
Ping all ips, create entries in the network if necessary.
source code
 
discoverRanges(self, driver)
Ping all IPs in the range and create devices for the ones that come back.
source code
Python iterable
discoverRouters(self, rootdev, seenips=None)
Discover all default routers based on DMD configuration.
source code
 
sendDiscoveredEvent(self, ip, dev=None, sev=2)
Send a 'device discovered' event through zenhub
source code
Python iterable
discoverDevices(self, ips, devicepath="/Discovered", prodState=1000)
Discover devices by active ips that are not associated with a device.
source code
deferred: Twisted deferred
findRemoteDeviceInfo(self, ip, devicePath, deviceSnmpCommunities=None)
Scan a device for ways of naming it: PTR DNS record or a SNMP name
source code
Python iterable
discoverDevice(self, ip, devicepath="/Discovered", prodState=1000)
Discover a device based on its IP address.
source code
Twisted deferred
collectNet(self, driver)
Twisted driver class to iterate through networks
source code
 
printResults(self, results)
Display the results that we've obtained
source code
Twisted deferred
createDevice(self, driver)
Add a device to the system by name or IP.
source code
Twisted deferred
walkDiscovery(self, driver)
Python iterable to go through discovery
source code
Twisted succeed() object
getDeviceList(self)
Our device list comes from our list of newly discovered devices
source code
 
connected(self)
Called by Twisted once a connection has been established.
source code
 
startDiscovery(self, data) source code
string
autoAllocate(self, device=None)
Execute a script that will auto allocate devices into their Device Classes
source code
 
buildOptions(self)
Command-line option builder for optparse
source code

Inherited from zenmodeler.ZenModeler: addClient, checkCollection, checkStop, clientFinished, cmdCollect, collectDevice, configure, cycleTime, fillCollectionSlots, fillError, heartbeat, main, mainLoop, portscanCollect, processOptions, pythonCollect, reactorLoop, remote_deleteDevice, reportError, selectPlugins, snmpCollect, timeoutClients, wmiCollect

Inherited from zenmodeler.ZenModeler (private): _timeoutClients

Inherited from ZenHub.PBDaemon.PBDaemon: connect, connectTimeout, eventService, getInitialServices, getService, getServiceNow, gotPerspective, pushEvents, pushEventsLoop, remote_getName, remote_setPropertyItems, remote_shutdown, remote_updateThresholdClasses, run, sendEvent, sendEvents, setExitCode, sigTerm, stop

Inherited from ZenUtils.ZenDaemon.ZenDaemon: becomeDaemon, becomeWatchdog, changeUser, convertSocketOption, logname, niceDoggie, openPrivilegedPort, setupLogging, sighandler_USR1, watchdogCycleTime, watchdogMaxRestartTime, watchdogStartTimeout, writePidFile

Inherited from ZenUtils.ZenDaemon.ZenDaemon (private): _sigUSR1_called

Inherited from ZenUtils.CmdBase.CmdBase: buildParser, checkLogpath, generate_configs, generate_xml_configs, generate_xml_table, getConfigFileDefaults, getGlobalConfigFileDefaults, getParamatersFromConfig, loadConfigFile, parseOptions, pretty_print_config_comment, validateConfigFile

Class Variables [hide private]
  initialServices = PBDaemon.initialServices+ ['DiscoverService']
  name = 'zendisc'
  scanned = 0

Inherited from zenmodeler.ZenModeler: classCollectorPlugins, configCycleInterval, generateEvents

Inherited from ZenHub.PBDaemon.PBDaemon: heartbeatEvent, heartbeatTimeout

Inherited from ZenUtils.ZenDaemon.ZenDaemon: pidfile

Inherited from ZenUtils.CmdBase.CmdBase: doesLogging

Method Details [hide private]

__init__(self, single=True)
(Constructor)

source code 

Initalizer

Parameters:
  • single (boolean) - collect from a single device?
Overrides: ZenUtils.CmdBase.CmdBase.__init__

config(self)

source code 

Get the DiscoverService

Returns: function
a DiscoverService from zenhub
Overrides: zenmodeler.ZenModeler.config

discoverIps(self, nets)

source code 

Ping all ips, create entries in the network if necessary.

Parameters:
  • nets (list) - list of networks to discover
Returns: Twisted deferred
successful result is a list of IPs that were added

discoverRanges(self, driver)

source code 

Ping all IPs in the range and create devices for the ones that come back.

Parameters:
  • ranges (list) - list of ranges to discover

discoverRouters(self, rootdev, seenips=None)

source code 

Discover all default routers based on DMD configuration.

Parameters:
  • rootdev (device class) - device root in DMD
  • seenips (list of strings) - list of IP addresses
Returns: Python iterable
Twisted/Zenoss Python iterable

sendDiscoveredEvent(self, ip, dev=None, sev=2)

source code 

Send a 'device discovered' event through zenhub

Parameters:
  • ip (strings) - IP addresses
  • dev (device object) - remote device name
  • sev (integer) - severity

discoverDevices(self, ips, devicepath="/Discovered", prodState=1000)

source code 

Discover devices by active ips that are not associated with a device.

Parameters:
  • ips (list of strings) - list of IP addresses
  • devicepath (string) - where in the DMD to put any discovered devices
  • prodState (integer) - production state (see Admin Guide for a description)
Returns: Python iterable
Twisted/Zenoss Python iterable

findRemoteDeviceInfo(self, ip, devicePath, deviceSnmpCommunities=None)

source code 

Scan a device for ways of naming it: PTR DNS record or a SNMP name

Parameters:
  • ip (string) - IP address
  • devicePath (string) - where in the DMD to put any discovered devices
  • deviceSnmpCommunities (list) - Optional list of SNMP community strings to try, overriding those set on the device class
Returns: deferred: Twisted deferred
result is None or a tuple containing (community, port, version, snmp name)

discoverDevice(self, ip, devicepath="/Discovered", prodState=1000)

source code 

Discover a device based on its IP address.

Parameters:
  • ip (string) - IP address
  • devicepath (string) - where in the DMD to put any discovered devices
  • prodState (integer) - production state (see Admin Guide for a description)
Returns: Python iterable
Twisted/Zenoss Python iterable

collectNet(self, driver)

source code 

Twisted driver class to iterate through networks

Parameters:
  • driver (Zenoss driver) - Zenoss driver
Returns: Twisted deferred
successful result is a list of IPs that were added

printResults(self, results)

source code 

Display the results that we've obtained

Parameters:
  • results (string) - what we've discovered

createDevice(self, driver)

source code 

Add a device to the system by name or IP.

Parameters:
  • driver (Twisted/Zenoss object) - driver object
Returns: Twisted deferred
Twisted deferred

walkDiscovery(self, driver)

source code 

Python iterable to go through discovery

Returns: Twisted deferred
Twisted deferred

getDeviceList(self)

source code 

Our device list comes from our list of newly discovered devices

Returns: Twisted succeed() object
list of discovered devices
Overrides: zenmodeler.ZenModeler.getDeviceList

connected(self)

source code 

Called by Twisted once a connection has been established.

Overrides: ZenHub.PBDaemon.PBDaemon.connected

autoAllocate(self, device=None)

source code 

Execute a script that will auto allocate devices into their Device Classes

Parameters:
  • device (device object) - device object
Returns: string
Device class path to put the new device

To Do: make it actually work

buildOptions(self)

source code 

Command-line option builder for optparse

Overrides: ZenUtils.CmdBase.CmdBase.buildOptions