Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sudo issue #3

Open
alperkar opened this issue Dec 29, 2014 · 12 comments
Open

Sudo issue #3

alperkar opened this issue Dec 29, 2014 · 12 comments

Comments

@alperkar
Copy link

Hi There,

This script does not seem to be working in RHEL or it's just me :)

When I have the following setting (with SUDO) in zabbix_agentd.conf:

UserParameter=mdraid[*], sudo /usr/local/bin/zabbix_mdraid.sh -m'$1' -$2'$3'
UserParameter=mdraid.discovery, sudo /usr/local/bin/zabbix_mdraid.sh -D

And execute the following from Zabbix proxy:

zabbix_get -s HOSTNAME -k mdraid[/dev/md0,d,1]

I am getting the following error ("sorry, you must have a tty to run sudo") in zabbix_agentd.log:

25547:20141229:090259.961 Requested [mdraid[/dev/md0,d,1]]
25547:20141229:090259.961 In zbx_popen() command:' sudo /usr/local/bin/zabbix_mdraid.sh -m'/dev/md0' -d'1''
25547:20141229:090259.962 End of zbx_popen():7
25552:20141229:090259.962 zbx_popen(): executing script
sudo 25546:20141229:090259.970 listener #1 [processing request]
25546:20141229:090259.970 Requested [system.cpu.util[,steal]]
25546:20141229:090259.970 Sending back [0.000000]
25546:20141229:090259.970 listener #1 [waiting for connection]
: sorry, you must have a tty to run sudo

Yes, I have already tweaked /etc/sudoers file:

/etc/sudoers:
zabbix ALL=(ALL) NOPASSWD: ALL

Defaults:zabbix !requiretty

Any ideas how to make this work?

@linuxsquad
Copy link
Owner

You are on the right path. Try to comment out the entire line:

Defaults:zabbix !requiretty
and search throu the /etc/sudoers to make sure there is no other line with requiretty

@alperkar
Copy link
Author

Defaults:zabbix !requiretty -> this actually means do not require tty for user zabbix
But I have commented out all requiretty lines just in case. Still the same issue. when I switch to zabbix user and run the script it works. It does not work when the command is initiated by the zabbix agent... It says tty is required but according to sudoers it is not?

@linuxsquad
Copy link
Owner

odd... What distro version are you running this zabbix agent on?
Oh... make sure that zabbix_agentd runs under zabbix user ID.

@alperkar
Copy link
Author

Zabbix agent runs under zabbix user:

zabbix 30980 0.0 0.2 76888 1348 ? S Dec30 0:00 zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf

Distro:
[/etc] # cat /etc/system-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)

@linuxsquad
Copy link
Owner

Sorry, wanted to check on the same server ... but none of them run zabbix with sudo enabled.

@linuxsquad
Copy link
Owner

Do you have selinux enabled?

@alperkar
Copy link
Author

selinux in permissive mode.

@linuxsquad
Copy link
Owner

were you able to resolve this issue?

@alperkar
Copy link
Author

Unfortunately, no. Had to use a different, more primitive solution.

@linuxsquad
Copy link
Owner

I found RHEL 6.5 where i can test it, give me some time.

@yogionwindows
Copy link

well when I am trying to import the template for zabbix 2.4 its not getting imported

@dbvan
Copy link

dbvan commented Nov 2, 2015

Hi linuxsquad,
Any update about that issue, i meet that problems, too.
Sorry my english not good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants