Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to save as text file #53

Closed
badsmoke opened this issue Jul 29, 2024 · 4 comments
Closed

add option to save as text file #53

badsmoke opened this issue Jul 29, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@badsmoke
Copy link

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

@matusnovak
Copy link
Owner

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.

@matusnovak matusnovak added the enhancement New feature or request label Aug 23, 2024
@badsmoke
Copy link
Author

badsmoke commented Aug 29, 2024

Hey @matusnovak

this option means you don't have to set an extra target in prometheus again.

I have made a pull request

#55

@badsmoke
Copy link
Author

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

@matusnovak
Copy link
Owner

Hi. Sorry for a late reply. I have merged your PR :)

Closing this issue as done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants