Watch your servers
Send Kiyesi's figures to Prometheus, Grafana or Datadog
Read every server’s grade, findings and figures from Prometheus, Grafana or Datadog, from one address.
It needs credit on the team: the trial alone is not enough. It sends names and numbers only (the names you gave servers, projects, databases and checks), never an address, an email, a token or a password.
Make an export token
Section titled “Make an export token”In the dashboard, Settings, Prometheus export: give the token a name, such as Grafana Cloud, and the code from your authenticator app, then Make an export token.
The token is shown once, already inside the settings for Prometheus, Grafana Alloy and Datadog. Pick your tool and copy them.
You need the Download and export files switch: Owners and Admins have it; for anyone else, an owner turns it on in their role (Team, Roles and access).
Give it to your tool
Section titled “Give it to your tool”Each tool reads https://api.kiyesi.dev/v1/export/prometheus with the token as a bearer token. Once a minute is enough: the figures change once a minute.
See it
Section titled “See it”In Prometheus, kiyesi_grade_score lists your servers’ grades. In Grafana, import Kiyesi’s dashboard.
Prometheus
Section titled “Prometheus”In prometheus.yml, under scrape_configs, then reload Prometheus:
scrape_configs: - job_name: kiyesi scrape_interval: 60s scheme: https metrics_path: /v1/export/prometheus authorization: credentials: kex_your_token static_configs: - targets: ["api.kiyesi.dev"]To keep the token out of the file, put it alone in a file readable only by Prometheus and use credentials_file: /etc/prometheus/kiyesi-token instead of credentials.
Grafana
Section titled “Grafana”Grafana Cloud, or any Grafana fed by Grafana Alloy: in Alloy’s config.alloy, where forward_to names your own remote_write (Grafana Cloud’s, for Grafana Cloud):
prometheus.scrape "kiyesi" { targets = [{"__address__" = "api.kiyesi.dev"}] scheme = "https" metrics_path = "/v1/export/prometheus" scrape_interval = "60s" authorization { type = "Bearer" credentials = "kex_your_token" } forward_to = [prometheus.remote_write.default.receiver]}Grafana with your own Prometheus: scrape it as above, and add that Prometheus as a data source.
Then Dashboards, New, Import, and upload kiyesi-dashboard.json, choosing the Prometheus data source it asks for. It shows each server’s grade, critical findings, open incidents, CPU, memory, disk, requests and errors, your databases’ storage and your uptime checks, with a Server filter at the top.
Datadog
Section titled “Datadog”On the Datadog Agent, save this as conf.d/openmetrics.d/conf.yaml, then restart the agent:
init_config:instances: - openmetrics_endpoint: https://api.kiyesi.dev/v1/export/prometheus namespace: kiyesi raw_metric_prefix: kiyesi_ metrics: - .* headers: Authorization: Bearer kex_your_token min_collection_interval: 60The figures arrive as kiyesi.grade_score, kiyesi.cpu_usage_percent and so on. Datadog bills them as custom metrics: about 17 for each server, 4 for each database and 2 for each uptime check. To pay for fewer, list only the ones you want under metrics, such as - grade_score and - findings.
What it sends
Section titled “What it sends”Every series is a gauge. A server’s series carry its server, project and environment.
| Series | What it is | Seen with |
|---|---|---|
kiyesi_up |
1 when the server reported in the last 5 minutes, else 0 | Servers |
kiyesi_last_report_timestamp_seconds |
When it last reported | Servers |
kiyesi_grade_score |
Its grade, 0 to 100, from the latest scan | Servers |
kiyesi_grade |
Its grade letter as the grade label (A to F); always 1 |
Servers |
kiyesi_findings |
Findings in the latest scan, by severity (critical, warning) |
Servers |
kiyesi_cpu_usage_percent |
CPU in use, of all cores | Metrics |
kiyesi_memory_used_bytes, kiyesi_memory_total_bytes |
Memory | Metrics |
kiyesi_swap_used_bytes, kiyesi_swap_total_bytes |
Swap | Metrics |
kiyesi_disk_used_bytes, kiyesi_disk_total_bytes |
Each disk, by mount |
Metrics |
kiyesi_network_receive_bytes_per_second, kiyesi_network_transmit_bytes_per_second |
Network in and out | Metrics |
kiyesi_http_requests_per_minute, kiyesi_http_errors_per_minute |
Requests answered, and server errors (5xx), in the last minute | Metrics |
kiyesi_incidents_open |
Open incidents, by severity |
Incidents |
kiyesi_database_size_bytes, kiyesi_database_limit_bytes |
A database’s storage and its limit, by server, database, engine |
Databases |
kiyesi_database_connections, kiyesi_database_max_connections |
Its connections, open and allowed | Databases |
kiyesi_uptime_up |
1 when the uptime check passes, else 0, by check |
Uptime |
kiyesi_uptime_response_seconds |
How long its last check took | Uptime |
kiyesi_export_source_ok |
1 when the export read that source this time; 0 if one could not be read, while the rest are still answered |
A server with nothing new for 3 minutes has no CPU, memory, disk or request figures until it reports again; kiyesi_up says it is silent.
Some alert rules to start with, for Prometheus:
groups: - name: kiyesi rules: - alert: KiyesiGradeDropped expr: kiyesi_grade_score < 70 for: 1h - alert: KiyesiServerSilent expr: kiyesi_up == 0 for: 10m - alert: KiyesiDiskFilling expr: kiyesi_disk_used_bytes / kiyesi_disk_total_bytes > 0.9 for: 15mWho sees what
Section titled “Who sees what”A token reads what the person who made it may see, as of each scrape: the servers, projects and environments of their access, and only the areas their role shows (a role without Databases sends no database series). If they leave the team, or their role loses the Download and export files switch, the token stops at once. Making a token asks for a fresh two-step code, and it appears in the activity log.
In Settings, Prometheus export, you see your tokens and when each was last scraped, and remove them. With Manage on settings, you see and can remove the team’s.
If something goes wrong
Section titled “If something goes wrong”- 401, “This export token is not valid”: it was removed, its maker left the team or lost the download and export switch, or it was copied in part. Make a new one.
- 402, “Kiyesi’s export needs credit on the team”: top up in Credit; the next scrape is answered.
- 429, too many requests: scrape at most every 15 seconds; once a minute is enough.
kiyesi_export_source_ok{source="metrics"} 0: the figures could not be read just then; the grades, databases and uptime checks are still there, and the next scrape tries again.