Open badsmoke opened 2 months ago
Hi.
Just out of curiosity, why do you want to avoid opening a port and reading metrics from there?
To answer your question, I think this could work quite easily. The Python prometheus_client
seems to have an option write_to_textfile
which is defined here: https://github.com/prometheus/client_python/blob/master/prometheus_client/exposition.py I haven't tried it, but it looks very promising.
I am currently busy with life events and other projects. I do not have time to implement this. However, PR is more than welcome if you would like to implement it.
Hey @matusnovak
this option means you don't have to set an extra target in prometheus again.
I have made a pull request
for those who are interested, this is the customized image
image: docker.badcloud.eu/library/prometheus-smartctl:latest
version: "3"
services:
node-exporter:
image: quay.io/prometheus/node-exporter
restart: always
volumes:
- '/:/host:ro,rslave'
- './tmp/:/tmp/'
network_mode: "host"
pid: "host"
command:
- "--path.rootfs=/host"
- "--collector.textfile.directory=/tmp/"
smartctl-exporter:
image: docker.badcloud.eu/library/prometheus-smartctl:latest
container_name: smartctl-exporter
privileged: true
environment:
- "SMARTCTL_METRICS_FILE_ENABLE=True"
volumes:
- ./tmp/:/metrics/
restart: unless-stopped
hey cool project, thanks for that.
an option to save the metrics as “smartmon_exporter.prom” would still be useful, the node-exporter can also retrieve the data in this way and thus no port has to be opened and the smart values are automatically retrieved with every node-exporter call