check_nt!MEMUSE showing wrong info

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
lafargeuser
Posts: 341
Joined: Thu Sep 27, 2012 12:23 am

check_nt!MEMUSE showing wrong info

Post by lafargeuser »

using Nagios Core 3.4.1.

I'm using check_nt!MEMUSE against a Windows 2008 server. The server has 32GB of memory, but the check is showing 64GB. I'm seeing this on all servers of 2008 64 Bit.
due to i am not getting alert, if Mem utilization breach above 90% threshold which we have set.

However, this type of behaviour i have not seen in XI. What can be done in this case ?
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_nt!MEMUSE showing wrong info

Post by jsmurphy »

The memuse check will by default include page file and virtual memory... if you go into the NSC.ini you will find a line that reads like:
alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll=long type=physical type=virtual type=paged type=page
If you want to only display physical memory then change it to:
alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll=long type=physical
lafargeuser
Posts: 341
Joined: Thu Sep 27, 2012 12:23 am

Re: check_nt!MEMUSE showing wrong info

Post by lafargeuser »

Did chaneges. But still it is not showing physical memory.
if this is known issue. how to get over this.
Badly need solution because monitoring 2000+ servers.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_nt!MEMUSE showing wrong info

Post by jsmurphy »

It's not really an issue... it is intentional. The above solution is the only way to change it that I know of, though that was for NSClient++ 0.3.x and may have changed for 0.4.x

I would suggest logging a support ticket on the NSClient++ site as you will get the most accurate information from the developers and if there is a bug they will be the only ones who can fix it: http://www.nsclient.org/nscp/report (to create a ticket you need to register).

Hopefully you get the help you need!
lafargeuser
Posts: 341
Joined: Thu Sep 27, 2012 12:23 am

Re: check_nt!MEMUSE showing wrong info

Post by lafargeuser »

is this the bug of NSClient ?

I dig more in to & found below script. Is this can be use to get Physical memory, If yes how can i use this. Do i upload this to on nagios server.Pls help how can i move further with this script.

# Script to check real memory usage
# L.Gill 02/05/06 - V.1.0
# ------------------------------------------
# ######## Script Modifications ##########
# ------------------------------------------
# Who When What
# --- ---- ----
# LGill 17/05/06 "$percent" lt 1% fix - sed edits dc result beggining with "."
#
#
#!/bin/bash
USAGE="`basename $0` [-w|--warning]<percent free> [-c|--critical]<percent free>"
THRESHOLD_USAGE="WARNING threshold must be greater than CRITICAL: `basename $0` $*"
calc=/tmp/memcalc
percent_free=/tmp/mempercent
critical=""
warning=""
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
# print usage
if [[ $# -lt 4 ]]
then
echo ""
echo "Wrong Syntax: `basename $0` $*"
echo ""
echo "Usage: $USAGE"
echo ""
exit 0
fi
# read input
while [[ $# -gt 0 ]]
do
case "$1" in
-w|--warning)
shift
warning=$1
;;
-c|--critical)
shift
critical=$1
;;
esac
shift
done
# verify input
if [[ $warning -eq $critical || $warning -lt $critical ]]
then
echo ""
echo "$THRESHOLD_USAGE"
echo ""
echo "Usage: $USAGE"
echo ""
exit 0
fi
# Total memory available
total=`free -m | head -2 |tail -1 |gawk '{print $2}'`
# Total memory used
used=`free -m | head -2 |tail -1 |gawk '{print $3}'`
# Calc total minus used
free=`free -m | head -2 |tail -1 |gawk '{print $2-$3}'`
# normal values
#echo "$total"MB total
#echo "$used"MB used
#echo "$free"MB free
# make it into % percent free = ((free mem / total mem) * 100)
echo "5" > $calc # decimal accuracy
echo "k" >> $calc # commit
echo "100" >> $calc # multiply
echo "$free" >> $calc # division integer
echo "$total" >> $calc # division integer
echo "/" >> $calc # division sign
echo "*" >> $calc # multiplication sign
echo "p" >> $calc # print
percent=`/usr/bin/dc $calc|/bin/sed 's/^\./0./'|/usr/bin/tr "." " "|/usr/bin/gawk {'print $1'}`
#percent1=`/usr/bin/dc $calc`
#echo "$percent1"
if [[ "$percent" -le $critical ]]
then
echo "CRITICAL - $free MB ($percent%) Free Memory"
exit 2
fi
if [[ "$percent" -le $warning ]]
then
echo "WARNING - $free MB ($percent%) Free Memory"
exit 1
fi
if [[ "$percent" -gt $warning ]]
then
echo "OK - $free MB ($percent%) Free Memory"
exit 0
fi
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_nt!MEMUSE showing wrong info

Post by sreinhardt »

Hi lafargeuser,

This script definitely would work for a linux host that you might try to monitor. You would need to install a version of NRPE on the machine and have this script locally there. Nagios then can schedule a check where it executes this and collects the results from the remote host. Based on your previous mentioning of nsclient, my guess would be you are working on Windows hosts, where this would not work as bash is not a language for Windows. I will see if I can find something to help you out, if jsmurphy doesn't respond first.
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.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_nt!MEMUSE showing wrong info

Post by jsmurphy »

jsmurphy wrote:The memuse check will by default include page file and virtual memory...
jsmurphy wrote:It's not really an issue... it is intentional.
Let me put it more plainly: THIS IS NOT A BUG.

As Mr. Reinhardt explained the script you provided is for monitoring Linux and will not work for Windows. For more information on how to use CheckMem and why it's displaying information you do not expect please refer to: http://nsclient.org/nscp/wiki/CheckSystem/checkMem

In particular look at the section that details checking physical memory :).
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_nt!MEMUSE showing wrong info

Post by slansing »

As Jsmurphy stated, this is not a bug. The only way to change what type of memory CheckMEM returns information for is by setting the variable:

Code: Select all

type=

If you are still having trouble getting this to return the physical memory percentage please show us exactly how you have the command defined as if it were going to be ran on the ssh terminal. This way we would be able to show you what may be causing this.
lafargeuser
Posts: 341
Joined: Thu Sep 27, 2012 12:23 am

Re: check_nt!MEMUSE showing wrong info

Post by lafargeuser »

However, I am able to get physical memory using below command
[root@vshimsnagioscore libexec]# ./check_nrpe -H 172.17.98.163 -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical
OK: physical memory: 671M|'physical memory %'=32%;80;90 'physical memory'=671.09MB;1638.04;1842.8;0;2047.55

But how to configured the same in Nagios.

I tried below steps but didnt show physical memory which i can see above
Nagios Configuration:
define command {
command_name <<CheckMEM>>
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$% ShowAll type=page
}
<<CheckMEM>> 80!90
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_nt!MEMUSE showing wrong info

Post by jsmurphy »

./check_nrpe -H 172.17.98.163 -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll type=physical
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=$ARG1$% MaxCrit=$ARG2$% ShowAll type=page
Spot the difference in your commands (hint: it's in bold) ;)
Locked