-1

two days ago,I change my running of zabbix-agent from zabbix_agentd run directly to systemctl start zabbix-agent.There is a weired thing.I write a python script to monitor java GC status, which invoke "sudo".

command jstat is installed with jdk env in the $PATH setting in /etc/profile((/xxx/xxx/bin/jstat,not in/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)) the two line which python invoke shell command

  1. jstat = commands.getoutput("which jstat")
  2. subprocess.Popen(['sudo',jstat, opts, self.pdict['pid']], stdout=subprocess.PIPE)

when using zabbix_agentd directly. commands.getoutput("which jstat") can give value of the abosolutely path to the statement 2.However it is not recognise when running zabbix agent with supervisor.which give a output enter image description here

what cause this difference between running process directly and systemctl ?

  • when running zabbix agent with systemctl – focus zheng Oct 26 '18 at 2:01
0

I also try to add jstat to /usr/bin it is ok because when using sudo,it find the command in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.