TECHZEN Zenoss User Community ARCHIVE  

Reg custom script db monitoring

Subject: Reg custom script db monitoring
Author: vinoth kumar
Posted: 2017-09-26 23:12

Hi all,

we have upgraded to zenoss 5.2.4  4 months back. and now we are facing an issue after upgrade.

Actually we created on python script on the server for DB cluster monitoring and while we tried running in server its working fine.
But when we test via zenoss its displaying error as given below

"
Preparing Command...
Executing command /home/azureuser/script/scripts/db_cluster_monitor.py against 10.1.0.40
I0927 03:11:23.075861 36556 main.go:97] waiting for response for zminion-return-4ecb7f69-3ffe-639b-b312-b030e8bbcb04
/bin/sh: /home/azureuser/script/scripts/db_cluster_monitor.py: No such file or directory
DONE in 0 seconds"


kindly give us any suggestions on these issue




------------------------------
vinoth kumar
vinoth monitoring indices
chennai IN
------------------------------


Subject: RE: Reg custom script db monitoring
Author: Jane Curry
Posted: 2017-09-27 08:51

So is this script supposed to run on the Zenoss server or on the target host over ssh?  If on the target host, does it exist on the target host?

If the script is supposed to run on the Zenoss server, are you running this script through a COMMAND template?  If so, with Zenoss 5.x, then the file has to exist in the zencommand container.  Attach to the zencommand container by:

serviced service attach zencommand su zenoss -l

and then check whether /home/azureuser/script/scripts/db_cluster_monitor.py exists.

I suspect that it will not - that it only exists on your base Zenoss server.  The best technique I have found to preserve files that are required within Zenoss containers is to use  DFS storage which is accessible by all containers.  On the base Zenosss server, find /opt/serviced/var/volumes/<tenant-id> where <tenant-d> will be a horrible alphanumeric specific to your installation.  Under there, is a var-zenpacks directory that is made available to all containers as /var/zenoss. I  create a scripts subdirectory under there and put any scripts inside it so the path to my files will be /var/zenoss/scripts as far as any containers are concerned.  Copy your db_cluster_monitor.py file to /opt/serviced/var/volumes/<tenant-id>/var-zenpacks/scripts on the base box and then check in your zencommand container that it appears as /var/zenoss/scripts/db_cluster_monitor.py.  Ensure that it is owned, in the container, by zenoss:zenoss. 

Change your command template so that the script attribute has the correct path.

Cheers,
Jane

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


Subject: RE: Reg custom script db monitoring
Author: vinoth kumar
Posted: 2017-09-27 22:45

Thank you jane for your reply.

Actually the script is in the target server. and the script present in the server and working when we try from that server. but when we try to test from zenoss (note:type:Zencommand) its showing the above error.

And if the script was in target server it need not to be copied to container rite.

------------------------------
vinoth kumar
vinoth monitoring indices
chennai IN
------------------------------


Subject: RE: Reg custom script db monitoring
Author: Jane Curry
Posted: 2017-09-28 10:04

Correct - if the script is on the target device then you shouldn't need to copy to containers.  However, depending on the exact version of your Zenoss, you should check the value of zCommandPath.  The default is $ZENHOME/libexec.  This should be pre-pended to whatever you put into your Command Template box.  If this box has a fully-qualified pathname, starting with /, then the zCommandPath SHOULD be ignored but some Zenoss 5 versions have been buggy with this.  To be sure, I would put in your template command, just the filename of the file and I would set zCommandPath for a test device to be /home/azureuser/script/scripts.

Also be aware that the test button in a COMMAND template often does not work for commands run on target devices, although the template WILL run correctly.

You do have the "Use ssh" box ticked on your command template, don't you?

Cheers,
Jane

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


Subject: RE: Reg custom script db monitoring
Author: vinoth kumar
Posted: 2017-10-03 03:32

Hi jane,

After checking the SSH the checkbox was disabled. after enabling that am facing the below issue.
/bin/sh: /opt/zenoss/bin/zentestds: Permission denied
kindily do the needful

------------------------------
vinoth kumar
vinoth monitoring indices
chennai IN
------------------------------


Subject: RE: Reg custom script db monitoring
Author: Jane Curry
Posted: 2017-10-03 04:04

So it is using the zCommandUsername and zCommandPassword to authorise over ssh.  The message is telling you that /opt/zenoss/bin/zentestds is not executable by that user.  Check the unix permissions on that file and its directory and make sure it is executable.

Cheers,
Jane

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


Subject: RE: Reg custom script db monitoring
Author: vinoth kumar
Posted: 2017-10-03 05:27

Actually i could access the file in server  using the username  and password(zcommand)  given in console. there i can login and its working fine.

Here its displaying some zenoss path you want me to check there,

------------------------------
vinoth kumar
vinoth monitoring indices
chennai IN
------------------------------


Subject: RE: Reg custom script db monitoring
Author: vinoth kumar
Posted: 2017-10-03 05:31

/bin/sh: /opt/zenoss/bin/zentestds: Permission denied 

what does zentestds represents

------------------------------
vinoth kumar
vinoth monitoring indices
chennai IN
------------------------------


Subject: RE: Reg custom script db monitoring
Author: Jane Curry
Posted: 2017-10-04 02:56

I assume that /opt/zenoss/bin/zentestds is the command that you have in your template.  It is saying that it cannot run it.  Is it executable?  Is that really the name of your script?

Cheers,
Jane

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


< Previous
Is Zenoss Core can be used for monitoring and act like IPS (Intrusion Prevention ...
  Next
ZENUP sp671 patch failed
>