Reputation: 9058
I've been struggling with this. I'm trying to configure a file_sd_configs section in my prometheus.yml file. Here's the relative section:
scrape_configs:
- job_name: ct_agents
file_sd_configs:
- files:
- agent_configs/agents.json
At startup, I get this error:
time="2019-02-07T16:15:21Z" level=error msg="Couldn't load configuration (-config.file=/etc/prometheus/prometheus.yml): file service discovery config must contain at least one path name" source="main.go:208"
I have tried a variety of things based on examples I found elsewhere. I tried putting the path in single quotes like one example. I tried full path. I originally had a wildcard and an empty directory, hoping Prometheus would find the possibly dynamic list of files.
I've checked spacing multiple times. There are no tabs in the file (the most common problem I have when editing .yml files).
The file itself exists although is currently just an empty array (in JSON).
I'm fairly sure it's something silly.
Upvotes: 3
Views: 2137
Reputation: 156
the error is well described in the error message:
file service discovery config must contain at least one path name
Thus, it means your json file should have at least one target
[
{
"targets":
"example.com"
],
}
]
Upvotes: 1
Reputation: 9058
Okay, thanks to Oliver's questions, we determined I was running an old version of Prometheus (installed with apt-get install prometheus). Installing a modern version was a pain, but it resolved the problem, once I got it configured again.
So -- if anyone is having problems getting this to work with the same error, check the logs to see how old your Prometheus binaries are. As of February, 2019, if you install using apt-get on a Docker Ubuntu instance, you get a very, very old copy of Prometheus.
Upvotes: 2