From b46aad6df449445a9fc4aa7b32bd40005438e3f7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:18:05 +0200 Subject: Adding upstream version 2.9.5. Signed-off-by: Daniel Baumann --- admin/netsnmp-perl/README | 111 +++ .../cacti_data_query_haproxy_backends.xml | 750 +++++++++++++++++++++ .../cacti_data_query_haproxy_frontends.xml | 750 +++++++++++++++++++++ admin/netsnmp-perl/haproxy.pl | 249 +++++++ admin/netsnmp-perl/haproxy_backend.xml | 83 +++ admin/netsnmp-perl/haproxy_frontend.xml | 83 +++ admin/netsnmp-perl/haproxy_socket.xml | 90 +++ 7 files changed, 2116 insertions(+) create mode 100644 admin/netsnmp-perl/README create mode 100644 admin/netsnmp-perl/cacti_data_query_haproxy_backends.xml create mode 100644 admin/netsnmp-perl/cacti_data_query_haproxy_frontends.xml create mode 100644 admin/netsnmp-perl/haproxy.pl create mode 100644 admin/netsnmp-perl/haproxy_backend.xml create mode 100644 admin/netsnmp-perl/haproxy_frontend.xml create mode 100644 admin/netsnmp-perl/haproxy_socket.xml (limited to 'admin/netsnmp-perl') diff --git a/admin/netsnmp-perl/README b/admin/netsnmp-perl/README new file mode 100644 index 0000000..f44eb5b --- /dev/null +++ b/admin/netsnmp-perl/README @@ -0,0 +1,111 @@ +SNMP support for HAProxy +Copyright 2007-2008 Krzysztof Piotr Oledzki + +Root OID: 1.3.6.1.4.1.29385.106 + +Files: + - README: this file + - haproxy.pl: Net-SNMP embedded perl module + - haproxy_backend.xml: Cacti snmp-query definition for backends + - haproxy_frontend.xml: Cacti snmp-query definition for frontends + +Install: + cp haproxy.pl /etc/snmp/ + grep -q "disablePerl false" /etc/snmp/snmpd.conf || echo "disablePerl false" >> /etc/snmp/snmpd.conf + echo "perl do '/etc/snmp/haproxy.pl';" >> /etc/snmp/snmpd.conf + +Supported commands: + - GET (snmpget, snmpbulkget): quite fast. + - GETNEXT (snmpwalk, snmpbulkwalk): not so fast as requires to transfer + and parse a lot of data during each step. Always use "get" instead of "walk" + if that's possible. + +Supported OIDs: + - 1.3.6.1.4.1.29385.106.1: get a variable from stats + Usage: 1.3.6.1.4.1.29385.106.1.$type.$field.$iid.$sid + + - type is one of: + 0) frontend + 1) backend + 2) server + + - field is one of: + 0..32) CSV format variable + 10001) index + 10002) unique name + + - iid is a proxy id + + - sid is a service id (sid): 0 for frontends and backends, >= 1 for servers + + - 1.3.6.1.4.1.29385.106.2: get a variable from info + Usage: 1.3.6.1.4.1.29385.106.2.$req.$varnr + + - req is one of: + 0) get variable name + 1) gat variable value + +Examples: + +- Get a list of frontends (type: 0) with status (field: 17): +$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.1.0.17 +SNMPv2-SMI::enterprises.29385.106.1.0.17.1.0 = STRING: "OPEN" +SNMPv2-SMI::enterprises.29385.106.1.0.17.47.0 = STRING: "OPEN" + +- Get a list of backends (type: 1) with index (field: 10001): +$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.1.1.10001 +SNMPv2-SMI::enterprises.29385.106.1.1.10001.1.0 = STRING: "1.0" +SNMPv2-SMI::enterprises.29385.106.1.1.10001.1100.0 = STRING: "1100.0" +SNMPv2-SMI::enterprises.29385.106.1.1.10001.1101.0 = STRING: "1101.0" +SNMPv2-SMI::enterprises.29385.106.1.1.10001.1200.0 = STRING: "1200.0" +SNMPv2-SMI::enterprises.29385.106.1.1.10001.1201.0 = STRING: "1201.0" +SNMPv2-SMI::enterprises.29385.106.1.1.10001.1300.0 = STRING: "1300.0" +SNMPv2-SMI::enterprises.29385.106.1.1.10001.1400.0 = STRING: "1400.0" +SNMPv2-SMI::enterprises.29385.106.1.1.10001.1401.0 = STRING: "1401.0" +SNMPv2-SMI::enterprises.29385.106.1.1.10001.1500.0 = STRING: "1500.0" +(...) + +- Get a list of servers (type: 2) with unique name (field: 10002): +$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.1.2.10002 +SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1001 = STRING: "backend1/s2" +SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1002 = STRING: "backend1/s5" +SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1003 = STRING: "backend1/s6" +SNMPv2-SMI::enterprises.29385.106.1.2.10002.1100.1012 = STRING: "backend1/s7" +SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1001 = STRING: "backend2/s9" +SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1002 = STRING: "backend2/s10" +SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1003 = STRING: "backend2/s11" +SNMPv2-SMI::enterprises.29385.106.1.2.10002.1101.1012 = STRING: "backend2/s12" +SNMPv2-SMI::enterprises.29385.106.1.2.10002.1200.1001 = STRING: "backend3/s8" +(...) + +- Get a list of servers (type: 2) with weight (field: 18) in proxy 4300: +$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.1.2.18.4300 +SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1001 = STRING: "40" +SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1002 = STRING: "25" +SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1003 = STRING: "40" +SNMPv2-SMI::enterprises.29385.106.1.2.18.4300.1012 = STRING: "80" + +- Get total sessions count (field: 7) in frontend (type: 1), sid.iid: 47.0 (proxy #47): +snmpget -c public -v2c 192.168.0.1 enterprises.29385.106.1.0.7.47.0 +SNMPv2-SMI::enterprises.29385.106.1.0.7.47.0 = STRING: "1014019" + +- Get a list of available variables (req: 0): +$ snmpbulkwalk -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.2.0 +SNMPv2-SMI::enterprises.29385.106.2.0.0 = STRING: "Name" +SNMPv2-SMI::enterprises.29385.106.2.0.1 = STRING: "Version" +SNMPv2-SMI::enterprises.29385.106.2.0.2 = STRING: "Release_date" +SNMPv2-SMI::enterprises.29385.106.2.0.3 = STRING: "Nbproc" +SNMPv2-SMI::enterprises.29385.106.2.0.4 = STRING: "Process_num" +SNMPv2-SMI::enterprises.29385.106.2.0.5 = STRING: "Pid" +SNMPv2-SMI::enterprises.29385.106.2.0.6 = STRING: "Uptime" +SNMPv2-SMI::enterprises.29385.106.2.0.7 = STRING: "Uptime_sec" +SNMPv2-SMI::enterprises.29385.106.2.0.8 = STRING: "Memmax_MB" +SNMPv2-SMI::enterprises.29385.106.2.0.9 = STRING: "Ulimit-n" +SNMPv2-SMI::enterprises.29385.106.2.0.10 = STRING: "Maxsock" +SNMPv2-SMI::enterprises.29385.106.2.0.11 = STRING: "Maxconn" +SNMPv2-SMI::enterprises.29385.106.2.0.12 = STRING: "CurrConns" + +- Get a variable (req: 1), varnr: 7 (Uptime_sec): +$ snmpget -c public -v2c 192.168.0.1 1.3.6.1.4.1.29385.106.2.1.7 +SNMPv2-SMI::enterprises.29385.106.2.1.7 = STRING: "18761" + diff --git a/admin/netsnmp-perl/cacti_data_query_haproxy_backends.xml b/admin/netsnmp-perl/cacti_data_query_haproxy_backends.xml new file mode 100644 index 0000000..9c4ea38 --- /dev/null +++ b/admin/netsnmp-perl/cacti_data_query_haproxy_backends.xml @@ -0,0 +1,750 @@ + + + HaProxy Backends + + <path_cacti>/resource/snmp_queries/haproxy_backend.xml + hash_030013bf566c869ac6443b0c75d1c32b5a350e + + + HAProxy Backend Sessions + hash_000013cdbf9accfcd57d9e0a7c97896313ddee + + + beSTot + hash_010013fa4d4fff334b60e9064e89082173fe34 + hash_080013230e04055a4228154123e74c6586d435 + + + beEResp + hash_010013fa4d4fff334b60e9064e89082173fe34 + hash_080013088549c8d7e8cdc80f19bae4d78dc296 + + + + + ResponseErrors + 1 + ResponseErrors + + + TotalSessions + 1 + TotalSessions + + + + + ResponseErrors + hash_010013fa4d4fff334b60e9064e89082173fe34 + 1 + ResponseErrors + + + TotalSessions + hash_010013fa4d4fff334b60e9064e89082173fe34 + 1 + TotalSessions + + + + + HAProxy Backend Traffic + hash_000013b6d238ff2532fcc19ab498043c7c65c2 + + + beBOut + hash_010013a63ddba34026d2c07d73c0ef2ae64b54 + hash_0800136c0e4debeb9b084231d858faabd82f8f + + + beBIn + hash_010013a63ddba34026d2c07d73c0ef2ae64b54 + hash_0800132f5283f17a7cde63137189d4d3ea7e4e + + + + + BytesIn + 1 + BytesIn + + + BytesOut + 1 + BytesOut + + + + + BytesIn + hash_010013fa4d4fff334b60e9064e89082173fe34 + 1 + BytesIn + + + BytesOut + hash_010013fa4d4fff334b60e9064e89082173fe34 + 1 + BytesOut + + + BytesIn + hash_010013a63ddba34026d2c07d73c0ef2ae64b54 + 1 + BytesIn + + + BytesOut + hash_010013a63ddba34026d2c07d73c0ef2ae64b54 + 1 + BytesOut + + + + + + + Get SNMP Data (Indexed) + 3 + + + + SNMP IP Address + + + + hostname + in + management_ip + + + SNMP Community + + + + snmp_community + in + snmp_community + + + SNMP Username (v3) + + + on + snmp_username + in + snmp_username + + + SNMP Password (v3) + + + on + snmp_password + in + snmp_password + + + SNMP Version (1, 2, or 3) + + + + snmp_version + in + snmp_version + + + Index Type + + + + index_type + in + index_type + + + Index Value + + + + index_value + in + index_value + + + Output Type ID + + + + output_type + in + output_type + + + SNMP Port + + + + snmp_port + in + snmp_port + + + + + HAProxy Backend Sessions + + + |host_description| - HaProxy - |query_bePxName| Backend Sessions + + 1 + + 120 + + 500 + + on + + 2 + + + + + + on + + on + + 10000 + + 0 + + 1000 + + + + + + + + + + hash_080013230e04055a4228154123e74c6586d435 + 0000FF + 5 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Total Sessions: + + 5 + + + hash_080013230e04055a4228154123e74c6586d435 + 0 + 9 + 4 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Current: + + 6 + + + hash_080013230e04055a4228154123e74c6586d435 + 0 + 9 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Average: + + 7 + + + hash_080013230e04055a4228154123e74c6586d435 + 0 + 9 + 3 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Maximum: + on + 8 + + + hash_080013088549c8d7e8cdc80f19bae4d78dc296 + EA8F00 + 5 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Response Errors: + + 9 + + + hash_080013088549c8d7e8cdc80f19bae4d78dc296 + 0 + 9 + 4 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Current: + + 10 + + + hash_080013088549c8d7e8cdc80f19bae4d78dc296 + 0 + 9 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Average: + + 11 + + + hash_080013088549c8d7e8cdc80f19bae4d78dc296 + 0 + 9 + 3 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Maximum: + on + 12 + + + 0 + 0 + 1 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Graph Last Updated: |date_time| + on + 13 + + + + + Data Source [TotalSessions] + + task_item_id + hash_0000131ecaf3728447913a30dfa80cdd9cdff4|hash_0000132171a00b34d33f99ef24bcc235fbb6a3|hash_0000132129590e72a46480422f85e063d8cf4d|hash_0000138d11fec869f88ccf2fa3227bcffadfc3 + + + Data Source [ResponseErrors] + + task_item_id + hash_000013783d295131617ad996e4699533a134ea|hash_0000139bc04e5072b25ca992ee0b0eec981b95|hash_0000136333a9334fa0dc0d2f75c031dee1dcc5|hash_00001386e0e18d79915cd21ff123fb830e150e + + + + + HAProxy Backend Traffic + + + |host_description| - HaProxy |query_bePxName| Backend Traffic + + 1 + + 120 + + 500 + + on + + 2 + + + + + + on + + on + + 10000000000 + + 0 + + 1024 + + + + + + bytes + + + + hash_0800132f5283f17a7cde63137189d4d3ea7e4e + 6EA100 + 5 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Ingress Traffic: + + 2 + + + hash_0800132f5283f17a7cde63137189d4d3ea7e4e + 0 + 9 + 4 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Current: + + 3 + + + hash_0800132f5283f17a7cde63137189d4d3ea7e4e + 0 + 9 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Average: + + 4 + + + hash_0800132f5283f17a7cde63137189d4d3ea7e4e + 0 + 9 + 3 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Maximum: + on + 5 + + + hash_0800136c0e4debeb9b084231d858faabd82f8f + FF0000 + 5 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Egress Traffic: + + 6 + + + hash_0800136c0e4debeb9b084231d858faabd82f8f + 0 + 9 + 4 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Current: + + 7 + + + hash_0800136c0e4debeb9b084231d858faabd82f8f + 0 + 9 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Average: + + 8 + + + hash_0800136c0e4debeb9b084231d858faabd82f8f + 0 + 9 + 3 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Maximum: + on + 9 + + + 0 + 0 + 1 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Graph Last Updated: |date_time| + on + 10 + + + + + Data Source [BytesIn] + + task_item_id + hash_000013184e60d8dac2421c2787887fe07f6d25|hash_000013f3889b4094b935798483e489b5f5e16e|hash_0000134bbdf263db6461f5d76717c12564c42c|hash_0000131b708578244e36caba0f4dea67230c80 + + + Data Source [BytesOut] + + task_item_id + hash_0000133e2f02edb1a55bcdd20e925a3849fd37|hash_0000134517c9799c71e03dcd2278681858d70f|hash_0000132edf24a4592c9537d2341ec20c588fc2|hash_000013150e680935bfccc75f1f88c7c60030f7 + + + + + HAProxy Backend Session Stats + + + |host_description| - HAProxy - |query_bePxName| Backend Session Stats + hash_030013bf566c869ac6443b0c75d1c32b5a350e + + + 300 + + on + hash_150013c21df5178e5c955013591239eb0afd46|hash_1500130d9c0af8b8acdc7807943937b3208e29|hash_1500136fc2d038fb42950138b0ce3e9874cc60|hash_150013e36f3adb9f152adfa5dc50fd2b23337e|hash_15001352829408ab566127eede2c74d201c678|hash_150013e73fb797d3ab2a9b97c3ec29e9690910 + + + + + TotalSessions + + 0 + + 10000 + + 2 + + 600 + + 0 + + + + ResponseErrors + + 0 + + 10000 + + 2 + + 600 + + 0 + + + + + hash_070013c1f36ee60c3dc98945556d57f26e475b + + + + + hash_070013e6deda7be0f391399c5130e7c4a48b28 + + + + + hash_070013cbbe5c1ddfb264a6e5d509ce1c78c95f + + + + + hash_0700136027a919c7c7731fbe095b6f53ab127b + + + + + hash_070013b5c23f246559df38662c255f4aa21d6b + + + + + hash_0700131cc1493a6781af2c478fa4de971531cf + + + + + hash_070013f4facc5e2ca7ebee621f09bc6d9fc792 + + + + + hash_070013acb449d1451e8a2a655c2c99d31142c7 + + + + + hash_070013617cdc8a230615e59f06f361ef6e7728 + + + + + + + HAProxy Backend Traffic Stats + + + |host_description| - HAProxy - |query_bePxName| Backend Traffic Stats + hash_030013bf566c869ac6443b0c75d1c32b5a350e + + + 300 + + on + hash_150013c21df5178e5c955013591239eb0afd46|hash_1500130d9c0af8b8acdc7807943937b3208e29|hash_1500136fc2d038fb42950138b0ce3e9874cc60|hash_150013e36f3adb9f152adfa5dc50fd2b23337e|hash_150013a4aa6f4de84eaa00008f88d3f5bd8520|hash_150013e73fb797d3ab2a9b97c3ec29e9690910 + + + + + BytesOut + + 0 + + 10000000000 + + 2 + + 600 + + 0 + + + + BytesIn + + 0 + + 10000000000 + + 2 + + 600 + + 0 + + + + + hash_070013c1f36ee60c3dc98945556d57f26e475b + + + + + hash_070013e6deda7be0f391399c5130e7c4a48b28 + + + + + hash_070013cbbe5c1ddfb264a6e5d509ce1c78c95f + + + + + hash_0700136027a919c7c7731fbe095b6f53ab127b + + + + + hash_070013b5c23f246559df38662c255f4aa21d6b + + + + + hash_0700131cc1493a6781af2c478fa4de971531cf + + + + + hash_070013f4facc5e2ca7ebee621f09bc6d9fc792 + + + + + hash_070013acb449d1451e8a2a655c2c99d31142c7 + + + + + hash_070013617cdc8a230615e59f06f361ef6e7728 + + + + + + + Daily (5 Minute Average) + 0.5 + 1 + 600 + 86400 + 1|2|3|4 + + + Weekly (30 Minute Average) + 0.5 + 6 + 700 + 604800 + 1|2|3|4 + + + Monthly (2 Hour Average) + 0.5 + 24 + 775 + 2678400 + 1|2|3|4 + + + Yearly (1 Day Average) + 0.5 + 288 + 797 + 33053184 + 1|2|3|4 + + + Three days (5 minutes average) + 0.5 + 6 + 700 + 302400 + 1|2|3|4 + + + Hourly (1 Minute Average) + 0.5 + 1 + 500 + 14400 + 1|3 + + + Normal + %8.2lf %s + + diff --git a/admin/netsnmp-perl/cacti_data_query_haproxy_frontends.xml b/admin/netsnmp-perl/cacti_data_query_haproxy_frontends.xml new file mode 100644 index 0000000..1429b07 --- /dev/null +++ b/admin/netsnmp-perl/cacti_data_query_haproxy_frontends.xml @@ -0,0 +1,750 @@ + + + HAProxy Frontends + + <path_cacti>/resource/snmp_queries/haproxy_frontend.xml + hash_030013bf566c869ac6443b0c75d1c32b5a350e + + + HAProxy Frontend Sessions + hash_00001328b6727aa54dde6bb3f5dde939ae03aa + + + feSTot + hash_0100139f985697a7530256b4e35c95ef03db20 + hash_080013f9c76e05d0a87b2d32f9a5b014e17aab + + + feEReq + hash_0100139f985697a7530256b4e35c95ef03db20 + hash_080013c137bec94d7220e65a5b3dfa4049c242 + + + + + TotalSessions + 1 + TotalSessions + + + RequestErrors + 1 + RequestErrors + + + + + RequestErrors + hash_0100139f985697a7530256b4e35c95ef03db20 + 1 + RequestErrors + + + TotalSessions + hash_0100139f985697a7530256b4e35c95ef03db20 + 1 + TotalSessions + + + + + HAProxy Frontend Traffic + hash_000013d0fe9e9efc2746de488fdede0419b051 + + + feBOut + hash_010013a88327df77ea19e333ddd96096c34751 + hash_0800137db81cd58fbbbd203af0f55c15c2081a + + + feBIn + hash_010013a88327df77ea19e333ddd96096c34751 + hash_08001305772980bb6de1f12223d7ec53e323c4 + + + + + BytesIn + 1 + BytesIn + + + BytesOut + 1 + BytesOut + + + + + BytesOut + hash_0100139f985697a7530256b4e35c95ef03db20 + 1 + BytesOut + + + BytesIn + hash_0100139f985697a7530256b4e35c95ef03db20 + 1 + BytesIn + + + BytesOut + hash_010013a88327df77ea19e333ddd96096c34751 + 1 + BytesOut + + + BytesIn + hash_010013a88327df77ea19e333ddd96096c34751 + 1 + BytesIn + + + + + + + Get SNMP Data (Indexed) + 3 + + + + SNMP IP Address + + + + hostname + in + management_ip + + + SNMP Community + + + + snmp_community + in + snmp_community + + + SNMP Username (v3) + + + on + snmp_username + in + snmp_username + + + SNMP Password (v3) + + + on + snmp_password + in + snmp_password + + + SNMP Version (1, 2, or 3) + + + + snmp_version + in + snmp_version + + + Index Type + + + + index_type + in + index_type + + + Index Value + + + + index_value + in + index_value + + + Output Type ID + + + + output_type + in + output_type + + + SNMP Port + + + + snmp_port + in + snmp_port + + + + + HAProxy Frontend Sessions + + + |host_description| - HaProxy - |query_fePxName| Frontend Sessions + + 1 + + 120 + + 500 + + on + + 2 + + + + + + on + + on + + 10000 + + 0 + + 1000 + + + + + + + + + + hash_080013f9c76e05d0a87b2d32f9a5b014e17aab + 0000FF + 5 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Total Sessions: + + 5 + + + hash_080013f9c76e05d0a87b2d32f9a5b014e17aab + 0 + 9 + 4 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Current: + + 6 + + + hash_080013f9c76e05d0a87b2d32f9a5b014e17aab + 0 + 9 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Average: + + 7 + + + hash_080013f9c76e05d0a87b2d32f9a5b014e17aab + 0 + 9 + 3 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Maximum: + on + 8 + + + hash_080013c137bec94d7220e65a5b3dfa4049c242 + EA8F00 + 5 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Request Errors: + + 9 + + + hash_080013c137bec94d7220e65a5b3dfa4049c242 + 0 + 9 + 4 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Current: + + 10 + + + hash_080013c137bec94d7220e65a5b3dfa4049c242 + 0 + 9 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Average: + + 12 + + + hash_080013c137bec94d7220e65a5b3dfa4049c242 + 0 + 9 + 3 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Maximum: + on + 13 + + + 0 + 0 + 1 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Graph Last Updated: |date_time| + on + 14 + + + + + Data Source [TotalSessions] + + task_item_id + hash_000013b1ecfd75df9c17c0ba11acc5e9b7d8f8|hash_000013fa878148199aee5bb2a10b7693318347|hash_0000138b0422b293230883462cfbfe32144d47|hash_0000137d834c383afa4863974edc19a337e260 + + + Data Source [RequestErrors] + + task_item_id + hash_0000131c87ed4e76c026cd131418d792822944|hash_000013a9993114514cb1abea4b929f984222ea|hash_0000131bc67adbaa8b77cd6c73d9622c7eebc1|hash_0000138840d17711368b90a61132ba83e9edb8 + + + + + HAProxy Frontend Traffic + + + |host_description| - HaProxy |query_fePxName| Frontend Traffic + + 1 + + 120 + + 500 + + on + + 2 + + + + + + on + + on + + 10000000000 + + 0 + + 1024 + + + + + + bytes + + + + hash_08001305772980bb6de1f12223d7ec53e323c4 + 6EA100 + 5 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Ingress Traffic: + + 2 + + + hash_08001305772980bb6de1f12223d7ec53e323c4 + 0 + 9 + 4 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Current: + + 3 + + + hash_08001305772980bb6de1f12223d7ec53e323c4 + 0 + 9 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Average: + + 4 + + + hash_08001305772980bb6de1f12223d7ec53e323c4 + 0 + 9 + 3 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Maximum: + on + 5 + + + hash_0800137db81cd58fbbbd203af0f55c15c2081a + FF0000 + 5 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Egress Traffic: + + 6 + + + hash_0800137db81cd58fbbbd203af0f55c15c2081a + 0 + 9 + 4 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Current: + + 7 + + + hash_0800137db81cd58fbbbd203af0f55c15c2081a + 0 + 9 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Average: + + 8 + + + hash_0800137db81cd58fbbbd203af0f55c15c2081a + 0 + 9 + 3 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Maximum: + on + 9 + + + 0 + 0 + 1 + 1 + 0 + + hash_060013e9c43831e54eca8069317a2ce8c6f751 + Graph Last Updated: |date_time| + on + 10 + + + + + Data Source [BytesOut] + + task_item_id + hash_000013d2d059378b521327426b451324bbb608|hash_0000137d82a7f3c82c698fe4e9cecc03d680b1|hash_0000132eef0fae129ef21ad2d73e5e80814a23|hash_0000138365462951b1f4e6b1a76f20b91be65d + + + Data Source [BytesIn] + + task_item_id + hash_00001353cff0cd64c4d70574ef9da42f62c86a|hash_000013d5c13ff711cbd645e9f88697b2c5e61b|hash_0000136788d44f6207ce323ad40ccc8f15d462|hash_000013d4cb02a8fb7fa37ef1e37d8b78333ea3 + + + + + HAProxy Frontend Session Stats + + + |host_description| - HAProxy - |query_fePxName| Frontend Session Stats + hash_030013bf566c869ac6443b0c75d1c32b5a350e + + + 300 + + on + hash_150013c21df5178e5c955013591239eb0afd46|hash_1500130d9c0af8b8acdc7807943937b3208e29|hash_1500136fc2d038fb42950138b0ce3e9874cc60|hash_150013e36f3adb9f152adfa5dc50fd2b23337e|hash_1500139b529013942d5a6891d05a84d17175e0|hash_150013e73fb797d3ab2a9b97c3ec29e9690910 + + + + + RequestErrors + + 0 + + 10000 + + 2 + + 600 + + 0 + + + + TotalSessions + + 0 + + 10000 + + 2 + + 600 + + 0 + + + + + hash_070013c1f36ee60c3dc98945556d57f26e475b + + + + + hash_070013e6deda7be0f391399c5130e7c4a48b28 + + + + + hash_070013cbbe5c1ddfb264a6e5d509ce1c78c95f + + + + + hash_0700136027a919c7c7731fbe095b6f53ab127b + + + + + hash_070013b5c23f246559df38662c255f4aa21d6b + + + + + hash_0700131cc1493a6781af2c478fa4de971531cf + + + + + hash_070013f4facc5e2ca7ebee621f09bc6d9fc792 + + + + + hash_070013acb449d1451e8a2a655c2c99d31142c7 + + + + + hash_070013617cdc8a230615e59f06f361ef6e7728 + + + + + + + HAProxy Frontend Traffic Stats + + + |host_description| - HAProxy - |query_fePxName| Frontend Traffic Stats + hash_030013bf566c869ac6443b0c75d1c32b5a350e + + + 300 + + on + hash_150013c21df5178e5c955013591239eb0afd46|hash_1500130d9c0af8b8acdc7807943937b3208e29|hash_1500136fc2d038fb42950138b0ce3e9874cc60|hash_150013e36f3adb9f152adfa5dc50fd2b23337e|hash_15001369b0abdb84cea4d93762fd5a5d0c2777|hash_150013e73fb797d3ab2a9b97c3ec29e9690910 + + + + + BytesOut + + 0 + + 10000000000 + + 2 + + 600 + + 0 + + + + BytesIn + + 0 + + 10000000000 + + 2 + + 600 + + 0 + + + + + hash_070013c1f36ee60c3dc98945556d57f26e475b + + + + + hash_070013e6deda7be0f391399c5130e7c4a48b28 + + + + + hash_070013cbbe5c1ddfb264a6e5d509ce1c78c95f + + + + + hash_0700136027a919c7c7731fbe095b6f53ab127b + + + + + hash_070013b5c23f246559df38662c255f4aa21d6b + + + + + hash_0700131cc1493a6781af2c478fa4de971531cf + + + + + hash_070013f4facc5e2ca7ebee621f09bc6d9fc792 + + + + + hash_070013acb449d1451e8a2a655c2c99d31142c7 + + + + + hash_070013617cdc8a230615e59f06f361ef6e7728 + + + + + + + Daily (5 Minute Average) + 0.5 + 1 + 600 + 86400 + 1|2|3|4 + + + Weekly (30 Minute Average) + 0.5 + 6 + 700 + 604800 + 1|2|3|4 + + + Monthly (2 Hour Average) + 0.5 + 24 + 775 + 2678400 + 1|2|3|4 + + + Yearly (1 Day Average) + 0.5 + 288 + 797 + 33053184 + 1|2|3|4 + + + Three days (5 minutes average) + 0.5 + 6 + 700 + 302400 + 1|2|3|4 + + + Hourly (1 Minute Average) + 0.5 + 1 + 500 + 14400 + 1|3 + + + Normal + %8.2lf %s + + diff --git a/admin/netsnmp-perl/haproxy.pl b/admin/netsnmp-perl/haproxy.pl new file mode 100644 index 0000000..64684ad --- /dev/null +++ b/admin/netsnmp-perl/haproxy.pl @@ -0,0 +1,249 @@ +# +# Net-SNMP perl plugin for HAProxy +# Version 0.30 +# +# Copyright 2007-2010 Krzysztof Piotr Oledzki +# +# 1. get a variable from "show stat": +# 1.3.6.1.4.1.29385.106.1.$type.$field.$iid.$sid +# type: 0->frontend, 1->backend, 2->server, 3->socket +# +# 2. get a variable from "show info": +# 1.3.6.1.4.1.29385.106.2.$req.$varnr +# +# TODO: +# - implement read timeout +# + +use NetSNMP::agent (':all'); +use NetSNMP::ASN qw(:all); +use IO::Socket::UNIX; + +use strict; + +my $agent = new NetSNMP::agent('Name' => 'HAProxy'); +my $sa = "/var/run/haproxy.stat"; + +use constant OID_HAPROXY => '1.3.6.1.4.1.29385.106'; +use constant OID_HAPROXY_STATS => OID_HAPROXY . '.1'; +use constant OID_HAPROXY_INFO => OID_HAPROXY . '.2'; + +my $oid_stat = new NetSNMP::OID(OID_HAPROXY_STATS); +my $oid_info = new NetSNMP::OID(OID_HAPROXY_INFO); + +use constant STATS_PXNAME => 0; +use constant STATS_SVNAME => 1; +use constant STATS_IID => 27; +use constant STATS_SID => 28; +use constant STATS_TYPE => 32; + +use constant FIELD_INDEX => 10001; +use constant FIELD_NAME => 10002; + +my %info_vars = ( + 0 => 'Name', + 1 => 'Version', + 2 => 'Release_date', + 3 => 'Nbproc', + 4 => 'Process_num', + 5 => 'Pid', + 6 => 'Uptime', + 7 => 'Uptime_sec', + 8 => 'Memmax_MB', + 9 => 'Ulimit-n', + 10 => 'Maxsock', + 11 => 'Maxconn', + 12 => 'Maxpipes', + 13 => 'CurrConns', + 14 => 'PipesUsed', + 15 => 'PipesFree', + 16 => 'Tasks', + 17 => 'Run_queue', + 18 => 'node', + 19 => 'description', +); + +sub find_next_stat_id { + my($type, $field, $proxyid, $sid) = @_; + + my $obj = 1 << $type; + + my $np = -1; + my $nl = -1; + + my $sock = new IO::Socket::UNIX (Peer => $sa, Type => SOCK_STREAM, Timeout => 1); + next if !$sock; + + print $sock "show stat -1 $obj -1\n"; + + while(<$sock>) { + chomp; + my @d = split(','); + + last if !$d[$field] && $field != FIELD_INDEX && $field != FIELD_NAME && /^#/; + next if /^#/; + + next if $d[STATS_TYPE] != $type; + + next if ($d[STATS_IID] < $proxyid) || ($d[STATS_IID] == $proxyid && $d[STATS_SID] <= $sid); + + if ($np == -1 || $d[STATS_IID] < $np || ($d[STATS_IID] == $np && $d[STATS_SID] < $nl)) { + $np = $d[STATS_IID]; + $nl = $d[STATS_SID]; + next; + } + } + + close($sock); + + return 0 if ($np == -1); + + return "$type.$field.$np.$nl" +} + +sub haproxy_stat { + my($handler, $registration_info, $request_info, $requests) = @_; + + for(my $request = $requests; $request; $request = $request->next()) { + my $oid = $request->getOID(); + + $oid =~ s/$oid_stat//; + $oid =~ s/^\.//; + + my $mode = $request_info->getMode(); + + my($type, $field, $proxyid, $sid, $or) = split('\.', $oid, 5); + + next if $type > 3 || defined($or); + + if ($mode == MODE_GETNEXT) { + + $type = 0 if !$type; + $field = 0 if !$field; + $proxyid = 0 if !$proxyid; + $sid = 0 if !$sid; + + my $nextid = find_next_stat_id($type, $field, $proxyid, $sid); + $nextid = find_next_stat_id($type, $field+1, 0, 0) if !$nextid; + $nextid = find_next_stat_id($type+1, 0, 0, 0) if !$nextid; + + if ($nextid) { + ($type, $field, $proxyid, $sid) = split('\.', $nextid); + $request->setOID(sprintf("%s.%s", OID_HAPROXY_STATS, $nextid)); + $mode = MODE_GET; + } + } + + if ($mode == MODE_GET) { + next if !defined($proxyid) || !defined($type) || !defined($sid) || !defined($field); + + my $obj = 1 << $type; + + my $sock = new IO::Socket::UNIX (Peer => $sa, Type => SOCK_STREAM, Timeout => 1); + next if !$sock; + + print $sock "show stat $proxyid $obj $sid\n"; + + while(<$sock>) { + chomp; + my @data = split(','); + + last if !defined($data[$field]) && $field != FIELD_INDEX && $field != FIELD_NAME; + + if ($proxyid) { + next if $data[STATS_IID] ne $proxyid; + next if $data[STATS_SID] ne $sid; + next if $data[STATS_TYPE] ne $type; + } + + if ($field == FIELD_INDEX) { + $request->setValue(ASN_OCTET_STR, + sprintf("%s.%s", $data[STATS_IID], + $data[STATS_SID])); + } elsif ($field == FIELD_NAME) { + $request->setValue(ASN_OCTET_STR, + sprintf("%s/%s", $data[STATS_PXNAME], + $data[STATS_SVNAME])); + } else { + $request->setValue(ASN_OCTET_STR, $data[$field]); + } + + close($sock); + last; + } + + close($sock); + next; + } + + } +} + +sub haproxy_info { + my($handler, $registration_info, $request_info, $requests) = @_; + + for(my $request = $requests; $request; $request = $request->next()) { + my $oid = $request->getOID(); + + $oid =~ s/$oid_info//; + $oid =~ s/^\.//; + + my $mode = $request_info->getMode(); + + my($req, $nr, $or) = split('\.', $oid, 3); + + next if $req >= 2 || defined($or); + + if ($mode == MODE_GETNEXT) { + $req = 0 if !defined($req); + $nr = -1 if !defined($nr); + + if (!defined($info_vars{$nr+1})) { + $req++; + $nr = -1; + } + + next if $req >= 2; + + $request->setOID(sprintf("%s.%s.%s", OID_HAPROXY_INFO, $req, ++$nr)); + $mode = MODE_GET; + + } + + if ($mode == MODE_GET) { + + next if !defined($req) || !defined($nr); + + if ($req == 0) { + next if !defined($info_vars{$nr}); + $request->setValue(ASN_OCTET_STR, $info_vars{$nr}); + next; + } + + if ($req == 1) { + next if !defined($info_vars{$nr}); + + my $sock = new IO::Socket::UNIX (Peer => $sa, Type => SOCK_STREAM, Timeout => 1); + next if !$sock; + + print $sock "show info\n"; + + while(<$sock>) { + chomp; + my ($key, $val) = /(.*):\s*(.*)/; + + next if $info_vars{$nr} ne $key; + + $request->setValue(ASN_OCTET_STR, $val); + last; + } + + close($sock); + } + } + } +} + +$agent->register('HAProxy stat', OID_HAPROXY_STATS, \&haproxy_stat); +$agent->register('HAProxy info', OID_HAPROXY_INFO, \&haproxy_info); + diff --git a/admin/netsnmp-perl/haproxy_backend.xml b/admin/netsnmp-perl/haproxy_backend.xml new file mode 100644 index 0000000..26ce63f --- /dev/null +++ b/admin/netsnmp-perl/haproxy_backend.xml @@ -0,0 +1,83 @@ + + HAProxy - backend + .1.3.6.1.4.1.29385.106.1.1.10001 + + + Proxy ID + get + value + input + .1.3.6.1.4.1.29385.106.1.1.27 + + + Service ID + get + value + input + .1.3.6.1.4.1.29385.106.1.1.28 + + + Proxy Name + get + value + input + .1.3.6.1.4.1.29385.106.1.1.0 + + + Service Name + get + value + input + .1.3.6.1.4.1.29385.106.1.1.1 + + + Total Sessions + get + value + output + .1.3.6.1.4.1.29385.106.1.1.7 + + + Bytes In + get + value + output + .1.3.6.1.4.1.29385.106.1.1.8 + + + Bytes Out + get + value + output + .1.3.6.1.4.1.29385.106.1.1.9 + + + Connection Errors + get + value + output + .1.3.6.1.4.1.29385.106.1.1.13 + + + Response Errors + get + value + output + .1.3.6.1.4.1.29385.106.1.1.14 + + + LB Total + get + value + output + .1.3.6.1.4.1.29385.106.1.1.30 + + + Denied Requests + get + value + output + .1.3.6.1.4.1.29385.106.1.1.10 + + + diff --git a/admin/netsnmp-perl/haproxy_frontend.xml b/admin/netsnmp-perl/haproxy_frontend.xml new file mode 100644 index 0000000..ade2a77 --- /dev/null +++ b/admin/netsnmp-perl/haproxy_frontend.xml @@ -0,0 +1,83 @@ + + HAProxy - frontend + .1.3.6.1.4.1.29385.106.1.0.10001 + + + Proxy ID + get + value + input + .1.3.6.1.4.1.29385.106.1.0.27 + + + Service ID + get + value + input + .1.3.6.1.4.1.29385.106.1.0.28 + + + Proxy Name + get + value + input + .1.3.6.1.4.1.29385.106.1.0.0 + + + Service Name + get + value + input + .1.3.6.1.4.1.29385.106.1.0.1 + + + Current Sessions + get + value + output + .1.3.6.1.4.1.29385.106.1.0.4 + + + Maximum Sessions + get + value + output + .1.3.6.1.4.1.29385.106.1.0.5 + + + Total Sessions + get + value + output + .1.3.6.1.4.1.29385.106.1.0.7 + + + Request Errors + get + value + output + .1.3.6.1.4.1.29385.106.1.0.12 + + + Bytes In + get + value + output + .1.3.6.1.4.1.29385.106.1.0.8 + + + Bytes Out + get + value + output + .1.3.6.1.4.1.29385.106.1.0.9 + + + Denied Requests + get + value + output + .1.3.6.1.4.1.29385.106.1.0.10 + + + diff --git a/admin/netsnmp-perl/haproxy_socket.xml b/admin/netsnmp-perl/haproxy_socket.xml new file mode 100644 index 0000000..63ae110 --- /dev/null +++ b/admin/netsnmp-perl/haproxy_socket.xml @@ -0,0 +1,90 @@ + + HAProxy - socket + .1.3.6.1.4.1.29385.106.1.3.10001 + + + Unique Index + get + value + input + .1.3.6.1.4.1.29385.106.1.3.10001 + + + Proxy ID + get + value + input + .1.3.6.1.4.1.29385.106.1.3.27 + + + Service ID + get + value + input + .1.3.6.1.4.1.29385.106.1.3.28 + + + Proxy Name + get + value + input + .1.3.6.1.4.1.29385.106.1.3.0 + + + Service Name + get + value + input + .1.3.6.1.4.1.29385.106.1.3.1 + + + Current Sessions + get + value + output + .1.3.6.1.4.1.29385.106.1.3.4 + + + Maximum Sessions + get + value + output + .1.3.6.1.4.1.29385.106.1.3.5 + + + Total Sessions + get + value + output + .1.3.6.1.4.1.29385.106.1.3.7 + + + Request Errors + get + value + output + .1.3.6.1.4.1.29385.106.1.3.12 + + + Bytes In + get + value + output + .1.3.6.1.4.1.29385.106.1.3.8 + + + Bytes Out + get + value + output + .1.3.6.1.4.1.29385.106.1.3.9 + + + Denied Requests + get + value + output + .1.3.6.1.4.1.29385.106.1.3.10 + + + -- cgit v1.2.3