Class: Zenoss::Model::ZDeviceLoader

Inherits:
Object
  • Object
show all
Includes:
Singleton, Zenoss::Model
Defined in:
lib/zenoss/model/z_device_loader.rb

Instance Method Summary collapse

Methods included from Zenoss::Model

#model_init

Methods included from Zenoss

connect, #parse_array, #pdatetime_to_datetime, #pdict_to_hash, #plist_to_array, #ptuples_to_hash, #sanitize_str

Constructor Details

#initializeZDeviceLoader

Returns a new instance of ZDeviceLoader.



27
28
29
# File 'lib/zenoss/model/z_device_loader.rb', line 27

def initialize
  @path = "DeviceLoader"
end

Instance Method Details

#add_system(system_path) ⇒ Object

add a system to the database addSystem(self, newSystemPath, REQUEST=None)



48
49
50
51
52
# File 'lib/zenoss/model/z_device_loader.rb', line 48

def add_system(system_path)
  method = "addSystem?newSystemPath=#{system_path}"
  rest(method)
  System.new("/Systems/#{system_path}")
end

#load_device(device_name, device_path) ⇒ Object

Load a device into the database connecting its major relations and collecting its configuration. loadDevice(self, deviceName, devicePath=“/Discovered”, tag=“”, serialNumber=“”, zSnmpCommunity=“”, zSnmpPort=161, zSnmpVer=None, rackSlot=0, productionState=1000, comments=“”, hwManufacturer=“”, hwProductName=“”, osManufacturer=“”, osProductName=“”, locationPath=“”, groupPaths=[], systemPaths=[], performanceMonitor=“localhost”, discoverProto=“snmp”, priority=3, REQUEST=None)

TODO: Enhance this functionality Return: true if the device is added, false if it is not



40
41
42
43
44
# File 'lib/zenoss/model/z_device_loader.rb', line 40

def load_device(device_name, device_path)
  method = "loadDevice?deviceName=#{device_name}&devicePath=#{device_path}"
  body = rest(method)
  (body =~ /Navigate to device/) ? true : false
end