Hi All,
Please help on this.
I'm using Nagios Core v3.2.0 installed in SLES10. And the Remote Client installed in RHEL.
And i found that the Monitoring of Service Status for Memory Usage in Nagios is inccorrect.
Nagios Monitoring:
Host:mypc001 OS:Linux:Memory:-:Usage:- OK: 94 % Memory used
OS Level:
But the actual memory usual in OS level is 40% Memory used
# free -m
total used free shared buffers cached
Mem: 7829 3149 4680 0 179 2074
-/+ buffers/cache: 895 6934
Swap: 10015 0 10015
and currently I'm using check_memory.sh as below:
=====================================================================
#!/bin/sh
#
# Prueft Memory-Auslastung anhand free
# Uebergabevariablen:
#
# $1 Warning-Schwellenwert %
# $2 Critical-Schwellenwert %
#
# -----------------------------------------------------
if [ $# -lt 2 ]; then
echo "Usage: $0 with params for warning in % and critical in % : $0 90 95"
exit 2
fi
mem_total=`free -m | grep Mem: | awk '{ print $2}'`
mem_used=`free -m | grep Mem: | awk '{ print $3}'`
let perc_used=100*$mem_used/$mem_total
if [ $perc_used -gt $2 ]
then
echo "Critical: $perc_used % Memory used"
exit 2
fi
if [ $perc_used -gt $1 ]
then
echo "Warning: $perc_used % Memory used"
exit 1
else
echo "OK: $perc_used % Memory used"
exit 0
fi
=====================================================================
Check Memory Usage 94% used
Check Memory Usage 94% used
- Attachments
-
- OS Level memory used
- check memory02.JPG (15.32 KiB) Viewed 3131 times
-
- Nagios Monitoring Memory used
- check memory01.JPG (27.58 KiB) Viewed 3131 times
Thanks & Regards,
SHEAN
SHEAN
Re: Check Memory Usage 94% used
I'm not a huge shell scripter, but I'd add a few debugging checks to see what the actual values are that it's figuring. I'm guessing it's just a simple logic error.
Code: Select all
echo "Var 2 is $2"
echo "Used is $perc_used"
if [ $perc_used -gt $2 ]
then
echo "Critical: $perc_used % Memory used"
exit 2
fi
Re: Check Memory Usage 94% used
Hi mGuthrie,
The result show as below:
OS:Linux:Memory:-:Usage:- Var 2 is -w
The current shell script as below:
=====================================================================
if [ $# -lt 2 ]; then
echo "Usage: $0 with params for warning in % and critical in % : $0 90 95"
exit 2
fi
mem_total=`free -m | grep Mem: | awk '{ print $2}'`
mem_used=`free -m | grep Mem: | awk '{ print $3}'`
let perc_used=100*$mem_used/$mem_total
echo "Var 2 is $2"
echo "Used is $perc_used"
if [ $perc_used -gt $2 ]
then
echo "Critical: $perc_used % Memory used"
exit 2
fi
if [ $perc_used -gt $1 ]
then
echo "Warning: $perc_used % Memory used"
exit 1
else
echo "OK: $perc_used % Memory used"
exit 0
fi
=====================================================================
The result show as below:
OS:Linux:Memory:-:Usage:- Var 2 is -w
The current shell script as below:
=====================================================================
if [ $# -lt 2 ]; then
echo "Usage: $0 with params for warning in % and critical in % : $0 90 95"
exit 2
fi
mem_total=`free -m | grep Mem: | awk '{ print $2}'`
mem_used=`free -m | grep Mem: | awk '{ print $3}'`
let perc_used=100*$mem_used/$mem_total
echo "Var 2 is $2"
echo "Used is $perc_used"
if [ $perc_used -gt $2 ]
then
echo "Critical: $perc_used % Memory used"
exit 2
fi
if [ $perc_used -gt $1 ]
then
echo "Warning: $perc_used % Memory used"
exit 1
else
echo "OK: $perc_used % Memory used"
exit 0
fi
=====================================================================
- Attachments
-
- Var 2 is -w
- check memory03.JPG (10.65 KiB) Viewed 3103 times
Thanks & Regards,
SHEAN
SHEAN
Re: Check Memory Usage 94% used
Ok, I think I see the problem. If you can show me what you actually passed this command as an argument I could confirm it. Right now your script is asking: Is '-w' less than 2?. You probably don't need the -w or -c arguments, just pass it the integers and see if that works better.
Re: Check Memory Usage 94% used
Hi,
Anyone here can share those scripts to monitor cpus and memory?
Are there already built in templates I can use?
It is a little frustrating and time wasting from my side to keep on searching and not finding any.
It just gives an impression that Nagios is not that user friendly.
Appreciate your help.
Anyone here can share those scripts to monitor cpus and memory?
Are there already built in templates I can use?
It is a little frustrating and time wasting from my side to keep on searching and not finding any.
It just gives an impression that Nagios is not that user friendly.
Appreciate your help.
Re: Check Memory Usage 94% used
You may refer to this site: http://nagios.manubulon.com/
Thanks & Regards,
SHEAN
SHEAN
Re: Check Memory Usage 94% used
Ah... am giving up on nagios already. Looks like good stuff don't come cheap. lol.
Enjoy your nagios journey.
Enjoy your nagios journey.