I have a script which run on linux machine (Ubuntu 18.04) and I need to run as root user.
I did the following configuration:
Code: Select all
/etc/sudoers.d/nagios
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_test.py
Code: Select all
/usr/local/nagios/etc/nrpe/nagios.cfg ( I added the dir in nrpe.cfg configuration)
command[check_test]=sudo -S /usr/local/nagios/libexec/check_test.py
Code: Select all
Dec 30 12:10:04 test-server nrpe[1659]: is_an_allowed_host (AF_INET): host is in allowed host list!
Dec 30 12:10:04 test-server nrpe[1659]: Host address is in allowed_hosts
Dec 30 12:10:04 test-server nrpe[1659]: Host 10.10.10.10 is asking for command 'check_test' to be run...
Dec 30 12:10:04 test-server nrpe[1659]: Running command: /usr/bin/sudo -S /usr/local/nagios/libexec/check_test.py
Dec 30 12:10:04 test-server sudo[1662]: nagios : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/local/nagios/libexec/check_test.py
Dec 30 12:10:04 test-server sudo[1662]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 30 12:10:04 test-server sudo[1662]: pam_unix(sudo:session): session closed for user root
Dec 30 12:10:04 test-server nrpe[1659]: Command completed with return code 0 and output: OK: no errors
Dec 30 12:10:04 test-server nrpe[1659]: Return Code: 0, Output: OK: no errors
Dec 30 12:10:04 test-server nrpe[1659]: Connection from 10.10.10.10 closed.
In shell command I get the error result - "Critical - check status" but in the GUI I get OK even when there are errors.
XI version 5.5.8
NRPE Plugin for Nagios
Version: 3.2.1
From user nagios I get the same result from shell command.
Any idea?