Package Products :: Package ZenModel :: Module BatchDeviceLoader :: Class BatchDeviceLoader |
[hide private]
[frames] | no frames]

# Class BatchDeviceLoader

source code

                  object --+
                           |
    ZenUtils.CmdBase.CmdBase --+
                               |
    ZenUtils.ZenDaemon.ZenDaemon --+
                                   |
          ZenUtils.ZCmdBase.ZCmdBase --+
                                       |
                                      BatchDeviceLoader

Base class wrapping around dmd.DeviceLoader

Instance Methods | [hide private]
__init__(self, *args, **kwargs) Initializer that takes care of basic daemon options. | source code
list of dictionaries |
loadDeviceList(self, args=None) Read through all of the files listed as arguments and return a list of device entries. | source code
applyZProps(self, device, device_specs) Apply zProperty settings (if any) to the device. | source code
applyCustProps(self, device, device_specs) Custom schema properties | source code
addAllLGSOrganizers(self, device_specs) | source code
addLGSOrganizer(self, lgsType, paths=[]) Add any new locations, groups or organizers | source code
addOrganizer(self, device_specs) Add any organizers as required, and apply zproperties to them. | source code
applyOtherProps(self, device, device_specs) Apply non-zProperty settings (if any) to the device. | source code
runLoader(self, loader, device_specs) It's up to the loader now to figure out what's going on. | source code
processDevices(self, device_list) Read the input and process the devices * create the device entry * set zproperties * set custom schema properties * model the device | source code
reportException(self, msg, devName='', **kwargs) Report exceptions back to the the event console | source code
reportResults(self, processed, totalDevices) Report the success + total counts from loading devices. | source code
notifyNewDeviceCreated(self, deviceName) Report that we added a new device. | source code
DMD device object |
getDevice(self, device_specs) Find or create the specified device | source code
buildOptions(self) Add our command-line options to the basics | source code
list of dictionaries |
parseDevices(self, data) From the list of strings in rawDevices, construct a list of device dictionaries, ready to load into Zenoss. | source code
dictionary |
parseDeviceEntry(self, line, defaults) Build a dictionary of properties from one line's input | source code
Inherited from `ZenUtils.ZCmdBase.ZCmdBase`: `closeAll`, `closedb`, `findDevice`, `getConnection`, `getContext`, `getDataRoot`, `getDmdObj`, `login`, `logout`, `opendb`, `sigTerm`, `syncdb`, `zodbConnect` 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]
| sample_configs = `"`...``
Inherited from `ZenUtils.ZenDaemon.ZenDaemon`: `pidfile` Inherited from `ZenUtils.CmdBase.CmdBase`: `doesLogging`

Method Details | [hide private]

### __init__(self, *args, **kwargs) (Constructor) | source code
Initializer that takes care of basic daemon options. Creates a PID file. Overrides: ZenUtils.CmdBase.CmdBase.__init__

### loadDeviceList(self, args=None) | source code
Read through all of the files listed as arguments and return a list of device entries. Parameters: `args` (list of strings) - list of filenames (uses self.args is this is None) Returns: list of dictionaries list of device specifications

### applyZProps(self, device, device_specs) | source code
Apply zProperty settings (if any) to the device. Parameters: `device` (DMD device object) - device to modify `device_specs` (dictionary) - device creation dictionary

### applyOtherProps(self, device, device_specs) | source code
Apply non-zProperty settings (if any) to the device. Parameters: `device` (DMD device object) - device to modify `device_specs` (dictionary) - device creation dictionary

### runLoader(self, loader, device_specs) | source code
It's up to the loader now to figure out what's going on. Parameters: `loader` (callable) - device loader `device_specs` (dictionary) - device entries

### processDevices(self, device_list) | source code
    Read the input and process the devices
      * create the device entry
      * set zproperties
      * set custom schema properties
      * model the device

    @parameter device_list: list of device entries
    @type device_list: list of dictionaries

### getDevice(self, device_specs) | source code
Find or create the specified device Parameters: `device_specs` (dictionary) - device creation dictionary Returns: DMD device object device or None

### buildOptions(self) | source code
Add our command-line options to the basics Overrides: ZenUtils.CmdBase.CmdBase.buildOptions

### parseDevices(self, data) | source code
From the list of strings in rawDevices, construct a list of device dictionaries, ready to load into Zenoss. Parameters: `data` (list of strings) - list of strings representing device entries Returns: list of dictionaries list of parsed device entries

### parseDeviceEntry(self, line, defaults) | source code
Build a dictionary of properties from one line's input Parameters: `line` (string) - string containing one device's info `defaults` (dictionary) - dictionary of default settings Returns: dictionary parsed device entry

Class Variable Details | [hide private]

  ### sample_configs Value:
      """#
      # Example zenbatchloader device file
      #
      # This file is formatted with one entry per line, like this:
      #
      #  /Devices/device_class_name Python-expression
      #  hostname Python-expression
      #
      ...