TECHZEN Zenoss User Community ARCHIVE  

Command Data Source Zenoss5/6

Subject: Command Data Source Zenoss5/6
Author: Warren Hewitt
Posted: 2018-03-07 00:29

I have a python script that works perfectly on Zenoss4 when used as command data source.
On Zenoss 5.2
I can "serviced service attach zenhub" place the file in a directory there and it executes fine and returns the desired data points.
When I try to Test Against a Device from the GUI  I get the following error  -
"/bin/sh: /usr/lib64/nagios/plugins/CheckPoint_V3.py: No such file or directory"
My question is - what container do I put my script in, so that it can be accessed via a line in the Command Template.

Thanks in Advance
Warren

------------------------------
[Warren] [Hewitt]
[Deloitte]
[Melbourne] [Victoria]
[Australia]
------------------------------


Subject: RE: Command Data Source Zenoss5/6
Author: Justin Bezuhly
Posted: 2018-03-08 11:30

Let me preface this with I am no expert, but maybe I can stumble through this with you.

First, I think a different service runs the command to run the script from the gui, but it may just be that you need to commit the image after making changes in zenhub. It may be better to store the script in the shared mount point that is mounted in all containers. Here is a script I use to add other scripts to said location, hope it helps.


#!/bin/bash

SERVICE_ID=$(serviced service status Zenoss.core | sed -n '2p' | awk {'print $2'})

mkdir -p "/opt/serviced/var/volumes/$SERVICE_ID/var-zenpacks/scripts/discovery"
mkdir -p "/opt/serviced/var/volumes/$SERVICE_ID/var-zenpacks/scripts/krb5_add"

cp /root/new_devices_ldap.py /opt/serviced/var/volumes/$SERVICE_ID/var-zenpacks/scripts/discovery/
cp /root/load_devices.sh /opt/serviced/var/volumes/$SERVICE_ID/var-zenpacks/scripts/discovery/
cp /root/sou.krb5.custom /opt/serviced/var/volumes/$SERVICE_ID/var-zenpacks/scripts/krb5_add/



------------------------------
Justin Bezuhly
System Administrator
Southern Oregon University
Ashland OR
------------------------------


Subject: RE: Command Data Source Zenoss5/6
Author: Warren Hewitt
Posted: 2018-03-09 09:24

Thank you Justin and Devon - Your recommendations did the trick - I am now getting the graphs I was after.

I can reference the files at /var/zenoss/scripts/

------------------------------
[Warren] [Hewitt]
[Deloitte]
[Melbourne] [Victoria]
[Australia]
------------------------------


Subject: RE: Command Data Source Zenoss5/6
Author: Devon Solomon
Posted: 2018-03-08 17:41

I think it would be zencommand service (container) or zenactiond. I know we have command notifications that run a script and we had to save (commit) the scripts to the zenactiond container and then restart the service. here's a link to save scripts inside a container. We keep our scripts in /home/zenoss/triggers and then just sync those to the container. 

commands i used for ours. 

mynew=notificationtriggers
serviced service shell -s $mynew -i zenactiond
mkdir /opt/zenoss/var/ext/scripts
cd /opt/zenoss/var/ext/scripts
sync -azv user@host:/home/zenoss/triggers/ /opt/zenoss/var/ext/scripts
exit
exit
serviced snapshot commit $mynew
serviced service restart zenactiond

How to add tools or scripts into a Resource Manager 5.x Docker Container
Zenoss remove preview
How to add tools or scripts into a Resource Manager 5.x Docker Container
Zenoss Resource Manager 5.x It is often useful to run scripts or troubleshooting tools in docker containers. This KB describes the methods necessary to modify Resource Manager (RM) Docker containers to run scripts or tools and enable them to persist. Because Docker containers are initiated from a base image, they are stateless.
View this on Zenoss >


------------------------------
Devon Solomon
------------------------------


< Previous
In Search Of information on Zenoss Core 5.x and user roles
  Next
How to add Micrisift/Windows Device class
>