systemctl zabbix invoke sudo shell command in python scrip
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
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
- jstat = commands.getoutput("which jstat")
- 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
what cause this difference between running process directly and systemctl ?
sudo python zabbix systemctl
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
favorite
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
- jstat = commands.getoutput("which jstat")
- 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
what cause this difference between running process directly and systemctl ?
sudo python zabbix systemctl
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
when running zabbix agent with systemctl
â focus zheng
8 mins ago
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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
- jstat = commands.getoutput("which jstat")
- 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
what cause this difference between running process directly and systemctl ?
sudo python zabbix systemctl
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
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
- jstat = commands.getoutput("which jstat")
- 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
what cause this difference between running process directly and systemctl ?
sudo python zabbix systemctl
sudo python zabbix systemctl
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 11 mins ago
focus zheng
1
1
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
when running zabbix agent with systemctl
â focus zheng
8 mins ago
add a comment |Â
when running zabbix agent with systemctl
â focus zheng
8 mins ago
when running zabbix agent with systemctl
â focus zheng
8 mins ago
when running zabbix agent with systemctl
â focus zheng
8 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
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.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
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.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
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.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
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.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
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.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 6 mins ago
focus zheng
1
1
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
focus zheng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
focus zheng is a new contributor. Be nice, and check out our Code of Conduct.
focus zheng is a new contributor. Be nice, and check out our Code of Conduct.
focus zheng is a new contributor. Be nice, and check out our Code of Conduct.
focus zheng is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f477870%2fsystemctl-zabbix-invoke-sudo-shell-command-in-python-scrip%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
when running zabbix agent with systemctl
â focus zheng
8 mins ago