Hello All,
We are in the process of testing out Grafana alloy as a replacement for promethes and snmp_exporter across our environment. Currently we are using snmp_exporter with custom lables that are loaded into a json file & processed by prometheus.yml. Example below
[
{
"targets": ["x.x.x.x"],
"labels": {
"brand": "string",
"category": "string",
"location": "string"
}
]
I am trying to take the same labels and put them into the grafana alloy config, i’ve added the exporter, discovery.file, config (from the snmp_generator) scraper, and remote write.
discovery.file "juniper" {
files = ["/etc/alloy/juniper.yml"]
}
prometheus.exporter.snmp "network" {
config_file = "/etc/alloy/snmp.yml"
targets = discovery.file.juniper.targets
}
prometheus.scrape "snmpExporter" {
targets = prometheus.exporter.snmp.network.targets
forward_to = [prometheus.remote_write.dev.receiver]
scrape_interval = "60s"
}
prometheus.remote_write "dev" {
endpoint {
url = "http://my_endpoint_here"
}
}
And here is the juniper.yml file
- targets:
- x.x.x.x:161
labels:
name: test
module: juniper_module
auth: public
brand: juniper
category: switch
location: lab
I am scraping information based on the OIDs i have setup in my snmp.yml config and I can see everything I need there however I am not getting the custom labels brand, category, or location.
I did see a recent commit that should allow this: Allow the setting of labels for snmp exporter for both target and targets by mattdurham · Pull Request #1876 · grafana/alloy · GitHub
I don’t really want to define all 100+ network devices in my config.alloy script which is the reason I am putting them into a separate file .
Stuck at the moment, any ideas?!