How to monitor the memory value which is in bytes or kb/mb

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
pratikmehta003
Posts: 105
Joined: Thu Apr 09, 2020 7:35 am

How to monitor the memory value which is in bytes or kb/mb

Post by pratikmehta003 »

Hi,

We have some network devices for which when we try to poll the memory values via OID, it is giving values other than % so how can we configure in nagios and use warning and critical threshold?

example below, the first value is for memory.
snmpwalk -v 2c -c 'limacharlie@1979' 10.150.1.122 1.3.6.1.2.1.25.2.3.1.6
HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 3369888
HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 3369888
HOST-RESOURCES-MIB::hrStorageUsed.6 = INTEGER: 148684
HOST-RESOURCES-MIB::hrStorageUsed.7 = INTEGER: 860436
HOST-RESOURCES-MIB::hrStorageUsed.10 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageUsed.31 = INTEGER: 440056
HOST-RESOURCES-MIB::hrStorageUsed.36 = INTEGER: 7907
HOST-RESOURCES-MIB::hrStorageUsed.38 = INTEGER: 154
HOST-RESOURCES-MIB::hrStorageUsed.39 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageUsed.55 = INTEGER: 4595
HOST-RESOURCES-MIB::hrStorageUsed.56 = INTEGER: 9053
HOST-RESOURCES-MIB::hrStorageUsed.57 = INTEGER: 177
HOST-RESOURCES-MIB::hrStorageUsed.58 = INTEGER: 2976
HOST-RESOURCES-MIB::hrStorageUsed.59 = INTEGER: 332959
HOST-RESOURCES-MIB::hrStorageUsed.60 = INTEGER: 557
HOST-RESOURCES-MIB::hrStorageUsed.61 = INTEGER: 565
HOST-RESOURCES-MIB::hrStorageUsed.62 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageUsed.63 = INTEGER: 0
HOST-RESOURCES-MIB::hrStorageUsed.64 = INTEGER: 0

screenshot from SNMPwalk wizard
snmpwalk wizard screenshot.PNG
You do not have the required permissions to view the files attached to this post.
pratikmehta003
Posts: 105
Joined: Thu Apr 09, 2020 7:35 am

Re: How to monitor the memory value which is in bytes or kb/

Post by pratikmehta003 »

if any other info needed, let me know..
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: How to monitor the memory value which is in bytes or kb/

Post by gsmith »

Hi,

There are a few ways you can go:

1) Find out the total memory, then using that you can set critical and warning levels.

2) Create your own command. Go to the CCM and in the left-hand menu choose Commands, _Commands. Select the + Add New box:
Screenshot 2021-04-26 132530.jpg
From Available plugins choose "check_snmp_mem.pl"
Screenshot 2021-04-26 133112.jpg
You can see an explanation of the plugin using the -h option:

Code: Select all

[root@gs-cent8-23-82 libexec]# ./check_snmp_mem.pl -h

SNMP Memory Monitor for Nagios version 1.1
(c)2004-2006 to my cat Ratoune - Author: Patrick Proy

Usage: ./check_snmp_mem.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>])  [-p <port>] -w <warn level> -c <crit level> [-I|-N|-E] [-f] [-m] [-t <timeout>] [-V]
-v, --verbose
   print extra debugging information (including interface list on the system)
-h, --help
   print this help message
-H, --hostname=HOST
   name or IP address of host to check
-C, --community=COMMUNITY NAME
   community name for the host's SNMP agent (implies SNMP v1 or v2c with option)
-2, --v2c
   Use snmp v2c
-l, --login=LOGIN ; -x, --passwd=PASSWD
   Login and auth password for snmpv3 authentication
   If no priv password exists, implies AuthNoPriv
-X, --privpass=PASSWD
   Priv password for snmpv3 (AuthPriv protocol)
-L, --protocols=<authproto>,<privproto>
   <authproto> : Authentication protocol (md5|sha : default md5)
   <privproto> : Priv protocole (des|aes : default des)
-P, --port=PORT
   SNMP port (Default 161)
-w, --warn=INTEGER | INT,INT
   warning level for memory in percent (0 for no checks)
     Default (-N switch) : comma separated level for Real Memory and Swap
     -I switch : warning level
-c, --crit=INTEGER | INT,INT
   critical level for memory in percent (0 for no checks)
     Default (-N switch) : comma separated level for Real Memory and Swap
     -I switch : critical level
-N, --netsnmp (default)
   check linux memory & swap provided by Net SNMP
-m, --memcache
   include cached memory in used memory (only with Net-SNMP)
-I, --cisco
   check cisco memory (sum of all memory pools)
-E, --hp
   check HP proccurve memory
-f, --perfdata
   Performance data output
-t, --timeout=INTEGER
   timeout for SNMP in seconds (Default: 5)
-V, --version
   prints version number
[root@gs-cent8-23-82 libexec]#
Thanks
You do not have the required permissions to view the files attached to this post.
pratikmehta003
Posts: 105
Joined: Thu Apr 09, 2020 7:35 am

Re: How to monitor the memory value which is in bytes or kb/

Post by pratikmehta003 »

Hi, the screenshot I gave is what it shows for total memory. So how can I use that for warning and critical. The value doesn't come in percentage.

The second option via writing a command I will check but if first option works then I would like to use that.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: How to monitor the memory value which is in bytes or kb/

Post by gsmith »

Hi,

1.3.6.1.2.1.25.2.3.1.6 is for hrStorageUsed.

Take a look at 1.3.6.1.2.1.25.2.3.1.5, it is hrStorageSize

So depending on how you are using warning and critical setpoints you can calculate values for 1.3.6.1.2.1.25.2.3.1.6.

An example:
if hrStorageSize = 4000000, and you want a warning when it gets to 80% used, then .8 x 4000000 = 3200000.
So you would set your warning value to 3200000.

You will need to verify with the hardware vendor that those are the correct OIDs to use for what
you are trying to measure and alert on.

Thanks
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: How to monitor the memory value which is in bytes or kb/

Post by ssax »

In addition to what @gsmith posted.

Try this one against it:

Code: Select all

/usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H 10.150.1.122 -C 'limacharlie@1979' --v2c -m "^/$" -T pl -w 10 -c 5 -f
Taken from here:

https://support.nagios.com/kb/article/d ... s-770.html
https://support.nagios.com/kb/category.php?id=186

That should output in percent and auto-convert the thresholds. Generally, if the remote system supports hrStorage you can run the Linux SNMP Wizard against it.
pratikmehta003
Posts: 105
Joined: Thu Apr 09, 2020 7:35 am

Re: How to monitor the memory value which is in bytes or kb/

Post by pratikmehta003 »

Hi,

Thanks for both information, let me check this.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: How to monitor the memory value which is in bytes or kb/

Post by gsmith »

Hi,

Sounds good. We'll keep this open until we hear back from you.

Thanks
Locked