<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>net-snmp &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/net-snmp/</link>
	<description>Feed of posts on WordPress.com tagged "net-snmp"</description>
	<pubDate>Tue, 08 Dec 2009 02:24:48 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Net-SNMP]]></title>
<link>http://nileshghogre.wordpress.com/2009/11/26/net-snmp/</link>
<pubDate>Thu, 26 Nov 2009 12:42:11 +0000</pubDate>
<dc:creator>Nilesh Ghogre</dc:creator>
<guid>http://nileshghogre.wordpress.com/2009/11/26/net-snmp/</guid>
<description><![CDATA[Net-SNMP is provided in Solaris 10 release now, and how to use it is descripted in this article. To ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Net-SNMP is provided in Solaris 10 release now, and how to use it is descripted in this article.</p>
<p>To disable Sun&#8217;s SNMP<br />
#svcadm disable svc:/application/management/snmpdx:default</p>
<p>the Net-SNMP daemon program locates at /usr/sfw/sbin/snmpd, and configure file of snmpd saved with the name snmpd.conf at /etc/sma/snmp. Use svcadm to start of stop snmpd:<br />
#svcadm enable svc:/application/management/sma:default<br />
#svcadm disable svc:/application/management/sma:default</p>
<p>Log File<br />
if there&#8217;s any error or warning messages, see the file /var/svc/log/application-management-sma\:default.log. The default log file of snmpd is <kbd>/var/log/snmpd.log.</kbd></p>
<p>Configuration file<br />
We may use /etc/sma/snmp/snmpd.conf.save as the working configure file to test wheather our snmpd daemon is ok.<br />
#cp /etc/sma/snmp/snmpd.conf.save /etc/sma/snmp/snmpd.conf<br />
#svcadm restart sma</p>
<p>P.S. There&#8217;s another file also named as snmpd.conf stored in /var/sma_snmp directory, and which is called persistent storage file. The persistent storage file, /var/sma_snmp/snmpd.conf, contains USM security information and any MIB components that are set for persistent storage. This file also contains the engineID and the engineID boots. This persistent storage file is automatically updated when the System Management Agent starts. When the System Management Agent stops, the snmpusm and snmpvacm utilities write user security information to this storage file.</p>
<p>Using the AgentX Protocol<br />
The AgentX protocol is supported in the System Management Agent. By default, the System Management Agent ships with a secure profile, that is, read–only access. AgentX allows interaction with third party subagents, provided that these subagents support AgentX over Unix Domain Sockets. For security reasons, AgentX is not supported over TCP/UDP. For more information on the AgentX protocol, see http://www.ietf.org/rfc/rfc2741.txt  Edit the main <kbd>/etc/sma/snmp/snmpd.conf</kbd> configuration file to configure the System Management Agent to use the AgentX protocol. By default, the AgentX protocol is disabled. The following procedure describes how to enable the AgentX protocol. To enable the AgentX protocol add the following to /etc/sma/snmp/snmpd.conf file:</p>
<p>master agentx</p>
<p>restart the sma (system management agent).<br />
# svcadm restart svc:/application/management/sma:default</p>
<p>Using the SMA<br />
To view the status of the agent<br />
# svcs svc:/application/management/sma:default</p>
<p>To See Which MIBs Are Initialized<br />
# /usr/sfw/sbin/snmpd  -Dregister_mib -Dmib_init -L</p>
<p>To Check the Disk Space and Network on a Local or Remote Machine<br />
# /usr/sfw/bin/snmpwalk -v1 -c public localhost HOST-RESOURCES-MIB::hrStorageIndex</p>
<p># /usr/sfw/bin/snmpget -v1 -c public localhost HOST-RESOURCES-MIB::hrStorageSize.1</p>
<p># /usr/sfw/bin/snmpwalk -v1 -c public localhost HOST-RESOURCES-MIB::hrStorageUsed</p>
<p># /usr/sfw/bin/snmpnetstat -v 2c -c public -a localhost</p>
<p>if all these works, congratulations, the sma is configured and brought on properly.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Cliente NET-SNMP]]></title>
<link>http://torocatala.wordpress.com/2009/11/10/cliente-net-snmp/</link>
<pubDate>Tue, 10 Nov 2009 10:21:21 +0000</pubDate>
<dc:creator>torocatala</dc:creator>
<guid>http://torocatala.wordpress.com/2009/11/10/cliente-net-snmp/</guid>
<description><![CDATA[1.- MSWindows 2.- GNU/Linux El cliente NET-SNMP nos servira para Nagios, Cacti, Zenoss y otras aplic]]></description>
<content:encoded><![CDATA[1.- MSWindows 2.- GNU/Linux El cliente NET-SNMP nos servira para Nagios, Cacti, Zenoss y otras aplic]]></content:encoded>
</item>
<item>
<title><![CDATA[Using NET-SNMP and HP-UX SNMP together]]></title>
<link>http://administratosphere.wordpress.com/2009/06/09/using-net-snmp-and-hp-ux-snmp-together/</link>
<pubDate>Tue, 09 Jun 2009 10:00:30 +0000</pubDate>
<dc:creator>ddouthitt</dc:creator>
<guid>http://administratosphere.wordpress.com/2009/06/09/using-net-snmp-and-hp-ux-snmp-together/</guid>
<description><![CDATA[Why would one want to do such a thing? A major reason is that the HP-UX SNMP daemon only supports th]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Why would one want to do such a thing?  A major reason is that the HP-UX SNMP daemon only supports the <a href="http://www.snmp.com/products/emanate.shtml">EMANATE</a> protocol for subagents; this means that subagents that support the <a href="http://www.scguild.com/agentx/">AgentX</a> protocol (which <a href="http://www.net-snmp.org/">NET-SNMP</a> &#8211; provided as part of HP&#8217;s <a href="http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXIEXP1131&#38;jumpid=reg_R1002_USEN">Internet Express</a> &#8211; supports) are not supported and cannot be accessed via HP&#8217;s SNMP daemon.</p>
<p>However, the HP-UX specific information is only available via the HP-UX native SNMP daemon.  What is the answer?</p>
<p>Change one or the other to run on a non-native port, <em>that&#8217;s</em> the answer.  With the two daemons listening on different ports &#8211; in essence, acting like to discrete damons &#8211; the capabilities of both can be exploited.  Since the native HP-UX snmp daemon does not provide the capability of specifying the port, the net-snmp daemon can be moved &#8211; and it is relatively trivial to do so as well.</p>
<p>There is probably already a line that says:</p>
<p><code>agentaddress 161</code></p>
<p>Change this line to a new port &#8211; I used 166:</p>
<p><code>agentaddress 166</code></p>
<p>Restart the daemon.  Once the NET-SNMP daemon has been moved, enable HP&#8217;s SNMP daemon (if you&#8217;ve not already done so) and start it up again:</p>
<p><code>cd /sbin/init.d<br />
SnmpMaster start</code></p>
<p>This should enable your two SNMP daemons on different ports.  Now you can access whichever one holds the data you want.  For example, using the command snmpwalk, getting <a href="http://www.intersystems.com/cache/index.html">Caché</a> data can be as simple as:</p>
<p><code>snmpwalk -m ALL -v 2c -c public my:166 .1.3.6.1.4.1.16563</code></p>
<p>Whereas getting HP-specific data can be retrieved this way:</p>
<p><code>snmpwalk -m ALL -v 2c -c public my .1.3.6.1.4.1.11</code></p>
<p>Note the contrast between the two commands: one accesses the host my with the standard port (<strong>my</strong>); one uses the host my with the port 166 (<strong>my:166</strong>).</p>
<p>As a side note, note that Caché provides AgentX subagents, and note, too, that OpenVMS supports SNMP and AgentX as of v8.x.  Thus, there&#8217;s no fighting with the SNMP daemon on OpenVMS.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Using SNMP with Intersystems Caché]]></title>
<link>http://administratosphere.wordpress.com/2009/05/25/using-snmp-with-intersystems-cache/</link>
<pubDate>Mon, 25 May 2009 10:00:21 +0000</pubDate>
<dc:creator>ddouthitt</dc:creator>
<guid>http://administratosphere.wordpress.com/2009/05/25/using-snmp-with-intersystems-cache/</guid>
<description><![CDATA[Intersystems Caché can be monitored using SNMP, but it must be started. The details of using SNMP in]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://www.intersystems.com/cache/">Intersystems Caché</a> can be monitored using SNMP, but it must be started.  The details of using SNMP in Caché are detailed in the <a href="http://docs.intersystems.com/cache20081/csp/docbook/DocBook.UI.Page.cls?KEY=GCM">Caché Monitoring Guide</a> in Appendix B.</p>
<p>Firstly, to make life easier, the SNMP MIB for Caché is included in the installation of a Caché instance.  Go to the top level directory (which contains the CPF file) and then change to the directory SNMP.  This directory contains the SNMP MIB (named ISC-CACHE.mib).</p>
<p>Put this file with the other MIBs that your client uses.  This will provide names and details for your SNMP client.  If using net-snmp under Red Hat Enterprise Linux, put the MIB file in /usr/share/snmp/mibs/.</p>
<p>To start using SNMP in Caché (assuming your SNMP server supports AgentX and is already running), use this command (in the %SYS namespace):</p>
<p><code>%SYS&#62; d start^SNMP(705,20)</code></p>
<p>The first parameter is the standard port for AgentX (705), and the second is a timeout value (default of 20).  When you look at the jobs running in %SYS (using THIS^%SS) you will see a job named SNMP.</p>
<p>To stop SNMP, just enter (again, in the %SYS namespace):</p>
<p><code>%SYS&#62; d stop^SNMP()</code></p>
<p>(Don&#8217;t forget the parenthesis; it won&#8217;t work otherwise.) Logs are written to the mgr/SNMP.log file.</p>
<p>Once SNMP is started, you can check Caché data:</p>
<p><code>snmpwalk -m ALL -v 2c -c public server .1.3.6.1.4.1.16563.1.1</code></p>
<p>This command is a net-snmp command, and assumes a server running SNMP v2 with a &#8220;public&#8221; community and Caché SNMP running.  If SNMP is fully set up, you will get a variety of details about your Caché instance.  The MIB file is well-documented as to what each element is and means.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[AgentX and SNMP on HP-UX]]></title>
<link>http://administratosphere.wordpress.com/2009/05/23/agentx-and-snmp-on-hp-ux/</link>
<pubDate>Sat, 23 May 2009 10:00:29 +0000</pubDate>
<dc:creator>ddouthitt</dc:creator>
<guid>http://administratosphere.wordpress.com/2009/05/23/agentx-and-snmp-on-hp-ux/</guid>
<description><![CDATA[A recent (in a relative fashion) protocol for support SNMP agents is called AgentX. This protocol is]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>A recent (in a relative fashion) protocol for support SNMP agents is called <a href="http://en.wikipedia.org/wiki/Agent_Extensibility_Protocol">AgentX</a>.  This protocol is an attempt to standardize the protocol between a &#8220;master&#8221; SNMP agent (or server daemon) and the client agents.  This style of SNMP configuration then makes the SNMP support extensible, providing for the ability to add and remove whole SNMP subtrees as desired.  <a href="http://www.intersystems.com/cache/">Intersystems Caché</a> is one product that provides an agent that uses that AgentX protocol.</p>
<p>Unfortunately, HP-UX does not support AgentX, but rather a commercial protocol called <a href="http://www.snmp.com/products/emanate.shtml">EMANATE</a>.</p>
<p>To be able to use subagents that support AgentX, the native SNMP server must be disabled, and one that supports AgentX installed to take its place.  Thankfully, this is not difficult.</p>
<p>First, disabling SNMP requires modifying a number of files in /etc/rc.config.d:</p>
<ul>
<li>SnmpHpunix</li>
<li>SnmpMaster</li>
<li>SnmpMib2</li>
<li>SnmpNaa</li>
<li>SnmpTrpDst</li>
<li>cmsnmpagt</li>
<li>emsagtconf</li>
</ul>
<p>Change the entry that enables the affiliated agent or server: typically, this is by setting an entry such as SNMP_MASTER_START to 0.</p>
<p>This completely disables all agents as well as the master SNMP daemon.  Don&#8217;t forget to stop all of these using their init scripts to stop them:</p>
<p><code>cd /sbin/init.d<br />
./SnmpHpunix stop<br />
./SnmpIpv6 stop<br />
./SnmpMib2 stop<br />
./SnmpTrpDst stop<br />
./SnmpNaa stop<br />
./SnmpMaster stop<br />
./cmsnmpagt stop<br />
./emsa stop</code></p>
<p>After this, get HP&#8217;s <a href="http://h71019.www7.hp.com/hpux11i/cache/324414-0-0-0-121.html">Internet Express</a> and install <a href="http://net-snmp.sourceforge.net/">Net-SNMP</a>, which supports AgentX. Strangely enough, the Net-SNMP documentation states that Tru64 and OpenVMS servers come with AgentX support built-in.</p>
<p>Once installed, use the utility snmpconf to configure the agent &#8211; it creates the appropriate configuration file in the directory you are in.  You&#8217;ll want to set these configuration parameters, either through the use of snmpconf or directly:</p>
<p><code>master yes<br />
agentuser root<br />
agentgroup sys<br />
agentaddress 161<br />
agentXSocket tcp:localhost:705</code></p>
<p>Better yet, create a special user and group for SNMP &#8211; installation of Net-SNMP does not set this up for you.</p>
<p>Once the snmpd.conf is configured, then run snmpd.  Make sure you are running the right snmpd; reread the path if you need to:</p>
<p><code># type snmpd<br />
snmpd is /opt/iexpress/net-snmpd/sbin/snmpd<br />
# snmpd -Lsdaemon -c /opt/iexpress/net-snmp/etc/snmpd.conf</code></p>
<p>You&#8217;ll have to create an initialization script in /sbin/init.d; we&#8217;ve discussed how to do this before.</p>
<p>You should not expect the rich set of HP-UX-specific entries that are provided with the standard installation, but in trade you get extensibility &#8211; which allows you to run subagents such as that provided with <a href="http://www.intersystems.com/cache/">Intersystems Caché</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[snmpd.conf 설정]]></title>
<link>http://synecnet.wordpress.com/2009/04/17/snmpdconf-%ec%84%a4%ec%a0%95/</link>
<pubDate>Fri, 17 Apr 2009 07:39:02 +0000</pubDate>
<dc:creator>synec</dc:creator>
<guid>http://synecnet.wordpress.com/2009/04/17/snmpdconf-%ec%84%a4%ec%a0%95/</guid>
<description><![CDATA[패키지들을 인스톨했으면 먼저 SNMPD(에이젼트)설정 파일인 /etc/snmp/snmpd.conf를 편집해야 한다. SNMP 패키지를 인스톨 하면 snmpconf 명령이 들어 있어]]></description>
<content:encoded><![CDATA[패키지들을 인스톨했으면 먼저 SNMPD(에이젼트)설정 파일인 /etc/snmp/snmpd.conf를 편집해야 한다. SNMP 패키지를 인스톨 하면 snmpconf 명령이 들어 있어]]></content:encoded>
</item>
<item>
<title><![CDATA[VULNERABILIDADES. Amenazas encontradas en el protocolo Net-SNMP que afectan entornos Unix/Linux.]]></title>
<link>http://vulnerabilityteam.wordpress.com/2008/12/04/vulnerabilidades-amenazas-encontradas-en-el-protocolo-net-snmp-que-afectan-entornos-unixlinux/</link>
<pubDate>Thu, 04 Dec 2008 13:27:17 +0000</pubDate>
<dc:creator>komz</dc:creator>
<guid>http://vulnerabilityteam.wordpress.com/2008/12/04/vulnerabilidades-amenazas-encontradas-en-el-protocolo-net-snmp-que-afectan-entornos-unixlinux/</guid>
<description><![CDATA[Grupo de amenazas encontradas en el protocolo Net-SNMP que afectan entornos Unix/Linux. Net-SNMP GET]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Grupo de amenazas encontradas en el protocolo Net-SNMP que afectan entornos Unix/Linux.</p>
<p><a href="http://www.securityfocus.com/bid/32020">Net-SNMP GETBULK Remote Denial of Service Vulnerability</a></p>
<p><a href="http://www.securityfocus.com/bid/29623">Net-SNMP Remote Authentication Bypass Vulnerability</a></p>
<p><a href="http://www.securityfocus.com/bid/29212">Net-SNMP Perl Module Buffer Overflow Vulnerability</a></p>
<p><em>fuente: securityfocus</em></p>
<p><em><a href="http://vulnerabilityteam.wordpress.com/files/2008/12/net-snmp.jpg"><img class="alignnone size-full wp-image-924" title="net-snmp" src="http://vulnerabilityteam.wordpress.com/files/2008/12/net-snmp.jpg" alt="net-snmp" width="144" height="38" /></a><br />
</em></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[IT@Home: Monitoring QNAP NAS with Nagios]]></title>
<link>http://swampy.wordpress.com/2008/11/04/ithome-monitoring-qnap-nas-with-nagios-snmp/</link>
<pubDate>Tue, 04 Nov 2008 05:46:00 +0000</pubDate>
<dc:creator>junior</dc:creator>
<guid>http://swampy.wordpress.com/2008/11/04/ithome-monitoring-qnap-nas-with-nagios-snmp/</guid>
<description><![CDATA[Once I had a Nagios server set up running on my network, I was trying to figure what would be a good]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://swampy.files.wordpress.com/2008/11/nagioslogo.gif"><img class="alignleft size-full wp-image-490" style="margin-right:10px;" title="nagioslogo" src="http://swampy.wordpress.com/files/2008/11/nagioslogo.gif" alt="" width="150" height="40" /></a>Once I had a <strong><a href="http://www.nagios.org/">Nagios</a></strong> server set up running on my network, I was trying to figure what would be a good way to monitor the status of my <strong>QNAP TS-209 Pro</strong> NAS box. It seems there are two possibilities &#8211; one is to use the <strong>NRPE</strong> and <strong>Nagios</strong> plugins port available on <strong>Optware</strong> IPKG and the other is to go down the SNMP route using the <a href="http://www.net-snmp.org/"><strong>net-snmp</strong></a> package available as a part of the same <strong>Optware</strong> system, and use it in combination with <strong>check_snmp </strong><strong>Nagios</strong> plugin. Here is what I ended up doing.</p>
<p><!--more--></p>
<p><strong></strong></p>
<p><strong><a href="http://swampy.files.wordpress.com/2008/11/nagios03.jpg"><img class="aligncenter size-full wp-image-513" title="nagios03" src="http://swampy.wordpress.com/files/2008/11/nagios03.jpg" alt="nagios03" width="265" height="140" /></a></strong></p>
<p><strong>Install Optware IPKG from the QPKG bundles</strong></p>
<p>First I began by installing <strong>Optware</strong> <strong>IPKG</strong> from the <strong>QPKG</strong> software bundles available from the QNAP Turbo Station System administration page. More information about <strong>Optware</strong> packaging system and the supported software can be found <a href="http://www.nslu2-linux.org/wiki/Optware/Packages?from=Unslung.Packages">here</a>.</p>
<p><strong>Optware</strong> installations typically happen under the <strong>/opt</strong> top level directory. I used the simple automated install approach from the system admin page of my QNAP TS -209 NAS device. More on <strong>Optware IPKG</strong> installation on QNAP can be found <a href="http://forum.qnap.com/viewtopic.php?f=85&#38;t=1085">here</a>.</p>
<p><strong>Install net-snmp </strong></p>
<p>Many of the <strong>Optware</strong> packages run fine on QNAP firmware . But not all do. Unfortunately <strong>NRPE</strong> seems to be one of them. The problem seems to be with the startup script and it is probably an easy fix. But I decided to go with <strong>net-snmp</strong> instead and installed <strong>net-snmp</strong> using <strong>ipkg</strong> . For this, one needs to log into the QNAP device via <strong>ssh</strong> using the <strong>admin</strong> account and run <strong>ipkg</strong> .</p>
<p>With <strong>net-snmp</strong> there are two things that are relevant here. The <strong>startup</strong> script and the <strong>snmpd.conf </strong>configuration file .</p>
<p><strong>Net-snmp startup </strong></p>
<p>The startup script can be found in <strong>/opt/etc/init.d/S70net-snmp</strong> with the following content</p>
<pre>#!/bin/sh
#
# $Header$
#
if [ -n "`pidof snmpd`" ] ; then
killall  snmpd 2&#62;/dev/null
 fi
sleep 2
/opt/sbin /snmpd -c /opt/etc/snmpd.conf</pre>
<p>But this does not get started automatically by default. I decided to go the <strong>autorun.sh</strong> based approach to get <strong>snmpd</strong> daemon started. To do this I needed to do the following after I logged into the <strong>admin</strong> account via <strong>ssh</strong>.</p>
<pre>prompt&#62; mount /dev/mtdblock5 -t ext2 /tmp/config
prompt&#62; cd /tmp/config
prompt&#62; vi autorun.sh (it may not already exist)</pre>
<p>I then added the following to the file. My TS-209 has two disk drives that are mounted under <strong>/share/HDA_DATA</strong> and <strong>/share/HDB_DAT</strong>A,<strong> </strong>and<strong> Optware</strong> was installed under <strong>/share/HDA_DATA/optware/opt</strong></p>
<pre>rm -rf /opt
ln -sf /share/HDA_DATA/optware/opt /opt
export PATH='/opt/bin:/opt/sbin:${PATH}'
/opt/sbin/snmpd -c /opt/etc/snmpd.conf</pre>
<p>Then quit vi and unmount the ram disk.</p>
<pre>prompt&#62; chmod 755 autorun.sh
prompt&#62; cd /
prompt&#62; umount /dev/mtdblock5</pre>
<p>More information for auto starting executables can be found in the IPKG modz QNAP <a href="http://forum.qnap.com/viewforum.php?f=85">forum</a>. Next time the NAS device is rebooted <strong>snmpd</strong> daemon should be up and running.</p>
<p><strong>Net-snmp Configuration</strong></p>
<p>The next item is the default snmp configuration file that is installed by <strong>net-snmp</strong> in <strong>/opt/etc/snmpd.conf</strong> Most of the file is self explanatory and I had to do only minor tweaks. If one is reasonably comfortable with <strong>net-snmp</strong> then I guess one can tweak it more. By default the configuration provides some customization points for various parameters of the device. These were good enough for my tweaks.</p>
<p>The basic idea of <a href="http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol"><strong>SNMP</strong></a> is that the SNMP agent uses a system state information database represented as a tree of objects, often referred to as the <strong>MIB</strong> (Management Information base) tree. There are different MIB tree definitions for different devices, vendors and domains. So it is important to know which tree(s) the SNMP daemon on the device is going to use to report the device information.</p>
<p>The following section in snmpd.conf for example allows me to add processes that I may want to monitor. I did not really change any of the default settings here. The important thing to note here, for those not so familiar with MIBs, is the MIB tree that will be used. It is the <strong>UC Davis SNMP MIB</strong> tree and the <strong>prTable</strong> section of the tree will be used. These allowed me to find the exact MIB objects to monitor via <strong>Nagios</strong>. If you one is not a SNMP expert one will need to use this kind of information to find the relevant MIB objects through a bit of poking around.</p>
<pre>###############################################################
# SECTION: Monitor Various Aspects of the Running Host
#
#   The following check up on various aspects of a host.
# proc: Check for processes that should be running.
#     proc NAME [MAX=0] [MIN=0]
#
#     NAME:  the name of the process to check for.  It must match
#            exactly (ie, http will not find httpd processes).
#     MAX:   the maximum number allowed to be running.  Defaults to 0.
#     MIN:   the minimum number to be running.  Defaults to 0.
#
#   The results are reported in the prTable section of the UCD-SNMP-MIB tree
#   Special Case:  When the min and max numbers are both 0, it assumes
#   you want a max of infinity and a min of 1.

proc  smbd 30 1
proc  nmbd 1 1
proc  sshd 30 1
proc  syslogd 1 1
proc  klogd 1 1
proc  USB_Detect 2 2</pre>
<p>The next section allows me to specify how I want the disks to be monitored. I have two disks on my TS-209 box and I want to monitor them using their mount points <strong>/share/HDA_DATA, /share/HDB_DATA</strong> as seen below.I set them up so that if the free space falls below 5% the error flag of the corresponding MIB objct will be set. These also use the UC Davis MIB Tree.</p>
<pre># disk: Check for disk space usage of a partition.
#   The agent can check the amount of available disk space, and make
#   sure it is above a set limit.
#
#    disk PATH [MIN=100000]
#
#    PATH:  mount path to the disk in question.
#    MIN:   Disks with space below this value will have the Mib's errorFlag set.
#           Can be a raw byte value or a percentage followed by the %
#           symbol.  Default value = 100000.
#
#   The results are reported in the dskTable section of the UCD-SNMP-MIB tree
disk  / 5%
disk  /share/HDA_DATA 5%
disk  /share/HDB_DATA 5%</pre>
<p>The following is for tracking load on the device and I simply used the default setting.</p>
<pre># load: Check for unreasonable load average values.
# Watch the load average levels on the machine.
#
#    load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]
#
#    1MAX:   If the 1 minute load average is above this limit at query
#            time, the errorFlag will be set.
#    5MAX:   Similar, but for 5 min average.
#    15MAX:  Similar, but for 15 min average.
#
#   The results are reported in the laTable section of the UCD-SNMP-MIB tree
load  10 8 5</pre>
<p>The following is an example of parameter that belongs to a a different MIB tree &#8211; the <strong>MIB-2</strong> tree.</p>
<pre>###########################################################
# SECTION: System Information Setup
#
#   This section defines some of the information reported in
#   the "system" mib group in the mibII tree.
#
# syslocation: The [typically physical] location of the system.
#   Note that setting this value here means that when trying to
#   perform an snmp SET operation to the sysLocation.0 variable will make
#   the agent return the "notWritable" error code.  IE, including
#   this token in the snmpd.conf file will disable write access to
#   the variable.
#   arguments:  location_string
#
syslocation  "2nd FLOOR"</pre>
<p>Once <strong>net-snmp</strong> is setup and started the challenge is in identifying the <strong>MIB OIDs</strong> (Object Identifiers) or <strong>names</strong> to target the right Object parameters for <strong>Nagios</strong>. If one is not very familiar with MIB objects then I found the use of a MIB browser tool like <strong><a href="http://www.kill-9.org/mbrowse/">mbrowse</a></strong> (on Linux) and the <strong>snmpwalk</strong> command line utility are useful.</p>
<pre>prompt&#62; snmpwalk -v 2c -c public &#60;host&#62;</pre>
<p>spits out a huge list of MIB Object OIDs and value. Output should be directed to a file which then can be used to look for OIDs and parameters of interest. But tools like <strong>mbrowse</strong> are much easier to use and there are many of them for Linux and Windows environment.</p>
<p>Pointing the <strong>mbrowse</strong> MIB browser at the QNAP box with the appropriate read only community name (default is &#8216;<strong>public</strong>&#8216;) it allowed me to browser the MIB objects that are being by the <strong>snmp daemon</strong> on the device. I think <strong>mbrowse</strong> is able to monitor MIB-2 and UCD MIB out of the box. There was no need to install additional MIB tree definitions, if I remember correctly. Sometimes it is necessary to make the MIB browser tool aware of new MIB tree definitions.</p>
<p>Once connection succeeded, expanding the displayed tree and doing a GET or WALK on a node on the tree tells me whether the corresponding MIB object data is available from the device or not. If it is, then the MIB object name, parameters, along with this current status is listed at the bottom panel. This is where knowing part of the name of the node or its parent can be useful for the search functionality available in <strong>mbrowse</strong>. if some object in the displayed tree is not supported by the target device it will be obvious while doing a GET or WALK.</p>
<p>It took a bit of hunting to track down the MIB Objects for the target system states I defined in the the <strong>snmpd.conf </strong>file. I have added some screenshots showing some of these MIB objects as identified in the <strong>mbrowse</strong> window.</p>
<p><strong>prTable Entries</strong></p>
<p style="text-align:center;"><a href="http://swampy.files.wordpress.com/2008/11/screenshot-mib-browser-0a.png"><img class="size-full wp-image-474 aligncenter" title="screenshot-mib-browser-0a" src="http://swampy.wordpress.com/files/2008/11/screenshot-mib-browser-0a.png" alt="" width="460" height="360" /></a></p>
<p><strong>diskPercent Usage</strong></p>
<p style="text-align:center;"><a href="http://swampy.files.wordpress.com/2008/11/screenshot-mib-browser-1a.png"><img class="aligncenter size-full wp-image-475" title="screenshot-mib-browser-1a" src="http://swampy.wordpress.com/files/2008/11/screenshot-mib-browser-1a.png" alt="" width="460" height="360" /></a></p>
<p><strong>sysUpTime</strong></p>
<p style="text-align:center;"><a href="http://swampy.files.wordpress.com/2008/11/screenshot-mib-browser-4a.png"><img class="aligncenter size-full wp-image-476" title="screenshot-mib-browser-4a" src="http://swampy.wordpress.com/files/2008/11/screenshot-mib-browser-4a.png" alt="" width="460" height="360" /></a></p>
<p>Once I was able to track down the names/OIDs and parameter names for the MIB Objects that I wanted to monitor I created the service definitions in the <strong>Nagios</strong> object configuration file (on <strong>Nagios</strong> server host) I am using to monitor the NAS device.</p>
<p>While trying to figure out the correct OIDs I found the command line use of <strong>check_snmp</strong> <strong>Nagios</strong> plugin on the <strong>Nagios</strong> server host box to be useful instead of restarting server repeatedly. The command line utility <strong>snmpget</strong> is also a good alternative. This is used by <strong>check_snmp</strong> plugin anyway.</p>
<p><strong>Nagios Service objects definitions on server machine</strong></p>
<p>Following are used to track the disk % used for 1st and 2nd disks. using the last part of the names of the MIB objects are sufficient. I posted this on QNAP forum <a href="http://forum.qnap.com/viewtopic.php?f=91&#38;t=8255">earlier</a>, when I setting things up.<br />
<code><br />
define service{<br />
use generic-service ; Inherit values from a template<br />
host_name QNAP01<br />
name Disk 1<br />
service_description Disk 1 Utilization<br />
check_command check_snmp!-P 2c -l Disk -u % -w 90 -c 95 -o dskPercent.1<br />
normal_check_interval 720<br />
retry_check_interval 15<br />
}</code><br />
<code><br />
define service{<br />
use generic-service ; Inherit values from a template<br />
host_name QNAP01<br />
name Disk 2<br />
service_description Disk 2 Utilization<br />
check_command check_snmp!-P 2c -l Disk -u % -w 70 -c 85 -o dskPercent.2<br />
normal_check_interval 720<br />
retry_check_interval 15<br />
}<br />
</code><br />
Using this to see if the network port is working ok<br />
<code><br />
define service{<br />
use generic-service ; Inherit values from a template<br />
host_name QNAP01<br />
service_description Network Port Status<br />
normal_check_interval 5<br />
check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB<br />
}</code><br />
Using this to monitor the system uptime. I am using the full OID in this case.<br />
<code><br />
define service{<br />
use generic-service ; Inherit values from a template<br />
host_name QNAP01<br />
service_description Uptime<br />
normal_check_interval 5<br />
check_command check_snmp!-P 2c -l Uptime -o .1.3.6.1.2.1.1.3.sysUpTimeInstance<br />
}<br />
</code><br />
Using this to monitor CPU load Average using three MIB object OIDs.<br />
<code><br />
define service{<br />
use generic-service ; Inherit values from a template<br />
host_name QNAP01<br />
service_description Load Average over 1 5 15 min<br />
normal_check_interval 5<br />
check_command check_snmp!-P 2c -l LoadAvg -o .1.3.6.1.4.1.2021.10.1.3.1,.1.3.6.1.4.1.202<br />
1.10.1.3.2,.1.3.6.1.4.1.2021.10.1.3.3<br />
}<br />
</code></p>
<p>Using this for checking CPU load Average Error Flag (0 is ok)<br />
<code><br />
define service{<br />
use generic-service ; Inherit values from a template<br />
host_name QNAP01<br />
service_description Load Average Error Flags<br />
normal_check_interval 5<br />
check_command check_snmp!-P 2c -l LAErrFlags -r0 -o .1.3.6.1.4.1.2021.10.1.100.1,.1.3.6.<br />
1.4.1.2021.10.1.100.2,.1.3.6.1.4.1.2021.10.1.100.3<br />
}<br />
</code><br />
Using this for Checking Real Memory (Outside range is ok)<br />
<code><br />
define service{<br />
use generic-service ; Inherit values from a template<br />
host_name QNAP01<br />
service_description Real Memory Availability<br />
normal_check_interval 5<br />
check_command check_snmp!-P 2c -l Memory -u KB -w 1000:500 -c 500:0 -o memAvailReal.0<br />
}<br />
</code><br />
The <strong>Nagios</strong> plugin <a href="http://nagiosplugins.org/man/check_snmp">manual</a> describes the exact syntax and meaning of parameters for the <strong>check_snmp</strong> plugin. Following is a screenshot of the parameters collected by <strong>Nagios</strong>.</p>
<p style="text-align:center;"><a href="http://swampy.files.wordpress.com/2008/11/screenshot-nagios.png"><img class="aligncenter size-full wp-image-477" title="screenshot-nagios" src="http://swampy.wordpress.com/files/2008/11/screenshot-nagios.png" alt="" width="460" height="110" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Develop Net-SNMP Module]]></title>
<link>http://dekaaditia.wordpress.com/2008/10/21/develop-net-snmp-module/</link>
<pubDate>Tue, 21 Oct 2008 09:56:13 +0000</pubDate>
<dc:creator>Deka Aditia Adam</dc:creator>
<guid>http://dekaaditia.wordpress.com/2008/10/21/develop-net-snmp-module/</guid>
<description><![CDATA[Actually, it&#8217;s kind of old story (3 months ago) when i still working on COOP Telkom Program. B]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Actually, it&#8217;s kind of old story (3 months ago) when i still working on COOP Telkom Program. But this isn&#8217;t to late to talk about it, right ?. When i was on COOP Telkom, i have  some task to develop an application that support a network device. This network device (I dont know what&#8217;s his name <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  ) is used to monitor some physical condition of  network infrastructure such as temperature, air pressure etc .Process for gathering information from this device is all ready handled by some program.  The information from this device will be accessed periodically via SNMP protocol. My job is to make sure that it will work.<br />
<!--more--></p>
<p>On the first moment, i was confusing about what should i do. So i began to search some information on google about it.  And i found some tools named Net-SNMP. So what the hell is it all about ?. Net-SNMP is a program that run under unix environment that implementing some SNMP functionality. More over, user can also add some new SNMP functionality to it (Net-SNMP is an open source program). So i started to create appropriate design for it.</p>
<p>My application will consist of three main parts. The first one is core engine, this is actually a Net-SNMP engine that it&#8217;s functionality extended by me. The way to do it is consist of some steps:</p>
<ol>
<li>First, you have to implement a MIB. Each real object which will be monitor is consist of 4 MIB node objects, that is objectName, objectValue, objectLastMessage and objectThresholdSettings. Object Value is specify what is the current value from it, while objectLastMessage is specifying what is the last message relate with it. The last one is objectThresholdSettings, it consist of information to set threshold value for an object.</li>
<li>After you&#8217;ve successfully implement your MIB, the next step you should do is to implement an MIB module for it. MIB module is developed by C programming language. This is some scratch of MIB module for an object:
<p><div id="attachment_18" class="wp-caption aligncenter" style="width: 310px"><a href="http://dekaaditia.wordpress.com/files/2008/10/12.jpg"><img class="size-medium wp-image-18" title="MIB Module example (Taken from www.net-snmp.org)" src="http://dekaaditia.wordpress.com/files/2008/10/12.jpg?w=300" alt="MIB Module" width="300" height="215" /></a><p class="wp-caption-text">MIB Module</p></div></li>
<li>As an additional information each object is linked with a procedure handler. On this handler what should have to do on each state of object must be specifying. As an example, on GET mode what should i do is to read object information from a file and save it into data buffer on memory. Totally, there are 5 kinds of mode : GET, GET-NEXT,SET_RESERVE1, SET_RESERVE2, SET_UNDO and SET. SET mode is not simple as i imagine before, steps processing on SET mode is described on the picture bellow.
<p><div id="attachment_19" class="wp-caption aligncenter" style="width: 341px"><a href="http://dekaaditia.wordpress.com/files/2008/10/2.jpg"><img class="size-full wp-image-19" title="//www.net-snmp.org)" src="http://dekaaditia.wordpress.com/files/2008/10/2.jpg" alt="SET Mode processing" width="331" height="290" /></a><p class="wp-caption-text">SET Mode processing</p></div></li>
</ol>
<p>The second part of my application is checker value. This is just a simple application that periodically will read value of an object and compare it. After this comparation, it would be able to judge what is status for this object (ex: Normal, Warning or Danger), it&#8217;s decided from objectValue and objectThresholdSettings.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Fun with BSNL Modem and SNMP]]></title>
<link>http://balajirrao.wordpress.com/2008/08/16/snmp-fun/</link>
<pubDate>Sat, 16 Aug 2008 02:29:05 +0000</pubDate>
<dc:creator>balajirrao</dc:creator>
<guid>http://balajirrao.wordpress.com/2008/08/16/snmp-fun/</guid>
<description><![CDATA[When surfing my ADSL modem&#8217;s web console, I came across a page on SNMP daemon, which read Simp]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>When surfing my ADSL modem&#8217;s web console, I came across a page on SNMP daemon, which read</p>
<blockquote><p>Simple Network Management Protocol (SNMP) allows a management application to              retrieve statistics and status from the SNMP agent in this device.</p></blockquote>
<div id="attachment_62" class="wp-caption alignnone" style="width: 554px"><a href="http://balajirrao.wordpress.com/files/2008/08/screenshot-dsl-router-mozilla-firefox.png"><img class="size-full wp-image-62" src="http://balajirrao.wordpress.com/files/2008/08/screenshot-dsl-router-mozilla-firefox.png" alt="ADSL Router - SNMP Agent" width="544" height="519" /></a><p class="wp-caption-text">ADSL Router - SNMP Agent</p></div>
<p>Immediately the phrase &#8220;allows a management application to              retrieve statistics&#8221; caught my attention. &#8220;How about a nice GNOME panel applet that reports the unaccounted statistics dirrectly from the browser ?&#8221; &#8211; I thought.. Sounds exciting for sure. I decided to do it.</p>
<p>The first step is to read about SNMP. I began searching for a book, and finally got one linux administration book in my hand which seemed to have a couple of pages long description about SNMP, but I skimmed through them quickly, as I wanted a quick and dirty solution!.</p>
<p>I figured out that I need to install net-smp packages and did a yum install. I god a utility called tkmib which  is GUI for net-snmp.</p>
<p><a href="http://balajirrao.wordpress.com/files/2008/08/screenshot-tkmib.png"><img class="alignnone size-full wp-image-63" src="http://balajirrao.wordpress.com/files/2008/08/screenshot-tkmib.png" alt="" width="544" height="603" /></a></p>
<p>I figured out from the list below that the interface I am interested in is No.5, as shown from .iso.org.dod.internet.mgmt.mib-2.interfaces.ifTable.ifEntry.ifDescr.5 = br0</p>
<p>I now decieded to hack up a shell script that prints the unaccounted usage accounted in the router.</p>
<pre>#!/bin/bash
out=`snmpget -v1 -c public  modem interfaces.ifTable.ifEntry.ifOutOctets.5 -Oq &#124; cut -d " " -f 2`
in=`snmpget -v1 -c public  modem interfaces.ifTable.ifEntry.ifInOctets.5 -Oq &#124; cut -d " " -f 2`
tot1=`expr \( $in + $out \)`
out=`snmpget -v1 -c public  modem interfaces.ifTable.ifEntry.ifOutOctets.3 -Oq &#124; cut -d " " -f 2`
in=`snmpget -v1 -c public  modem interfaces.ifTable.ifEntry.ifInOctets.3 -Oq &#124; cut -d " " -f 2`
tot2=`expr \( $in + $out \)`
echo -e "Ashwin : \t" $tot2 "MB"
tot=`expr $tot1 - $tot2`
echo -e "Balaji : \t" $tot "MB"
echo -e "Total : \t" $tot1 "MB"</pre>
<p>It worked very well. Now, how about writing a gnome applet to display the utilization in real time ?  Here&#8217;s how I did it.</p>
<pre class="brush: python;">
#!/usr/bin/env python

import pygtk
pygtk.require('2.0' )

import gtk
import gnomeapplet
import time
from pysnmp import role, v1, asn1
from fpformat import fix
from string import Template
import gobject

tr = role.manager(('modem', 161))

req = v1.GETREQUEST()
rsp = v1.GETRESPONSE()

msg = Template(' Ashwin = $ash Balaji = $bal' )

class ModemApplet(gnomeapplet.Applet):

lbl = None
def __init__ (self, applet, iid):
self.lbl = gtk.Label(&quot;Please Wait..&quot; )
applet.add(self.lbl)
xx = gobject.timeout_add(10000, self.update)
applet.show_all()

def update (self):
req['encoded_oids'] = [ asn1.OBJECTID().encode('1.3.6.1.2.1.2.2.1.10.5' ) ]
(rawrsp, src) = tr.send_and_receive(req.encode())
rsp.decode(rawrsp)
vals = map(lambda x: x[0](), map(asn1.decode, rsp['encoded_vals']))
ino = vals[0]

req['encoded_oids'] = [ asn1.OBJECTID().encode('1.3.6.1.2.1.2.2.1.16.5 ' ) ]
(rawrsp, src) = tr.send_and_receive(req.encode())
rsp.decode(rawrsp)
vals = map(lambda x: x[0](), map(asn1.decode, rsp['encoded_vals ']))
outo = vals[0]
wan_tot = (ino + outo) / (1024.0 * 1024.0)

req['encoded_oids'] = [ asn1.OBJECTID().encode('1.3.6.1.2.1.2.2.1.10.3' ) ]
(rawrsp, src) = tr.send_and_receive(req.encode())
rsp.decode(rawrsp)
vals = map(lambda x: x[0](), map(asn1.decode, rsp['encoded_vals']))
ino = vals[0]
req['encoded_oids'] = [ asn1.OBJECTID().encode('1.3.6.1.2.1.2.2.1.16.3' ) ]
(rawrsp, src) = tr.send_and_receive(req.encode())
rsp.decode(rawrsp)
vals = map(lambda x: x[0](), map(asn1.decode, rsp['encoded_vals' ]))

outo = vals[0]
wlan_tot = (ino + outo) / (1024.0 * 1024.0)
self.lbl.set_label(msg.substitute(ash = str(fix(wlan_tot, 3)), bal = str(fix(wan_tot - wlan_tot, 3))))
return True

def modem_factory(applet, iid):
ModemApplet(applet, iid);
return gtk.TRUE

gobject.type_register(ModemApplet)

if __name__ == '__main__':
gnomeapplet.bonobo_factory(&quot;OAFIID:GNOME_ModemSNMP_Factory&quot;, ModemApplet.__gtype__, &quot;modem&quot;, &quot;1&quot;, modem_factory)
</pre>
<p>Its now a applet at the top. Doesn&#8217;t it look cool ? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<a href="http://balajirrao.wordpress.com/files/2008/08/snap1.jpeg"><img class="alignnone size-full wp-image-75" src="http://balajirrao.wordpress.com/files/2008/08/snap1.jpeg" alt="" width="544" height="77" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Install MRTG + net-snmp ]]></title>
<link>http://verafirmansyah.wordpress.com/2008/08/14/install-mrtg-net-snmp/</link>
<pubDate>Thu, 14 Aug 2008 09:19:38 +0000</pubDate>
<dc:creator>verafirmansyah</dc:creator>
<guid>http://verafirmansyah.wordpress.com/2008/08/14/install-mrtg-net-snmp/</guid>
<description><![CDATA[Nglanjutin ngoprek server yang kemarin ini mau nulis tutorial lagi tentang MRTG (Multi Router Traffi]]></description>
<content:encoded><![CDATA[Nglanjutin ngoprek server yang kemarin ini mau nulis tutorial lagi tentang MRTG (Multi Router Traffi]]></content:encoded>
</item>
<item>
<title><![CDATA[Perdi 500 euros]]></title>
<link>http://netcrash.wordpress.com/2008/04/09/de-lamentar/</link>
<pubDate>Wed, 09 Apr 2008 13:39:51 +0000</pubDate>
<dc:creator>Fernando André</dc:creator>
<guid>http://netcrash.wordpress.com/2008/04/09/de-lamentar/</guid>
<description><![CDATA[É com grande pena que o meu monitor de 21&#8243; ontem à noite deu os últimos sinais de vida&#8230; ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>É com grande pena que o meu monitor de 21&#8243; ontem à noite deu os últimos sinais de vida&#8230;</p>
<p><img class="alignright" style="float:right;border:1px solid black;" src="http://farm1.static.flickr.com/174/410745844_b281805994_t_d.jpg" alt="Monitor de 21" width="100" height="67" /></p>
<p>À parte disso não gosto quando o net-snmp falha por um motivo que ainda não consegui identificar. Simplesmente parei e reiniciei o serviço e aconteceu <a title="Google groups net-snmp" href="http://groups.google.com/group/mailing.unix.net-snmp-users/browse_thread/thread/ef900922d299fdc7/c222178a4ff830cc" target="_blank">isto</a>.</p>
<p>Mário Brothers em <a title="mario brothers" href="http://www.nihilogic.dk/labs/mario/mario_large_music.htm" target="_blank">Javascript</a></p>
<p>Gostava que o wordpress suporta-se o <a title="twitter" href="http://twitter.com/" target="_blank">twitter</a> mas isso são desejos que não se vão concretizar devido ao <a title="pownce" href="http://pownce.com/" target="_blank">pownce</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Monitoring your Linux/Unix servers and network devices using MRTG and SNMP]]></title>
<link>http://teklimbu.wordpress.com/2007/12/05/monitoring-your-linuxunix-servers-and-network-devices-using-mrtg-and-snmp/</link>
<pubDate>Wed, 05 Dec 2007 15:57:25 +0000</pubDate>
<dc:creator>teklimbu</dc:creator>
<guid>http://teklimbu.wordpress.com/2007/12/05/monitoring-your-linuxunix-servers-and-network-devices-using-mrtg-and-snmp/</guid>
<description><![CDATA[This tutorial will guide you to create MRTG graphs for your Linux/Unix Server or just about any netw]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><iframe src='http://digg.com/api/diggthis.php?u=http%3A%2F%2Fdigg.com%2Flinux_unix%2FMonitor_your_Linux_Unix_server_using_MRTG_graphing' height='82' width='55' frameborder='0' scrolling='no' style='float: right; margin-left: 10px; margin-bottom: 5px; padding: 4px 0 2px 4px; background: #fff;'></iframe></p>
<p>This tutorial will guide you to create MRTG graphs for your Linux/Unix Server or just about any network device which supports SNMP.</p>
<p>This guide will present you the layout in a practical way and will not go in depth to explain the theories behind how they work. This is because the users will explore and learn them by themselves.</p>
<p><b>SNMP </b>stands for <b>Simple Network Management Protocol</b>.</p>
<p><!--more--></p>
<p>It is an application layer protocol that helps the exchange of management information between network devices. It is based on <b>TCP/IP</b> and allows us to extract various information like network traffic and performance which in turn help us plan our network for growth and problems.</p>
<p>More information about SNMP can be found at it&#8217;s site at: <a href="http://net-snmp.sourceforge.net/" title="net-snmp homepage">http://net-snmp.sourceforge.net/ </a></p>
<p>First of all, you need the MRTG package.</p>
<p><b>MRTG </b>stands for <b>Multi Router Traffic Grapher</b>. It can be used to monitor and graphically display traffic and usage of an internet connection among many other things.</p>
<p>More information about MRTG can be found on it&#8217;s creator&#8217;s site at: <a href="http://oss.oetiker.ch/mrtg/" title="MRTG Homepage" target="_blank">http://oss.oetiker.ch/mrtg/</a></p>
<p>In addition to MRTG, you will need a Web server to display the graphs and statistics generated by MRTG. More information to setup an Apache web server can be found in the following URL:</p>
<p><a href="http://teklimbu.wordpress.com/2007/10/08/configuring-apache-2x-with-php-5x-and-mysql-5x/" title="Apache installation" target="_blank">http://teklimbu.wordpress.com/2007/10/08/configuring-apache2</a></p>
<p>In case, you are in a hurry, follow the steps below to install a very basic Apache web server.</p>
<p><b>(1.)  Download Apache</b></p>
<p>cd   /usr/local/src</p>
<p>wget   http://mirror.nyi.net/apache/httpd/httpd-2.2.6.tar.gz</p>
<p><b>(2.)  unzip the sources</b></p>
<p>tar   zxvf   httpd-2.2.6.tar.gz</p>
<p><b>(3.)  Configure Apache</b></p>
<p>cd    httpd-2.2.6</p>
<p>./configure</p>
<p>–prefix=/usr/local/httpd \</p>
<p>–enable-so</p>
<p><b>(4.) Compile and install Apache </b></p>
<p>make  &#38;&#38;   make  install</p>
<p><i><b>(5.)  Start the Apache web server </b></i></p>
<p>/usr/local/httpd/bin/apachectl start</p>
<p>That’s it. Apache 2.2.6 should now be running!</p>
<p>Moving on, we will next compile and install the MRTG package.</p>
<p><b>MRTG Installation</b></p>
<p><b><i>(1.)  Create local directory and change to that directory.</i></b></p>
<p>mkdir  -p  /usr/local/src/mrtg</p>
<p>cd   /usr/local/src/mrtg</p>
<p><i><b>(2.) Download MRTG. The latest version of MRTG as on 05-Dec-2007 is 2.15.2.<br />
</b></i></p>
<p>wget http://oss.oetiker.ch/mrtg/pub/mrtg-2.15.2.tar.gz</p>
<p><b><i>(3.)   Unzip the package.</i></b></p>
<p>tar   zxvf mrtg-2.15.2.tar.gz</p>
<p>cd   mrtg-2.15.2</p>
<p><b><i>(4.)   Configure MRTG</i></b></p>
<p>./configure   &#8211;prefix=/usr/local/mrtg-2</p>
<p>Note: you may need to install the GD library. For Debian users, it&#8217;s just a matter of typing: apt-get install libgd-dev</p>
<p align="left">&#160;</p>
<p> <b><i> (5.)    Compile and install the MRTG software.</i></b></p>
<p>make &#38;&#38; make  install</p>
<p>That&#8217;s it. MRTG is now installed in the prefixed directory:  /usr/local/mrtg-2</p>
<p><b>Net-SNMP Installation</b></p>
<p><b><i>(1.)  Create local directory to your download SNMP</i></b></p>
<p>mkdir -p  /usr/local/src/snmp</p>
<p>cd  /usr/local/src/snmp</p>
<p><b><i>(2.) Download the latest source package of net-snmp. The latest version of net-snmp as on 05-Dec-2007 is 5.2.4. </i></b></p>
<p>wget http://nchc.dl.sourceforge.net/sourceforge/net-snmp/net-snmp-5.2.4.tar.gz</p>
<p><b><i>(3.)   Unzip the source file</i></b></p>
<p>tar zxvf net-snmp-5.2.4.tar.gz</p>
<p><b><i>(4.)  Configure your SNMP package</i></b></p>
<p>cd /usr/local/src/snmp/net-snmp-5.2.4<br />
./configure &#8211;prefix=/usr/local/net-snmp</p>
<p>Note: You will be asked some questions regarding setting up SNMP such as the following:</p>
<p>(a.)  Default version of SNMP to use: Choose 2</p>
<p>(b.)  System Contact Information: type in your email address</p>
<p>(c.)  System Location: Type in the location of this box</p>
<p>(d.)  Location to write log file: /var/log/snmpd.log</p>
<p>(e.)  Location to write persistent information: /var/net-snmp</p>
<p>If your configuration options was successful you will see something the following:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Net-SNMP configuration summary:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>SNMP Versions Supported:    1 2c 3<br />
Net-SNMP Version:           5.2.4<br />
Building for:               linux<br />
Network transport support:  Callback Unix TCP UDP<br />
SNMPv3 Security Modules:    usm<br />
Agent MIB code:             mibII ucd_snmp snmpv3mibs notification target agent_mibs agentx utilities<br />
SNMP Perl modules:          disabled<br />
Embedded perl support:      disabled<br />
Authentication support:     MD5 SHA1<br />
Encryption support:         DES AES</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<i><b> (5.)  Compile and install SNMP</b></i></p>
<p>make  &#38;&#38;  make install</p>
<p>If everything completes without any errors, that&#8217;s it. Net-SNMP is installed in your machine!</p>
<p align="center"><b>Configuration of snmpd.conf</b></p>
<p>Let us now create a snmpd.conf file which contains the basic elements for extracting information about your machine.</p>
<p><b><i>(1.)  Create the etc directory to hold your snmpd.conf file.</i></b><br />
mkdir -p /usr/local/net-snmp/etc</p>
<p><b><i>(2.)  Create the snmpd.conf</i></b></p>
<p>vi /usr/local/net-snmp/etc/snmpd.conf</p>
<p>##Copy and paste the following##</p>
<p>#############Start of snmpd.conf###########################<br />
#<br />
# snmpd.conf<br />
#<br />
#   &#8211; created by Tek Limbu on 05-Dec-2007<br />
#<br />
#######################################################<br />
# SECTION: System Information Setup<br />
#<br />
#   This section defines some of the information reported in<br />
#   the &#8220;system&#8221; mib group in the mibII tree.</p>
<p># syslocation: The [typically physical] location of the system.<br />
#   Note that setting this value here means that when trying to<br />
#   perform an snmp SET operation to the sysLocation.0 variable will make<br />
#   the agent return the &#8220;notWritable&#8221; error code.  IE, including<br />
#   this token in the snmpd.conf file will disable write access to<br />
#   the variable.<br />
#   arguments:  location_string</p>
<p>syslocation Kathmandu-Nepal</p>
<p># syscontact: The contact information for the administrator<br />
#   Note that setting this value here means that when trying to<br />
#   perform an snmp SET operation to the sysContact.0 variable will make<br />
#   the agent return the &#8220;notWritable&#8221; error code.  IE, including<br />
#   this token in the snmpd.conf file will disable write access to<br />
#   the variable.<br />
#   arguments:  contact_string</p>
<p>syscontact tekbdrlimbu@hotmail.com</p>
<p>#####################################################<br />
# SECTION: Access Control Setup<br />
#<br />
#   This section defines who is allowed to talk to your running<br />
#   snmp agent.</p>
<p># rocommunity: a SNMPv1/SNMPv2c read-only access community name<br />
#   arguments:  community [default&#124;hostname&#124;network/bits] [oid]</p>
<p>rocommunity MyPass333</p>
<p>#Disk size in Megabytes (MB).</p>
<p>disk  /usr</p>
<p>disk  /var</p>
<p>#################End of snmpd.conf########################</p>
<p>The most important data in any SNMP configuration is the community string which can be compared to a password. In the above snmpd.conf file, the <i>rocommunity </i>stands for <i>read-only community</i> string which has the value &#8220;MyPass333&#8243;. As with passwords, this has to be kept as as secret!</p>
<p><b><i>(3.)  Run the SNMP daemon using the above snmpd.conf file.<br />
</i></b></p>
<p>/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/etc/snmpd.conf</p>
<p><i><b>(4.)  </b></i><b><i>Test to see if SNMP is working and functioning properly.</i></b></p>
<p><i>/usr/local/net-snmp/bin/snmpwalk -v2c -c MyPass333 localhost system</i><br />
You should see something like the following:</p>
<p>###############################################</p>
<p>SNMPv2-MIB::sysDescr.0 = STRING: Linux gw-npj-sp 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686<br />
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10<br />
SNMPv2-MIB::sysUpTime.0 = Timeticks: (168913) 0:28:09.13<br />
SNMPv2-MIB::sysContact.0 = STRING: tekbdrlimbu@hotmail.com<br />
SNMPv2-MIB::sysName.0 = STRING: linux-box-hostname<br />
SNMPv2-MIB::sysLocation.0 = STRING: Kathmandu-Nepal<br />
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00</p>
<p>##############################################</p>
<p>Looks familiar doesn&#8217;t it? This is because we supplied the information in the snmpd.conf file!</p>
<p><i><b>Creating your 1st MRTG graph using SNMP</b></i></p>
<p>Assuming that you have did everything mentioned above correctly, then we will move on to generate a very simple graph showing the traffic status of your machine&#8217;s network interfaces.</p>
<p><b><i>(1.)  Create the directory to store your MRTG configuration (cfg) files. </i></b></p>
<p>mkdir -p /usr/local/mrtg-2/etc</p>
<p><b><i>(2.)  Create the directories to store your MRTG cfg files and it&#8217;s output files in your Apache DocumentRoot directory.</i></b></p>
<p>Assuming that you followed the steps outlined in the URL:</p>
<p><a href="http://teklimbu.wordpress.com/2007/10/08/configuring-apache-2x-with-php-5x-and-mysql-5x/" title="Apache installation" target="_blank">http://teklimbu.wordpress.com/2007/10/08/configuring-apache2</a></p>
<p>Then, your DocumentRoot will be the default &#8220;/usr/local/httpd/htdocs/&#8221; directory.</p>
<p>mkdir -p  /usr/local/httpd/htdocs/mrtg/traffic</p>
<p><b><i>(3.)  Run the cfgmaker tool installed from the MRTG package</i></b></p>
<p>/usr/local/mrtg-2/bin/cfgmaker &#8211;output=/usr/local/mrtg-2/etc/mrtg.cfg &#8211;global &#8220;workdir: /usr/local/httpd/htdocs/mrtg/traffic&#8221; -ifref=ip &#8211;global &#8216;options[_]: growright,bits&#8217; MyPass333@localhost</p>
<p>The above command will produce the output file &#8220;mrtg.cfg&#8221; and all graphs generated will be stored in  the &#8220;workdir&#8221; directory.</p>
<p>output file= /usr/local/mrtg-2/etc/mrtg.cfg</p>
<p>workdir=  /usr/local/httpd/htdocs/mrtg/traffic/</p>
<p><i><b>(4.)  Finally run the mrtg tool to generate the graphs.</b></i></p>
<p><i><b>         </b></i><br />
env LANG=C /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/mrtg.cfg</p>
<p><i><b>(5.)  Your graphs should now be generated. Fire up your web browser and enter the IP address or hostname of your machine.</b></i></p>
<p>http://192.168.0.1/mrtg/traffic</p>
<p>If this machine is your desktop, simply type:</p>
<p>http://localhost/mrtg/traffic</p>
<p>Note:  Replace the IP above with the actual IP of your Linux machine.</p>
<p><i><b>(5.)  Generate your index.html file using the tool called indexmaker which comes with the MRTG package.</b></i></p>
<p>/usr/local/mrtg-2/bin/indexmaker &#8211;title=&#8221;Traffic Status&#8221; \</p>
<p>/usr/local/mrtg-2/etc/mrtg.cfg \</p>
<p>&#62;  /usr/local/httpd/htdocs/mrtg/traffic/index.html</p>
<p>You should see something like the following graph:</p>
<p align="center"><img src="http://farm3.static.flickr.com/2072/2086765264_bd59af0ddb.jpg?v=0" alt="eth0 traffic" height="135" width="500" /></p>
<p align="center"><i>Graph showing traffic analysis for eth0 </i></p>
<p><i><b>(6.)  We need to setup an entry in the cron table to update the MRTG graphs every 5 minutes. On a Linux or FreeBSD machine, you can do it the following way:</b></i></p>
<p>vi  /etc/crontab</p>
<p>##### Copy and paste the following #####</p>
<p>*/5    *    *    *    *     root env LANG=C /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/mrtg.cfg   &#62; /dev/null 2&#62;&#38;1</p>
<p>Note: The above statement should be in a single line, i.e. no line breaks.</p>
<p>There you have it. Your graphs will update every 5 minutes indicating the traffic flow in your eth0 network interface.</p>
<p>Now that you have used cfgmaker to extract the traffic of the network interfaces of your Linux machine, it can be used on any network devices which support SNMP.</p>
<p>Moving on, to explore more about SNMP and MRTG, we will create a new configuration file which will generate graphs showing the CPU load, Memory Usage, TCP connections and disk partitions   of your Linux/Unix machine.</p>
<p>The cfg file used for this task is taken from the site: www.linuxhomenetworking.com. This is a great site for all level of Linux/Unix users.</p>
<p>MRTG and SNMP are covered in depth at:</p>
<p><a href="http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch22_:_Monitoring_Server_Performance" title="Linuxhomenetworking chaper 22" target="_blank">http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch22</a></p>
<p><a href="http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch23_:_Advanced_MRTG_for_Linux" title="Linuxhomenetworking chaper 23" target="_blank">http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch23</a></p>
<p>Having said that, let&#8217;s move on..</p>
<p><b><i>(1.)  Create a new directory for Apache to store the graphs</i></b></p>
<p>mkdir  -p  /usr/local/httpd/htdocs/mrtg/server</p>
<p><b><i>(2.)  Create a new configuration file called server-mrtg.cfg</i></b></p>
<p>vi   /usr/local/mrtg-2/etc/server-mrtg.cfg</p>
<p>##### Copy and paste the following:######</p>
<p>#####Start of server-mrtg.cfg########</p>
<p># Configuration file for non bandwidth server statistics<br />
#</p>
<p>#<br />
# Define global options<br />
#</p>
<p>LoadMIBs: /usr/local/net-snmp/share/snmp/mibs/UCD-SNMP-MIB.txt,</p>
<p>/usr/local/net-snmp/share/snmp/mibs/TCP-MIB.txt<br />
workdir: /usr/local/httpd/htdocs/mrtg/server</p>
<p>#<br />
# CPU Monitoring<br />
# (Scaled so that the sum of all three values doesn&#8217;t exceed 100)<br />
#</p>
<p>Target[server.cpu]:ssCpuRawUser.0&#38;ssCpuRawUser.0:MyPass333@localhost + ssCpuRawSystem.0&#38;ssCpuRawSystem.0:MyPass333@localhost + ssCpuRawNice.0&#38;ssCpuRawNice.0:MyPass333@localhost<br />
Title[server.cpu]: Server CPU Load<br />
PageTop[server.cpu]: &#60;H1&#62;CPU Load &#8211; System, User and Nice Processes&#60;/H1&#62;<br />
MaxBytes[server.cpu]: 100<br />
ShortLegend[server.cpu]: %<br />
YLegend[server.cpu]: CPU Utilization<br />
Legend1[server.cpu]: Current CPU percentage load<br />
LegendI[server.cpu]: Used<br />
LegendO[server.cpu]:<br />
Options[server.cpu]: growright,nopercent<br />
Unscaled[server.cpu]: ymwd</p>
<p>#<br />
# Memory Monitoring (Total Versus Available Memory)<br />
#</p>
<p>Target[server.memory]: memAvailReal.0&#38;memTotalReal.0:MyPass333@localhost<br />
Title[server.memory]: Free Memory<br />
PageTop[server.memory]: &#60;H1&#62;Free Memory&#60;/H1&#62;<br />
MaxBytes[server.memory]: 100000000000<br />
ShortLegend[server.memory]: B<br />
YLegend[server.memory]: Bytes<br />
LegendI[server.memory]: Free<br />
LegendO[server.memory]: Total<br />
Legend1[server.memory]: Free memory, not including swap, in bytes<br />
Legend2[server.memory]: Total memory<br />
Options[server.memory]: gauge,growright,nopercent<br />
kMG[server.memory]: k,M,G,T,P,X</p>
<p>#<br />
# Memory Monitoring (Percentage usage)<br />
#<br />
Title[server.mempercent]: Percentage Free Memory<br />
PageTop[server.mempercent]: &#60;H1&#62;Percentage Free Memory&#60;/H1&#62;<br />
Target[server.mempercent]: ( memAvailReal.0&#38;memAvailReal.0:MyPass333@localhost ) * 100 / ( memTotalReal.0&#38;memTotalReal.0:MyPass333@localhost )<br />
options[server.mempercent]: growright,gauge,transparent,nopercent<br />
Unscaled[server.mempercent]: ymwd<br />
MaxBytes[server.mempercent]: 100<br />
YLegend[server.mempercent]: Memory %<br />
ShortLegend[server.mempercent]: Percent<br />
LegendI[server.mempercent]: Free<br />
LegendO[server.mempercent]: Free<br />
Legend1[server.mempercent]: Percentage Free Memory<br />
Legend2[server.mempercent]: Percentage Free Memory</p>
<p>#<br />
# New TCP Connection Monitoring (per minute)<br />
#</p>
<p>Target[server.newconns]: tcpPassiveOpens.0&#38;tcpActiveOpens.0:MyPass333@localhost<br />
Title[server.newconns]: Newly Created TCP Connections<br />
PageTop[server.newconns]: &#60;H1&#62;New TCP Connections&#60;/H1&#62;<br />
MaxBytes[server.newconns]: 10000000000<br />
ShortLegend[server.newconns]: c/s<br />
YLegend[server.newconns]: Conns / Min<br />
LegendI[server.newconns]: In<br />
LegendO[server.newconns]: Out<br />
Legend1[server.newconns]: New inbound connections<br />
Legend2[server.newconns]: New outbound connections<br />
Options[server.newconns]: growright,nopercent,perminute</p>
<p>#<br />
# Established TCP Connections<br />
#</p>
<p>Target[server.estabcons]: tcpCurrEstab.0&#38;tcpCurrEstab.0:MyPass333@localhost<br />
Title[server.estabcons]: Currently Established TCP Connections<br />
PageTop[server.estabcons]: &#60;H1&#62;Established TCP Connections&#60;/H1&#62;<br />
MaxBytes[server.estabcons]: 10000000000<br />
ShortLegend[server.estabcons]:<br />
YLegend[server.estabcons]: Connections<br />
LegendI[server.estabcons]: In<br />
LegendO[server.estabcons]:<br />
Legend1[server.estabcons]: Established connections<br />
Legend2[server.estabcons]:<br />
Options[server.estabcons]: growright,nopercent,gauge</p>
<p>#<br />
# Disk Usage Monitoring<br />
#</p>
<p>Target[server.disk]: dskPercent.1&#38;dskPercent.2:MyPass333@localhost<br />
Title[server.disk]: Disk Partition Usage<br />
PageTop[server.disk]: &#60;H1&#62;Disk Partition Usage /usr and /var&#60;/H1&#62;<br />
MaxBytes[server.disk]: 100<br />
ShortLegend[server.disk]: %<br />
YLegend[server.disk]: Utilization<br />
LegendI[server.disk]: /usr<br />
LegendO[server.disk]: /var<br />
Options[server.disk]: gauge,growright,nopercent<br />
Unscaled[server.disk]: ymwd<br />
######End of server-mrtg.cfg#######</p>
<p><b><i>(3.)  Generate the MRTG graphs </i></b></p>
<p>env LANG=C /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/server-mrtg.cfg</p>
<p><i><b>(4.)  Create the index.html file running indexmaker </b></i></p>
<p>/usr/local/mrtg-2/bin/indexmaker &#8211;title=&#8221;Server Status&#8221; \<br />
/usr/local/mrtg-2/etc/server-mrtg.cfg \<br />
&#62;   /usr/local/httpd/htdocs/mrtg/server/index.html</p>
<p>(5.)  Fire up your web browser and point it to:</p>
<p>http://192.168.0.1/mrtg/server/</p>
<p>or if this is your local machine</p>
<p>http://localhost/mrtg/server</p>
<p>You should see something like the following graphs:</p>
<p align="center">&#160;</p>
<p align="center">&#160;</p>
<p align="center"><img src="http://farm3.static.flickr.com/2114/2121889287_5d783bc4ed.jpg?v=0" alt="linux-server-mrtg" height="320" width="500" /></p>
<p align="center"><i>MRTG graph showing your server status</i></p>
<p align="center">&#160;</p>
<p align="left"><b><i>(6.)  Finally create a cron table entry to generate update these graphs every 5 minutes. </i></b></p>
<p align="left">&#160;</p>
<p align="left">vi  /etc/crontab</p>
<p align="left">&#160;</p>
<p align="left">###Copy and paste the following###</p>
<p align="left"> */5     *     *     *    *     root     env LANG=C /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/server-mrtg.cfg</p>
<p align="left">&#160;</p>
<p align="left">That&#8217;s it. You have just created an effective method for monitoring your Linux/Unix box!</p>
<p align="left">Of course, MRTG is very versatile and can generate traffic graphs from your Squid proxy, Apache Web, Bind DNS, Qmail, routers, switches, just to mention a few. We will visit these topics in the coming days to come.</p>
<p align="left">Till then, enjoy monitoring your server with your newly generated MRTG graphs!</p>
<p align="left">&#160;</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
