Configuration & Administration

Expand all | Collapse all

Monitoring templates, commands in Zenoss 6

  • 1.  Monitoring templates, commands in Zenoss 6

    Posted 6 days ago
    Hello,

    I'm using Zenoss 4 and I rely heavily on commands and monitoring templates.

    I don't have direct communication with my devices. Instead:
    • My devices report to a service that updates a local mysql db with certain values every interval
    • I issue commands to my devices in custom ways
    The way this affects my usage of Zenoss is:
    • My monitoring templates use nagios check_mysql_query with the local mysql db
    • My commands run a shell script on the local machine that target the devices they are run on

    Both of the above will not work in Zenoss 6 out of the box for the following reasons:
    • I cannot run a command on the host
    • I cannot communicate with external ports (my local mysql db)

    Any suggestions for how I can do this?

    Here's what I've come up with so far, it's kinda ugly though:
    • Commands
      • Create a file to a directory mounted from the host. A host schedule task (cron maybe) would pull these files and run what is in them
      • Move all the commands and everything they require to run inside the container
    • Monitoring templates
      • Expose the host database to the container: how do I do this in serviced? This should be a template change in zenoss service template. Any idea what I have to change?


    ------------------------------
    Jad
    ------------------------------


  • 2.  RE: Monitoring templates, commands in Zenoss 6

    Posted 6 days ago
    For commands, can you define them as a user command? Rather than run them as a shell script on the host, can you run them within Zenoss itself by defining them in Advanced -> Commands -> Define Commands?

    ------------------------------
    Jason Olson

    ------------------------------



  • 3.  RE: Monitoring templates, commands in Zenoss 6

    Posted 6 days ago
    Thanks but this is what I'm currently doing.

    I have Zenoss commands. They invoke a shell script on the host. Something like:
    sh issue_command.sh ${device/id} <command_name>

    This shell script in turn inserts a record in a mysql db (this table holds which devices have an upcoming command to run). The actual running of the command is completely outside Zenoss and is very custom.

    In any case, this is custom business logic and is not going to change.

    If possible, please re-read the question with this in mind.

    Thank you

    ------------------------------
    Jad
    ------------------------------



  • 4.  RE: Monitoring templates, commands in Zenoss 6

    Posted 6 days ago
    So, I think you are saying that your extra mysql database is on your "local" Zenoss 4 server, along with the commands that communicate with the target devices?

    It's clunky but can you create some ssh scripts in the zencommand container that uses ssh to drive the existing scripts on the base Zenoss system?  That way, at least you leave your existing mechanism unchanged on the base box.  Importing stuff into a container, updating it, protecting it from Zenoss 6 updates, etc may be a big pain.  Effectively, you just treat the base box as a "remote" target.

    Do you know that anything in a container under /var/zenoss is "DFS" storage and appears on the base box under /opt/serviced/var/volumes/<tenant-id>/var-zenpacks - I use this to hold stuff that I need accessible by all containers and the base.

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------



  • 5.  RE: Monitoring templates, commands in Zenoss 6

    Posted 6 days ago
    Oh wow, sounds great.
    Thanks Jane.

    I guess this could work similarly for monitoring templates, right?
    I could do:
    ssh -t user@domain 'check_mysql_query ...'

    Another question here is: I'll be going from one environment to another (dev, stage, prod) where "domain" changes, along with the "user" as well.
    I wouldn't want to rename these commands every time.

    Is there a way to store and use variables like these as global variables somewhere?

    ------------------------------
    Jad
    ------------------------------



  • 6.  RE: Monitoring templates, commands in Zenoss 6

    Posted 4 days ago
    Uou might look at the concept of cProperties (custom properties).  They work just like zProperties but you can create them through the GUI - you don't need to write a ZenPack.  You create them at a device class level from DETAILS -> Custom Schema and can set a default value at the class level but you can override for an individual device.  So you might create a cDomain cProperty...

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------