Run netstat using NRPE failed
Run netstat using NRPE failed
Hello
I've created a simple script to check established connection number.
The script runs fine, but when I'm trying to run it using NRPE, I'm getting "OK, 0 connections " instead of the real connection number.
I've added the sudo to the command configuration in nrpe.cgf, and now I'm getting "sh: /usr/bin/sudo: Permission denied"
What I'm doing wrong?
Both systems are centos 6.4 and the nagios version is 4
Thanks
I've created a simple script to check established connection number.
The script runs fine, but when I'm trying to run it using NRPE, I'm getting "OK, 0 connections " instead of the real connection number.
I've added the sudo to the command configuration in nrpe.cgf, and now I'm getting "sh: /usr/bin/sudo: Permission denied"
What I'm doing wrong?
Both systems are centos 6.4 and the nagios version is 4
Thanks
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Run netstat using NRPE failed
Can you share your script with us so we can see what may be causing this? Without that we can only guess.
You should not need sudo for the nrpe.cfg it's read by the nagios user and the permissions on it should reflect that.
You should not need sudo for the nrpe.cfg it's read by the nagios user and the permissions on it should reflect that.
Re: Run netstat using NRPE failed
Here are the scripts
nrpe.cfg
My script ( located at /usr/lib64/nagios/plugins )
I've also tried copying the netstat file to the plugins directory, but with same results.
Thanks
Yaniv
nrpe.cfg
My script ( located at /usr/lib64/nagios/plugins )
I've also tried copying the netstat file to the plugins directory, but with same results.
Thanks
Yaniv
- Attachments
-
- check_netstat.sh.txt
- (751 Bytes) Downloaded 442 times
-
- nrpe.cpg.txt
- (8.11 KiB) Downloaded 407 times
Re: Run netstat using NRPE failed
Your script is wrong. Try the one I attached.
Also, what is the check command you are actually executing from Nagios?
Also, what is the check command you are actually executing from Nagios?
- Attachments
-
- check_netstat.sh.txt
- (722 Bytes) Downloaded 480 times
Former Nagios employee
Re: Run netstat using NRPE failed
Running the attached one I'm getting :
/usr/lib64/nagios/plugins/check_netstat.sh: line 22: su: command not found
/usr/lib64/nagios/plugins/check_netstat.sh: line 24: [: -lt: unary operator expected
/usr/lib64/nagios/plugins/check_netstat.sh: line 33: [: -gt: unary operator expected
/usr/lib64/nagios/plugins/check_netstat.sh: line 42: [: -gt: unary operator expected
From the nagios server I'm executing "check_nrpe -H 10.4.4.30 -c check_netstat 32 64" ( from the terminal )
/usr/lib64/nagios/plugins/check_netstat.sh: line 22: su: command not found
/usr/lib64/nagios/plugins/check_netstat.sh: line 24: [: -lt: unary operator expected
/usr/lib64/nagios/plugins/check_netstat.sh: line 33: [: -gt: unary operator expected
/usr/lib64/nagios/plugins/check_netstat.sh: line 42: [: -gt: unary operator expected
From the nagios server I'm executing "check_nrpe -H 10.4.4.30 -c check_netstat 32 64" ( from the terminal )
Re: Run netstat using NRPE failed
Do you have 'su'?yaniv@ashnav.co.il wrote:/usr/lib64/nagios/plugins/check_netstat.sh: line 22: su: command not found
Code: Select all
which su
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Run netstat using NRPE failed
Yes, I have su
/bin/su
Permissions :
-rwsr-xr-x. 1 root root 34904 May 23 14:00 /bin/su
/bin/su
Permissions :
-rwsr-xr-x. 1 root root 34904 May 23 14:00 /bin/su
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Run netstat using NRPE failed
Is /bin/bash actually a bash shell or linked to another shell? It seems that it does not contain standard operators that bash should. You might hard code su to /bin/su on line 21 and see if that resolves not finding it.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Run netstat using NRPE failed
Tried that, but I'm getting a permission denied
/bin/su: Permission denied
/bin/su: Permission denied
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Run netstat using NRPE failed
Out of curiosity, do you have selinux enabled or any other restrictive security systems? Unless you have got some very strange permissions setup, I have never heard of su and sudo being inaccessible to a user. They certainly may not allow elevated rights if the user does not have permission, but thats far from being denied read\execute permission.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.