# Monitoring

Set `GDB_METRICS_BIND` to a `host:port` and the server answers
`GET /metrics` there in the Prometheus text format, and `GET /health` with `ok`.
The endpoint is off by default and has no authentication, so bind it to an
interface only your monitoring can reach.

```yaml
# prometheus.yml
scrape_configs:
  - job_name: galactus
    static_configs:
      - targets: ['db:9187']        # GDB_METRICS_BIND=0.0.0.0:9187
```

| Metric | Type | Meaning |
|---|---|---|
| `gdb_build_info{version}` | gauge | Always 1; the label carries the version |
| `gdb_uptime_seconds` | gauge | Seconds since the server started |
| `gdb_connections_active` | gauge | Connections currently open |
| `gdb_connections_accepted_total` | counter | Connections accepted |
| `gdb_connections_rejected_total` | counter | Connections closed because `GDB_MAX_CONNECTIONS` was reached |
| `gdb_tls_handshake_failures_total` | counter | TLS handshakes that failed |
| `gdb_auth_failures_total` | counter | Rejected authentication attempts |
| `gdb_statements_total{outcome}` | counter | Statements finished: `ok`, `error`, `timeout`, `terminated` |
| `gdb_statements_running` | gauge | Statements executing or waiting on a lock |
| `gdb_statement_duration_seconds` | histogram | Time from `RUN` to the result being ready |
| `gdb_rows_streamed_total` | counter | Result rows sent to clients |
| `gdb_results_deferred_total` | counter | Large results [read as they were pulled](transactions.md#reading-large-results) (from 1.2.0) |
| `gdb_transactions_active` | gauge | Explicit transactions open |
| `gdb_transactions_committed_total` | counter | Explicit transactions committed |
| `gdb_transactions_rolled_back_total` | counter | Explicit transactions rolled back or aborted |
| `gdb_database_nodes{database}` | gauge | Live nodes |
| `gdb_database_relationships{database}` | gauge | Live relationships |

A scrape never waits for a write: a database that is write-locked at that
moment is left out of the two per-database gauges for that scrape. Log, cache
and checkpoint figures are not exported yet.

For one query, `PROFILE` reports per-operator counters; see
[EXPLAIN and PROFILE](../cypher/planning.md). Running statements are listed by
`CALL dbms.listQueries()`; see [transactions](transactions.md#listing-and-stopping-running-statements).

## Related articles

[Server configuration](configuration.md) · [Transactions and concurrency](transactions.md) · [Docker deployment](docker.md)
