Hello
Disclaimer: I am very new to Grafana Alloy (started looking at this today)
- What Grafana version and what operating system are you using?
Grafana Alloy 1.0.0 on Ubuntu 22.04
- What are you trying to achieve?
I am experimenting to see if it is possible to use the content of a file to then present to prometheus.scrape
and forward to a prometheus remote write target. It looks like this is not possible, but I’m really checking here amongst experts to see if it is or is not for sure.
I am doing this because I’m trying to collect metrics from a textfile. The exporter I’m using is pkg-exporter and is meant to be consumed using node-exporter’s --collector.textfile.directory
option. The reason for this is that we are not currently using node-exporter and wish to avoid installing/configuring if we can.
- How are you trying to achieve it?
Using a local.file
block to point to the file and using this as a target with prometheus.scrape
- What happened?
The error received is:
Error: /etc/alloy/config.alloy:13:21: expected =, got .
interrupt received
I’m guessing this is because Alloy is expecting to parse a simple key/value pair and is getting a prometheus metrics textfile instead
- What did you expect to happen?
To be able to read the file in and parse as prometheus output to be sent on to the rest of our prometheus config
- Can you copy/paste the configuration(s) that you are having problems with?
local.file "pkgexporter" {
filename = "/var/prometheus/pkg-exporter.prom"
}
prometheus.scrape "pkgexporter" {
targets = [ {local.file.pkgexporter.content} ]
forward_to = [prometheus.remote_write.main.receiver]
}
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
Error: /etc/alloy/config.alloy:13:21: expected =, got .
interrupt received
- Did you follow any online instructions? If so, what is the URL?
No, I couldn’t find any instructions online, which suggests that this is not actually possible. I did want to check here, however.