how to get embedded perl support on snmpd (doc)

From: Pablo Escobar <pescobar#cipf.es>
Date: Tue, 9 Dec 2008 15:52:39 +0100


Hi,

I had to spend some time to get this working on my haproxy machine so here you have the info that I saved on my personal wiki in case is useful for anyone or maybe can be added to haproxy docs.

All the info explained here has been tested on debian etch x86_64

snmpd servers avaiable on repositories (at least debian repos) dont have embedded perl support. If your snmpd doesn´t support embedded perl you will get this errors on syslog after adding this lines on snmpd.conf

lines on the snmpd config (snmpd.conf)
disablePerl false
perl do '/etc/snmp/haproxy.pl';

errors on syslog:
/etc/snmp/snmpd.conf: line 25: Warning: Unknown token: disablePerl. /etc/snmp/snmpd.conf: line 26: Warning: Unknown token: perl.

once verified we have no embedded perl support on our snmpd the only solution is to recompile/upgrade our snmpd.



The classic way:
just get the source code from net-snmp website http://www.net-snmp.org/

install needed libs
$> apt-get install build-essential libperl-dev

compile and install:
./configure --enable-embedded-perl
(be sure that after running configure you get something like "Embedded Perl support: enabled"

make
make install

then just add your startup-scripts on init.d as needed.

*******************************************************************+

The debian way:

Install required packages:

$> apt-get install build-essential fakeroot dpkg-dev libperl-dev
$> mkdir build
$> cd build
$> apt-get source snmpd
$> apt-get build-dep snmpd
$> dpkg-source -x net-snmp_5.2.3-7etch2.dsc
$> cd net-snmp-5.2.3/

To compile with perl support you have to pass the flag "--enable-embedded-perl" to the configure script. It is supposed that you can do it in this way:

$>DEB_BUILD_OPTIONS="--enable-embedded-perl" fakeroot debian/rules binary

but this didn´t worked for me so I had to edit with a text editor the file net-snmp-5.2.3/debian/rules and manually add the flag "--enable-embedded-perl"

After this I generated the .deb packages with:
$> fakeroot debian/rules binary

Then I installed all the generated .deb files and when I restarted the snmpd server the error on syslog dissapeared.

**********************************************************************************+

When I got embedded perl support on snmpd I also had to change this line on haproxy.cfg

line on cfg not working:
stats socket /var/run/haproxy.stat mode 600

modified to:
stats socket /var/run/haproxy.stat mode 777

Now I can query with snmpwalk:

[root][harry]# snmpbulkwalk -c public -v2c IPHAPROXY 1.3.6.1.4.1.29385.106.1.0.17
SNMPv2-SMI::enterprises.29385.106.1.0.17.1.0 = STRING: "OPEN"

I hope this info is useful.

Pablo.

-- 
Pablo Escobar Lopez
Head of Infrastructure & IT Support
Bioinformatics Department
Centro de Investigación Príncipe Felipe (CIPF)
Tfn: (34) 96 328 96 80 ext: 1004
http://bioinfo.cipf.es
Received on 2008/12/09 15:52

This archive was generated by hypermail 2.2.0 : 2008/12/09 16:00 CET