Memory utilization not showing in HP-UX through NRPE

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Memory utilization not showing in HP-UX through NRPE

Post by lmiltchev »

You get a value for the PERCENTUSED variable just fine, and your command (run on the remote box) displays a percentage. So, the other possibility is that nagios user cannot run swapinfo (permissions issue) or doesn't have the full path to grep, sed or awk, which are used to determine the value of PERCENTUSED.

Code: Select all

PERCENTUSED=$(swapinfo -m | grep memory |  sed 's/'%'//' | awk ' { print $5 }')
Can you run the same command on the remote machine but as nagios user and show the output?

Code: Select all

su - nagios
/usr/local/nagios/libexec/check_mem -w 80 -c 90
Be sure to check out our Knowledgebase for helpful articles and solutions!
progressive.nagiosXI
Posts: 277
Joined: Mon Jul 31, 2017 5:54 am

Re: Memory utilization not showing in HP-UX through NRPE

Post by progressive.nagiosXI »

Hi Team,

We have run those command with Nagios user and we were getting desired output, i"ll share the snapshot soon please suggest what need to be done next.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Memory utilization not showing in HP-UX through NRPE

Post by lmiltchev »

Let's verify the output of the following commands:

On the Nagios XI server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <remote ip> -c check_mem -a '-w 80 -c 90'
On the remote machine:

Code: Select all

su - nagios
/usr/local/nagios/libexec/check_mem -w 80 -c 90
Be sure to check out our Knowledgebase for helpful articles and solutions!
progressive.nagiosXI
Posts: 277
Joined: Mon Jul 31, 2017 5:54 am

Re: Memory utilization not showing in HP-UX through NRPE

Post by progressive.nagiosXI »

We have shared the output with nagios user only and yes nagios user is able to run this plugin and getting output with percentage details. no problem in doing this on server with nagios user also.

Only NRPE is not able to fetch the details its only showing OK without no. in percent no matter if the output is in critical state or in warning state it will only show OK.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Memory utilization not showing in HP-UX through NRPE

Post by lmiltchev »

We have shared the output with nagios user only and yes nagios user is able to run this plugin and getting output with percentage details. no problem in doing this on server with nagios user also.
I don't see it anywhere... You showed us the command run as "root":
HSOLMANDEV:/usr/local/nagios/libexec #./check_mem -w 80 -c 90
OK - System Memory is at 10% |memory=10;90;80;00;80
HSOLMANDEV:/usr/local/nagios/libexec #

HSOLMANDEV:/usr/local/nagios/libexec #/usr/local/nagios/libexec/check_mem -w 80 -c 90
OK - System Memory is at 10% |memory=10;90;80;00;80
HSOLMANDEV:/usr/local/nagios/libexec #
Am I missing something?
Be sure to check out our Knowledgebase for helpful articles and solutions!
progressive.nagiosXI
Posts: 277
Joined: Mon Jul 31, 2017 5:54 am

Re: Memory utilization not showing in HP-UX through NRPE

Post by progressive.nagiosXI »

Hi Team,

Appoligies from our end.

Yes Nagios user is not able to run the command we were doing it wrong,

please find below output
HSOLMANDEV:/ #su - nagios
(c)Copyright 1983-2006 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993 The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2006 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.

Confidential computer software. Valid license from HP required for
possession, use or copying. Consistent with FAR 12.211 and 12.212,
Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government
under vendor's standard commercial license.

$ /usr/local/nagios/libexec/check_mem -w 80 -c 90
/usr/local/nagios/libexec/check_mem[92]: swapinfo: not found
OK - System Memory is at % |memory=;90;80;00;80
$

$ PERCENTUSED=$(swapinfo -m | grep memory | sed 's/'%'//' | awk ' { print $5 }')
sh: swapinfo: not found.
$

===========================================================


we have tried to give permission on swapinfo command

HSOLMANDEV:/ #which swapinfo
/usr/sbin/swapinfo
HSOLMANDEV:/ #ll /usr/sbin/swapinfo
-r-sr-xr-x 1 bin bin 77428 Nov 28 2013 /usr/sbin/swapinfo
HSOLMANDEV:/ #

but no success.

still nagios is not able to run the command.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Memory utilization not showing in HP-UX through NRPE

Post by lmiltchev »

Try adding the following line to sudoers:

Code: Select all

nagios ALL=NOPASSWD: /usr/sbin/swapinfo *
then test running the check again with sudo, logged in as nagios user:

Code: Select all

su - nagios
sudo /usr/local/nagios/libexec/check_mem -w 80 -c 90
If it works, you can change your command in the nrpe.cfg file by adding "sudo" to it.

Code: Select all

command[check_mem]=sudo /usr/local/nagios/libexec/check_mem $ARG1$
Be sure to check out our Knowledgebase for helpful articles and solutions!
progressive.nagiosXI
Posts: 277
Joined: Mon Jul 31, 2017 5:54 am

Re: Memory utilization not showing in HP-UX through NRPE

Post by progressive.nagiosXI »

the first time sudo required nagios password which we have not set as its using by NRPE,

is there any default password??
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Memory utilization not showing in HP-UX through NRPE

Post by lmiltchev »

No, there is no 'default' password for the nagios user. Did you add the following line to sudoers on the remote machine?

Code: Select all

nagios ALL=NOPASSWD: /usr/sbin/swapinfo *
It is strange that it is asking you for a password...
Be sure to check out our Knowledgebase for helpful articles and solutions!
progressive.nagiosXI
Posts: 277
Joined: Mon Jul 31, 2017 5:54 am

Re: Memory utilization not showing in HP-UX through NRPE

Post by progressive.nagiosXI »

Hi Team,

This is working the only problem was this that in the plugin check_mem command 'swapinfo' was getting used directly not with pure path ' /usr/sbin/swapinfo'

so the problem in HP- UX was this that root user is able to run the command by juust typing swapinfo but rest of the users need to type the exact path of this /usr/sbin/swapinfo

;-) Thanks team.

Thanks
ABhijay
Locked