A simple uptime monitor for Prometheus
- Rust 100%
| LICENSES | add REUSE licensing information and dual license under GAL & AGPL | |
| src | add REUSE licensing information and dual license under GAL & AGPL | |
| .gitignore | add REUSE licensing information and dual license under GAL & AGPL | |
| .ignore | add REUSE licensing information and dual license under GAL & AGPL | |
| Cargo.lock | add FreshRSS support | |
| Cargo.lock.license | add REUSE licensing information and dual license under GAL & AGPL | |
| Cargo.toml | add REUSE licensing information and dual license under GAL & AGPL | |
| README.md | add REUSE licensing information and dual license under GAL & AGPL | |
up_metrics
A simple uptime monitor and stats collector for prometheus.
Why?
FreshRSS and Plausible don't have metrics but I want to have an up value and some stats for them.
Configuration & Usage
Here is an example config. Place it at ~/apps/up_metrics:
[[endpoints]]
name = "freshrss"
type = "freshrss"
host = "freshrss.jak2k.eu"
user = "jak2k"
token = "..." # From curl 'https://freshrss.example.net/api/greader.php/accounts/ClientLogin?Email={{user}}&Passwd={{app_password}}'
[[endpoints]]
name = "website"
type = "http_get"
url = "https://jak2k.eu/"
[[endpoints]]
name = "plausible"
type = "http_get"
url = "https://plausible.jak2k.eu/"
[[endpoints]]
name = "linkding"
type = "linkding"
host = "linkding.jak2k.eu"
token = "..."
Build the binary and place it at ~/apps/up_metrics/up_metrics. Then create this file at ~/.config/systemd/user/up-metrics.service:
[Unit]
Description=Up Metrics Health Check Exporter
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=%h/apps/up_metrics/up_metrics %h/apps/up_metrics/config.toml
Restart=always
RestartSec=10
WorkingDirectory=%h/apps/up_metrics
# Security settings
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=%h/apps/up_metrics
PrivateTmp=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
# Resource limits
LimitNOFILE=65536
LimitNPROC=4096
# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=up-metrics
[Install]
WantedBy=default.target
Now run systemctl --user daemon-reload and systemctl --user enable --now up-metrics and add https://localhost:9095 to your Prometheus config. Don't forget to make your user linger: sudo loginctl enable-linger $USER.
Queries you can use in Grafana
linkding_bookmarks{app_type="linkding"}freshrss_feeds{app="freshrss"}freshrss_posts_unread{app="freshrss"}- This one only works after two hours of collecting data:
avg_over_time( clamp_min( (freshrss_posts_unread{app_type="freshrss"} offset 1h) - freshrss_posts_unread{app_type="freshrss"}, 0 )[1h:1h] ) sum by(app) (up{app=~".+"})