Skip to content

Commit

Permalink
Set DK attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
russss committed May 30, 2024
1 parent 303d0a1 commit e26624c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dk_geojson/generate_dk_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pynetbox
import os

# prom = PrometheusConnect(url="http://polarize.camp.ccc.de:9090/", disable_ssl=True)
prom = PrometheusConnect(url="https://prometheus.monitoring.emf.camp")

NETBOX_URL = "https://netbox.noc.emfcamp.org/"

Expand All @@ -25,21 +25,20 @@
features = []


""" def get_monitoring_data():
data = prom.get_current_metric_value(
metric_name="probe_success", label_config={"job": "blackbox_icmp"}
)
def get_monitoring_data():
data = prom.get_current_metric_value(metric_name="up")
result = {}
for row in data:
if row["value"][1] == "1" and row["value"][0] > time() - 300:
result[row["metric"]["shortname"]] = True
result[row["metric"]["job"]] = True
else:
result[row["metric"]["shortname"]] = False
result[row["metric"]["job"]] = False

return result


monitoring_data = get_monitoring_data() """
# monitoring_data = get_monitoring_data()
monitoring_data = {}


def device_info(device):
Expand Down Expand Up @@ -82,6 +81,7 @@ def device_info(device):

props = {
"name": location["name"],
"dk": location["name"][:2] == "DK",
"netbox_url": f"{NETBOX_URL}/dcim/locations/{location.id}/",
"devices": sorted(
(device_info(device) for device in devices), key=lambda x: x["type"]
Expand Down

0 comments on commit e26624c

Please sign in to comment.