Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
liberodark
Posts: 25 Joined: Tue Mar 19, 2019 8:56 am
Post
by liberodark » Wed May 29, 2019 8:10 am
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
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Wed May 29, 2019 4:38 pm
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
liberodark
Posts: 25 Joined: Tue Mar 19, 2019 8:56 am
Post
by liberodark » Thu May 30, 2019 7:50 am
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
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Thu May 30, 2019 9:11 am
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
liberodark
Posts: 25 Joined: Tue Mar 19, 2019 8:56 am
Post
by liberodark » Fri May 31, 2019 2:42 am
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
Last edited by
liberodark on Fri May 31, 2019 4:29 am, edited 1 time in total.
liberodark
Posts: 25 Joined: Tue Mar 19, 2019 8:56 am
Post
by liberodark » Fri May 31, 2019 3:05 am
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.
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Fri May 31, 2019 6:42 am
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