Discussion:
how to run zencommand in the cron
mura
2011-10-13 07:56:53 UTC
Permalink
mura [http://community.zenoss.org/people/mura] created the discussion

"how to run zencommand in the cron"

To view the discussion, visit: http://community.zenoss.org/message/61829#61829

--------------------------------------------------------------
My zenoss zencommand process always down。
I want to make a cron to check zencommand process status,if zencommand isnot run,then start this process。

#!/bin/bash
export ZENHOME="/opt/zenoss"
export PATH="${ZENHOME}/bin:${PATH}"
export PYTHONPATH="/opt/zenoss/lib/python"
export LD_LIBRARY_PATH="/opt/zenoss/lib"
status=`zencommand status | grep pid| wc -l`
if [ 0 -eq $status ]
  then  /opt/zenoss/bin/python /opt/zenoss/Products/ZenRRD/zencommand.py --configfile /opt/zenoss/etc/zencommand.conf --cycle --daemon
fi

I run this scripts by zenoss role well。
but run cron by zenoss.the start action no run.

*/2 * * * * zenoss /home/zenoss/check_zencommand

how can run start command in the cron
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/61829#61829]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2011-10-13 18:41:08 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: how to run zencommand in the cron"

To view the discussion, visit: http://community.zenoss.org/message/61842#61842

--------------------------------------------------------------
Several things here...

First, I think you should examine $ZENHOME/log/zencommand.log and try and find out why the daemon is failing - it doesn't normally.  Restarting may not buy you anything.  How long does it run for?

Make sure that you put your cron entry into the zenoss user's crontab and take out the "zenoss" parameter in your cron line above.

Do just check that your shellscript is executable?

I would simply do a
$ZENHOME/bin/zencommand restart

as my then clause - but I wouldn;t do this until I know why it is failing.

Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/61842#61842]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
mura
2011-10-14 01:38:55 UTC
Permalink
mura [http://community.zenoss.org/people/mura] created the discussion

"Re: how to run zencommand in the cron"

To view the discussion, visit: http://community.zenoss.org/message/61845#61845

--------------------------------------------------------------
thanks Jane.
i try find error in my zencommand.log file.

more zencommand.log |grep error
2011-10-13 13:53:58 ERROR zen.zencommand: [Failure instance: Traceback (failure with no frames): twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion: Connection lost.
PBConnectionLost: [Failure instance: Traceback (failure with no frames): twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion: Connection lost.
2011-10-13 13:53:58 ERROR zen.zencommand: [Failure instance: Traceback (failure with no frames): twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion: Connection lost.
PBConnectionLost: [Failure instance: Traceback (failure with no frames): twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion: Connection lost.
2011-10-13 13:53:58 ERROR zen.zencommand: [Failure instance: Traceback (failure with no frames): twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion: Connection lost.

i try find eroor in my zenhub.log,it isn't related with zencommand error log.
more zenhub.log |grep error
2011-10-09 04:59:25 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-09 17:00:50 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-10 04:58:28 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-10 17:45:00 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-11 04:58:32 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-11 17:56:20 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-12 04:58:36 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-12 17:35:06 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-13 04:58:25 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-13 17:45:37 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com
2011-10-14 04:58:17 WARNING zen.ApplyDataMap: Add Blocked: Software 'libgpg-error-1.0-1' on europe1.sino-i.com

so i can't determine zencommand run problem.

my cron in the zenoss user's,but i don't know how can configrue "zenoss" parameter in this cron line.
I confirm that the Shellscript commands can perform, in Cron, "zencommand status" command is run. but "zencommand start" isn't run.
I think this and environment variables related, but don't know how to adjust it.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/61845#61845]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2011-10-14 08:11:36 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: how to run zencommand in the cron"

To view the discussion, visit: http://community.zenoss.org/message/61847#61847

--------------------------------------------------------------
On the problem determination, see if there is anything in event.log - that gets many generic, inter-process messages. 

Not sure what your libgpg-error messages are in your log.  Was this a stack-build install or did you build from rpms?  I'm wondering if you have pre-req problems.  Is there anything in /var/log/messages.

You might just check and make sure that you are not short on filesystem space.  Zenoss uses temporary disk space under the covers so if you are short of space in / or /tmp this may cause oddities.

With regard to your cron entry, as the zenoss user, run crontab -e and add an entry - here's one of mine:
0 1 * * * /usr/local/zenoss/zenoss/local/jc_zenbackup.sh

In my case, $ZENHOME is /usr/local/zenoss/zenoss.

Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/61847#61847]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
mura
2011-10-17 02:41:42 UTC
Permalink
mura [http://community.zenoss.org/people/mura] created the discussion

"Re: how to run zencommand in the cron"

To view the discussion, visit: http://community.zenoss.org/message/61903#61903

--------------------------------------------------------------
yes,I am install zenoss by rpm.
in the /event.log&/var/log/messages found not about zencommand problem.
My filesystem has enough space Zenoss running.and this server or distributed the master.
In this Server running thousands of Check command, and also used as other node of the Nrpe data transmission, but I don't think this is the key to the problem. Because most of the time, these commands or can run normally.
Talk about the Shell scripts problem in the zenoss user's Cron.  I'm sure Scripts run most of the Zenoss command by the zenoss user's , such as zencommand status.
But, zencommand start command may need more environment, so it not run in the zenoss  user's Cron.
To tell you the truth, I don't quite understand the process starting for environment, so I haven't the solution to this problem. If you include the part of the script, Can you list for my reference?
Thanks again for your help.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/61903#61903]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Shane Scott
2011-10-19 02:56:21 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: how to run zencommand in the cron"

To view the discussion, visit: http://community.zenoss.org/message/61956#61956

--------------------------------------------------------------
mura:

I reccomend you update your zencommand.conf and zenhub.conf to set the logging to debug level. That way we can figure why it keeps breaking.

As for the cron job, to be honest, I'd just cron root /sbin/service zenoss start. Service zenoss start will skip daemons already running and start those that have failed plus handle all environment setup. A cron to start failed daemons isn't a solution- please post your debug level zenhub.log and zencommand.log soon as you can.

Thanks!

Best,
--Shane W. Scott(Hackman238)
  ZCA - http://community.zenoss.org/community/zca/blog http://community.zenoss.org/community/zca/blog
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/61956#61956]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...