TECHZEN Zenoss User Community ARCHIVE  

Modelling a list of devices

Subject: Modelling a list of devices
Author: AMAL JOSE
Posted: 2021-04-26 10:27

Hi Team,

I have to model devices from a  list of device names. Is there any script/command that I can use to model multiple devices from a given list of device names. 
And also, is there any limitation/risk for modelling a large number of devices at one go?

Thanks & Regards,
Amal Jose

------------------------------
AMAL JOSE
MELBOURNE VIC
------------------------------


Subject: RE: Modelling a list of devices
Author: Michael Rogers
Posted: 2021-04-26 11:28

Hi, Amal!

I can think of a few ways to do this, but I'll start with the easiest:

Method A

1. Create an organizer (either Groups or Systems).  You can give it a name like "DevicesForModeling."
2. Drag and drop the relevant devices to the group.
3. Select the organizer in the left-hand navigation pane.
4. Click the "Modeling" button and choose "Model Devices."
5. The overlay window will pop up and the devices will be modeled sequentially.

Method B.

1. SSH to your Control Center host.
2. Attach to the zenmodeler container: serviced service attach zenmodeler
3. Switch to the zenoss user: su - zenoss
4. Add all the device IDs to a text file.
5. Write a bash loop that calls each ID from the file and substitutes it into the following command: zenmodeler run -v10 -d $DEVICEID >> /tmp/zenmodeler_output.txt 2>&1

  That should preserve the output log as /tmp/zenmodeler_output.txt, in case something goes wrong and you need to check for errors.

Method A is going to be fairly easy, but will require more dragging and dropping.  Method B assumes a little more comfort at the command line.

Let me know if either of those help?

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


Subject: RE: Modelling a list of devices
Author: Michael Rogers
Posted: 2021-04-26 17:01

Update.

I forgot to mention, if you do opt for Method B, you may want to run your loop in a screen or tmux session.  Depending on the total number of devices to model, it might take a while to complete.  If your SSH connection breaks while the loop is running, you'll need to start over.  If you were logging the output of the modeler, it should give you a clue as to where to restart.

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


Subject: RE: Modelling a list of devices
Author: AMAL JOSE
Posted: 2021-04-27 02:36

Thanks Michael.

------------------------------
AMAL JOSE
MELBOURNE VIC
------------------------------


Subject: RE: Modelling a list of devices
Author: AMAL JOSE
Posted: 2021-04-28 21:48

Hi,

Is there any command/script to find out devices that are not modelled?

Thanks & Regards,
Amal

------------------------------
AMAL JOSE
MELBOURNE VIC
------------------------------


Subject: RE: Modelling a list of devices
Author: Michael Rogers
Posted: 2021-05-05 17:57

If you captured your modeler output, you can grep for any non-INFO and non-DEBUG lines to find errors with the process.  If you see the lines "No change in configuration detected," or "Changes in configuration applied," the model should have been successful.  

The "Model Collection Age" or "Device Changes" reports may give you some more info on model times (but I can't recall if those are available in Core or strictly in Resource Manager).

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


Subject: RE: Modelling a list of devices
Author: Steve Aiello
Posted: 2021-05-07 09:38

Also, to build off Michael's post, if you are familiar with the Zenoss RM/CZ JSON REST API, you can use that to query all the model times of your devices. There is an example script that can be found in the zenoss-RM-api repo. A nice little side benefit of that script, the "Model Events" column, allowing you to correlate stale modeling dates with modeling error events.

Reference info:
  • https://help.zenoss.com/dev/collection-zone-and-resource-manager-apis
  • https://help.zenoss.com/zsd/archive/json-api


------------------------------
Steve Aiello
Zenoss
------------------------------


Subject: RE: Modelling a list of devices
Author: AMAL JOSE
Posted: 2021-05-20 21:02

Thanks Steve. This is very helpful. we can manage python scripts easily.

------------------------------
AMAL JOSE
MELBOURNE VIC
------------------------------


< Previous
Zenoss REST API (curl) not retuning more than 1000 rows
  Next
Modeling times out in Custom ZenPack
>