Alloy SNMP exporter error "server returned HTTP status 400 Bad Request"

Hi,

I’m trying to migrate from prometheus/snmp_exporter to Grafana Alloy. The config I’m using has been working fine with the former for a long time now, however returns the above mentioned error when used with Alloy.

Here’s a snippet from my config.alloy:

prometheus.exporter.snmp "example" {
    config_file = "/etc/alloy/snmp.yml"

    target "canon_printer" {
        address     = "192.168.1.213"
        module      = "printer_mib"
        auth        = "canon"
        walk_params = "public"
    }
}

Here’s the snmp.yaml:

auths:
  canon:
    security_level: authPriv
    auth_protocol: SHA
    username: 'username'
    password: 'password'
    priv_protocol: AES
    priv_password: 'password'
    version: 3

Alloy is running in a Docker container, the local snmp.yml is mapped to /etc/alloy/snmp.yml via volume mount.

Anybody got an idea as to why this won’t work?

Okay, did some more debugging and found the error. Using curl got me the following:

Unknown module 'printer_mib'

I was able to solve it by getting the default snmp.yml and merge it with my custom config.

Now my question becomes: Is this the way to go? Is there no default snmp.yml included with Alloy?

1 Like

that is actually a great idea. do devices that have snmp share same identical values in the mib?

Well, I’m by no means an SNMP expert but at least that’s how snmp_exporter does it and it seems to make sense.

that is how it does what?
my question was is there a standard of snmp values across all devices by all manufacturers of devices that implement snmp?

i would think it would be daunting to provide a sample yaml to account for all types of mib as they might differ from one manufacturer to another?

not an expert of snmp by any stretch

What’s weird is that, when asking Grot (the AI helper) it responded with the following:

Yes, Alloy does come with default SNMP modules built-in. According to the knowledge sources, the SNMP exporter in Alloy includes a set of pre-defined SNMP modules.

Specifically, the Grafana Agent documentation states:

“SNMP modules available can be found in the embedded snmp.yml file here. If not specified, if_mib module is used.”

While this if referring to Agent instead of Alloy it seems to me that I’m not that far off…

1 Like

I’m pretty sure that different manufacturers of a specific category share the same MIBs. So for example all printers should expose the same SNMP OIDs.

BTW: I think they’re already working on this in this Pull Request

1 Like

Just found the snmp.yaml included with Alloy here

So now I’m just waiting for the aforementioned PR to get merged and a new version to be released to have my issue fixed :slight_smile:

1 Like