|
| 1 | +# Rubin's Ugly SNMP Generator |
| 2 | + |
| 3 | +This repository provides a simple way to generate the `snmp.yml` configuration file using the `generator` binary based on definitions specified in `generator.yml`. |
| 4 | + |
| 5 | +If new mibs are needed, they should be manually downloaded to the mibs directory. |
| 6 | + |
| 7 | +Keep in mind that the `generator` binary is not provided and you should compile it locally to use it. |
| 8 | + |
| 9 | +You can grab a copy of the sources from https://github.com/prometheus/snmp_exporter |
| 10 | + |
| 11 | +## Directory Structure |
| 12 | + |
| 13 | +- `generator.yml`: Input file containing the SNMP targets and configuration schema. |
| 14 | +- `snmp.yml`: Output file automatically generated from `generator.yml`. |
| 15 | +- `mibs/`: Directory containing all required MIB files used during generation. |
| 16 | + |
| 17 | +## Usage |
| 18 | + |
| 19 | +To generate the `snmp.yml` file, simply run: |
| 20 | + |
| 21 | +```bash |
| 22 | +generator generate --fail-on-parse-errors --log.level=debug -m mibs |
| 23 | +``` |
| 24 | + |
| 25 | +## Example |
| 26 | + |
| 27 | +As of May of 2025 the following is the output of this tool: |
| 28 | + |
| 29 | +```bash |
| 30 | +$ generator generate --fail-on-parse-errors --log.level=debug -m mibs |
| 31 | +time=2025-05-20T20:37:17.930Z level=INFO source=net_snmp.go:174 msg="Loading MIBs" from=mibs |
| 32 | +time=2025-05-20T20:37:18.003Z level=INFO source=main.go:57 msg="Generating config for module" module=if_mib |
| 33 | +time=2025-05-20T20:37:18.013Z level=INFO source=main.go:75 msg="Generated metrics" module=if_mib metrics=40 |
| 34 | +time=2025-05-20T20:37:18.013Z level=INFO source=main.go:57 msg="Generating config for module" module=ip_mib |
| 35 | +time=2025-05-20T20:37:18.014Z level=INFO source=main.go:75 msg="Generated metrics" module=ip_mib metrics=4 |
| 36 | +time=2025-05-20T20:37:18.014Z level=INFO source=main.go:57 msg="Generating config for module" module=raritan |
| 37 | +time=2025-05-20T20:37:18.016Z level=INFO source=main.go:75 msg="Generated metrics" module=raritan metrics=86 |
| 38 | +time=2025-05-20T20:37:18.016Z level=INFO source=main.go:57 msg="Generating config for module" module=xups |
| 39 | +time=2025-05-20T20:37:18.018Z level=INFO source=main.go:75 msg="Generated metrics" module=xups metrics=22 |
| 40 | +time=2025-05-20T20:37:18.018Z level=INFO source=main.go:57 msg="Generating config for module" module=schneider_pm5xxx |
| 41 | +time=2025-05-20T20:37:18.020Z level=INFO source=main.go:75 msg="Generated metrics" module=schneider_pm5xxx metrics=36 |
| 42 | +time=2025-05-20T20:37:18.020Z level=INFO source=main.go:57 msg="Generating config for module" module=arista_tunnel |
| 43 | +time=2025-05-20T20:37:18.022Z level=INFO source=main.go:75 msg="Generated metrics" module=arista_tunnel metrics=1 |
| 44 | +time=2025-05-20T20:37:18.022Z level=INFO source=main.go:57 msg="Generating config for module" module=network_base |
| 45 | +time=2025-05-20T20:37:18.023Z level=INFO source=main.go:75 msg="Generated metrics" module=network_base metrics=14 |
| 46 | +time=2025-05-20T20:37:18.036Z level=INFO source=main.go:100 msg="Config written" file=snmp.yml |
| 47 | +$ |
| 48 | +``` |
0 commit comments