packet:linbpq_monitoring
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
packet:linbpq_monitoring [2024/05/06 16:05] – created g6fji | packet:linbpq_monitoring [2024/05/15 10:05] (current) – [Prometheus] remove note about sysUpTime 2m0mqn | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Monitoring LinBPQ through | + | ====== Monitoring LinBPQ through |
- | ===== 1. Enable SNMP on LinBPQ ===== | + | ===== Enable SNMP on LinBPQ ===== |
N.B. This approach requires a recent version of LinBPQ, 6.0.24.34 or later. | N.B. This approach requires a recent version of LinBPQ, 6.0.24.34 or later. | ||
Line 31: | Line 31: | ||
</ | </ | ||
- | ===== 2. Set up SNMP on Home Assistant ===== | + | ===== Set up monitoring in Home Assistant ===== |
+ | |||
+ | One way to monitor BPQ's SNMP metrics is using Home Assistant. | ||
SNMP support is built-in to HA but requires hand-editing '' | SNMP support is built-in to HA but requires hand-editing '' | ||
Line 125: | Line 127: | ||
+ | ===== Telegraf / Grafana ===== | ||
+ | |||
+ | Another way to collect and monitor BPQ's SNMP metrics is by using Telegraf. You typically run Telegraf as part of a monitoring stack, in this case Telegraf + InfluxDB + Grafana. Telegraf is the collection agent, InfluxDB is the time-series database, and Grafana is the visualisation. | ||
+ | |||
+ | In telegraf.conf: | ||
+ | |||
+ | < | ||
+ | [[inputs.snmp]] | ||
+ | agents = [" | ||
+ | version = 1 | ||
+ | |||
+ | # for each port... | ||
+ | | ||
+ | [[inputs.snmp.field]] | ||
+ | oid = " | ||
+ | name = " | ||
+ | conversion = " | ||
+ | |||
+ | [[inputs.snmp.field]] | ||
+ | oid = " | ||
+ | name = " | ||
+ | conversion = " | ||
+ | |||
+ | </ | ||
+ | |||
+ | These counters show up in InfluxDB under a measurement named SNMP with multiple fields, one for each oid. You get a counter update every 10 seconds. | ||
+ | |||
+ | Query like this: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | End result: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===== Prometheus ===== | ||
+ | |||
+ | It's also quite easy to get prometheus-snmp-exporter to collect stats from BPQ. | ||
+ | |||
+ | Add something like the following to your generator.yml | ||
+ | |||
+ | < | ||
+ | linbpq: | ||
+ | walk: | ||
+ | - 1.3.6.1.2.1.1.3.0 | ||
+ | - 1.3.6.1.2.1.1.5 | ||
+ | - 1.3.6.1.2.1.2.2.1.10.1 | ||
+ | - 1.3.6.1.2.1.2.2.1.16.1 | ||
+ | version: 1 | ||
+ | auth: | ||
+ | community: public | ||
+ | </ | ||
+ | |||
+ | Repeat the 1.3.6.1.2.1.2.2.1.10.X and 1.3.6.1.2.1.2.2.1.16.X lines for each of your ports, then run prometheus-snmp-generator generate to regenerate your configuration. | ||
+ | |||
+ | You'll likely already have an snmp scrape configuration in your prometheus.yml. | ||
+ | Add the linbpq module (as defined above) and the target address of your BPQ node to it. | ||
+ | The result will look something like this: | ||
+ | |||
+ | < | ||
+ | - job_name: ' | ||
+ | scrape_interval: | ||
+ | scrape_timeout: | ||
+ | metrics_path: | ||
+ | params: | ||
+ | module: [linbpq] | ||
+ | static_configs: | ||
+ | - targets: | ||
+ | - packet.example.org: | ||
+ | relabel_configs: | ||
+ | - source_labels: | ||
+ | target_label: | ||
+ | - source_labels: | ||
+ | target_label: | ||
+ | - target_label: | ||
+ | replacement: | ||
+ | </ | ||
+ | |||
+ | After restarting prometheus-snmp-exporter and prometheus you should start seeing ifInOctets, ifOutOctets, | ||
packet/linbpq_monitoring.1715011505.txt.gz · Last modified: 2024/05/06 16:05 by g6fji