Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
opensprinkler_prometheus_exporter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
varac-projects
opensprinkler_prometheus_exporter
Commits
364bdd6d
Verified
Commit
364bdd6d
authored
2 years ago
by
Varac
Browse files
Options
Downloads
Patches
Plain Diff
Add celsius temp metrics
parent
18339f13
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
opensprinkler_prometheus_exporter.py
+19
-13
19 additions, 13 deletions
opensprinkler_prometheus_exporter.py
with
19 additions
and
13 deletions
opensprinkler_prometheus_exporter.py
+
19
−
13
View file @
364bdd6d
...
...
@@ -12,7 +12,6 @@ Author: varac@varac.net
Todo:
* Add celsius temp values
* Add units of measurement
* What
'
s wtdata.p ?
"""
import
json
...
...
@@ -33,19 +32,22 @@ log = logging.getLogger(__name__)
wt_eto
=
Gauge
(
'
opensprinkler_wt_eto
'
,
'
Weather provider: ETo
'
,
[
'
type
'
])
wt_radiation
=
Gauge
(
'
opensprinkler_wt_radiation
'
,
'
Weather provider: radiation
'
)
wt_temp
=
Gauge
(
'
opensprinkler_wt_temp
'
,
'
Weather provider: Temperature (min/max)
'
,
[
'
type
'
])
wt_temp_f
=
Gauge
(
'
opensprinkler_wt_temp_f
'
,
'
Weather provider: Temperature (min/max), Fahrenheid
'
,
[
'
type
'
])
wt_temp_c
=
Gauge
(
'
opensprinkler_wt_temp_c
'
,
'
Weather provider: Temperature (min/max), Celsius
'
,
[
'
type
'
])
wt_hum
=
Gauge
(
'
opensprinkler_wt_hum
'
,
'
Weather provider: Humidity (min/max)
'
,
[
'
type
'
])
wt_wind
=
Gauge
(
'
opensprinkler_wt_wind
'
,
'
Weather provider: wind speed
'
)
wt_p
=
Gauge
(
'
opensprinkler_wt_p
'
,
'
Weather provider: ?
'
)
sun
=
Gauge
(
'
opensprinkler_sunrise
'
,
'
Daytime of sunrise (mins) (sunrise/sunset)
'
,
[
'
type
'
])
'
Weather provider: Humidity (min/max), %
'
,
[
'
type
'
])
wt_wind
=
Gauge
(
'
opensprinkler_wt_wind
'
,
'
Weather provider: Wind speed, m/h
'
)
wt_precip
=
Gauge
(
'
opensprinkler_wt_precip
'
,
'
Weather provider: Precipation, mm
'
)
sun
=
Gauge
(
'
opensprinkler_sun
'
,
'
Daytime of sunrise (sunrise/sunset), mins
'
,
[
'
type
'
])
last_weather_call
=
Gauge
(
'
opensprinkler_last_weather_call
'
,
'
Timestamp of the last weather call/query
(epoch time)
(request/response)
'
,
'
Timestamp of the last weather call/query (request/response)
, epoch time
'
,
[
'
type
'
])
water_level
=
Gauge
(
'
opensprinkler_water_level
'
,
'
Water level (
i.e. % Watering,
0 to 250)
'
)
'
Water level (0 to 250)
, %
'
)
station_open
=
Gauge
(
'
opensprinkler_station_open
'
,
'
Station status, 0=closed, 1=open
'
,
[
'
station
'
])
...
...
@@ -79,12 +81,16 @@ def main():
wtdata
=
j
[
'
settings
'
][
'
wtdata
'
]
wt_eto
.
labels
(
type
=
'
current
'
).
set
(
wtdata
[
'
eto
'
])
wt_radiation
.
set
(
wtdata
[
'
radiation
'
])
wt_temp
.
labels
(
type
=
'
min
'
).
set
(
wtdata
[
'
minT
'
])
wt_temp
.
labels
(
type
=
'
max
'
).
set
(
wtdata
[
'
maxT
'
])
wt_temp_f
.
labels
(
type
=
'
min
'
).
set
(
wtdata
[
'
minT
'
])
wt_temp_f
.
labels
(
type
=
'
max
'
).
set
(
wtdata
[
'
maxT
'
])
wt_temp_c
.
labels
(
type
=
'
min
'
).
set
(
(
wtdata
[
'
minT
'
]
-
32
)
*
5.0
/
9.0
)
wt_temp_c
.
labels
(
type
=
'
max
'
).
set
(
(
wtdata
[
'
maxT
'
]
-
32
)
*
5.0
/
9.0
)
wt_hum
.
labels
(
type
=
'
min
'
).
set
(
wtdata
[
'
minH
'
])
wt_hum
.
labels
(
type
=
'
max
'
).
set
(
wtdata
[
'
maxH
'
])
wt_wind
.
set
(
wtdata
[
'
wind
'
])
wt_p
.
set
(
wtdata
[
'
p
'
])
wt_p
recip
.
set
(
wtdata
[
'
p
'
])
sun
.
labels
(
type
=
'
sunrise
'
).
set
(
j
[
'
settings
'
][
'
sunrise
'
])
sun
.
labels
(
type
=
'
sunset
'
).
set
(
j
[
'
settings
'
][
'
sunset
'
])
last_weather_call
.
labels
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment