{
  "title": "Postgres Overview",
  "timezone": "browser",
  "schemaVersion": 39,
  "version": 1,
  "refresh": "10s",
  "panels": [
    {
      "type": "gauge",
      "title": "pg_up",
      "targets": [{ "expr": "pg_up", "refId": "A" }],
      "gridPos": { "x": 0, "y": 0, "w": 4, "h": 6 }
    },
    {
      "type": "timeseries",
      "title": "Active sessions by state",
      "targets": [
        { "expr": "sum by (state,instance) (pg_stat_activity_count)", "refId": "A" }
      ],
      "gridPos": { "x": 4, "y": 0, "w": 20, "h": 6 }
    },
    {
      "type": "timeseries",
      "title": "Transactions per second (commits+rollbacks)",
      "targets": [
        { "expr": "sum(rate(pg_stat_database_xact_commit[1m])) + sum(rate(pg_stat_database_xact_rollback[1m]))", "refId": "A" }
      ],
      "gridPos": { "x": 0, "y": 6, "w": 12, "h": 8 }
    },
    {
      "type": "timeseries",
      "title": "Tuples fetched/returned/inserted/updated/deleted",
      "targets": [
        { "expr": "sum(rate(pg_stat_database_tup_fetched[1m]))", "legendFormat": "fetched", "refId": "A" },
        { "expr": "sum(rate(pg_stat_database_tup_returned[1m]))", "legendFormat": "returned", "refId": "B" },
        { "expr": "sum(rate(pg_stat_database_tup_inserted[1m]))", "legendFormat": "inserted", "refId": "C" },
        { "expr": "sum(rate(pg_stat_database_tup_updated[1m]))", "legendFormat": "updated", "refId": "D" },
        { "expr": "sum(rate(pg_stat_database_tup_deleted[1m]))", "legendFormat": "deleted", "refId": "E" }
      ],
      "gridPos": { "x": 12, "y": 6, "w": 12, "h": 8 }
    }
  ]
}