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

web: prometheus metrics support #2332

Merged
merged 13 commits into from
Aug 30, 2020
Merged

web: prometheus metrics support #2332

merged 13 commits into from
Aug 30, 2020

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented Aug 21, 2020

resolve #2323

Looks like:

relay0 0
relay1 0
relay2 0
relay3 0
temperature0 10.000
temperature1 9.000
humidity 35.000
pressure 997.000

I'll need to adjust sensor value printing, decimal places are hard-coded to 3 and need to be handled by the sensors module (somehow), as those methods aren't public right now.
HTTP auth won't work, as it seems. I can't find any config option to accept user:pass pair for the metrics target.

scrape_configs:
  - job_name: 'espurna'
    metrics_path: '/api/metrics'
    params:
      apikey: ['apikeyapikey']
    static_configs:
      - targets: ['espurna-blabla.lan:80']

@mcspr
Copy link
Collaborator Author

mcspr commented Aug 30, 2020

Using decimals from sensor / defaults:

relay0 0
temperature0 30.5
temperature1 29.5
humidity 56
pressure 1005.50

(i.e. for my DummySensor, temperature resolution is 0.1. Same for pressure, where it is 0.01. Humidity is a percentage, thus no decimals at all. Any specific sensor will override this in case value could fit more digits)

Path is /api/metrics?apikey=..., config example updated above.

@mcspr mcspr merged commit a496308 into xoseperez:dev Aug 30, 2020
@mcspr mcspr deleted the web/metrics branch August 30, 2020 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a metrics page for prometheus scraping
1 participant