Add a systemd unit file + default with flags

This commit is contained in:
2026-03-24 20:37:29 +01:00
parent 699c3680cd
commit 770bfe9806
3 changed files with 58 additions and 0 deletions

View File

@@ -47,6 +47,35 @@ scrape_configs:
- targets: ['localhost:9781'] - targets: ['localhost:9781']
``` ```
## systemd
A unit file and defaults file are included.
```sh
# install binary
go build -o /usr/local/bin/ctlog-uptime-exporter .
# install defaults (edit to taste)
cp ctlog-uptime-exporter.default /etc/default/ctlog-uptime-exporter
# install and start the service
cp ctlog-uptime-exporter.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now ctlog-uptime-exporter
```
Runtime flags are controlled via the `ARGS` variable in `/etc/default/ctlog-uptime-exporter`.
## Grafana dashboard
`dashboard.json` can be imported directly into Grafana (Dashboards -> Import).
It expects a Prometheus datasource and provides:
- Summary stats: number of logs, endpoint types, average uptime, degraded count, fetch status, last fetch time
- Variable selectors for Log URL and Endpoint (both multi-select with All)
- Time series panel showing the rolling 24h uptime ratio over the chosen time range
- Table of the top N least-available log/endpoint pairs (N is selectable: 5, 10, 25, 50)
## License ## License
Apache 2.0 - see [LICENSE](LICENSE). Apache 2.0 - see [LICENSE](LICENSE).

View File

@@ -0,0 +1,9 @@
# Command-line arguments for ctlog-uptime-exporter.
# Install this file as /etc/default/ctlog-uptime-exporter.
#
# -listen address to listen on (default: :9781)
# -url URL of the uptime CSV (default: https://www.gstatic.com/ct/compliance/endpoint_uptime_24h.csv)
# -interval how often to fetch the CSV (default: 12h)
# -jitter maximum +/-jitter on the interval (default: 5m)
ARGS='-listen :9781 -url https://www.gstatic.com/ct/compliance/endpoint_uptime_24h.csv -interval 12h -jitter 5m'

View File

@@ -0,0 +1,20 @@
[Unit]
Description=CT Log Uptime Prometheus Exporter
Documentation=https://git.ipng.ch/certificate-transparency/ctlog-uptime-exporter
After=network-online.target
Wants=network-online.target
[Service]
EnvironmentFile=/etc/default/ctlog-uptime-exporter
ExecStart=/usr/local/bin/ctlog-uptime-exporter $ARGS
Restart=on-failure
RestartSec=5s
DynamicUser=yes
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
CapabilityBoundingSet=
[Install]
WantedBy=multi-user.target