{"id":236,"date":"2012-04-18T22:15:21","date_gmt":"2012-04-19T02:15:21","guid":{"rendered":"http:\/\/blog.domb.net\/?p=236"},"modified":"2012-04-18T22:15:21","modified_gmt":"2012-04-19T02:15:21","slug":"nagios-check_netsnmp_memory-and-rhel6","status":"publish","type":"post","link":"https:\/\/blog.domb.net\/?p=236","title":{"rendered":"Nagios check_netsnmp_memory and RHEL6"},"content":{"rendered":"<p>Today I was searching for a nagios check which gets memory information over snmp. So I came across check_netsnmp_memory. It has also a nice php template for pnp4nagios.<\/p>\n<p>To test the command I run:<\/p>\n<p># .\/check_netsnmp_memory -L &#8220;Memory Utilization&#8221; -A &#8216;*&#8217; -H graylog2.domb.net -C public -a &#8216;total,user,cached,buffer,%used_real,%used_swap,%user_real,%cached_real&#8217; -w &#8216;,,,500MB,,65%,65%,&#8217;\u00a0 -c &#8216;,,,800MB,,80%,80%,&#8217;<\/p>\n<p>As a result I got this:<\/p>\n<p><strong>ERROR: snmp get_request failed &#8211; Received noSuchName(2) error-status at error-index 7.<\/strong><\/p>\n<p>Seems that one of the snmp checks does not get a value back. So i looked at the check_netsnmp_memory script.<\/p>\n<p>On line \u00a056\u00a0 you&#8217;ll find\u00a0 &#8220;shared=snmp(1.3.6.1.4.1.2021.4.13.0),1000,\/,round(1),&#8217; MB&#8217;,+&#8221;,<\/p>\n<p>This queries the following value UCD-SNMP-MIB::memShared.0.<\/p>\n<p>Aha \ud83d\ude42 <em><strong>memShared<\/strong><\/em>.<\/p>\n<p>As far as I now &#8220;memShared&#8221; is no longer valid in Linux &gt;= 2.6 kernel and was dropped from<br \/>\nnet-snmp. Because we know that this value should be always &#8216;0&#8217; you can comment\u00a0 line 56 and replace shared with a &#8216;0&#8217; on line 65.<\/p>\n<p>line 56:<\/p>\n<p><span style=\"color: red\"> &#8211; <\/span>&#8220;shared=snmp(1.3.6.1.4.1.2021.4.13.0),1000,\/,round(1),&#8217; MB&#8217;,+&#8221;,<br \/>\n<span style=\"color: green\"> + <\/span> <strong>#<\/strong> &#8220;shared=snmp(1.3.6.1.4.1.2021.4.13.0),1000,\/,round(1),&#8217; MB&#8217;,+&#8221;,<\/p>\n<p>line 65:<\/p>\n<p><span style=\"color: red\"> &#8211; <\/span> &#8220;user=total_real,avail_real,-,total_swap,+,avail_swap,-,buffer,-,<em><strong>shared<\/strong><\/em>,-,cached,-,&#8217; MB&#8217;,+&#8221;,<br \/>\n<span style=\"color: green\"> + <\/span> &#8220;user=total_real,avail_real,-,total_swap,+,avail_swap,-,buffer,-,<em><strong>0,<\/strong><\/em>-,cached,-,&#8217; MB&#8217;,+&#8221;,<\/p>\n<p>Now run the command again:<\/p>\n<p># .\/check_netsnmp_memory -L &#8220;Memory Utilization&#8221; -A &#8216;*&#8217; -H graylog2.domb.net -C public -a &#8216;total,user,cached,buffer,%used_real,%used_swap,%user_real,%cached_real&#8217; -w &#8216;,,,500MB,,65%,65%,&#8217;\u00a0 -c &#8216;,,,800MB,,80%,80%,&#8217;<\/p>\n<p>Memory Utilization OK &#8211; total is 24846.1 MB [16457.5 MB real 8388.6 MB swap : 8734.0 MB free], user is 7149 MB, cached is 8803.8 MB, buffer is 159.3 MB, %used_real is 97.76%, %used_swap is 0.27%, %user_real is 43.44%, %cached_real is 53.49% | total_free=8734.0 %avail_real=2.24 %avail_swap=99.73 %buffer_real=0.97 user=7149 %user_real=43.44 avail_swap=8365.7 %used_real=97.76 used_swap=22.9 total=24846.1 %cached_real=53.49 cached=8803.8 total_swap=8388.6 buffer=159.3 min_swap=16.0 avail_real=368.3 total_real=16457.5 %used_swap=0.27<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I was searching for a nagios check which gets memory information over snmp. So I came across check_netsnmp_memory. It has also a nice php template for pnp4nagios. To test the command I run: # .\/check_netsnmp_memory -L &#8220;Memory Utilization&#8221; -A &#8216;*&#8217; -H graylog2.domb.net -C public -a &#8216;total,user,cached,buffer,%used_real,%used_swap,%user_real,%cached_real&#8217; -w &#8216;,,,500MB,,65%,65%,&#8217;\u00a0 -c &#8216;,,,800MB,,80%,80%,&#8217; As a result I&#8230;<\/p>\n","protected":false},"author":2,"featured_media":245,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-236","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=236"}],"version-history":[{"count":7,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/236\/revisions"}],"predecessor-version":[{"id":247,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/posts\/236\/revisions\/247"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=\/wp\/v2\/media\/245"}],"wp:attachment":[{"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.domb.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}