NRPE: Command 'check_mem' not defined

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

NRPE: Command 'check_mem' not defined

Post by RIDS_I2MP »

Hello Team,

We have one AIX server (10.144.223.174) on which we need to monitor physical memory. I have searched regarding the same and got to know about a plugin "check_mem.pl".

I have downloaded this plugin on our Nagios XI server (10.144.223.156):

-rwxr-xr-x 1 apache nagios 15013 Jun 18 06:18 check_mem.pl

On remote host, I have edited the nrpe.cfg file and added the command as below:

command[check_mem]=/usr/local/nagios/libexec/check_mem -f -w 20 -c 10

command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$

While trying to test the command from NAgios server command line, getting the below error:

[nagios@eu1papu003 libexec]$ /usr/local/nagios/libexec/check_nrpe -H 10.144.223.174 -c check_mem
NRPE: Command 'check_mem' not defined
[nagios@eu1papu003 libexec]$


Kindly, look into the issue and help us on the same.
Thanks & Regards,
I2MP Team.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Command 'check_mem' not defined

Post by scottwilkerson »

2 possible problems, first your command is defined like this

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem -f -w 20 -c 10
but your filename is check_mem.pl, I would change the command to

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem.pl -f -w 20 -c 10
2nd, you need to make sure you restart the nrpe service after making changes to the nrpe.cfg
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: NRPE: Command 'check_mem' not defined

Post by RIDS_I2MP »

Hello,

I changed the command as below:

command[check_mem]=/usr/local/nagios/libexec/check_mem.pl -f -w 20 -c 10

After that I restarted nrpe and ran the check command, getting other error now as below:

[nagios@eu1papu003 ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.144.223.174 -c check_mem
NRPE: Unable to read output
Thanks & Regards,
I2MP Team.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE: Command 'check_mem' not defined

Post by scottwilkerson »

What do you get if you run the following on the remote server

Code: Select all

su nagios -c "/usr/local/nagios/libexec/check_mem.pl -f -w 20 -c 10"
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: NRPE: Command 'check_mem' not defined

Post by RIDS_I2MP »

Hello,

Below is the output:

PRODUCTION> nagios@eu1pdwu094: /usr/local/nagios/libexec > su nagios -c "/usr/local/nagios/libexec/check_mem.pl -f -w 20 -c 10"
nagios's Password:
Memory CRITICAL - 0.0% (0 kB) free
PRODUCTION> nagios@eu1pdwu094: /usr/local/nagios/libexec >
Thanks & Regards,
I2MP Team.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE: Command 'check_mem' not defined

Post by lmiltchev »

Can you run the following command as nagios user (and as root) on the AIX box, and show the output?

Code: Select all

/usr/bin/vmstat -v
As far as I can tell, this is what is used by the plugin:

Code: Select all

...
elsif ( $uname =~ /AIX/ ) {
        my @meminfo = `/usr/bin/vmstat -v`;
        foreach (@meminfo) {
            chomp;
            if (/^\s*([0-9.]+)\s+(.*)/) {
                my $counter_name = $2;
                if ($counter_name eq 'memory pages') {
                    $total_memory_kb = $1*4;
                }
                if ($counter_name eq 'free pages') {
                    $free_memory_kb = $1*4;
                }
                if ($counter_name eq 'file pages') {
                    $caches_kb = $1*4;
                }
            }
        }
        $used_memory_kb = $total_memory_kb - $free_memory_kb;
    }
...
Be sure to check out our Knowledgebase for helpful articles and solutions!
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: NRPE: Command 'check_mem' not defined

Post by RIDS_I2MP »

Hi,

Below is the output:

PRODUCTION> nagios@eu1pdwu094: /home/nagios > /usr/bin/vmstat -v
12582912 memory pages
12120032 lruable pages
1376342 free pages
3 memory pools
2644264 pinned pages
90.0 maxpin percentage
3.0 minperm percentage
90.0 maxperm percentage
24.3 numperm percentage
2953153 file pages
0.0 compressed percentage
0 compressed pages
24.3 numclient percentage
90.0 maxclient percentage
2953153 client pages
0 remote pageouts scheduled
11533088 pending disk I/Os blocked with no pbuf
0 paging space I/Os blocked with no psbuf
2228 filesystem I/Os blocked with no fsbuf
131 client filesystem I/Os blocked with no fsbuf
63937017 external pager filesystem I/Os blocked with no fsbuf
65.6 percentage of memory used for computational pages
PRODUCTION> nagios@eu1pdwu094: /home/nagios >


I dont have root access to the server.
Thanks & Regards,
I2MP Team.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE: Command 'check_mem' not defined

Post by lmiltchev »

Can you also show the output of the following command?

Code: Select all

vmstat | tail -1 | awk '{print $4,$5}'
Be sure to check out our Knowledgebase for helpful articles and solutions!
RIDS_I2MP
Posts: 751
Joined: Thu Mar 13, 2014 9:25 am

Re: NRPE: Command 'check_mem' not defined

Post by RIDS_I2MP »

Hello,

Below is the output:

PRODUCTION> nagios@eu1pdwu094: /usr/bin > vmstat | tail -1 | awk '{print $4,$5}'
2388404 0
PRODUCTION> nagios@eu1pdwu094: /usr/bin >
Thanks & Regards,
I2MP Team.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE: Command 'check_mem' not defined

Post by tgriep »

We don't have access to an AIX server so we cannot test the plugin to see if it functions.

What version of AIX is the server running?
Can you run the plugin as root like the following example to see if it works?

Code: Select all

/usr/local/nagios/libexec/check_mem.pl -f -w 20 -c 10
There are a few versions of that plugin, can you provide a link to where you found it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked