Page 2 of 3
Re: Having Some NRPE issues with specific commands
Posted: Wed Apr 30, 2014 2:10 pm
by abrist
Try:
Code: Select all
su - -s /bin/bash nagios '/usr/lib64/nagios/plugins/check_open_files.pl -w 85 -c 95'
echo $?
Or:
Code: Select all
su - nagios -c "/usr/lib64/nagios/plugins/check_open_files.pl -w 85 -c 95"
echo $?
Re: Having Some NRPE issues with specific commands
Posted: Wed Apr 30, 2014 2:18 pm
by brandon.pal
Code: Select all
[root@dc01-cache-01 plugins]# ./check_open_files.pl -w 85 -c 95
OK: 928 open files (0% of max 1000000)|opened_files=928;850000;950000
Code: Select all
[root@dc01-cache-01 plugins]# su - -s /bin/bash nagios /usr/lib64/nagios/plugins/check_open_files.pl -w 85 -c 95
su: invalid option -- 'w'
Try `su --help' for more information.
Code: Select all
su -l -s /bin/bash nagios /usr/lib64/nagios/plugins/check_open_files.pl
/usr/lib64/nagios/plugins/check_open_files.pl: line 3: use: command not found
/usr/lib64/nagios/plugins/check_open_files.pl: line 4: syntax error near unexpected token `('
/usr/lib64/nagios/plugins/check_open_files.pl: line 4: `use vars qw($opt_h $PROGNAME $opt_w $opt_c $opt_t $opt_vi $msg $state);'
Re: Having Some NRPE issues with specific commands
Posted: Wed Apr 30, 2014 4:48 pm
by abrist
Can nagios see the perl bin and use it?
Code: Select all
su -l -s /bin/bash nagios -c "which perl"
su -l -s /bin/bash nagios -c "perl --version"
Re: Having Some NRPE issues with specific commands
Posted: Thu May 01, 2014 10:50 am
by brandon.pal
Code: Select all
[root@dc01-cache-01 ~]# su -l -s /bin/bash nagios -c "which perl"
/usr/bin/perl
[root@dc01-cache-01 ~]# su -l -s /bin/bash nagios -c "perl --version"
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Re: Having Some NRPE issues with specific commands
Posted: Thu May 01, 2014 11:30 am
by lmiltchev
Run the following commands and show the output.
Code: Select all
usermod -s /bin/bash nagios
su nagios
/usr/lib64/nagios/plugins/check_open_files.pl -w 85 -c 95
echo $?
Re: Having Some NRPE issues with specific commands
Posted: Fri May 02, 2014 10:41 am
by brandon.pal
Code: Select all
[root@dc01-cache-01 ~]# usermod -s /bin/bash nagios
[root@dc01-cache-01 ~]# su nagios
bash-4.1$ /usr/lib64/nagios/plugins/check_open_files.pl -w 85 -c 95
Can't locate utils.pm in @INC (@INC contains: /usr/local/nagios/libexec /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/lib64/nagios/plugins/check_open_files.pl line 6.
BEGIN failed--compilation aborted at /usr/lib64/nagios/plugins/check_open_files.pl line 6.
bash-4.1$ echo
Re: Having Some NRPE issues with specific commands
Posted: Fri May 02, 2014 10:55 am
by slansing
Did you compile the nagios plugins package on this system? It looks like you are missing the Utils perl module. Can you attach your plugin? I'd be interested in seeing it's USE definition, since you have a fairly unstandard directory for your plugins I would not be surprised if it is looking in the wrong location. Does the file "utils.pm" exist in your plugin directory?
Re: Having Some NRPE issues with specific commands
Posted: Fri May 02, 2014 11:03 am
by brandon.pal
From what I know our prod sys admin did this:
Code: Select all
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum -y install nagios nagios-plugins-all nrpe
chkconfig nagios on
slansing wrote:Does the file "utils.pm" exist in your plugin directory?
/usr/lib64/nagios/plugins/utils.pm
slansing wrote:I'd be interested in seeing it's USE definition
Code: Select all
use Getopt::Long;
use vars qw($opt_h $PROGNAME $opt_w $opt_c $opt_t $opt_vi $msg $state);
use lib "/usr/local/nagios/libexec";
use utils qw(%ERRORS &print_revision &support &usage );
Re: Having Some NRPE issues with specific commands
Posted: Fri May 02, 2014 11:05 am
by slansing
Try changing:
Code: Select all
use lib "/usr/local/nagios/libexec";
To
Code: Select all
use lib "/usr/lib64/nagios/plugins/";
Then run the commands lmiltchev posted above, again, thanks!
Yeah yum is a really easy way to install applications, unfortunately on a system to system basis and package to package, the directory structure or contents of the package can change. That's why I usually recommend compiling the plugins by hand.
Re: Having Some NRPE issues with specific commands
Posted: Fri May 02, 2014 11:10 am
by brandon.pal
brandon.pal wrote:Then run the commands lmiltchev posted above, again, thanks!
Code: Select all
[root@dc01-cache-01 ~]# su nagios
bash-4.1$ /usr/lib64/nagios/plugins/check_open_files.pl -w 85 -c 95
OK: 1408 open files (0% of max 1000000)|opened_files=1408;850000;950000
bash-4.1$ echo $?
0
brandon.pal wrote:That's why I usually recommend compiling the plugins by hand.
I'll be honest. I have no idea how to do that.