Add meteocat exporter #103

Manually merged
rarias merged 2 commits from monitor-outside-temp into master 2025-05-29 13:07:27 +02:00
Owner

Allows us to track ambient temperature changes and estimate the
temperature delta between the server room and exterior temperature.
We should be able to predict when we would need to stop the machines due
to excesive temperature as summer approaches.

Allows us to track ambient temperature changes and estimate the temperature delta between the server room and exterior temperature. We should be able to predict when we would need to stop the machines due to excesive temperature as summer approaches.
rarias added 2 commits 2025-05-23 16:26:46 +02:00
Allows us to see which derivations are being built in realtime. It is a
bit of a hack, but it seems to work. We simply look at the environment
of the child processes of nix-daemon (usually bash) and then look for
the $name variable which should hold the current derivation being
built. Needs root to be able to read the environ file of the different
nix-daemon processes as they are owned by the nixbld* users.

See: https://discourse.nixos.org/t/query-ongoing-builds/23486
Allows us to track ambient temperature changes and estimate the
temperature delta between the server room and exterior temperature.
We should be able to predict when we would need to stop the machines due
to excesive temperature as summer approaches.
abonerib reviewed 2025-05-23 17:32:15 +02:00
@@ -0,0 +23,4 @@
soup = BeautifulSoup(data, 'lxml')
table = soup.find("table", {"class" : "tblperiode"})
rows = table.find_all('tr')
row = rows[-1] # Take the last row
Collaborator

Seems that meteocat does not update the data in realtime (right now at 17:20 the last row is from 14:30). Also, the periods are of 30 minutes, so we will have duplicates.

Can we manually set the time of the gauge and check for duplicates?

Seems that meteocat does not update the data in realtime (right now at 17:20 the last row is from 14:30). Also, the periods are of 30 minutes, so we will have duplicates. Can we manually set the time of the gauge and check for duplicates?
Author
Owner
  1. Meteocat uses UTC time, so you need to add 2 hours to the website times to convert to Spain time. It is mostly realtime.

  2. Meteocat samples the temp over 30 minutes, then computes the min/max/avg during ~5 minutes and then outputs the values on the table, so they have at most 40 min of delay as we retry every 5 minutes.

  3. There are no duplicates per-se. We update the gauge as soon as we discover a new value. But prometheus will query the metrics every minute, so it will continue to read the same values for 30 min at least. This is fine as they have a very effective mechanism to store duplicates that only takes around 1 bit of information (see https://www.vldb.org/pvldb/vol8/p1816-teller.pdf section 4.1.2).

1. Meteocat uses UTC time, so you need to add 2 hours to the website times to convert to Spain time. It is mostly realtime. 2. Meteocat samples the temp over 30 minutes, then computes the min/max/avg during ~5 minutes and then outputs the values on the table, so they have at most 40 min of delay as we retry every 5 minutes. 3. There are no duplicates per-se. We update the gauge as soon as we discover a new value. But prometheus will query the metrics every minute, so it will continue to read the same values for 30 min at least. This is fine as they have a very effective mechanism to store duplicates that only takes around 1 bit of information (see https://www.vldb.org/pvldb/vol8/p1816-teller.pdf section 4.1.2).
rarias marked this conversation as resolved
rarias added 2 commits 2025-05-26 11:24:43 +02:00
These sensors are part of their air quality measurements, which just
happen to be very close to our server room.
Author
Owner
I have added another sensor from the UPC C6 building: https://jungle.bsc.es/grafana/d/EKkKVvLVz/hut?orgId=1&from=now-24h&to=now&timezone=browser&refresh=5s&viewPanel=panel-50
abonerib reviewed 2025-05-26 11:59:12 +02:00
@@ -0,0 +29,4 @@
for i in range(7):
for j in range(48):
key = 'week.days[{}].hours[{}].value'.format(i, j)
d[key] = 'OPEN'
Collaborator

Amazing API design

Amazing API design
rarias marked this conversation as resolved
abonerib approved these changes 2025-05-26 11:59:37 +02:00
rarias force-pushed monitor-outside-temp from 8230ea507e to 7a2f37aaa2 2025-05-29 13:02:23 +02:00 Compare
rarias manually merged commit 7a2f37aaa2 into master 2025-05-29 13:07:27 +02:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rarias/jungle#103