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. On Friday, 27 June 2025 at 08:54:16 UTC+1 Ben Kochie wrote: > Hmm, maybe we should add an empty config check (no modules, no auths) to > the startup. > > On Fri, Jun 27, 2025 at 9:20 AM 'Brian Candler' via Prometheus Users < > [email protected]> wrote: > >> 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. >> >> On Thursday, 26 June 2025 at 17:49:48 UTC+1 Joel Djojotaroeno wrote: >> >>> 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. >>> >>> On Thursday, June 26, 2025 at 12:43:04 PM UTC-3 Brian Candler wrote: >>> >>>> 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. >>>> >>> -- >> > 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 [email protected]. >> > To view this discussion visit >> https://groups.google.com/d/msgid/prometheus-users/9421905d-63ab-4413-adca-5f781b62d1bdn%40googlegroups.com >> >> <https://groups.google.com/d/msgid/prometheus-users/9421905d-63ab-4413-adca-5f781b62d1bdn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 [email protected]. To view this discussion visit https://groups.google.com/d/msgid/prometheus-users/989c0f5d-02e8-4db9-af31-a9146ae301fdn%40googlegroups.com.

