TECHZEN Zenoss User Community ARCHIVE  

Zenoss 4.2.5 zenbatchload

Subject: Zenoss 4.2.5 zenbatchload
Author: Davide Mancosu
Posted: 2020-12-14 13:21

Hi,

I am using zenbatchload to bulk load a number of devices.
In zenoss 3.2 I used a txt file like this:

device-RM setManageIp='xxx.xxx.xxx.xxx',zSnmpCommunity='xxxxxxxxxxx',zSnmpVer='v2c',locationPath='/Roma',devicePath='/Server/Linux',groupPaths='VSTP_OC3C'

In zenoss 3.2 the device is loaded correctly.
In zenoss 4.2.5 it is not loaded and the following is returned:
> zenbatchload TSG-800.txt
2020-12-14 11:48:43,446 INFO zen.BatchDeviceLoader: Creating initial device device-RM (customized properties are set after creation)
2020-12-14 11:48:43,496 INFO zen.Device: device name 'device-RM' for ip '127.0.0.1'
2020-12-14 11:48:43,510 INFO zen.DeviceLoader: Manage IP 127.0.0.1 already exists
2020-12-14 11:48:43,510 ERROR zen.DeviceLoader: Unable to add the device device-RM
2020-12-14 11:48:43,511 ERROR zen.BatchDeviceLoader: Unable to find newly created device device-RM -- skipping
2020-12-14 11:48:43,512 INFO zen.BatchDeviceLoader: Creating initial device device-MI (customized properties are set after creation)
2020-12-14 11:48:43,558 INFO zen.Device: device name 'device-MI' for ip '127.0.0.1'
2020-12-14 11:48:43,561 INFO zen.DeviceLoader: Manage IP 127.0.0.1 already exists
2020-12-14 11:48:43,561 ERROR zen.DeviceLoader: Unable to add the device device-MI
2020-12-14 11:48:43,561 ERROR zen.BatchDeviceLoader: Unable to find newly created device device-MI -- skipping
2020-12-14 11:48:43,561 INFO zen.BatchDeviceLoader: Processed 0 of 2 devices, with 0 errors
2020-12-14 11:48:43,561 INFO zen.BatchDeviceLoader: Unable to process 0 entries

Why 127.0.0.1 if I set different IP Address in setManageIp='xxx.xxx.xxx.xxx'  ?
2020-12-14 11:48:43,558 INFO zen.Device: device name 'device-MI' for ip '127.0.0.1'
2020-12-14 11:48:43,561 INFO zen.DeviceLoader: Manage IP 127.0.0.1 already exists

Are this parameters
locationPath='/Roma',devicePath='/Server/Linux',groupPaths='VSTP_OC3C'
correct?

Can anyone suggest me the correct compilation of the txt file to pass as an argument to zenbatchload?

thanks in advance
Regards

------------------------------
Davide Mancosu
system administartor
Tiscali Italia S.p.A.
Cagliari
------------------------------


Subject: RE: Zenoss 4.2.5 zenbatchload
Author: Michael Rogers
Posted: 2020-12-14 18:23

Davide,

Zenoss Core 4.2.5 should allow you to run zenbatchload with the `--sample_configs` flag to see samples of the batchload syntax.  Here is the output when running the command on my 6.4.1 instance:

$ zenbatchload --sample_configs
#
# Example zenbatchloader file (Groups, Systems Locations, Devices, etc.)
#
# This file is formatted with one entry per line, like this:
#
# /Devices/device_class_name Python-expression
# hostname Python-expression
#
# For organizers (for example, the /Devices path), the Python-expression
# is used to define defaults to be used for devices listed
# after the organizer. The defaults that can be specified are:
#
# * loader arguments (use the --show_options flag to show these)
#
# * zProperties (from a device, use the 'Configuration Properties'
# menu item to see the available ones.)
#
# NOTE: new zProperties *cannot* be created through this file
#
# * cProperties (from a device, use the 'Custom Properties'
# menu item to see the available ones.)
#
# NOTE: new cProperties *cannot* be created through this file
#
# The Python-expression is used to create a dictionary of settings.
# device_settings = eval( 'dict(' + python-expression + ')' )
#

# Defining groups
/Groups/Admin
/Groups/Support

#Defining systems
/Systems/Production
/Systems/Staging

# Defining locations
/Locations/Canada address="Canada"
/Locations/Canada/Alberta address="Alberta, Canada"
/Locations/Canada/Alberta/Calgary address="Calgary, Alberta, Canada"

# If no organizer is specified at the beginning of the file,
# defaults to the /Devices/Discovered device class.
device0 comments="A simple device"
# All settings must be seperated by a comma.
device1 comments="A simple device", zSnmpCommunity='blue', zSnmpVer='v1'

# Notes for this file:
# * Oraganizer names *must* start with '/'
#
/Devices/Server/Linux zSnmpPort=1543
# Python strings can use either ' or " -- there's no difference.
# As a special case, it is also possible to specify the IP address
linux_device1 setManageIp='10.10.10.77', zSnmpCommunity='blue', zSnmpVer="v2c"
# A '' at the end of the line allows you to place more
# expressions on a new line. Don't forget the comma...
linux_device2 zLinks="<a href='http://example.org'>Support site</a>", zTelnetEnable=True, zTelnetPromptTimeout=15.3

# A new organizer drops all previous settings, and allows
# for new ones to be used.
/Devices/Server/Windows zWinUser="administrator", zWinPassword='fred'
# Bind templates
windows_device1 zDeviceTemplates=[ 'Device', 'myTemplate' ], rackSlot=1
# Override the default from the organizer setting.
windows_device2 zWinUser="administrator", zWinPassword='thomas', setProdState=500, rackSlot=2, settingsDevice setManageIp='10.10.10.77', setLocation="123 Elm Street", setSystems=['/mySystems'], setPerformanceMonitor='remoteCollector1', setHWSerialNumber="abc123456789", setGroups=['/myGroup'], # Apply custom schema properties (c-properties) to a device
windows_device7 cDateTest='2010/02/28'

# If the device or device class contains a space, then it must be quoted (either ' or ")
"/Server/Windows/WMI/Active Directory/2008"
windows_device_3 setTitle="Windows AD Server 1", setHWTag="service-tag-ABCDEF", setPriority=2

# Now, what if we have a device that isn't really a device, and requires
# a special loader?
# The 'loader' setting requires a registered utility, and 'loader_arg_keys' is
# a list from which any other settings will be passed into the loader callable.
#
# Here is a commmented-out example of how a VMware endpoint might be added:
#
#/Devices/VMware loader='vmware', loader_arg_keys=['host', 'username', 'password', 'useSsl', 'id']
#esxwin2 id='esxwin2', host='esxwin2.zenoss.loc', username='testuser', password='password', useSsl=True

# The following are wrapper methods that specifically set properties on a device:
# setManageIp
# setPerformanceMonitor
# setTitle
# setHWTag
# setHWSerialNumber
# setProdState
# setPriority
# setGroups
# setSystems

There shouldn't be any difference in acceptable syntax between 4.2.5 and 6.4.1, but I would recommend running the command on your system to confirm.



------------------------------
Michael J. Rogers
Senior Instructor - Zenoss
Austin TX
------------------------------


Subject: RE: Zenoss 4.2.5 zenbatchload
Author: Davide Mancosu
Posted: 2020-12-15 03:23

Thanks Michael it works now.
Regards


------------------------------
Davide Mancosu
system administartor
Tiscali Italia S.p.A.
Cagliari
------------------------------


< Previous
Zenoss 4.2.5 - Maintenance Windows suddenly stopped working
  Next
Zenoss 4.2.5 Event Transform
>