2009-08-25

How to upgrade SNMP agent on Debian Etch

Hi!

This is my first post on my very first blog.
So I ask for your understanding.
Also - I'm not a xNIX systems expert (yet) so posts regarding Linux may contain some errors.
Again - be forgiving :-)                   
(and give feedback, always give feedback!!)


OK. To the point.

I'm using SNMP to get performance data of a Linux (Debian Etch) machine. I need to get CPU usage of every core separately. Unfortunately the machine does not give out that information via SNMP.
I fixed it by upgrading SNMP agent to latest (almost) stable version.


Here are the steps I needed to take.

Check the current snmpd version installed on said box:
  • locally: 
find / -name snmpd
/usr/sbin/snmpd -v
  •  remotely:
snmpwalk -v 1 -c community_string X.X.X.X versiontag
It turned out that machine uses snmpd version 5.2.3 which is the latest version for Debian Etch.

So the only way to use newer SNMP agent on this old Debian is to compile it from source.

Download the latest stable source package of Net-Snmp:
wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.4.2.1/net-snmp-5.4.2.1.tar.gz/download

Unpack it, configure, compile and install
tar -xf  net-snmp-5.4.2.1.tar.gz
cd  net-snmp-5.4.2.1
./configure
make
make install
OOOPS! Error:
/usr/bin/ld: cannot find -lperl
It turned out that the poor Etch did not have libperl-dev (PERL development library)
So:
apt-get install libperl-dev
and than compile and install again.

After the installation disable / remove the old snmpd package:

/etc/init.d/snmpd stop
or
aptitude remove snmpd

Run the newly installed agent with old configuration file:
/usr/local/sbin/snmpd -c /etc/snmp/snmpd.conf &

Check the running processes:
 ps -ef | grep -i snmp.
(the dot at the end is a REGEXP symbol for "any single character" so that grep will filter for "snmp" and "snmpd")

And check the SNMP agent version again.
Success!

Afterword:
I use OpsView for monitoring. It a s Nagios-based open-source application. I will talk about it near future.