{
  "__inputs": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.2.0-beta1"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "originalTemplating": [],
  "originalTime": {
    "from": "now-15m",
    "to": "now-10s"
  },
  "panels": [
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 43,
      "panels": [
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- Information collected 1 hour ago at max",
          "fontSize": "100%",
          "gridPos": {
            "h": 14,
            "w": 8,
            "x": 0,
            "y": 1
          },
          "id": 5,
          "links": [],
          "pageSize": 10,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "hide": false,
              "rawSql": "with information_panel as (\n(SELECT \n'Collection time : ' ||  to_char(dtcol, 'YYYY/MM/DD HH24:MI:SS') as collection_time,\n'Hostname : ' || cluster_hostname as hostname,\n'Cluster version : '|| cluster_postgres_version as version,\n'Cluster port : '|| cluster_port as port,\n'WAL archiving : '|| cluster_archive_mode as archive_mode,\n'Number of processes : '|| cluster_processes as processes,\n'Shared buffers size : '|| cluster_shared_buffers as shared_buffers,\n'Cluster size : '|| cluster_pretty_size as cluster_size,\n'Databases : '|| cluster_databases as databases,\n'Description : '|| cluster_comment as comment\n from traqueur_cluster_information where $__timeFilter(dtcol) order by dtcol desc fetch first 1 rows only)\n)\nselect unnest(array[collection_time, hostname, comment, version, port, processes, archive_mode, shared_buffers, cluster_size, databases]) as \"Informations\" from information_panel\n",
              "refId": "B"
            }
          ],
          "timeFrom": "1h",
          "title": "Cluster Informations",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "fontSize": "100%",
          "gridPos": {
            "h": 14,
            "w": 8,
            "x": 8,
            "y": 1
          },
          "id": 32,
          "links": [],
          "pageSize": 10,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "hide": false,
              "rawSql": "with information_panel as (\n(SELECT \n'Collection time : ' ||  to_char(dtcol, 'YYYY/MM/DD HH24:MI:SS') as collection_time,\n'Global note : ' || cluster_bench_global_power as bench_global_power,\n'CPU/RAM speed : '|| cluster_bench_cpu_ram as bench_cpu_ram,\n'IO speed : '|| cluster_bench_io as bench_io,\n'Comment : '|| cluster_bench_comment as comment\n from traqueur_cluster_bench order by dtcol desc fetch first 1 rows only)\n)\nselect unnest(array[collection_time, bench_global_power, bench_cpu_ram, bench_io, comment]) as \"Informations\" from information_panel\n",
              "refId": "B"
            }
          ],
          "title": "Benchmark Informations",
          "transform": "table",
          "type": "table"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "#58140c",
            "#58140c"
          ],
          "datasource": "local_traqueur",
          "description": "- last 5 minutes",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": true,
            "thresholdLabels": false,
            "thresholdMarkers": false
          },
          "gridPos": {
            "h": 14,
            "w": 8,
            "x": 16,
            "y": 1
          },
          "id": 16,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  $__time(dtcol),\n  100 - pourcentage_cpu as \"non_cpu_activity\"\nFROM\n  traqueur_sessions_actives\nWHERE\n   $__timeFilter(dtcol) and datid is not null\n  \n",
              "refId": "A"
            }
          ],
          "thresholds": "20",
          "timeFrom": "5m",
          "timeShift": null,
          "title": "NON CPU activity",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "avg"
        }
      ],
      "repeat": null,
      "title": "General informations & activity type",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 44,
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "local_traqueur",
          "fill": 1,
          "gridPos": {
            "h": 10,
            "w": 14,
            "x": 0,
            "y": 2
          },
          "id": 23,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": false,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null as zero",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  dtcol as \"time\",\n  count(*)-1 as \"active processes\"\nFROM\n  traqueur_sessions_actives\nWHERE\n   $__timeFilter(dtcol)\n  group by dtcol\norder by dtcol\n\n  \n\n",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "Active sessions *",
          "tooltip": {
            "shared": false,
            "sort": 1,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "decimals": 0,
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": true
            },
            {
              "decimals": 0,
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- top 10\n- last completed minute of collection within the last 5 minutes",
          "fontSize": "100%",
          "gridPos": {
            "h": 10,
            "w": 10,
            "x": 14,
            "y": 2
          },
          "hideTimeOverride": true,
          "id": 37,
          "links": [],
          "pageSize": 5,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "detections",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "pid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "with collecte_complete(derniere) as (select date_trunc('minute', max(dtcol) - interval '1 minute') from traqueur_sessions_actives where  $__timeFilter(dtcol))\nSELECT datname as \"database\", pid, application, detections from\n(SELECT date_trunc('minute', dtcol) as \"time\", datname, pid, application_name as application, count(*) as detections\nFROM traqueur_sessions_actives\nwhere $__timeFilter(dtcol) and date_trunc('minute', dtcol) = (select derniere from collecte_complete) and datid is not null\ngroup by date_trunc('minute', dtcol),  pid, application_name, datname\nFETCH FIRST 10 ROWS ONLY) r\norder by detections desc",
              "refId": "A"
            }
          ],
          "timeFrom": "5m",
          "title": "Current PIDs & applications",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- top 10\n- last completed minute of collection within the last 5 minutes",
          "fontSize": "100%",
          "gridPos": {
            "h": 10,
            "w": 24,
            "x": 0,
            "y": 12
          },
          "hideTimeOverride": true,
          "id": 29,
          "links": [],
          "minSpan": 24,
          "pageSize": 5,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "detections",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "distinct",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "distinct_exe",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "with collecte_complete(derniere) as (select date_trunc('minute', max(dtcol) - interval '1 minute') from traqueur_sessions_actives where  $__timeFilter(dtcol))\nSELECT datname as \"database\", application, query, detections, distinct_exe from\n(SELECT date_trunc('minute', dtcol) as \"time\", datname, application_name as \"application\", coalesce(tquery, query) as \"query\", count(*) as detections, count(distinct query_start) as distinct_exe\nFROM traqueur_sessions_actives\nwhere  $__timeFilter(dtcol) and date_trunc('minute', dtcol) = (select derniere from collecte_complete) and datid is not null\ngroup by date_trunc('minute', dtcol),  coalesce(tquery, query), application_name,datname\nFETCH FIRST 10 ROWS ONLY) r\norder by detections desc",
              "refId": "A"
            }
          ],
          "timeFrom": "5m",
          "title": "Current applications & queries",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- top 10\n- last completed minute of collection within the last 5 minutes",
          "fontSize": "100%",
          "gridPos": {
            "h": 10,
            "w": 24,
            "x": 0,
            "y": 22
          },
          "hideTimeOverride": true,
          "id": 42,
          "links": [],
          "minSpan": 24,
          "pageSize": 5,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "detections",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "distinct",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "distinct_exe",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "pid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "with collecte_complete(derniere) as (select date_trunc('minute', max(dtcol) - interval '1 minute') from traqueur_sessions_actives where $__timeFilter(dtcol))\nSELECT datname as \"database\", pid, query, detections, distinct_exe from\n(SELECT date_trunc('minute', dtcol) as \"time\", datname, pid, coalesce(tquery, query) as \"query\", count(*) as detections, count(distinct query_start) as distinct_exe\nFROM traqueur_sessions_actives\nwhere $__timeFilter(dtcol) and date_trunc('minute', dtcol) = (select derniere from collecte_complete) and datid is not null\ngroup by date_trunc('minute', dtcol),  coalesce(tquery, query), pid, datname\nFETCH FIRST 10 ROWS ONLY) r\norder by detections desc",
              "refId": "A"
            }
          ],
          "timeFrom": "5m",
          "title": "Current PIDs & queries",
          "transform": "table",
          "type": "table"
        }
      ],
      "repeat": null,
      "title": "Current activity (pids, applications, queries)",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 2
      },
      "id": 45,
      "panels": [
        {
          "aliasColors": {},
          "bars": true,
          "dashLength": 10,
          "dashes": false,
          "datasource": "local_traqueur",
          "description": "- last completed minute of collection within the last 5 minutes",
          "fill": 1,
          "gridPos": {
            "h": 11,
            "w": 14,
            "x": 0,
            "y": 3
          },
          "hideTimeOverride": true,
          "id": 38,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": false,
            "total": false,
            "values": false
          },
          "lines": false,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "with collecte_complete(derniere) as (select date_trunc('minute', max(dtcol) - interval '1 minute') from traqueur_sessions_actives where  $__timeFilter(dtcol))\nSELECT time, wait_event_type as \"metric\", detections from\n(SELECT date_trunc('minute', dtcol) as \"time\", coalesce(wait_event_type, 'CPU or ?') as \"wait_event_type\", count(*) as detections\nFROM traqueur_sessions_actives\nWHERE  $__timeFilter(dtcol) and date_trunc('minute', dtcol) = (select derniere from collecte_complete) and datid is not null\ngroup by date_trunc('minute', dtcol),  coalesce(wait_event_type, 'CPU or ?')\nFETCH FIRST 5 ROWS ONLY) r\norder by detections desc",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": "5m",
          "timeShift": null,
          "title": "Current wait event types",
          "tooltip": {
            "shared": false,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "series",
            "name": null,
            "show": true,
            "values": [
              "total"
            ]
          },
          "yaxes": [
            {
              "decimals": 0,
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- top 10\n- last completed minute of collection within the last 5 minutes",
          "fontSize": "100%",
          "gridPos": {
            "h": 11,
            "w": 10,
            "x": 14,
            "y": 3
          },
          "hideTimeOverride": true,
          "id": 31,
          "links": [],
          "minSpan": 24,
          "pageSize": 10,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "#7eb26d"
              ],
              "decimals": 0,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "with collecte_complete(derniere) as (select date_trunc('minute', max(dtcol) - interval '1 minute') from traqueur_sessions_actives where  $__timeFilter(dtcol))\nSELECT datname as \"database\", wait_event_type, detections from\n(SELECT datname, date_trunc('minute', dtcol) as \"time\", coalesce(wait_event_type, 'CPU or ?') as \"wait_event_type\", count(*) as detections\nFROM traqueur_sessions_actives\nWHERE  $__timeFilter(dtcol) and date_trunc('minute', dtcol) = (select derniere from collecte_complete) and datid is not null\ngroup by date_trunc('minute', dtcol),  coalesce(wait_event_type, 'CPU or ?'), datname\nFETCH FIRST 10 ROWS ONLY) r\norder by detections desc",
              "refId": "A"
            }
          ],
          "timeFrom": "5m",
          "title": "Current wait event types",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- top 10\n- last completed minute of collection within the last 5 minutes",
          "fontSize": "100%",
          "gridPos": {
            "h": 11,
            "w": 24,
            "x": 0,
            "y": 14
          },
          "hideTimeOverride": true,
          "id": 22,
          "links": [],
          "pageSize": 5,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "detections",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "pattern": "wait_event_type",
              "preserveFormat": false,
              "sanitize": false,
              "thresholds": [],
              "type": "string",
              "unit": "short"
            },
            {
              "alias": "distinct",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "distinct_exe",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "with collecte_complete(derniere) as (select date_trunc('minute', max(dtcol) - interval '1 minute') from traqueur_sessions_actives where $__timeFilter(dtcol))\nSELECT datname as \"database\", wait_event_type, query, detections, distinct_exe from\n(SELECT datname, date_trunc('minute', dtcol) as \"time\", coalesce(tquery, query) as \"query\", coalesce(wait_event_type, 'CPU or ?') as \"wait_event_type\", count(*) as detections, count(distinct query_start) as distinct_exe\nFROM traqueur_sessions_actives\nwhere $__timeFilter(dtcol) and date_trunc('minute', dtcol) = (select derniere from collecte_complete) and datid is not null\ngroup by date_trunc('minute', dtcol),  coalesce(tquery, query), coalesce(wait_event_type, 'CPU or ?'), datname\nFETCH FIRST 10 ROWS ONLY) r\norder by detections desc",
              "refId": "A"
            }
          ],
          "timeFrom": "5m",
          "title": "Current wait event types & queries",
          "transform": "table",
          "type": "table"
        }
      ],
      "repeat": null,
      "title": "Current waits",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 3
      },
      "id": 46,
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "local_traqueur",
          "decimals": 0,
          "fill": 1,
          "gridPos": {
            "h": 9,
            "w": 10,
            "x": 0,
            "y": 70
          },
          "id": 27,
          "legend": {
            "avg": false,
            "current": false,
            "hideEmpty": true,
            "hideZero": true,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": false,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null as zero",
          "percentage": false,
          "pointradius": 1,
          "points": true,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  $__time(dtcol),\n  count(*) as \"blocked sessions\"\nFROM\n  traqueur_sessions_actives\nWHERE\n$__timeFilter(dtcol) and datid is not null and blockers is not null\n  group by dtcol\norder by dtcol\n\n  \n\n",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "Blocked sessions *",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "decimals": 0,
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- blocked/blockers by minute within the last 5 minutes",
          "fontSize": "100%",
          "gridPos": {
            "h": 9,
            "w": 14,
            "x": 10,
            "y": 70
          },
          "id": 28,
          "links": [],
          "pageSize": 5,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "pid",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "pid",
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Start time (1m period)",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "pattern": "time",
              "thresholds": [],
              "type": "date",
              "unit": "short"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "SELECT date_trunc('minute', dtcol) as \"time\", array_agg(distinct pid) as \"blocked pids\",  blockers as blockers from traqueur_sessions_actives where  $__timeFilter(dtcol) and blockers is not null group by time, blockers order by \"time\" desc",
              "refId": "A"
            }
          ],
          "timeFrom": "5m",
          "title": "Blocked pids & final blockers",
          "transform": "table",
          "type": "table"
        }
      ],
      "repeat": null,
      "title": "Locks : blocked pids & blockers",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 4
      },
      "id": 47,
      "panels": [
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "",
          "fontSize": "100%",
          "gridPos": {
            "h": 3,
            "w": 24,
            "x": 0,
            "y": 5
          },
          "height": "50",
          "hideTimeOverride": false,
          "id": 6,
          "links": [],
          "pageSize": 1,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Start time (1h period max)",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "link": false,
              "pattern": "detections",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Detections",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "Total",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "application - query hash value -  query text",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "link": false,
              "pattern": "metric",
              "preserveFormat": false,
              "sanitize": false,
              "thresholds": [],
              "type": "string",
              "unit": "short"
            },
            {
              "alias": "Detections",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "Value",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "distinct",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "distinct_exe",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "average active sessions",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "pattern": "average_active_sessions",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "committed transactions per second",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "pattern": "committed_transactions_by_sec",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "rolled back transactions per second",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "pattern": "rolled_back_transactions_by_sec",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "with tentatives(nb) as (select count(*) from traqueur_sessions_actives where $__timeFilter(dtcol) and datid is null),\nstats as (select datname, min(extract (epoch from dtcol)) mindtcol, max(extract (epoch from dtcol)) maxdtcol, min(xact_commit) mincom, min(xact_rollback) minrol, max(xact_commit) maxcom, max(xact_rollback) maxrol from traqueur_cluster_stats where $__timeFilter(dtcol) and not $__timeFilter(stats_reset) group by datname),\ncommitted_transactions as (select (sum(maxcom)-sum(mincom))/(min(maxdtcol)-min(mindtcol)) as committed_transactions_by_sec from stats),\nrolled_back_transactions as (select (sum(maxrol)-sum(minrol))/(min(maxdtcol)-min(mindtcol)) as rolled_back_transactions_by_sec from stats)\nSELECT\n   count(*) as detections, \n   count(distinct query_start) as distinct_exe, \n   (count(*)::real/(select nb from tentatives)) as average_active_sessions, \n   (select committed_transactions_by_sec from committed_transactions) as committed_transactions_by_sec,\n   (select rolled_back_transactions_by_sec from rolled_back_transactions) as rolled_back_transactions_by_sec\nFROM\n  traqueur_sessions_actives\nWHERE\n   $__timeFilter(dtcol) and datid is not null\n\n\n\n\n",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Global charge *",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- top 100",
          "fontSize": "100%",
          "gridPos": {
            "h": 3,
            "w": 24,
            "x": 0,
            "y": 8
          },
          "hideTimeOverride": false,
          "id": 41,
          "links": [],
          "pageSize": 5,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 1,
            "desc": true
          },
          "styles": [
            {
              "alias": "Start time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "link": false,
              "pattern": "detections",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Detections",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "Total",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "database - application - query hash value -  query text",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "link": false,
              "pattern": "metric",
              "preserveFormat": false,
              "sanitize": false,
              "thresholds": [],
              "type": "string",
              "unit": "short"
            },
            {
              "alias": "Detections",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "Value",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "distinct",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "SELECT\n   datname || ' -' || case when length(coalesce(application_name , '')) = 0 then '?' else application_name end || ' - ' || coalesce(itquery, iquery) || ' - ' || coalesce(tquery, query) as metric, count(*) as detections, count(distinct query_start) as distinct\nFROM\n  traqueur_sessions_actives\nWHERE\n   $__timeFilter(dtcol) and datid is not null\ngroup by metric\norder by detections desc\nfetch first 1000 rows only \n\n\n\n",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Top Queries *",
          "transform": "table",
          "type": "table"
        }
      ],
      "repeat": null,
      "title": "Global charge and top queries",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "id": 48,
      "panels": [
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- by hour",
          "fontSize": "100%",
          "gridPos": {
            "h": 16,
            "w": 24,
            "x": 0,
            "y": 6
          },
          "id": 13,
          "links": [],
          "minSpan": 24,
          "pageSize": 10,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 0,
            "desc": true
          },
          "styles": [
            {
              "alias": "Start time (1h period max)",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "#7eb26d"
              ],
              "decimals": 0,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "with tsa_agg as (select min(dtcol) as mindtcol, date_trunc('hour', dtcol) as dtrunc, wait_event_type, count(*)  as detections\nFROM\n  traqueur_sessions_actives\nWHERE \n   $__timeFilter(dtcol) and datid is not null\ngroup by dtrunc, wait_event_type)\nselect case when dtrunc  < (select min(mindtcol) from tsa_agg) then (select min(mindtcol) from tsa_agg) else dtrunc end as \"time\", \n       coalesce(wait_event_type, 'CPU or ?') as metric,\n       detections\nfrom tsa_agg\norder by \"time\" desc, detections desc;\n\n\n",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Top wait event types *",
          "transform": "timeseries_to_columns",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- top 100",
          "fontSize": "90%",
          "gridPos": {
            "h": 16,
            "w": 24,
            "x": 0,
            "y": 22
          },
          "hideTimeOverride": false,
          "id": 25,
          "links": [],
          "minSpan": 24,
          "pageSize": 10,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Wait event type - wait event",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "metric",
              "type": "string"
            },
            {
              "alias": "Detections",
              "colorMode": null,
              "colors": [
                "#c15c17",
                "#890f02",
                "#58140c"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "Value",
              "thresholds": [
                ""
              ],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "#7eb26d"
              ],
              "decimals": 0,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "SELECT coalesce(wait_event_type || ' - ' || wait_event, 'CPU or ?') as metric,\n  count(*) as detections\n  from traqueur_sessions_actives\nwhere $__timeFilter(dtcol) and datid is not null\ngroup by metric\norder by count(*) desc\nFETCH FIRST 100 ROWS ONLY",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "title": "Top wait events *",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- top 1000",
          "fontSize": "90%",
          "gridPos": {
            "h": 16,
            "w": 24,
            "x": 0,
            "y": 38
          },
          "hideTimeOverride": false,
          "id": 40,
          "links": [],
          "minSpan": 24,
          "pageSize": 10,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": null,
            "desc": false
          },
          "styles": [
            {
              "alias": "Detections",
              "colorMode": null,
              "colors": [
                "#c15c17",
                "#890f02",
                "#58140c"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "Value",
              "thresholds": [
                ""
              ],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "query text",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "query",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "wait event",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "pattern": "metric",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "hash value",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "iquery",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "#7eb26d"
              ],
              "decimals": 0,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "SELECT \n  datname as \"database\", coalesce(itquery, iquery) as iquery, coalesce(tquery, query) as query, coalesce(wait_event_type || ' - ' || wait_event, 'CPU or ?') as metric,\n  count(*) as detections\n  from traqueur_sessions_actives\nwhere $__timeFilter(dtcol) and datid is not null\ngroup by coalesce(itquery, iquery), coalesce(tquery, query), metric, datname\norder by count(*) desc\nFETCH FIRST 1000 ROWS ONLY",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "title": "Top queries & wait events *",
          "transform": "table",
          "type": "table"
        }
      ],
      "repeat": null,
      "title": "Top waits",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 6
      },
      "id": 49,
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "#890f02",
            "#bf1b00"
          ],
          "datasource": "local_traqueur",
          "description": "- current cpu load excluding traqueur",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": true,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 11,
            "w": 8,
            "x": 0,
            "y": 7
          },
          "id": 39,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "minSpan": null,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  $__time(dtcol),\n  pourcentage_cpu\nFROM\n  traqueur_sessions_actives\nWHERE\n    $__timeFilter(dtcol) and datid is null\norder by dtcol\n\n  \n",
              "refId": "A"
            }
          ],
          "thresholds": "90",
          "timeFrom": "5m",
          "title": "CPU load",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "aliasColors": {},
          "bars": true,
          "dashLength": 10,
          "dashes": false,
          "datasource": "local_traqueur",
          "description": "- Last 5 minutes",
          "fill": 1,
          "gridPos": {
            "h": 11,
            "w": 16,
            "x": 8,
            "y": 7
          },
          "id": 30,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": false,
            "total": false,
            "values": false
          },
          "lines": false,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "with vals_deb as (select dtcol, user_traqueur, system_traqueur, idle_traqueur, iowait_traqueur from traqueur_times where dtcol = (select min(dtcol) from traqueur_times where $__timeFilter(dtcol))),\nvals_fin as (select  dtcol, user_traqueur, system_traqueur, idle_traqueur, iowait_traqueur from traqueur_times where dtcol = (select max(dtcol) from traqueur_times where $__timeFilter(dtcol)))\nselect \nvals_fin.dtcol as \"time\",\ngreatest(round(vals_fin.user_traqueur - vals_deb.user_traqueur),0) as \"CPU user time (s)\",\ngreatest(round(vals_fin.system_traqueur - vals_deb.system_traqueur),0) as \"CPU system time (s)\",\nCASE when (select upper(cluster_os_family) from traqueur_cluster_information where cluster_os_family is not null fetch first 1 row only) like '%LINUX%' THEN greatest(round(vals_fin.iowait_traqueur - vals_deb.iowait_traqueur),0) ELSE null END AS \"IO wait (s)\",\ngreatest(round(vals_fin.idle_traqueur - vals_deb.idle_traqueur),0) as \"CPU idle time (s)\"\nfrom vals_deb, vals_fin;\n",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": "5m",
          "timeShift": null,
          "title": "CPU activity & IO waits system wide",
          "tooltip": {
            "shared": false,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "series",
            "name": null,
            "show": true,
            "values": [
              "current"
            ]
          },
          "yaxes": [
            {
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "local_traqueur",
          "description": "- cpu load excluding traqueur",
          "fill": 1,
          "gridPos": {
            "h": 11,
            "w": 24,
            "x": 0,
            "y": 18
          },
          "id": 7,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  $__time(dtcol),\n  pourcentage_cpu as \"CPU load\"\nFROM\n  traqueur_sessions_actives\nWHERE\n   $__timeFilter(dtcol)  and datid is null\norder by dtcol\n  \n\n",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "CPU load *",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": "100",
              "min": "0",
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "columns": [],
          "datasource": "local_traqueur",
          "description": "- by hour",
          "fontSize": "100%",
          "gridPos": {
            "h": 11,
            "w": 24,
            "x": 0,
            "y": 29
          },
          "id": 33,
          "links": [],
          "pageSize": 10,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 0,
            "desc": true
          },
          "styles": [
            {
              "alias": "Start time (1h period max)",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "time",
              "type": "date"
            },
            {
              "alias": "CPU_user_time (s)",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "CPU_user_time",
              "sanitize": false,
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "CPU_system_time (s)",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "CPU_system_time",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "CPU_idle_time (s)",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "CPU_idle_time",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "IO_wait (s)",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 0,
              "pattern": "IO_wait",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "with vals_deb as (select min(dtcol) as mindtcol, date_trunc('hour', dtcol) as dtcol_h,  min(user_traqueur) as user_traqueur, min(system_traqueur) as system_traqueur, min(idle_traqueur) as idle_traqueur, min(iowait_traqueur) as iowait_traqueur from traqueur_times where $__timeFilter(dtcol) group by date_trunc('hour', dtcol)),\nvals_fin as (select date_trunc('hour', dtcol)  as dtcol_h, max(user_traqueur) as user_traqueur, max(system_traqueur) as system_traqueur, max(idle_traqueur) as idle_traqueur, max(iowait_traqueur) as iowait_traqueur from traqueur_times where $__timeFilter(dtcol) group by date_trunc('hour', dtcol))\nselect  \ncase when dtcol_h > (select min(vals_deb.mindtcol) from vals_deb) then vals_deb.dtcol_h else vals_deb.mindtcol end as \"time\", \ngreatest(round(vals_fin.user_traqueur - vals_deb.user_traqueur),0) as \"CPU_user_time\",\ngreatest(round(vals_fin.system_traqueur - vals_deb.system_traqueur),0) as \"CPU_system_time\",\nCASE when (select upper(cluster_os_family) from traqueur_cluster_information fetch first 1 row only) like '%LINUX%' THEN greatest(round(vals_fin.iowait_traqueur - vals_deb.iowait_traqueur), 0) ELSE null END AS \"IO_wait\",\ngreatest(round(vals_fin.idle_traqueur - vals_deb.idle_traqueur),0) as \"CPU_idle_time\"\nfrom vals_deb join vals_fin using (dtcol_h) order by \"time\" desc;",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "title": "CPU & IO times *",
          "transform": "table",
          "type": "table"
        }
      ],
      "repeat": null,
      "title": "CPU load & IO waits",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 7
      },
      "id": 50,
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "#f9e2d2",
            "#f9e2d2",
            "#f9e2d2"
          ],
          "datasource": "local_traqueur",
          "description": "- sum of memory used by current postgresql active processes excluding traqueur",
          "format": "decmbytes",
          "gauge": {
            "maxValue": 500000,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 11,
            "w": 8,
            "x": 0,
            "y": 8
          },
          "hideTimeOverride": true,
          "id": 19,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  $__time(dtcol),\n  sum(mem)/1024/1024\nFROM\n  traqueur_sessions_actives\nWHERE\n  $__timeFilter(dtcol) and datid is not null\ngroup by dtcol\norder by dtcol desc\nfetch first 1 row only \n\n  \n",
              "refId": "A"
            }
          ],
          "thresholds": "",
          "timeFrom": "5m",
          "title": "Memory (MB)",
          "type": "singlestat",
          "valueFontSize": "200%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "local_traqueur",
          "description": "Total memory used by postgresql active processes, excluding traqueur ones",
          "fill": 1,
          "gridPos": {
            "h": 11,
            "w": 16,
            "x": 8,
            "y": 8
          },
          "id": 17,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null as zero",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "hide": false,
              "rawSql": "SELECT\n  $__time(dtcol),\n  sum(mem)/1024/1024 as \"Memory\"\nFROM\n  traqueur_sessions_actives \nWHERE\n    $__timeFilter(dtcol) and datid is not null\n  group by dtcol\norder by dtcol\n\n  \n\n",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "Memory (mb) *",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "#58140c",
            "#58140c",
            "#58140c"
          ],
          "datasource": "local_traqueur",
          "description": "- sum of memory swapped by current postgresql active processes, excluding traqueur",
          "format": "decmbytes",
          "gauge": {
            "maxValue": 32,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 11,
            "w": 8,
            "x": 0,
            "y": 19
          },
          "id": 18,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  $__time(dtcol),\n  sum(swapped)/1024/1024\nFROM\n  traqueur_sessions_actives\nWHERE\n  $__timeFilter(dtcol) and datid is not null\ngroup by dtcol\norder by dtcol desc\nfetch first 1 row only ",
              "refId": "A"
            }
          ],
          "thresholds": "",
          "timeFrom": null,
          "title": "Swapped memory (MB)",
          "type": "singlestat",
          "valueFontSize": "200%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "local_traqueur",
          "description": "Total swapped memory used by postgresql active processes, excluding traqueur ones",
          "fill": 1,
          "gridPos": {
            "h": 11,
            "w": 16,
            "x": 8,
            "y": 19
          },
          "id": 20,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  $__time(dtcol),\n  sum(swapped)/1024/1024 as \"Swapped memory\"\nFROM\n  traqueur_sessions_actives\nWHERE\n  $__timeFilter(dtcol) and datid is not null\n  group by dtcol\norder by dtcol\n\n\n  \n\n",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "Swapped memory (mb) *",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        }
      ],
      "repeat": null,
      "title": "Memory",
      "type": "row"
    }
  ],
  "refresh": "5s",
  "schemaVersion": 16,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-15m",
    "to": "now-10s"
  },
  "timepicker": {
    "nowDelay": "10s",
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "1h",
      "8h"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "traqueur_dashboard",
  "uid": "000000001",
  "version": 188
}
