Monitor SHMALL value

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
anthonywong
Posts: 11
Joined: Mon Mar 04, 2019 8:17 am

Monitor SHMALL value

Post by anthonywong »

Hi Support,
There is a request came in to monitor "SHMALL" value. Is this possible for Nagios?

Following is SHMALL in Linux box:

a1383660@HKLPAPISI005[~] $ lsipc
RESOURCE DESCRIPTION LIMIT USED USE%
MSGMNI Number of message queues 1024 1 0.10%
MSGMAX Max size of message (bytes) 131072 - -
MSGMNB Default max size of queue (bytes) 131072 - -
SHMMNI Shared memory segments 4096 39 0.95%
SHMALL Shared memory pages 2097152 198537 9.47%
SHMMAX Max size of shared memory segment (bytes) 68719476736 - -
SHMMIN Min size of shared memory segment (bytes) 1 - -
SEMMNI Number of semaphore identifiers 1024 32 3.12%
SEMMNS Total number of semaphores 256000 32 0.01%
SEMMSL Max semaphores per semaphore set. 500 - -
SEMOPM Max number of operations per semop(2) 250 - -
SEMVMX Semaphore max value 32767 - -
a1383660@HKLPAPISI005[~] $ lsipc

Thanks and Regards,
Anthony
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitor SHMALL value

Post by lmiltchev »

You will need to write a custom script by following the Nagios Plugins Development Guidelines.

Here's a "sample" script that can get you started.

SHMALL.sh

Code: Select all

#!/bin/bash

output=`lsipc | grep SHMALL | awk '{print $6}'`
warn=$1
crit=$2

if [ $output -gt $crit ]; then
  echo "CRITICAL: Shared memory pages: $output | 'Used'=$output;$warn;$crit"
  exit 2
elif [ $output -gt $warn ]; then
  echo "WARNING: Shared memory pages: $output | 'Used'=$output;$warn;$crit"
  exit 1
else
  echo "OK: Shared memory pages: $output | 'Used'=$output;$warn;$crit"
  exit 0
fi
Place the script into the nagios plugins directory, and create a command in the nrpe.cfg file, for example:

Code: Select all

command[check_SHMALL]=/usr/local/nagios/libexec/SHMALL.sh $ARG1$ $ARG2$
Save, exit and restart NRPE, so that changes can take effect.

Test the check by running the following command from the command line on the Nagios server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_SHMALL -a <warning> <critical>
where you substitute <warning> and <critical> with actual values for warning and critical thresholds.

Note: In the example above, I am looking into the "USED Shared memory pages". If you wanted to monitor "USE%" instead, you would need to modify the script.

Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
anthonywong
Posts: 11
Joined: Mon Mar 04, 2019 8:17 am

Re: Monitor SHMALL value

Post by anthonywong »

thanks for your assistance and pointer.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitor SHMALL value

Post by lmiltchev »

You are welcome! Let us know if it is OK to close this topic. Thank you!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked