131 lines
5.1 KiB
Django/Jinja
131 lines
5.1 KiB
Django/Jinja
{
|
|
"nodes": [
|
|
{
|
|
"id": "internet",
|
|
"title": "Internet",
|
|
"subtitle": "public",
|
|
"group": "edge"
|
|
},
|
|
{
|
|
"id": "ingress",
|
|
"title": "Ingress",
|
|
"subtitle": "animeistrash",
|
|
"group": "edge",
|
|
"up": "up{job=\"node\",host=\"ingress\"}",
|
|
"stat": "100 - (avg(rate(node_cpu_seconds_total{job=\"node\",host=\"ingress\",mode=\"idle\"}[5m])) * 100)",
|
|
"stat_unit": "pct"
|
|
},
|
|
{
|
|
"id": "tunnel",
|
|
"title": "WireGuard",
|
|
"subtitle": "{{ wireguard_ingress_ip }} to {{ wireguard_beepi_ip }}",
|
|
"group": "edge",
|
|
"up": "max(wireguard_peer_up{peer=\"beepi\"})",
|
|
"stat": "max(wireguard_peer_handshake_age_seconds{peer=\"beepi\"})",
|
|
"stat_unit": "h"
|
|
},
|
|
{
|
|
"id": "beepi",
|
|
"title": "beepi",
|
|
"subtitle": "raspberry pi",
|
|
"group": "host",
|
|
"up": "up{job=\"node\",host=\"beepi\"}",
|
|
"stat": "100 - (avg(rate(node_cpu_seconds_total{job=\"node\",host=\"beepi\",mode=\"idle\"}[5m])) * 100)",
|
|
"stat_unit": "pct"
|
|
},
|
|
{% for service in monitored_services %}
|
|
{
|
|
"id": "{{ service.name }}",
|
|
"title": "{{ service.title }}",
|
|
"subtitle": "{{ service.vhost | default(service.group) }}",
|
|
"group": "{{ service.group }}",
|
|
"enabled": "max(service_enabled{service=\"{{ service.name }}\"})",
|
|
{% if service.probe is defined or service.tcp is defined %}
|
|
"up": "min(probe_success{service=\"{{ service.name }}\",vantage=\"local\"})",
|
|
"stat": "max(probe_duration_seconds{service=\"{{ service.name }}\",vantage=\"local\"})",
|
|
"stat_unit": "s"
|
|
{% elif service.vhost is defined %}
|
|
"up": "min(probe_success{service=\"{{ service.name }}\",vantage=\"nginx\"})",
|
|
"stat": "max(probe_duration_seconds{service=\"{{ service.name }}\",vantage=\"nginx\"})",
|
|
"stat_unit": "s"
|
|
{% else %}
|
|
"up": "min(service_units_active{service=\"{{ service.name }}\"} / service_units_total{service=\"{{ service.name }}\"})"
|
|
{% endif %}
|
|
},
|
|
{% endfor %}
|
|
{
|
|
"id": "raid",
|
|
"title": "RAID",
|
|
"subtitle": "{{ backup_raid_mount }}",
|
|
"group": "storage",
|
|
"up": "max(backup_raid_mounted)",
|
|
"stat": "max(node_filesystem_avail_bytes{mountpoint=\"{{ backup_raid_mount }}\"})",
|
|
"stat_unit": "bytes",
|
|
"fill": "1 - (max(node_filesystem_avail_bytes{mountpoint=\"{{ backup_raid_mount }}\"}) / max(node_filesystem_size_bytes{mountpoint=\"{{ backup_raid_mount }}\"}))"
|
|
},
|
|
{% for job in backup_jobs %}
|
|
{% if job.name != 'offsite' %}
|
|
{
|
|
"id": "backup-{{ job.name }}",
|
|
"title": "{{ job.title }}",
|
|
"subtitle": "backup job",
|
|
"group": "backup",
|
|
"up": "(max(backup_last_status{backup_job=\"{{ job.name }}\"}) == 1) and ((time() - max(backup_last_success_timestamp_seconds{backup_job=\"{{ job.name }}\"})) < {{ job.max_age_hours * 3600 }})",
|
|
"stat": "time() - max(backup_last_success_timestamp_seconds{backup_job=\"{{ job.name }}\"})",
|
|
"stat_unit": "h"
|
|
},
|
|
{% endif %}
|
|
{% endfor %}
|
|
{
|
|
"id": "offsite",
|
|
"title": "Offsite sync",
|
|
"subtitle": "daily 07:00",
|
|
"group": "storage",
|
|
"up": "(time() - max(backup_last_success_timestamp_seconds{backup_job=\"offsite\"})) < {{ 26 * 3600 }}",
|
|
"stat": "time() - max(backup_last_success_timestamp_seconds{backup_job=\"offsite\"})",
|
|
"stat_unit": "h"
|
|
},
|
|
{
|
|
"id": "hetzner",
|
|
"title": "Hetzner box",
|
|
"subtitle": "{{ hetzner_host | default('storage box') }}",
|
|
"group": "storage",
|
|
"up": "(max(hetzner_reachable) == 1) and (max(hetzner_remote_files{path=\"beepi\"}) > 0)",
|
|
"stat": "max(hetzner_remote_bytes{path=\"beepi\"})",
|
|
"stat_unit": "bytes",
|
|
"fill": "sum(hetzner_remote_bytes) / {{ hetzner_box_bytes }}"
|
|
},
|
|
{
|
|
"id": "uptimerobot",
|
|
"title": "External checks",
|
|
"subtitle": "uptimerobot",
|
|
"group": "edge",
|
|
"dashboard": "/d/beepi-uptimerobot",
|
|
"enabled": "max(uptimerobot_api_ok)",
|
|
"up": "min(uptimerobot_monitor_up and on (monitor) (uptimerobot_monitor_enabled == 1))",
|
|
"stat": "count(uptimerobot_monitor_enabled == 1)"
|
|
}
|
|
],
|
|
"edges": [
|
|
{"source": "uptimerobot", "target": "internet", "label": "probes"},
|
|
{"source": "internet", "target": "ingress", "label": "public"},
|
|
{"source": "ingress", "target": "tunnel", "label": "dnat"},
|
|
{"source": "tunnel", "target": "beepi", "label": "wg0"},
|
|
{% for service in monitored_services %}
|
|
{% if service.vhost is defined and service.name != 'nginx' %}
|
|
{"source": "nginx", "target": "{{ service.name }}", "label": "proxy"},
|
|
{% endif %}
|
|
{% if service.vhost is not defined %}
|
|
{"source": "beepi", "target": "{{ service.name }}", "label": "{{ service.group }}"},
|
|
{% endif %}
|
|
{% endfor %}
|
|
{"source": "beepi", "target": "nginx", "label": "tls"},
|
|
{"source": "beepi", "target": "backup-daily", "label": "03:00"},
|
|
{"source": "backup-daily", "target": "backup-weekly", "label": "sun 05:00"},
|
|
{"source": "backup-daily", "target": "backup-restoretest", "label": "sun 06:00"},
|
|
{"source": "backup-daily", "target": "raid", "label": "archive"},
|
|
{"source": "raid", "target": "offsite", "label": "rsync"},
|
|
{"source": "offsite", "target": "hetzner", "label": "ssh 23"}
|
|
]
|
|
}
|