2

I am trying to monitor HAProxy states through SNMP. There is a haproxy.pl file for use with NetSNMP which I've copied and set up in snmpd.conf according to /usr/share/doc/haproxy/contrib/netsnmp-perl/README.gz. Two lines have been appended to snmpd.conf:

disablePerl false
perl do '/etc/snmp/haproxy.pl';

which should have done the trick, but querying the appropriate OID just gives:

denis@nagios:~# snmpbulkwalk -c public -v2c 192.168.1.102 1.3.6.1.4.1.29385.106
SNMPv2-SMI::enterprises.29385.106 = No Such Object available on this agent at this OID

I've done a research on the net and there seems to be some fuzz about Ubuntu's net-snmp not having been compiled with the --enable-embedded-perl option. I've checked that with net-snmp-config --configure-options and there were no embedded-perl options mentioned, which would mean that it defaulted to enabling embedded perl support according to the INSTALL docs. Furthermore, I was getting the error embedded perl support failed to initalize (apparently meaning that I was missing a prerequisite module) until I've installed libsnmp-dev - another clue that embedded perl support was compiled in.

Net-SNMP now restarts quite fine and without errors, but yet I have no luck in querying the HAProxy OID. My logs just show entries like

Connection from UDP: [192.168.1.111]:34391->[192.168.1.102]

Any ideas greatly appreciated. Furthermore, if someone has got some perl-agent setup running with Ubuntu, I'd love to hear the configuration details.

1
  • 1
    In /tmp/test.pl, try putting system("touch /tmp/test.works"); return 1;. If you start snmpd and it creates /tmp/test.works then you know the perl is getting executed. Otherwise, there is a different problem. Also make sure that your snmpd.conf file is being read (run snmpd using: -f -Le -Dread_config and watch the output). May 25, 2011 at 22:05

1 Answer 1

3

make sure your haproxy stats already enabled

 haproxy.cfg
 global
     stats socket /var/run/haproxy.stat mode 666

and then try to execute /etc/snmp/haproxy.pl

 perl /etc/snmp/haproxy.pl

it's should be showing the output if the steps above running well, and when you snmpwalk still no output, check your snmp installation again. or just run below command to check your standard snmp working fine.

 snmpwalk -c YOUR_COMMUNITY -v1 YOUR_IPADDRESS

above command should be showing stats like cpu, ip addr, etc and snmp installation and config should be fine. and it's mean something not right on snmp perl for haproxy.

1
  • Thank you - the "stats" socket was missing so haproxy.pl had no results to forward.
    – the-wabbit
    May 26, 2011 at 7:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .