blob: f44eb5b8b3a8a4b325a96223789a176601fcd552 [file] [log] [blame]
Krzysztof Piotr Oledzki2c6962c2008-03-02 02:42:14 +01001SNMP support for HAProxy
2Copyright 2007-2008 Krzysztof Piotr Oledzki <ole@ans.pl>
3
4Root OID: 1.3.6.1.4.1.29385.106
5
6Files:
7 - README: this file
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
11
12Install:
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
16
17Supported commands:
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"
21 if that's possible.
22
23Supported OIDs:
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
26
27 - type is one of:
28 0) frontend
29 1) backend
30 2) server
31
32 - field is one of:
33 0..32) CSV format variable
34 10001) index
35 10002) unique name
36
37 - iid is a proxy id
38
39 - sid is a service id (sid): 0 for frontends and backends, >= 1 for servers
40
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
43
44 - req is one of:
45 0) get variable name
46 1) gat variable value
47
48Examples:
49
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
52SNMPv2-SMI::enterprises.29385.106.1.0.17.1.0 = STRING: "OPEN"
53SNMPv2-SMI::enterprises.29385.106.1.0.17.47.0 = STRING: "OPEN"
54
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
57SNMPv2-SMI::enterprises.29385.106.1.1.10001.1.0 = STRING: "1.0"
58SNMPv2-SMI::enterprises.29385.106.1.1.10001.1100.0 = STRING: "1100.0"
59SNMPv2-SMI::enterprises.29385.106.1.1.10001.1101.0 = STRING: "1101.0"
60SNMPv2-SMI::enterprises.29385.106.1.1.10001.1200.0 = STRING: "1200.0"
61SNMPv2-SMI::enterprises.29385.106.1.1.10001.1201.0 = STRING: "1201.0"
62SNMPv2-SMI::enterprises.29385.106.1.1.10001.1300.0 = STRING: "1300.0"
63SNMPv2-SMI::enterprises.29385.106.1.1.10001.1400.0 = STRING: "1400.0"
64SNMPv2-SMI::enterprises.29385.106.1.1.10001.1401.0 = STRING: "1401.0"
65SNMPv2-SMI::enterprises.29385.106.1.1.10001.1500.0 = STRING: "1500.0"
66(...)
67
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
70SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1001 = STRING: "backend1/s2"
71SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1002 = STRING: "backend1/s5"
72SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1003 = STRING: "backend1/s6"
73SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1012 = STRING: "backend1/s7"
74SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1001 = STRING: "backend2/s9"
75SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1002 = STRING: "backend2/s10"
76SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1003 = STRING: "backend2/s11"
77SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1012 = STRING: "backend2/s12"
78SNMPv2-SMI::enterprises.29385.106.1.2.10002.1200.1001 = STRING: "backend3/s8"
79(...)
80
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
83SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1001 = STRING: "40"
84SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1002 = STRING: "25"
85SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1003 = STRING: "40"
86SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1012 = STRING: "80"
87
88- Get total sessions count (field: 7) in frontend (type: 1), sid.iid: 47.0 (proxy #47):
89snmpget -c public -v2c 192.168.0.1 enterprises.29385.106.1.0.7.47.0
90SNMPv2-SMI::enterprises.29385.106.1.0.7.47.0 = STRING: "1014019"
91
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
94SNMPv2-SMI::enterprises.29385.106.2.0.0 = STRING: "Name"
95SNMPv2-SMI::enterprises.29385.106.2.0.1 = STRING: "Version"
96SNMPv2-SMI::enterprises.29385.106.2.0.2 = STRING: "Release_date"
97SNMPv2-SMI::enterprises.29385.106.2.0.3 = STRING: "Nbproc"
98SNMPv2-SMI::enterprises.29385.106.2.0.4 = STRING: "Process_num"
99SNMPv2-SMI::enterprises.29385.106.2.0.5 = STRING: "Pid"
100SNMPv2-SMI::enterprises.29385.106.2.0.6 = STRING: "Uptime"
101SNMPv2-SMI::enterprises.29385.106.2.0.7 = STRING: "Uptime_sec"
102SNMPv2-SMI::enterprises.29385.106.2.0.8 = STRING: "Memmax_MB"
103SNMPv2-SMI::enterprises.29385.106.2.0.9 = STRING: "Ulimit-n"
104SNMPv2-SMI::enterprises.29385.106.2.0.10 = STRING: "Maxsock"
105SNMPv2-SMI::enterprises.29385.106.2.0.11 = STRING: "Maxconn"
106SNMPv2-SMI::enterprises.29385.106.2.0.12 = STRING: "CurrConns"
107
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
110SNMPv2-SMI::enterprises.29385.106.2.1.7 = STRING: "18761"
111