Ad Widget

Collapse

UserParameter issues with multi part commands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kim
    Junior Member
    • Dec 2014
    • 1

    #1

    UserParameter issues with multi part commands

    Hello

    I am having issues with a user parameter that has a few parts to it.
    the command i need to run is: "bundle exec /srv/zabbix/scripts/resque_stats $1"
    where $1 is one of --failed --total --current-working --current-pending etc.

    However to run this command successfully i need to either run it from the application directory or set a environment variable.

    the two things i have tried are:

    Code:
    UserParameter=resque_stats[*],BUNDLE_GEMFILE=/srv/www/application-production/current/Gemfile bundle exec /srv/zabbix/scripts/resque_stats $1
    and
    Code:
    UserParameter=resque_stats[*],cd /srv/www/application-production/current && bundle exec /srv/zabbix/scripts/resque_stats $1
    I have set it in the server as both text and as a decimal number but both give the same result as the agent is just returning a blank result.

    I turned on debug level 4 and got the following:
    Code:
    12427:20141209:105307.002 Processing request.
     12427:20141209:105307.004 Requested [resque_stats["--current-working"]]
     12427:20141209:105307.004 In zbx_popen() command:'BUNDLE_GEMFILE=/srv/www/application-production/current/Gemfile bundle exec /srv/zabbix/scripts/resque_stats --current-working'
     12427:20141209:105307.004 End of zbx_popen():6
     14300:20141209:105307.005 zbx_popen(): executing script
    sh: 1: bundle: not found
     12427:20141209:105307.007 In zbx_waitpid()
     12427:20141209:105307.007 zbx_waitpid() exited, status:127
     12427:20141209:105307.007 End of zbx_waitpid():14300
     12427:20141209:105307.007 Run remote command [BUNDLE_GEMFILE=/srv/www/application-production/current/Gemfile bundle exec /srv/zabbix/scripts/resque_stats --current-working] Result [0] []...
     12427:20141209:105307.007 Sending back []
    the "sh: 1: bundle: not found" bit suggests to me that the path is messed up and it cant find bundle.
    but i can happily run the command as the zabbix user using zabbix_agentd -t:
    Code:
    zabbix@host:/home/kim$ /srv/zabbix/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf -t resque_stats["--failed"]
    resque_stats[--failed]                        [t|36102]
    zabbix@host:/home/kim$ /srv/zabbix/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf -t resque_stats["--current-working"]
    resque_stats[--current-working]               [t|1]
    If anyone has any ideas of where i am going wrong or how i can fix it i would be very grateful
Working...