1
SNMP support for HAProxy
2
Copyright 2007-2008 Krzysztof Piotr Oledzki <ole@ans.pl>
4
Root OID: 1.3.6.1.4.1.29385.106
8
- haproxy.pl: Net-SNMP embedded perl module
9
- haproxy_backend.xml: Cacti snmp-query definition for backends
10
- haproxy_frontend.xml: Cacti snmp-query definition for frontends
13
cp haproxy.pl /etc/snmp/
14
grep -q "disablePerl false" /etc/snmp/snmpd.conf || echo "disablePerl false" >> /etc/snmp/snmpd.conf
15
echo "perl do '/etc/snmp/haproxy.pl';" >> /etc/snmp/snmpd.conf
18
- GET (snmpget, snmpbulkget): quite fast.
19
- GETNEXT (snmpwalk, snmpbulkwalk): not so fast as requires to transfer
20
and parse a lot of data during each step. Always use "get" instead of "walk"
24
- 1.3.6.1.4.1.29385.106.1: get a variable from stats
25
Usage: 1.3.6.1.4.1.29385.106.1.$type.$field.$iid.$sid
33
0..32) CSV format variable
39
- sid is a service id (sid): 0 for frontends and backends, >= 1 for servers
41
- 1.3.6.1.4.1.29385.106.2: get a variable from info
42
Usage: 1.3.6.1.4.1.29385.106.2.$req.$varnr
50
- Get a list of frontends (type: 0) with status (field: 17):
51
$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.1.0.17
52
SNMPv2-SMI::enterprises.29385.106.1.0.17.1.0 = STRING: "OPEN"
53
SNMPv2-SMI::enterprises.29385.106.1.0.17.47.0 = STRING: "OPEN"
55
- Get a list of backends (type: 1) with index (field: 10001):
56
$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.1.1.10001
57
SNMPv2-SMI::enterprises.29385.106.1.1.10001.1.0 = STRING: "1.0"
58
SNMPv2-SMI::enterprises.29385.106.1.1.10001.1100.0 = STRING: "1100.0"
59
SNMPv2-SMI::enterprises.29385.106.1.1.10001.1101.0 = STRING: "1101.0"
60
SNMPv2-SMI::enterprises.29385.106.1.1.10001.1200.0 = STRING: "1200.0"
61
SNMPv2-SMI::enterprises.29385.106.1.1.10001.1201.0 = STRING: "1201.0"
62
SNMPv2-SMI::enterprises.29385.106.1.1.10001.1300.0 = STRING: "1300.0"
63
SNMPv2-SMI::enterprises.29385.106.1.1.10001.1400.0 = STRING: "1400.0"
64
SNMPv2-SMI::enterprises.29385.106.1.1.10001.1401.0 = STRING: "1401.0"
65
SNMPv2-SMI::enterprises.29385.106.1.1.10001.1500.0 = STRING: "1500.0"
68
- Get a list of servers (type: 2) with unique name (field: 10002):
69
$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.1.2.10002
70
SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1001 = STRING: "backend1/s2"
71
SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1002 = STRING: "backend1/s5"
72
SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1003 = STRING: "backend1/s6"
73
SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1012 = STRING: "backend1/s7"
74
SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1001 = STRING: "backend2/s9"
75
SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1002 = STRING: "backend2/s10"
76
SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1003 = STRING: "backend2/s11"
77
SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1012 = STRING: "backend2/s12"
78
SNMPv2-SMI::enterprises.29385.106.1.2.10002.1200.1001 = STRING: "backend3/s8"
81
- Get a list of servers (type: 2) with weight (field: 18) in proxy 4300:
82
$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.1.2.18.4300
83
SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1001 = STRING: "40"
84
SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1002 = STRING: "25"
85
SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1003 = STRING: "40"
86
SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1012 = STRING: "80"
88
- Get total sessions count (field: 7) in frontend (type: 1), sid.iid: 47.0 (proxy #47):
89
snmpget -c public -v2c 192.168.0.1 enterprises.29385.106.1.0.7.47.0
90
SNMPv2-SMI::enterprises.29385.106.1.0.7.47.0 = STRING: "1014019"
92
- Get a list of available variables (req: 0):
93
$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.2.0
94
SNMPv2-SMI::enterprises.29385.106.2.0.0 = STRING: "Name"
95
SNMPv2-SMI::enterprises.29385.106.2.0.1 = STRING: "Version"
96
SNMPv2-SMI::enterprises.29385.106.2.0.2 = STRING: "Release_date"
97
SNMPv2-SMI::enterprises.29385.106.2.0.3 = STRING: "Nbproc"
98
SNMPv2-SMI::enterprises.29385.106.2.0.4 = STRING: "Process_num"
99
SNMPv2-SMI::enterprises.29385.106.2.0.5 = STRING: "Pid"
100
SNMPv2-SMI::enterprises.29385.106.2.0.6 = STRING: "Uptime"
101
SNMPv2-SMI::enterprises.29385.106.2.0.7 = STRING: "Uptime_sec"
102
SNMPv2-SMI::enterprises.29385.106.2.0.8 = STRING: "Memmax_MB"
103
SNMPv2-SMI::enterprises.29385.106.2.0.9 = STRING: "Ulimit-n"
104
SNMPv2-SMI::enterprises.29385.106.2.0.10 = STRING: "Maxsock"
105
SNMPv2-SMI::enterprises.29385.106.2.0.11 = STRING: "Maxconn"
106
SNMPv2-SMI::enterprises.29385.106.2.0.12 = STRING: "CurrConns"
108
- Get a variable (req: 1), varnr: 7 (Uptime_sec):
109
$ snmpget -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.2.1.7
110
SNMPv2-SMI::enterprises.29385.106.2.1.7 = STRING: "18761"