ZenPacks, JSON API, and Integrations

Expand all | Collapse all

Modelling a list of devices

  • 1.  Modelling a list of devices

    Posted 11 days ago
    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
    ------------------------------


  • 2.  RE: Modelling a list of devices

    Posted 11 days ago
    Edited by Michael 11 days ago
    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
    ------------------------------



  • 3.  RE: Modelling a list of devices

    Posted 11 days ago
    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
    ------------------------------



  • 4.  RE: Modelling a list of devices

    Posted 10 days ago
    Thanks Michael.

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



  • 5.  RE: Modelling a list of devices

    Posted 9 days ago
    Hi,

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

    Thanks & Regards,
    Amal

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



  • 6.  RE: Modelling a list of devices

    Posted 2 days ago
    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
    ------------------------------



  • 7.  RE: Modelling a list of devices

    Posted 14 hours ago
    Edited by Steve 14 hours ago
    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
    ------------------------------