Re: canīt get snmp to work

From: Pablo Escobar <pescobar#cipf.es>
Date: Tue, 22 Apr 2008 19:47:58 +0200


Hi Willy,

Finally I got it working.

I found that default snmpd server on debian etch has no perl support, thatīs why I was getting this errors on syslog:

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

So I had to recompile snmpd package with perl support. I did on the "debian way", I am going to try to describe to steps I followed, maybe itīs usefull for any reader of the list interested on getting snmp support.

Intall required packages:

$> apt-get install build-essential fakeroot dpkg-dev  #this to build .deb
$> 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.

I also also had to change a line on my haproxy.cfg. I had this on the global section:

stats socket /var/run/haproxy.stat mode 600

and had to change for this:

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"

Now itīs time for cacti :)

Many thanks for your help Willy, you are developing a great software and also make this mailing list really interesting with your inputs.

If anyone is interested on getting the snmpd .deb files with perl support for debian etch x86_64 just mail me.

Pablo.

El Tuesday 22 April 2008 06:21:12 Willy Tarreau escribió:
> Hi Pablo,
>
> On Mon, Apr 21, 2008 at 06:27:16PM +0200, Pablo Escobar wrote:
> > Hi all
> >
> > Today I decided to upgrade to last stable version of haproxy on my web
> > cluster because I would like to get snmp statistics from haproxy to show
> > on cacti but I canīt get snmp to work.
> >
> > I followed the instructions on haproxy-1.3.15/contrib/netsnmp-perl/README
> > so copied the script haproxy.pl to /etc/snmp directory and got this two
> > new lines on my snmpd.conf
> >
> > [root]@[txema]# tail -n2 /etc/snmp/snmpd.conf
> > disablePerl false
> > perl do '/etc/snmp/haproxy.pl';
> >
> > then I restarted snmpd and tried to do some snmp queries but I get no
> > results.
>
> I have not tried this script yet, because I don't have a perl-enabled
> snmpd. But could you check /var/log/messages, just in case snmpd would log
> some errors ? Probably that /etc/snmp/haproxy.pl needs to be installed with
> execute permission (chmod +x).
>
> Also check that the unix socket referenced in haproxy.pl matches the one
> you have in your haproxy configuration. Maybe you have a slightly different
> path ?
>
> Regards,
> Willy

-- 
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/04/22 19:47

This archive was generated by hypermail 2.2.0 : 2008/04/22 19:46 CEST