lookup device-id failed: Physical Memory

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.
tmeto
Posts: 26
Joined: Tue Aug 20, 2013 4:59 am

Re: lookup device-id failed: Physical Memory

Post by tmeto »

windows server 2000 and no nsclient++ install, only snmp service.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: lookup device-id failed: Physical Memory

Post by abrist »

Looks like windows 2000 does not support the necessary OID that is being checked by the plugin. Do you know which oid/mib you wish to check?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
JeffreySilverman
Posts: 2
Joined: Fri Apr 01, 2016 6:55 pm

Re: lookup device-id failed: Physical Memory

Post by JeffreySilverman »

I believe I know the answer. In order to find the index in the table HOST-RESOURCES-MIB::hrStorageDescr, the SNMP client has to walk the table and look for the string "Physical Memory". In my example here, I am looking at "Virtual Memory", but the principle is exactly the same:

Code: Select all

[nagios@nagios-test libexec]$ ../libexec/check_disk_snmp.pl -H seeppzap15 -s XXXXXX -d virt

HOST	seeppzap15
PORT	161
COMM	XXXXXXX
Finding index for "Virtual Memory"
devDesc .1.3.6.1.2.1.25.2.3.1.3.3 => Virtual memory
devDesc .1.3.6.1.2.1.25.2.3.1.3.40 => /var/tmp
devDesc .1.3.6.1.2.1.25.2.3.1.3.31 => /
devDesc .1.3.6.1.2.1.25.2.3.1.3.6 => Memory buffers
devDesc .1.3.6.1.2.1.25.2.3.1.3.38 => /tmp
devDesc .1.3.6.1.2.1.25.2.3.1.3.39 => /var/log/audit
devDesc .1.3.6.1.2.1.25.2.3.1.3.7 => Cached memory
devDesc .1.3.6.1.2.1.25.2.3.1.3.10 => Swap space
devDesc .1.3.6.1.2.1.25.2.3.1.3.36 => /boot
devDesc .1.3.6.1.2.1.25.2.3.1.3.1 => Physical memory
devDesc .1.3.6.1.2.1.25.2.3.1.3.37 => /home
devDesc .1.3.6.1.2.1.25.2.3.1.3.35 => /dev/shm
devDesc .1.3.6.1.2.1.25.2.3.1.3.46 => /usr/applications/commerce-prod/data/media
devDesc .1.3.6.1.2.1.25.2.3.1.3.47 => /usr/applications/commerce-prod/data/tommybahama
lookup device-id failed: Virtual Memory
[nagios@nagios-test libexec]$


The problem is that the snmpd on linux returned the string "Virtual memory", but the program is looking for the string "Virtual Memory". I changed 1 letter in the source code, and that fixed the problem for me.

Code: Select all

[nagios@nagios-test libexec]$ ../libexec/check_disk_snmp.pl -H seeppzap15 -s XXXXXXXX -d virt

HOST	seeppzap15
PORT	161
COMM	XXXXXXXX
Finding index for "Virtual memory"
devDesc .1.3.6.1.2.1.25.2.3.1.3.3 => Virtual memory
Matched "Virtual memory" as index 3
Getting information for hrStorage.3
devDesc .1.3.6.1.2.1.25.2.3.1.3.3 => Virtual memory
devSize .1.3.6.1.2.1.25.2.3.1.5.3 => 20462452
devUsed .1.3.6.1.2.1.25.2.3.1.6.3 => 16294172
devUnit .1.3.6.1.2.1.25.2.3.1.4.3 => 1024

SNMP OK - Virtual memory at 79% with 4,070 of 19,982 MB free
[nagios@nagios-test libexec]$
I tried the same fix, and it should work for you.

Code: Select all

[nagios@nagios-test libexec]$ ../libexec/check_disk_snmp.pl -H seeppzap15 -s XXXXXXX  -d phys

HOST	seeppzap15
PORT	161
COMM	XXXXXXXXXX
Finding index for "Physical memory"
devDesc .1.3.6.1.2.1.25.2.3.1.3.3 => Virtual memory
devDesc .1.3.6.1.2.1.25.2.3.1.3.40 => /var/tmp
devDesc .1.3.6.1.2.1.25.2.3.1.3.31 => /
devDesc .1.3.6.1.2.1.25.2.3.1.3.6 => Memory buffers
devDesc .1.3.6.1.2.1.25.2.3.1.3.38 => /tmp
devDesc .1.3.6.1.2.1.25.2.3.1.3.39 => /var/log/audit
devDesc .1.3.6.1.2.1.25.2.3.1.3.7 => Cached memory
devDesc .1.3.6.1.2.1.25.2.3.1.3.10 => Swap space
devDesc .1.3.6.1.2.1.25.2.3.1.3.36 => /boot
devDesc .1.3.6.1.2.1.25.2.3.1.3.1 => Physical memory
Matched "Physical memory" as index 1
Getting information for hrStorage.1
devDesc .1.3.6.1.2.1.25.2.3.1.3.1 => Physical memory
devSize .1.3.6.1.2.1.25.2.3.1.5.1 => 16333688
devUsed .1.3.6.1.2.1.25.2.3.1.6.1 => 16051556
devUnit .1.3.6.1.2.1.25.2.3.1.4.1 => 1024

SNMP CRITICAL - Physical memory at 98% with 275 of 15,950 MB free
[nagios@nagios-test libexec]$ 

I think the changes I made were a little overkill:

Code: Select all

[nagios@nagios-test libexec]$ diff check_disk_snmp.pl check_disk_snmp_ORIGINAL.pl
17c17
< $VERBOSE	= 2;	# Was 0 JHS
---
> $VERBOSE	= 0;
69,70c69,70
< 	     "\tUse \"phys\" device_description for \"Physical memory\"\n",
< 	     "\tUse \"real\" device_description for \"Real memory\"\n",
---
> 	     "\tUse \"phys\" device_description for \"Physical Memory\"\n",
> 	     "\tUse \"real\" device_description for \"Real Memory\"\n",
72c72
< 	     "\tUse \"virt\" device_description for \"Virtual memory\"\n",
---
> 	     "\tUse \"virt\" device_description for \"Virtual Memory\"\n",
120c120
<     "  # Checks free \"Virtual memory\", warning at 1GB, critical at 512MB\n\n",
---
>     "  # Checks free \"Virtual Memory\", warning at 1GB, critical at 512MB\n\n",
233,234c233,234
<     $desc	= $desc	eq 'real' ? 'Real memory'	:
< 		  $desc eq 'phys' ? 'Physical memory'	:
---
>     $desc	= $desc	eq 'real' ? 'Real Memory'	:
> 		  $desc eq 'phys' ? 'Physical Memory'	:
236c236
< 		  $desc eq 'virt' ? 'Virtual memory'	:
---
> 		  $desc eq 'virt' ? 'Virtual Memory'	:
267c267
<   -version	=> 2,	# Was 1 JHS
---
>   -version	=> 1,
[nagios@nagios-test libexec]$ 

Does that help?

Now, this is not a universal panacea. Solaris uses an upper M. So the real solution is to do a case insensitive comparison. I left an issue at https://github.com/romicaraicu/nagios/issues on the subject.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: lookup device-id failed: Physical Memory

Post by mcapra »

Thanks for the info @JeffreySilverman ! Going to lock this thread up since it's getting a bit old
Former Nagios employee
https://www.mcapra.com/
Locked