53 lines
1.7 KiB
Markdown
53 lines
1.7 KiB
Markdown
# ctlog-uptime-exporter
|
|
|
|
A Prometheus exporter for [Certificate Transparency](https://certificate.transparency.dev/) log uptime data published by Google at:
|
|
|
|
```
|
|
https://www.gstatic.com/ct/compliance/endpoint_uptime_24h.csv
|
|
```
|
|
|
|
The CSV reports the 24-hour uptime percentage for each CT log URL broken down by operation type (`add-chain`, `get-entries`, `get-sth`, etc.). This exporter fetches that CSV on a configurable schedule and exposes the data as Prometheus metrics.
|
|
|
|
## Metrics
|
|
|
|
| Metric | Labels | Description |
|
|
|---|---|---|
|
|
| `ct_log_uptime_ratio` | `log_url`, `endpoint` | 24h uptime as a ratio (0-1) |
|
|
| `ct_log_uptime_fetch_success` | | 1 if the last fetch succeeded, 0 otherwise |
|
|
| `ct_log_uptime_fetch_timestamp_seconds` | | Unix timestamp of the last fetch attempt |
|
|
|
|
Standard `go_*` and `process_*` metrics are also exposed.
|
|
|
|
## Usage
|
|
|
|
```sh
|
|
go build -o ctlog-uptime-exporter .
|
|
./ctlog-uptime-exporter
|
|
```
|
|
|
|
Metrics are served at `http://localhost:9781/metrics`.
|
|
|
|
## Flags
|
|
|
|
| Flag | Default | Description |
|
|
|---|---|---|
|
|
| `-listen` | `:9781` | Address to listen on |
|
|
| `-url` | `https://www.gstatic.com/ct/compliance/endpoint_uptime_24h.csv` | URL of the uptime CSV |
|
|
| `-interval` | `12h` | How often to fetch the CSV |
|
|
| `-jitter` | `5m` | Maximum +/-jitter applied to the fetch interval |
|
|
|
|
The exporter fetches the CSV once on startup, then repeats every `-interval` +/- a random value up to `-jitter`. This avoids thundering-herd effects if multiple instances run in parallel.
|
|
|
|
## Example Prometheus scrape config
|
|
|
|
```yaml
|
|
scrape_configs:
|
|
- job_name: ctlog_uptime
|
|
static_configs:
|
|
- targets: ['localhost:9781']
|
|
```
|
|
|
|
## License
|
|
|
|
Apache 2.0 - see [LICENSE](LICENSE).
|