<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>logIt &#187; snmp</title>
	<atom:link href="https://lakm.us/logit/tag/snmp/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Zabbix Proxy: distributed NMS monitoring via embedded Linux (Ubuntu on BeagleBoard)</title>
		<link>https://lakm.us/logit/2012/07/zabbix-proxy-distributed-nms-monitoring-embedded-linux-ubuntu-beagleboard/</link>
		<comments>https://lakm.us/logit/2012/07/zabbix-proxy-distributed-nms-monitoring-embedded-linux-ubuntu-beagleboard/#comments</comments>
		<pubDate>Thu, 19 Jul 2012 07:26:15 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[ARMv7]]></category>
		<category><![CDATA[BeagleBoard]]></category>
		<category><![CDATA[embedded system]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[snmp]]></category>
		<category><![CDATA[Zabbix]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=404</guid>
		<description><![CDATA[As already mentioned in previous post&#8217;s introduction, proof of concept on how Zabbix Proxy works under unreliable communication is what this next post about. The idea is to have these scenarios tested: independent SNMP data polling by individual NMS proxy (embedded system) intermittent connection between main/master NMS server with its proxy Of course we&#8217;ll do [...]]]></description>
				<content:encoded><![CDATA[<p>As already mentioned in <a href="./2012/07/compile-zabbix-proxy-ubuntu-arm-beagleboard/" title="Compile Zabbix Proxy in Ubuntu ARM (BeagleBoard)" target="_blank">previous post&#8217;s</a> introduction, proof of concept on how <a href="http://www.zabbix.com/documentation/1.8/manual/processes/zabbix_proxy" title="Zabbix Proxy" target="_blank">Zabbix Proxy</a> works under unreliable communication is what this next post about. The idea is to have these scenarios tested:</p>
<ol>
<li>independent SNMP data polling by individual NMS proxy (embedded system)</li>
<li>intermittent connection between main/master NMS server with its proxy</li>
</ol>
<p>Of course we&#8217;ll do them in implementation context of <a href="http://www.zabbix.com/documentation/1.8/manual/processes/zabbix_server" title="Zabbix Server" target="_blank">Zabbix Server</a> as main/master NMS server and our <a href="http://beagleboard.org/hardware-xM/" target="_blank">BeagleBoard xM</a> as its proxy.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="zabbix-proxy-routine-log-abstract-illustration.jpg" src="../../../../images/zabbix-proxy-routine-log-abstract-illustration.jpg" title="Zabbix Proxy - distributed NMS over embedded Linux" width="380" height="293" /><p class="wp-caption-text">Zabbix Proxy - distributed NMS over embedded Linux</p></div>
<p>In the technical details, I already followed pretty much the same steps showed in <a href="http://www.zabbix.com/wiki/howto/install/debian/zabbix_proxy_on_debian_sqlite" target="_blank">installation wiki</a> (with the exception that I didn&#8217;t put the process into startup <code>init.d</code> script as I would start it manually as needed).</p>
<p>The first test is to make our Ubuntu ARM board accepts configuration done in Zabbix Server web-GUI, retrieves SNMP data to it, and sends collected data to server. Mode passive is chosen so that the server will be the one initiating contact with the board. After enabling a certain SNMP host, i.e. <code>host-aaa</code>, as monitored-by-proxy, the Zabbix Server log will show:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">15677</span>:<span style="color: #000000;">20120601</span>:<span style="color: #000000;">022022.960</span> Sending configuration data to proxy <span style="color: #ff0000;">'beaglexm1'</span>. Datalen <span style="color: #000000;">9205</span></pre></div></div>

<p>Our board, &#8216;<code>beaglexm1</code>&#8216;, will start to poll SNMP data from <code>host-xxx</code> to then store it in designated <code>sqlite</code> database.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">975</span>:<span style="color: #000000;">20120531</span>:<span style="color: #000000;">212024.098</span> proxy <span style="color: #666666; font-style: italic;">#8 started [poller #5]</span>
<span style="color: #000000;">984</span>:<span style="color: #000000;">20120531</span>:<span style="color: #000000;">212024.128</span> proxy <span style="color: #666666; font-style: italic;">#17 started [discoverer #1]</span>
<span style="color: #000000;">968</span>:<span style="color: #000000;">20120531</span>:<span style="color: #000000;">212025.423</span> Received configuration data from server. Datalen <span style="color: #000000;">9205</span>
<span style="color: #000000;">971</span>:<span style="color: #000000;">20120531</span>:<span style="color: #000000;">212030.388</span> Enabling SNMP host <span style="color: #7a0874; font-weight: bold;">&#91;</span>host-aaa<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>From time to time as configured, our board will also run housekeeping to keep our board database file in small size.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">1081</span>:<span style="color: #000000;">20120531</span>:<span style="color: #000000;">224513.922</span> Executing housekeeper
<span style="color: #000000;">1081</span>:<span style="color: #000000;">20120531</span>:<span style="color: #000000;">224514.505</span> Deleted <span style="color: #000000;">4885</span> records from <span style="color: #7a0874; font-weight: bold;">history</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0.453765</span> seconds<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Under normal connection, in main Zabbix Server we&#8217;ll start seeing the collected data from <code>host-aaa</code> the same way as when the SNMP data is polled by the server directly. To emulate disruption to the connectivity, I choose to use simple <code>iptables</code> drop packet. This time the server will no longer seeing new data.</p>
<p>After the drop block is released, the server we&#8217;ll start seeing new data as well as data from the period of intermittent connection. It will take some time before all of that being sent to the server.</p>
<p>In general that proves it. I collected 44 OID values from the <code>host-aaa</code> every 30 seconds and in this case BeagleBoard utilization was very low as this wasn&#8217;t a stress test to see its performance. </p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2012/07/zabbix-proxy-distributed-nms-monitoring-embedded-linux-ubuntu-beagleboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compile Zabbix Proxy in Ubuntu ARM (BeagleBoard)</title>
		<link>https://lakm.us/logit/2012/07/compile-zabbix-proxy-ubuntu-arm-beagleboard/</link>
		<comments>https://lakm.us/logit/2012/07/compile-zabbix-proxy-ubuntu-arm-beagleboard/#comments</comments>
		<pubDate>Tue, 17 Jul 2012 08:28:57 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARMv7]]></category>
		<category><![CDATA[BeagleBoard]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[embedded system]]></category>
		<category><![CDATA[make-install]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[snmp]]></category>
		<category><![CDATA[workaround]]></category>
		<category><![CDATA[Zabbix]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=401</guid>
		<description><![CDATA[I needed to tackle practical limitation of SNMP monitoring under unreliable communication, a serious consideration was made for Zabbix Proxy. It was an option said to be ready for embedded hardware. I already had BeagleBoard xM Rev C running Ubuntu 11.10 Oneiric and needed to proof that it would port functionally to this Linux ARM [...]]]></description>
				<content:encoded><![CDATA[<p>I needed to tackle practical limitation of SNMP monitoring under unreliable communication, a serious consideration was made for <a href="http://www.zabbix.com/documentation/1.8/manual/processes/zabbix_proxy" title="Zabbix Proxy" target="_blank">Zabbix Proxy</a>. It was an option said to be <a href="http://www.zabbix.com/documentation/1.8/manual/proxies/proxy_vs_node" title="Zabbix: Proxy vs Node" target="_blank">ready for embedded hardware</a>. I already had BeagleBoard xM Rev C running <a href="./2011/12/ubuntu-on-beagleboard-xm-with-easycap-video-capture-compiling-driver/" title="Ubuntu on Beagleboard xM" target="_blank">Ubuntu 11.10 Oneiric</a> and needed to proof that it would port functionally to this Linux ARM board. There existed <code>zabbix-proxy-mysql</code> in <a href="https://launchpad.net/ubuntu/oneiric/armel/zabbix-proxy-mysql/1:1.8.5-1ubuntu2" title="armel zabbix-proxy-mysql" target="_blank">Oneiric repository</a>, but <code><a href="http://www.sqlite.org/" title="SQLite" target="_blank">sqlite</a></code> seemed to be a better scale option for embedded deployment.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="zabbix-proxy-abstract-illustration.png" src="../../../../images/zabbix-proxy-abstract-illustration.png" title="Zabbix Proxy Distributed NMS" width="330" height="253" /><p class="wp-caption-text">Zabbix Proxy Distributed NMS</p></div>
<p>An example set out for <a href="http://www.zabbix.com/wiki/howto/install/debian/zabbix_proxy_on_debian_sqlite" title="Wiki: Zabbix Proxy on Debian using sqlite" target="_blank">Zabbix Proxy on Debian</a> appears to be pretty straightforward to follow. With the ARM board already installed with <code>build-essential</code>, <code>snmp</code>, and <code>snmpd</code>, the following needs to be added:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libsnmp-dev libcurl4-openssl-dev fping curl sqlite libsqlite3-dev ntpdate</pre></div></div>

<p>then start the pre-compilation <code>configure</code> (in this case <a href="http://www.zabbix.com/rn1.8.7.php" title="Zabbix 1.8.7" target="_blank">Zabbix 1.8.7</a> is used):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> zabbix-1.8.7
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-proxy</span> <span style="color: #660033;">--enable-agent</span> <span style="color: #660033;">--with-sqlite3</span> <span style="color: #660033;">--with-net-snmp</span> <span style="color: #660033;">--with-libcurl</span></pre></div></div>

<p>It will go smooth. However, during <code>make</code> there are complains about undefined references to &#8216;<code>sqlite3_open</code>&#8216;, &#8216;<code>sqlite3_close</code>&#8216;, etc.:</p>
<p><span id="more-401"></span></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>libzbxdb.<span style="color: #202020;">a</span><span style="color: #009900;">&#40;</span>db.<span style="color: #202020;">o</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> In <span style="color: #000000; font-weight: bold;">function</span> `zbx_db_connect<span style="color: #ff0000;">':
/home/zabbix/zabbix-1.8.7/src/libs/zbxdb/db.c:331: undefined reference to `sqlite3_open'</span>
<span style="color: #339933;">/</span>home<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">-</span>1.8.7<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>db.<span style="color: #202020;">c</span><span style="color: #339933;">:</span><span style="color: #0000dd;">343</span><span style="color: #339933;">:</span> undefined reference to `sqlite3_busy_timeout<span style="color: #ff0000;">'
/home/zabbix/zabbix-1.8.7/src/libs/zbxdb/db.c:334: undefined reference to `sqlite3_errmsg'</span>
<span style="color: #339933;">/</span>home<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">-</span>1.8.7<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>db.<span style="color: #202020;">c</span><span style="color: #339933;">:</span><span style="color: #0000dd;">335</span><span style="color: #339933;">:</span> undefined reference to `sqlite3_close<span style="color: #ff0000;">'
../../src/libs/zbxdb/libzbxdb.a(db.o): In function `zbx_db_init'</span><span style="color: #339933;">:</span>
<span style="color: #339933;">/</span>home<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">-</span>1.8.7<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>db.<span style="color: #202020;">c</span><span style="color: #339933;">:</span><span style="color: #0000dd;">385</span><span style="color: #339933;">:</span> undefined reference to `sqlite3_open<span style="color: #ff0000;">'
/home/zabbix/zabbix-1.8.7/src/libs/zbxdb/db.c:387: undefined reference to `sqlite3_errmsg'</span>
..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>libzbxdb.<span style="color: #202020;">a</span><span style="color: #009900;">&#40;</span>db.<span style="color: #202020;">o</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> In <span style="color: #000000; font-weight: bold;">function</span> `zbx_db_close<span style="color: #ff0000;">':
/home/zabbix/zabbix-1.8.7/src/libs/zbxdb/db.c:446: undefined reference to `sqlite3_close'</span>
..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>libzbxdb.<span style="color: #202020;">a</span><span style="color: #009900;">&#40;</span>db.<span style="color: #202020;">o</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> In <span style="color: #000000; font-weight: bold;">function</span> `zbx_db_vexecute<span style="color: #ff0000;">':
/home/zabbix/zabbix-1.8.7/src/libs/zbxdb/db.c:827: undefined reference to `sqlite3_exec'</span>
<span style="color: #339933;">/</span>home<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">-</span>1.8.7<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>db.<span style="color: #202020;">c</span><span style="color: #339933;">:</span><span style="color: #0000dd;">852</span><span style="color: #339933;">:</span> undefined reference to `sqlite3_changes<span style="color: #ff0000;">'
/home/zabbix/zabbix-1.8.7/src/libs/zbxdb/db.c:833: undefined reference to `sqlite3_free'</span>
..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>libzbxdb.<span style="color: #202020;">a</span><span style="color: #009900;">&#40;</span>db.<span style="color: #202020;">o</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> In <span style="color: #000000; font-weight: bold;">function</span> `SQ_DBfree_result<span style="color: #ff0000;">':
/home/zabbix/zabbix-1.8.7/src/libs/zbxdb/db.c:1363: undefined reference to `sqlite3_free_table'</span>
..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>libzbxdb.<span style="color: #202020;">a</span><span style="color: #009900;">&#40;</span>db.<span style="color: #202020;">o</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> In <span style="color: #000000; font-weight: bold;">function</span> `zbx_db_vselect<span style="color: #ff0000;">':
/home/zabbix/zabbix-1.8.7/src/libs/zbxdb/db.c:1121: undefined reference to `sqlite3_get_table'</span>
<span style="color: #339933;">/</span>home<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">/</span>zabbix<span style="color: #339933;">-</span>1.8.7<span style="color: #339933;">/</span>src<span style="color: #339933;">/</span>libs<span style="color: #339933;">/</span>zbxdb<span style="color: #339933;">/</span>db.<span style="color: #202020;">c</span><span style="color: #339933;">:</span><span style="color: #0000dd;">1127</span><span style="color: #339933;">:</span> undefined reference to `sqlite3_free<span style="color: #ff0000;">'</span></pre></div></div>

<p>this is obviously from the database related code compilation. I run the <code>gcc</code> manually for the <code>db.c</code> file inside its directory by adding the flag &#8216;<code>-lsqlite3</code>&#8216; in the tail of &#8216;<code>../../src/libs/zbxdb/libzbxdb.a</code>&#8216; to make it work. Afterward by going to the initial directory first, running <code>make</code> again will then continue successfully.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> src<span style="color: #000000; font-weight: bold;">/</span>zabbix_proxy
$ <span style="color: #c20cb9; font-weight: bold;">gcc</span> -DZABBIX_DAEMON <span style="color: #660033;">-g</span> <span style="color: #660033;">-O2</span>     -L<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>arm-linux-gnueabi    -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>perl<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5.12</span><span style="color: #000000; font-weight: bold;">/</span>CORE -I. -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include      -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">-lsqlite3</span>  -L<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>arm-linux-gnueabi <span style="color: #660033;">-lcurl</span>  -L<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">-lnetsnmp</span> <span style="color: #660033;">-lcrypto</span>  -L<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">-lnetsnmp</span> <span style="color: #660033;">-lcrypto</span>   <span style="color: #660033;">-rdynamic</span>    <span style="color: #660033;">-o</span> zabbix_proxy zabbix_proxy-servercomms.o zabbix_proxy-events.o zabbix_proxy-zlog.o zabbix_proxy-proxy.o heart<span style="color: #000000; font-weight: bold;">/</span>libzbxheart.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>zabbix_server<span style="color: #000000; font-weight: bold;">/</span>dbsyncer<span style="color: #000000; font-weight: bold;">/</span>libzbxdbsyncer.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>zabbix_server<span style="color: #000000; font-weight: bold;">/</span>discoverer<span style="color: #000000; font-weight: bold;">/</span>libzbxdiscoverer.a housekeeper<span style="color: #000000; font-weight: bold;">/</span>libzbxhousekeeper.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>zabbix_server<span style="color: #000000; font-weight: bold;">/</span>httppoller<span style="color: #000000; font-weight: bold;">/</span>libzbxhttppoller.a proxyconfig<span style="color: #000000; font-weight: bold;">/</span>libzbxproxyconfig.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>zabbix_server<span style="color: #000000; font-weight: bold;">/</span>pinger<span style="color: #000000; font-weight: bold;">/</span>libzbxpinger.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>zabbix_server<span style="color: #000000; font-weight: bold;">/</span>poller<span style="color: #000000; font-weight: bold;">/</span>libzbxpoller.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>zabbix_server<span style="color: #000000; font-weight: bold;">/</span>trapper<span style="color: #000000; font-weight: bold;">/</span>libzbxtrapper.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>zabbix_server<span style="color: #000000; font-weight: bold;">/</span>nodewatcher<span style="color: #000000; font-weight: bold;">/</span>libzbxnodewatcher.a datasender<span style="color: #000000; font-weight: bold;">/</span>libzbxdatasender.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>zabbix_server<span style="color: #000000; font-weight: bold;">/</span>selfmon<span style="color: #000000; font-weight: bold;">/</span>libzbxselfmon.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxsysinfo<span style="color: #000000; font-weight: bold;">/</span>libzbxserversysinfo.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxsysinfo<span style="color: #000000; font-weight: bold;">/</span>linux<span style="color: #000000; font-weight: bold;">/</span>libspecsysinfo.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxsysinfo<span style="color: #000000; font-weight: bold;">/</span>common<span style="color: #000000; font-weight: bold;">/</span>libcommonsysinfo.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxsysinfo<span style="color: #000000; font-weight: bold;">/</span>simple<span style="color: #000000; font-weight: bold;">/</span>libsimplesysinfo.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxlog<span style="color: #000000; font-weight: bold;">/</span>libzbxlog.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxdbcache<span style="color: #000000; font-weight: bold;">/</span>libzbxdbcache.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxmemory<span style="color: #000000; font-weight: bold;">/</span>libzbxmemory.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxalgo<span style="color: #000000; font-weight: bold;">/</span>libzbxalgo.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxnix<span style="color: #000000; font-weight: bold;">/</span>libzbxnix.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxsys<span style="color: #000000; font-weight: bold;">/</span>libzbxsys.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxconf<span style="color: #000000; font-weight: bold;">/</span>libzbxconf.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxcommon<span style="color: #000000; font-weight: bold;">/</span>libzbxcommon.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxcrypto<span style="color: #000000; font-weight: bold;">/</span>libzbxcrypto.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxcomms<span style="color: #000000; font-weight: bold;">/</span>libzbxcomms.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxcommshigh<span style="color: #000000; font-weight: bold;">/</span>libzbxcommshigh.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxjson<span style="color: #000000; font-weight: bold;">/</span>libzbxjson.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxexec<span style="color: #000000; font-weight: bold;">/</span>libzbxexec.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxself<span style="color: #000000; font-weight: bold;">/</span>libzbxself.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxserver<span style="color: #000000; font-weight: bold;">/</span>libzbxserver.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxicmpping<span style="color: #000000; font-weight: bold;">/</span>libzbxicmpping.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxdbhigh<span style="color: #000000; font-weight: bold;">/</span>libzbxdbhigh.a ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>libs<span style="color: #000000; font-weight: bold;">/</span>zbxdb<span style="color: #000000; font-weight: bold;">/</span>libzbxdb.a <span style="color: #660033;">-lsqlite3</span> <span style="color: #660033;">-lcurl</span>  <span style="color: #660033;">-lnetsnmp</span>    <span style="color: #660033;">-lm</span>  <span style="color: #660033;">-lresolv</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2012/07/compile-zabbix-proxy-ubuntu-arm-beagleboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SNMP: Mistake of Using Tabular OID in Practice</title>
		<link>https://lakm.us/logit/2012/03/snmp-mistake-tabular-oid-practice/</link>
		<comments>https://lakm.us/logit/2012/03/snmp-mistake-tabular-oid-practice/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 07:57:58 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[appliance]]></category>
		<category><![CDATA[MIB]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[proprietary]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=372</guid>
		<description><![CDATA[Recently, I retrieve rectifier-related SNMP data from Eltek&#8217;s Smartpack Controller. This one has the following rear type where we can connect to the ethernet plug (see the purple area). It is presumably in its default configuration and I can snmpwalk through its corporate specific OIDs (under 12148 tree) to find i.e. output voltage, current, battery [...]]]></description>
				<content:encoded><![CDATA[<p>Recently, I retrieve rectifier-related SNMP data from <a href="http://www.eltek.com/wip4/detail_products.epl?k1=25507&#038;close=1&#038;id=1123846" title="Eltek Smartpack Controller" target="_blank">Eltek&#8217;s Smartpack Controller</a>. This one has the following rear type where we can connect to the ethernet plug (see the purple area).</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="Eltek Smartpack Controller type with SNMP Support" src="../../../../images/eltek-smartpack-rear-1.jpg" title="Eltek Smartpack Controller type with SNMP Support" width="266" height="103" /><p class="wp-caption-text">Eltek Smartpack Controller rear view (type that comes with SNMP support)</p></div>
<p>It is presumably in its default configuration and I can <code>snmpwalk</code> through its corporate specific OIDs (under 12148 tree) to find i.e. output voltage, current, battery temperature, etc. Doing it without translating against the MIB will retrieve all the values perfectly fine. However, I want to show you a mistake in practice related to how the MIB is written and put to place, which is a version 4 by the name of <a href="http://forums.manageengine.com/viewFile.do?fileId=49000003919231&#038;forumGroupId=49000000002007" title="Manage Engine Forum: ELTEK-DISTRIBUTED-PLANTV4-MIB">ELTEK-DISTRIBUTED-PLANTV4-MIB</a>. It has tabular part as clipped in the following tree (see <a href="./2011/09/write-mib-file-tabular/" title="Write Your Own MIB File (Tabular)" target="_blank">previous post</a> on how to write such part in your own MIB):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">            <span style="color: #000000; font-weight: bold;">|</span>     +--eltek<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">12148</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        +--eltekDistributedPlantV4<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
...
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>     +--rectifierStatusTable<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>        +--rectifierStatusEntry<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>  Index: rectifierStatusID
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>           +-- <span style="color: #660033;">-R--</span> Integer32 rectifierStatusID<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>        Range: 1..100
...
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>           +-- <span style="color: #660033;">-R--</span> Integer32 rectifierStatusOutputVoltage<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>           <span style="color: #000000; font-weight: bold;">|</span>        Range: 0..65535</pre></div></div>

<p>Looking at the above <code>rectifierStatusEntry</code> branch, it marks a tabular entry expected to range from 1 to 100 as defined by <code>rectifierStatusID</code>. Hence, putting 0 as one of the output voltage index will confuse the OID reported by <code>GET</code> as</p>
<ol>
<li>belong to the scalar type (a misconception that is)</li>
<li>belong to the tabular type but out of index range</li>
</ol>
<p><code>GET</code> against the MIB will return the following error</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> snmpget <span style="color: #660033;">-m</span> +ELTEK-DISTRIBUTED-PLANTV4-MIB <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public raddlex ELTEK-DISTRIBUTED-PLANTV4-MIB::rectifierStatusOutputCurrent.0
ELTEK-DISTRIBUTED-PLANTV4-MIB::rectifierStatusOutputCurrent.0: Unknown Object Identifier <span style="color: #7a0874; font-weight: bold;">&#40;</span>Index out of range: <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>rectifierStatusID<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>while the item (output current) actually has value in it as found below</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> snmpget <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public raddlex .1.3.6.1.4.1.12148.9.5.5.2.1.3.0
SNMPv2-SMI::enterprises.12148.9.5.5.2.1.3.0 = INTEGER: <span style="color: #000000;">1</span></pre></div></div>

<p>By this time the MIB is already the latest to be used with firmware version 4.3.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2012/03/snmp-mistake-tabular-oid-practice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write Your Own MIB File (Tabular)</title>
		<link>https://lakm.us/logit/2011/09/write-mib-file-tabular/</link>
		<comments>https://lakm.us/logit/2011/09/write-mib-file-tabular/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 11:23:19 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[MIB]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=355</guid>
		<description><![CDATA[When it comes to writing our own MIB, a practical choice might be to write the whole objects as of scalar type (RFC-1212). That means, let&#8217;s say we have 2 battery statuses, each of them must be explicitly written individually within the MIB file. Example of calling their voltages: $ snmpwalk -m +REKTRONIK-MIB -v 1 [...]]]></description>
				<content:encoded><![CDATA[<p>When it comes to writing our own <a href="http://en.wikipedia.org/wiki/Management_information_base" title="http://en.wikipedia.org/wiki/Management_information_base" target="_blank">MIB</a>, a practical choice might be to write the whole objects as of <strong>scalar</strong> type (<a href="http://tools.ietf.org/html/rfc1212#section-3" title="RFC-1212: Columnar Objects" target="_blank">RFC-1212</a>). That means, let&#8217;s say we have 2 battery statuses, each of them must be explicitly written individually within the MIB file. Example of calling their voltages:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpwalk <span style="color: #660033;">-m</span> +REKTRONIK-MIB <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public monitored-host .1.3.6.1.4.1.38610
...
REKTRONIK-MIB::battery1Voltage.0 = INTEGER: <span style="color: #000000;">9</span>
REKTRONIK-MIB::battery2Voltage.0 = INTEGER: <span style="color: #000000;">11</span>
...</pre></div></div>

<p>If additional 3rd battery is to be monitored, <code>REKTRONIK-MIB.txt</code> in this example must be modified. In small scale we don&#8217;t need consistent MIB as changes are manageable, but if a whole bunch of different people must reference to this, a better way is to have <strong>tabular</strong> object where the above batteries are indexed instead of ended with &#8220;<code>.0</code>&#8221; scalar identifier.</p>
<p>Quick approach by checking established <code><a href="http://www.observium.org/svn/observer/trunk/mibs/LM-SENSORS-MIB" title="LM-SENSORS-MIB" target="_blank">LM-SENSORS-MIB.txt</a></code> shows at least we need three object definitions inside the MIB file:</p>
<div class="wp-caption aligncenter" style="width: 510px"><img alt="snmp-mib-tabular-object-basics.jpg" src="../../../../images/snmp-mib-tabular-object-basics.jpg" title="snmp-mib-tabular-object-basics.jpg" width="154" height="173" /><p class="wp-caption-text">Components of writing tabular MIB</p></div>
<p>
Its stemmed MIB tree to show the (1) <code>Table</code>, (2) <code>Entry</code>, and (3) <code>Index</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     +--lmFanSensorsTable<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  +--lmFanSensorsEntry<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  Index: lmFanSensorsIndex
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>     +-- <span style="color: #660033;">-R--</span> Integer32 lmFanSensorsIndex<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>        Range: 0..65535
...</pre></div></div>

<p>Now the writing part of those three types to our MIB, plus the <code>batteryVoltage</code> which is the actual object to be indexed in the final SNMP monitoring.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">batteryTable OBJECT-TYPE
    SYNTAX     SEQUENCE OF BatteryEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
        <span style="color: #ff0000;">&quot;The (conceptual) table of batteries contained by the
        module.&quot;</span>
    ::= <span style="color: #7a0874; font-weight: bold;">&#123;</span> monitor <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
batteryEntry OBJECT-TYPE
    SYNTAX     BatteryEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
        <span style="color: #ff0000;">&quot;A (conceptual) entry for one battery contained by
        the module.  The batteryIndex in the index represents
        the entry in the batteryTable that corresponds to the
        batteryEntry.
&nbsp;
        As an example of how objects in this table are named,
        an instance of the batteryVoltage object might be
        named batteryVoltage.3&quot;</span>
    INDEX <span style="color: #7a0874; font-weight: bold;">&#123;</span> batteryIndex <span style="color: #7a0874; font-weight: bold;">&#125;</span>
    ::= <span style="color: #7a0874; font-weight: bold;">&#123;</span> batteryTable <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
batteryIndex OBJECT-TYPE
    SYNTAX      DeviceIndex
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
            <span style="color: #ff0000;">&quot;A unique value, greater than zero, for each battery. 
            It is recommended that values are assigned contiguously
            starting from 1.&quot;</span>
    ::= <span style="color: #7a0874; font-weight: bold;">&#123;</span> batteryEntry <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
batteryVoltage    OBJECT-TYPE 
   SYNTAX Integer32 
   ACCESS read-only 
   STATUS current 
   DESCRIPTION 
      <span style="color: #ff0000;">&quot;Voltage A/D value&quot;</span> 
   ::= <span style="color: #7a0874; font-weight: bold;">&#123;</span> batteryEntry <span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></td></tr></table></div>

<p>There are some header parts of course, check the resulting <code>REKTRONIK-MIB.txt</code> <a href="../../../../upload/REKTRONIK-MIB.txt" title="REKTRONIK-MIB.txt" target="_blank">here</a>.</p>
<p>The tree view becomes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">            +--private<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>  +--enterprises<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>     +--rektronik<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">39559</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
...
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        +--monitor<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  +--batteryTable<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>  +--batteryEntry<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  Index: batteryIndex
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     +-- <span style="color: #660033;">-R--</span> Integer32 batteryIndex<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>        Textual Convention: DeviceIndex
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>        Range: 1..2147483647
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     +-- <span style="color: #660033;">-R--</span> Integer32 batteryVoltage<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>     +-- <span style="color: #660033;">-R--</span> Integer32 batteryCurrent<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  +--environment<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>  +-- <span style="color: #660033;">-R--</span> Integer32 temperature<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>  +-- <span style="color: #660033;">-R--</span> Integer32 humidity<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
...</pre></div></div>

<p>and example of getting SNMP is</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpwalk <span style="color: #660033;">-m</span> +REKTRONIK-MIB <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public monitored-host .1.3.6.1.4.1.38610
REKTRONIK-MIB::name.0 = STRING: <span style="color: #ff0000;">&quot;RekMini&quot;</span>
REKTRONIK-MIB::version.0 = STRING: <span style="color: #ff0000;">&quot;1.0&quot;</span>
REKTRONIK-MIB::date.0 = STRING: <span style="color: #ff0000;">&quot;2011-09-08&quot;</span>
REKTRONIK-MIB::batteryIndex.22 = INTEGER: <span style="color: #000000;">22</span>
REKTRONIK-MIB::batteryIndex.23 = INTEGER: <span style="color: #000000;">23</span>
REKTRONIK-MIB::batteryVoltage.22 = INTEGER: <span style="color: #000000;">9</span>
REKTRONIK-MIB::batteryVoltage.23 = INTEGER: <span style="color: #000000;">11</span>
REKTRONIK-MIB::batteryCurrent.22 = INTEGER: <span style="color: #000000;">2</span>
REKTRONIK-MIB::batteryCurrent.23 = INTEGER: <span style="color: #000000;">2</span>
...</pre></div></div>

<p>in the above example any additional 3rd battery voltage insertion will be OID &#8220;<code>REKTRONIK-MIB::batteryVoltage<strong>.24</strong></code>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/09/write-mib-file-tabular/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Running Raddle (2): snmpd &amp; Replay Custom Private Enterprise MIB</title>
		<link>https://lakm.us/logit/2011/08/running-raddle-2-snmpd-replay-custom-private-enterprise-mib/</link>
		<comments>https://lakm.us/logit/2011/08/running-raddle-2-snmpd-replay-custom-private-enterprise-mib/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 03:13:44 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=217</guid>
		<description><![CDATA[Net-SNMP wiki gives tutorial on extending snmpd using Perl. In basic run of Raddle (previous post) this involves r1.pl called by r1.conf fed to snmpd. Private enterprise MIB i.e. Microchip&#8217;s in this example can be replayed without really ever captured the real device&#8217;s SNMP data. This is necessary when the actual device is yet existed; normal [...]]]></description>
				<content:encoded><![CDATA[<p>Net-SNMP wiki gives tutorial on 	<a href="http://www.net-snmp.org/wiki/index.php/Tut:Extending_snmpd_using_perl">extending <code>snmpd</code> using Perl</a>. In basic run of Raddle (<a href="./215/running-raddle-in-rhel/">previous post</a>) this involves <code>r1.pl</code> called by <code>r1.conf</code> fed to <code>snmpd</code>. Private enterprise MIB i.e. <a href="http://read.pudn.com/downloads133/sourcecode/embed/567121/TCPIP%20Demo%20App/mchip.mib__.htm" target="_blank">Microchip&#8217;s </a>in this example can be replayed without really ever captured the real device&#8217;s SNMP data. This is necessary when the actual device is yet existed; normal situation when developing.  There are two simple ways of replaying this artificial SNMP data over which either way requires correct OID.</p>
<p>First put the <code>Microchip.TXT</code> (the MIB file) under <code>/usr/share/snmp/mibs</code> to easily exchange OID canonical form and name vice versa while making dummy. In this case I&#8217;ve modify the MIB to have some additional object i.e. <code>name</code>:<br />
<code>$ snmptranslate -m +Microchip -On Microchip::name<br />
.1.3.6.1.4.1.17095.1.1</code><br />
so we can then use this correct OID for our dummy.</p>
<p>How?</p>
<ol>
<li>use <code>SetMIBValue()</code> in <code>r1.pl</code>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #0000ff;">$agent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">SetMIBValue</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">'.1.3.6.1.4.1.17095.1.1'</span><span style="color: #339933;">,</span> ASN_OCTET_STR<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Microchip&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$agent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">SetMIBValue</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">'.1.3.6.1.4.1.17095.3.13'</span><span style="color: #339933;">,</span> ASN_INTEGER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">82</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Feed <code>r1.snmp </code>for playing as in

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #0000ff;">$agent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">ParseDataFile</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">'/usr/local/etc/snmp-emulator/r1.snmp'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span></pre></div></div>

<p>with the content of</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.1.3.6.1.4.1.17095.1.1 = STRING: Microchip
.1.3.6.1.4.1.17095.3.13 = INTEGER: <span style="color: #000000;">82</span></pre></div></div>

</li>
</ol>
<p>In all above two examples we can only <code>GET</code> for Raddle to return an answer for each OID. <code>GETNEXT</code> as in bulk <code>snmpwalk</code> won&#8217;t give output because they are not sequenced.</p>
<p>A sample of sequenced data inside a real <code>snmpwalk</code> dump is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpwalk <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public <span style="color: #660033;">-On</span> localhost
&nbsp;
.1.3.6.1.2.1.1.1.0 = STRING: Linux xp-racy 2.6.38-<span style="color: #000000;">10</span>-generic <span style="color: #666666; font-style: italic;">#46~lucid1-Ubuntu SMP Wed Jul 6 18:40:11 UTC 2011 i686</span>
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.8072.3.2.10
.1.3.6.1.2.1.1.3.0 = Timeticks: <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">496371</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1</span>:<span style="color: #000000;">22</span>:<span style="color: #000000;">43.71</span>
.1.3.6.1.2.1.1.4.0 = STRING: Root  <span style="color: #7a0874; font-weight: bold;">&#40;</span>configure <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snmp<span style="color: #000000; font-weight: bold;">/</span>snmpd.local.conf<span style="color: #7a0874; font-weight: bold;">&#41;</span>
.1.3.6.1.2.1.1.5.0 = STRING:
.1.3.6.1.2.1.1.6.0 = STRING: Unknown <span style="color: #7a0874; font-weight: bold;">&#40;</span>configure <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snmp<span style="color: #000000; font-weight: bold;">/</span>snmpd.local.conf<span style="color: #7a0874; font-weight: bold;">&#41;</span>
.1.3.6.1.2.1.1.8.0 = Timeticks: <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">0</span>:00:<span style="color: #000000;">00.00</span>
.1.3.6.1.2.1.1.9.1.2.1 = OID: .1.3.6.1.6.3.10.3.1.1
.1.3.6.1.2.1.1.9.1.2.2 = OID: .1.3.6.1.6.3.11.3.1.1</pre></div></div>

<p>thus, we can only</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpget <span style="color: #660033;">-m</span> +Microchip <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public localhost Microchip::control.13
Microchip::control.13 = INTEGER: <span style="color: #000000;">82</span></pre></div></div>

<p>or from other system with no Microchip MIB use</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpget <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public 192.168.40.105 .1.3.6.1.4.1.17095.3.13
SNMPv2-SMI::enterprises.17095.3.13 = INTEGER: <span style="color: #000000;">82</span></pre></div></div>

<p>The tree below may visually explains sequenced data for <code>GETNEXT</code> where our Microchip is branched at <code>private.enterprises.microchip</code> :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmptranslate <span style="color: #660033;">-m</span> +Microchip <span style="color: #660033;">-Tp</span>
&nbsp;
+--iso<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
   <span style="color: #000000; font-weight: bold;">|</span>
   +--org<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
      <span style="color: #000000; font-weight: bold;">|</span>
      +--dod<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
         <span style="color: #000000; font-weight: bold;">|</span>
         +--internet<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>
            +--directory<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>
            +--mgmt<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>  +--mib-<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>     +--system<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
...
            +--private<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
...
            <span style="color: #000000; font-weight: bold;">|</span>  +--enterprises<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
...
            <span style="color: #000000; font-weight: bold;">|</span>     +--microchip<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">17095</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        +--product<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span></pre></div></div>

<p>How <code>GET</code> and <code>GETNEXT</code> appeared in SNMP can be viewed by running snmpd in debug mode with this options:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpd <span style="color: #660033;">-m</span> +Microchip <span style="color: #660033;">-f</span> <span style="color: #660033;">-L</span> <span style="color: #660033;">-V</span> <span style="color: #660033;">-C</span> <span style="color: #660033;">-I</span> vacm_vars <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snmp-emulator<span style="color: #000000; font-weight: bold;">/</span>r1.conf
NET-SNMP version 5.3.1
Connection from UDP: <span style="color: #7a0874; font-weight: bold;">&#91;</span>127.0.0.1<span style="color: #7a0874; font-weight: bold;">&#93;</span>:<span style="color: #000000;">32770</span>
Received SNMP packet<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> from UDP: <span style="color: #7a0874; font-weight: bold;">&#91;</span>127.0.0.1<span style="color: #7a0874; font-weight: bold;">&#93;</span>:<span style="color: #000000;">32770</span>
  GET message
    <span style="color: #660033;">--</span> control.13</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/08/running-raddle-2-snmpd-replay-custom-private-enterprise-mib/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Raddle in RHEL</title>
		<link>https://lakm.us/logit/2011/08/running-raddle-in-rhel/</link>
		<comments>https://lakm.us/logit/2011/08/running-raddle-in-rhel/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 07:43:05 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[install-deinstall]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=215</guid>
		<description><![CDATA[Raddle is a great SNMP player written in Perl. I say player to this emulator application, meaning that I can append or dump snmpwalk output from a device and then replay that from Raddle. Installing it can be both simple and tedious tasks. I used Red Hat Enterprise Linux 5.2 inside a virtual machine (VirtualBox) [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://raddle.sourceforge.net/" target="_blank">Raddle</a> is a great SNMP player written in Perl. I say player to this emulator application, meaning that I can append or dump <code>snmpwalk</code> output from a device and then replay that from Raddle. Installing it can be both simple and tedious tasks. I used Red Hat Enterprise Linux 5.2 inside  a virtual machine (VirtualBox) to make it compact without interfering my own host <code>snmpd</code> setting.</p>
<p>net-SNMP packages are required for Raddle to work on top of primarily <code>snmpd</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> net-snmp net-snmp-utils</pre></div></div>

<p>Prior to installation some rpm packages must be downloaded separately as my local repo (created from original RHEL CD images) may not contain them. They are installed as follow:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm <span style="color: #660033;">-i</span> perl-Carp-Clan-<span style="color: #000000;">6.00</span>-1.el4.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Bit-Vector-<span style="color: #000000;">6.4</span>-2.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Crypt-DES-<span style="color: #000000;">2.05</span>-3.2.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Digest-SHA1-<span style="color: #000000;">2.11</span>-1.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Digest-HMAC-<span style="color: #000000;">1.01</span>-2.2.el5.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Socket6-<span style="color: #000000;">0.20</span>-1.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Date-Pcalc-<span style="color: #000000;">1.2</span>-1.2.el5.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Date-Calc-<span style="color: #000000;">5.4</span>-1.el5.rf.i386.rpm</pre></div></div>

<p>continued by installing <code>net-snmp-perl</code> from original repo</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> net-snmp-perl</pre></div></div>

<p>Uncompressing Raddle and successful <code>make test</code> will mean installation is good and can be finished by <code>make install</code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> Net-Raddle-<span style="color: #000000;">0.08</span>
<span style="color: #c20cb9; font-weight: bold;">perl</span> Makefile.PL
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #7a0874; font-weight: bold;">test</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<h1>Replaying SNMP Packets</h1>
<p>The idea is to run <code>snmpd</code> which replays a specific prepared-SNMP-packets instead of our own real time system SNMP data (in this case the condition of RHEL 5.2 host). There are three files to do that, let&#8217;s name them <code>r1.*</code>:</p>
<ol>
<li><code>r1.snmp</code><br />
A capture from i.e.<br />
<code>snmpwalk -v 1 -c &lt;community string&gt; -OneU &lt;device&gt; &gt; r1.snmp</code></li>
<li><code>r1.conf</code><br />
<code>snmpd</code> will run this instead of the original OS default:<br />
<code>snmpd -C -I vacm_vars -c /usr/local/etc/snmp-emulator/r1.conf</code></li>
<li><code>r1.pl</code><br />
the perl script where the most basic is to just replay the above <code>r1.snmp</code></li>
</ol>
<p>An official documentation to replay SNMP can be found <a href="http://raddle.sourceforge.net/docs/SNMPAgent.html" target="_blank">here</a>. I got hold back when trying to listen from other host, it turns out that I must remove the localhost section in <code>r1.conf</code> which will make it to use standard port 161 as well</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Listen on port 9501</span>
<span style="color: #666666; font-style: italic;">#agentaddress    udp:localhost:9501,tcp:localhost:9501</span></pre></div></div>

<p>It is also wise to always cut the <code>r1.snmp</code> first to see if the perl works (test with <code>perl -w /usr/local/etc/snmp-emulator/r1.pl</code>) either with warning or clean, meaning no problem with just some of the OIDs found inside the file.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/08/running-raddle-in-rhel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring Cacti</title>
		<link>https://lakm.us/logit/2009/09/configuring-cacti/</link>
		<comments>https://lakm.us/logit/2009/09/configuring-cacti/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 05:55:04 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[Cacti]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[RRDtool]]></category>
		<category><![CDATA[snmp]]></category>
		<category><![CDATA[web-based]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=77</guid>
		<description><![CDATA[A successful installation in a LAMP system may require more library. I added php5-cli to enable php through command line i.e $ /usr/bin/php , libphp-adodb, php5-snmp. In localhost snmpd is installed and configured /etc/default/snmpd: SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid' and edit /etc/snmp/snmpd.conf to have: com2sec readonly  localhost         &#60;some community string&#62; Install [...]]]></description>
				<content:encoded><![CDATA[<p>A successful installation in a LAMP system may require more library. I added php5-cli to enable php through command line i.e <code>$ /usr/bin/php <some_command></code>, libphp-adodb, php5-snmp.</p>
<p>In localhost <code>snmpd</code> is installed and configured <code>/etc/default/snmpd</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SNMPDOPTS</span>=<span style="color: #ff0000;">'-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid'</span></pre></div></div>

<p>and edit <code>/etc/snmp/snmpd.conf</code> to have:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">com2sec <span style="color: #7a0874; font-weight: bold;">readonly</span>  localhost         <span style="color: #000000; font-weight: bold;">&lt;</span>some community string<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Install <code>snmp</code>, then I can test <code>snmpwalk</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpwalk <span style="color: #660033;">-Os</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">&lt;</span>some community string<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> localhost system</pre></div></div>

<p>Cacti requires RRDTool and the correct version to be set in Settings menu of the Cacti web console. In my case, RRDTool version is 1.3x. In Cacti 0.8.6.x and above <code>poller.php</code> is called by cron instead of <code>cmd.php</code>, put this trough crontab in Cacti user (enter this Cacti user crontab from <code>crontab -e -u <some Cacti user></code> or embed the user in crontab by root instead of individually edited).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>cacti<span style="color: #000000; font-weight: bold;">/</span>poller.php</pre></div></div>

<p>It will generate file under <code>rra</code> directory of the web <code>/var/www/cacti/rra/<some file>.rrd</code>. RRD tool will create image based on this polling result file.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/09/configuring-cacti/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
