Page 1 of 1

My plugin not work ?

Posted: Wed May 29, 2019 8:10 am
by liberodark
Hi,

Have make new plugin for cpu nrpe but is not work is very strange.

https://github.com/liberodark/nrpe-inst ... heck_cpu.c

Centos 7
SELinux disable

Work in local :

Code: Select all

./check_cpu -w 70 -c 90
OK: CPU Used = 0.00% | Core 0 = 0.00%; Core 1 = 0.00%
parameter on nrpe.cfg :

Code: Select all

command[cpu]=/usr/local/nagios/libexec/check_cpu -w 70 -c 90
Not work :

Code: Select all

./check_nrpe -H 127.0.0.1 -c cpu
NRPE: Unable to read output
No more information in debug :
May 29 15:04:49 server nrpe[31896]: WARNING: my_system() seteuid(0): Operation not permitted

NRPE: Unable to read output

You have any idea for what my plugin work ?
PS : Is my first plugin !


Best Regards

Re: My plugin not work ?

Posted: Wed May 29, 2019 4:38 pm
by scottwilkerson
It looks like your plugin need root access, you would have to add sudoers access for the nagios user and then change the command in the nrpe.cfg to

Code: Select all

command[cpu]=sudo /usr/local/nagios/libexec/check_cpu -w 70 -c 90

Re: My plugin not work ?

Posted: Thu May 30, 2019 7:50 am
by liberodark
For what need sudo ?
This plugin run without sudo.
Have possibility to no add sudo ? would better for me.

Best Regard
Thanks for your reply

Re: My plugin not work ?

Posted: Thu May 30, 2019 9:11 am
by scottwilkerson
This leads me to have elevated permissions
liberodark wrote:May 29 15:04:49 server nrpe[31896]: WARNING: my_system() seteuid(0): Operation not permitted
Can you run the following

Code: Select all

su nagios
./check_cpu -w 70 -c 90

Re: My plugin not work ?

Posted: Fri May 31, 2019 2:42 am
by liberodark
Yes is not work in su nagios

Code: Select all

su nagios
bash-4.2$ /usr/local/nagios/libexec/check_cpu -w 70 -c 90
bash: /usr/local/nagios/libexec/check_cpu: Permission non accordée
have try to

Code: Select all

chown nagios:nagios /usr/local/nagios/libexec/check_cpu
Now work on su nagios

Re: My plugin not work ?

Posted: Fri May 31, 2019 3:05 am
by liberodark
Ok have try :

with visudo

Code: Select all

nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_cpu
that work

Best Regards

So sorry to disturb you no forget to change the chown all plugins is on nagios and this plugin have add manually is very stupid issue sorry.

Re: My plugin not work ?

Posted: Fri May 31, 2019 6:42 am
by scottwilkerson
liberodark wrote:Ok have try :

with visudo

Code: Select all

nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_cpu
that work

Best Regards

So sorry to disturb you no forget to change the chown all plugins is on nagios and this plugin have add manually is very stupid issue sorry.
Glad it is resolved!

Locking thread