{"id":540,"date":"2014-09-10T12:34:33","date_gmt":"2014-09-10T12:34:33","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=540"},"modified":"2014-09-10T12:35:24","modified_gmt":"2014-09-10T12:35:24","slug":"snmp-and-shell-script","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/snmp-and-shell-script\/","title":{"rendered":"SNMP and Shell Script"},"content":{"rendered":"<p>First you will need to make sure SNMP is installed.<\/p>\n<pre>apt-get install snmpd snmp snmp-mibs-downloader<\/pre>\n<p>You&#8217;ll need to configure a new snmpd.conf file with<\/p>\n<pre>snmpconf<\/pre>\n<p>Run through the steps and when your done replace your current snmpd.conf file in \/etc\/snmp\/ with the new one.<\/p>\n<p>Now open up your new snmpd.conf file<\/p>\n<pre>vi \/etc\/snmp\/snmpd.conf<\/pre>\n<p>and add the following to the bottom of the file.<\/p>\n<pre>extend myshscript \/path\/to\/your.sh<\/pre>\n<p>Save and close the file and restart the snmpd service.<\/p>\n<pre>service snmpd restart<\/pre>\n<p>Now we need to find the OID of our new data point.\u00a0 Do this by running<\/p>\n<pre>snmpwalk -v2c -c public localhost .1.3.6.1.4.1.8072.1.3.2<\/pre>\n<p>It should display something similar to the following.<\/p>\n<pre>root@localhost:\/etc\/snmp# snmpwalk -v2c -c public localhost .1.3.6.1.4.1.8072.1.3.2\r\niso.3.6.1.4.1.8072.1.3.2.1.0 = INTEGER: 1\r\niso.3.6.1.4.1.8072.1.3.2.2.1.2.4.118.111.108.116 = STRING: \"\/etc\/snmp\/volt.sh\"\r\niso.3.6.1.4.1.8072.1.3.2.3.1.4.4.118.111.108.116 = INTEGER: 0\r\niso.3.6.1.4.1.8072.1.3.2.4.1.2.4.118.111.108.116.1 = STRING: \"14.3\"\r\nroot@localhost:\/etc\/snmp#\r\n<\/pre>\n<p>The OID we are interested in is the one on the last line.\u00a0 If you run a snmpwalk command with the OID you should get your data point.<\/p>\n<pre>root@localhost:\/etc\/snmp# snmpwalk -v2c -c public localhost 1.3.6.1.4.1.8072.1.3.2.4.1.2.4.118.111.108.116.1\r\niso.3.6.1.4.1.8072.1.3.2.4.1.2.4.118.111.108.116.1 = STRING: \"14.3\"\r\nroot@localhost:\/etc\/snmp#\r\n<\/pre>\n<p>All that&#8217;s left is to add the OID to your SNMP monitor.\u00a0 If You run into issues with your SNMP server not monitoring the OID, you might need do what I did in the above command, replace the beginning of the OID &#8220;iso.&#8221; with a &#8220;1&#8221;.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First you will need to make sure SNMP is installed. apt-get install snmpd snmp snmp-mibs-downloader You&#8217;ll need to configure a new snmpd.conf file with snmpconf Run through the steps and when your done replace your current snmpd.conf file in \/etc\/snmp\/ &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/snmp-and-shell-script\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,130],"tags":[7,173,133,174,171,172],"class_list":["post-540","post","type-post","status-publish","format-standard","hentry","category-linux","category-snmp","tag-linux-2","tag-script","tag-snmp-2","tag-snmp-extend","tag-snmpd","tag-snmpwalk"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=540"}],"version-history":[{"count":9,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/540\/revisions"}],"predecessor-version":[{"id":561,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/540\/revisions\/561"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}