Unknown auth 'public_v1'

85 views
Skip to first unread message

Joel Djojotaroeno

unread,
Jun 26, 2025, 10:42:36 AMJun 26
to Prometheus Users
Hi,

I'm currently on my internship and need to work with prometheus + grafana. I've installed Prometheus on a Linux Ubuntu 22.04.5 LTS server. 
After configuring prometheus and node exporter correctly, i unfortunately get a error when configuring snmp exporter. 

Error:  Error scraping target: server returned HTTP status 400 Bad Request

And when i click on the ip of the server i receive: Unknown auth "public_v1_''

I have two prometheus.yml files:
/home/rpbgintern2/prometheus.yml
/etc/prometheus/prometheus.yml

And two snmp.yml files:
/home/rpbgintern2/snmp_exporter-0.26.0.linux-amd64/snmp.yml
/home/rpbgintern2/snmp/snmp.yml

I don't know if multiple yml files are causing this error. 


/etc/prometheus/prometheus.yml:
global:
  scrape_interval: 15s
  evaluation_interval: 15s
  # scrape_timeout is set to the global default (10s).

alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

scrape_configs:
  - job_name: 'node_exporter'
    static_configs:
      - targets: ['172.27.136.2:9100']

  - job_name: "prometheus"
    static_configs:
      - targets: ["172.27.136.2:9090"]
        labels:
          app: "prometheus"

  - job_name: 'snmp_exporter'
    metrics_path: /snmp
    params:
      auth: [public_v1]
      module: [if_mib]
    static_configs:
      - targets:
          - 200.1.212.158  # SNMP device.
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 172.27.136.2:9116  # SNMP exporter's host:port

Please help! i've been troubleshooting this for the past 3 weeks 

Matthew Koch

unread,
Jun 26, 2025, 11:24:57 AMJun 26
to Joel Djojotaroeno, Prometheus Users
can you share your snmp.yml? Looks like you are missing an auth or have the name wrong 

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/prometheus-users/a25063e4-cf74-4dd1-bf55-458cf6990518n%40googlegroups.com.

Brian Candler

unread,
Jun 26, 2025, 11:43:04 AMJun 26
to Prometheus Users
On Thursday, 26 June 2025 at 15:42:36 UTC+1 Joel Djojotaroeno wrote:
I have two prometheus.yml files:
/home/rpbgintern2/prometheus.yml
/etc/prometheus/prometheus.yml

And two snmp.yml files:
/home/rpbgintern2/snmp_exporter-0.26.0.linux-amd64/snmp.yml
/home/rpbgintern2/snmp/snmp.yml

I don't know if multiple yml files are causing this error. 

No. But you do need to work out which is being used.

This depends on how you are starting the services. Are you using systemd services perhaps?

If you're not sure, then use
ps auxwww | grep prometheus
ps auxwww | grep snmp_exporter
to see what flags you're running them with.

For prometheus, the config file is specified by the --config.file argument. If you don't specify it, it will read "prometheus.yml" in whatever the current working directory is when prometheus is started.

snmp_exporter also has a --config.file argument; I believe it defaults to "snmp.yml" in the current working directory.  It can be used with a wildcard, e.g. '--config.file=/etc/prometheus/snmp.d/*.yml'.  
This is very useful because you can provide multiple files: the supplied snmp.yml, and then a separate file (say "auth.yml") with just your site-specific authentication parameters. For example:

auths:
  test_v2:
    version: 2
    community: Testing123

  test_v3:
    version: 3
    security_level: authNoPriv
    username: admin
    auth_protocol: SHA
    password: Testing123

  test_v3_priv:
    version: 3
    security_level: authPriv
    username: admin
    auth_protocol: SHA
    password: Testing123
    priv_protocol: AES
    priv_password: VerySecret

If you're polling snmp_exporter with parameter public_v1, then this auth needs to be defined. The supplied snmp.yml does define this, so perhaps your snmp_exporter is not picking up *any* configuration files? That will be down to the --config.file parameter you may or may not be passing.
 
Either that, or there's a typo somewhere. I note that your error message complains about "public_v1_'' with a trailing underscore.

Brian Candler

unread,
Jun 26, 2025, 11:50:55 AMJun 26
to Prometheus Users
I've just checked, and snmp_exporter will happily start even if it can't find snmp.yml. strace shows:

newfstatat(AT_FDCWD, "snmp.yml", 0xc0001b2ed8, AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory)

(but it continues to run, and doesn't log any error). This feels like a bug to me, as it will lead to confusing behaviour which is quite possibly what's happening to you. Whereas Prometheus complains and refuses to start:

ts=2025-06-26T15:49:29.540Z caller=main.go:537 level=error msg="Error loading config (--config.file=prometheus.yml)" file=/root/zzz/prometheus.yml err="open prometheus.yml: no such file or directory"

Joel Djojotaroeno

unread,
Jun 26, 2025, 12:47:06 PMJun 26
to Prometheus Users
Is there a way to share all the 34454 lines in a txt file?

Joel Djojotaroeno

unread,
Jun 26, 2025, 12:49:48 PMJun 26
to Prometheus Users
rpbgintern2@rpbgintern:~$ ps auxwww | grep prometheus
prometh+    1823  0.2  0.8 1744528 105088 ?      Ssl  14:31   0:21 /usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/
rpbgint+    1942  0.0  0.0   6612  2396 pts/0    S+   16:47   0:00 grep --color=auto prometheus

rpbgintern2@rpbgintern:~$ ps auxwww | grep snmp_exporter
rpbgint+     787  0.0  0.1 1239076 12976 ?       Ssl  11:24   0:04 /home/rpbgintern2/snmp_exporter-0.26.0.linux-amd64/snmp_exporter --web.listen-address=172.27.136.2:9116
rpbgint+    1944  0.0  0.0   6612  2388 pts/0    S+   16:48   0:00 grep --color=auto snmp_exporter

I must specify that i'm only using snmp v1.

Brian Candler

unread,
Jun 27, 2025, 3:20:03 AMJun 27
to Prometheus Users
You're not passing --config.file to snmp_exporter.

Therefore it will only attempt to pick up a file called "snmp.yml" from the working directory where it was started, and you can check that directory using:
ls -l /proc/784/cwd

But if that file doesn't exist, it will silently ignore the problem and run with *no* configuration at all (which is pretty useless). That seems to be the most likely thing that's happened here.

Ben Kochie

unread,
Jun 27, 2025, 3:54:16 AMJun 27
to Brian Candler, Prometheus Users
Hmm, maybe we should add an empty config check (no modules, no auths) to the startup.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.

Brian Candler

unread,
Jun 28, 2025, 4:46:48 AMJun 28
to Prometheus Users
As a guess, the failure to detect missing config is due to glob expansion - e.g. expand glob pattern "snmp.yml" and it returns an empty list.

Maybe it would be reasonable to give an error if the glob expansion matches no files - or at least a warning.

Brian Candler

unread,
Jul 2, 2025, 7:30:52 AMJul 2
to Prometheus Users
Reply all
Reply to author
Forward
0 new messages