Skip to content

Instantly share code, notes, and snippets.

@qclaogui
Forked from fortuna/Queries.md
Last active January 28, 2022 08:20
Show Gist options
  • Save qclaogui/7737344af6cab862942c92173d82586a to your computer and use it in GitHub Desktop.
Save qclaogui/7737344af6cab862942c92173d82586a to your computer and use it in GitHub Desktop.
Grafana dashboard for Outline Servers
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 84,
"iteration": 1643356658195,
"links": [],
"liveNow": false,
"panels": [
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 10,
"panels": [],
"title": "Are users using the service?",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 3,
"x": 0,
"y": 1
},
"id": 16,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "8.3.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "grafanacloud-prom"
},
"exemplar": true,
"expr": "time() - process_start_time_seconds{job=\"outline-server-main\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "uptime",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 3,
"x": 3,
"y": 1
},
"id": 18,
"links": [],
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "8.3.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "grafanacloud-prom"
},
"exemplar": true,
"expr": "shadowsocks_keys",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"title": "Total Access Keys",
"type": "stat"
},
{
"datasource": {
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 6,
"y": 1
},
"id": 14,
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.3.5",
"targets": [
{
"expr": "sum(max(increase(shadowsocks_data_bytes{access_key!=\"\"} [1h])) by (access_key, location) > bool 0) by (location)",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 1,
"legendFormat": "1h {{location}}",
"refId": "A"
},
{
"expr": "sum(max(max_over_time(shadowsocks_data_bytes{access_key!=\"\"} [1d])) by (access_key) > bool 0)",
"format": "time_series",
"hide": false,
"interval": "1h",
"intervalFactor": 1,
"legendFormat": "1d",
"refId": "B"
},
{
"expr": "sum(max(max_over_time(shadowsocks_data_bytes{access_key!=\"\"} [7d])) by (access_key) > bool 0)",
"format": "time_series",
"interval": "1h",
"intervalFactor": 1,
"legendFormat": "7d",
"refId": "C"
}
],
"title": "Active Access Keys",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "Bps"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 12,
"y": 1
},
"id": 20,
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.3.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "grafanacloud-prom"
},
"exemplar": true,
"expr": "sum(rate(shadowsocks_data_bytes[1h])) by (access_key)",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{access_key}}",
"refId": "A"
}
],
"title": "Access Key 1h Activity",
"type": "timeseries"
},
{
"datasource": {
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"log": 10,
"type": "log"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 18,
"y": 1
},
"id": 2,
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.3.5",
"targets": [
{
"expr": "sum(increase(shadowsocks_data_bytes{dir=~\"c<p|p>t\"} [1h])) by (location)",
"format": "time_series",
"hide": false,
"intervalFactor": 2,
"legendFormat": "1h {{location}}",
"metric": "shadowsocks_data_proxy_client_bytes",
"refId": "A"
},
{
"expr": "sum(increase(shadowsocks_data_bytes{dir=~\"c<p|p>t\"} [1d]))",
"format": "time_series",
"interval": "1h",
"intervalFactor": 1,
"legendFormat": "1d",
"refId": "B"
},
{
"expr": "sum(increase(shadowsocks_data_bytes{dir=~\"c<p|p>t\"} [7d]))",
"format": "time_series",
"interval": "1h",
"intervalFactor": 1,
"legendFormat": "7d",
"refId": "C"
},
{
"expr": "sum(increase(shadowsocks_data_bytes{dir=~\"c<p|p>t\"} [4w]))",
"format": "time_series",
"interval": "1h",
"intervalFactor": 1,
"legendFormat": "4w",
"refId": "D"
}
],
"title": "Total Data usage",
"type": "timeseries"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 9
},
"id": 12,
"panels": [],
"title": "Is the service healthy?",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "{instance=\"localhost:9091\",job=\"outline-ss-server\"}"
},
"properties": [
{
"id": "unit",
"value": "percentunit"
}
]
},
{
"matcher": {
"id": "byName",
"options": "cpu"
},
"properties": [
{
"id": "unit",
"value": "percentunit"
}
]
},
{
"matcher": {
"id": "byName",
"options": "cpu prometheus"
},
"properties": [
{
"id": "unit",
"value": "percentunit"
}
]
},
{
"matcher": {
"id": "byName",
"options": "cpu outline-ss-server"
},
"properties": [
{
"id": "unit",
"value": "percentunit"
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 10
},
"id": 4,
"links": [],
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right"
},
"tooltip": {
"mode": "multi"
}
},
"pluginVersion": "8.3.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "grafanacloud-prom"
},
"exemplar": true,
"expr": "sum(rate(process_cpu_seconds_total[10m])) by (job)",
"format": "time_series",
"instant": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "cpu {{job}}",
"metric": "process_cpu_seconds_total",
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "grafanacloud-prom"
},
"expr": "go_goroutines",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "go_goroutines {{job}}",
"metric": "go_goroutines",
"refId": "B"
}
],
"title": "Process",
"type": "timeseries"
},
{
"datasource": {
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "udp nat entries"
},
"properties": [
{
"id": "unit",
"value": "short"
}
]
},
{
"matcher": {
"id": "byName",
"options": "process_open_fds{instance=\"localhost:9091\",job=\"outline-ss-server\"}"
},
"properties": [
{
"id": "unit",
"value": "short"
}
]
},
{
"matcher": {
"id": "byName",
"options": "process_open_fds{instance=\"localhost:9090\",job=\"prometheus\"}"
},
"properties": [
{
"id": "unit",
"value": "short"
}
]
},
{
"matcher": {
"id": "byName",
"options": "open_fds outline-ss-server"
},
"properties": [
{
"id": "unit",
"value": "short"
}
]
},
{
"matcher": {
"id": "byName",
"options": "open_fds prometheus"
},
"properties": [
{
"id": "unit",
"value": "short"
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 10
},
"id": 3,
"links": [],
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.3.5",
"targets": [
{
"expr": "process_virtual_memory_bytes",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "virtual_memory {{job}}",
"metric": "process_virtual_memory_bytes",
"refId": "C"
},
{
"expr": "shadowsocks_udp_nat_entries_added - shadowsocks_udp_nat_entries_removed",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "udp nat entries",
"metric": "",
"refId": "A"
},
{
"expr": "process_open_fds",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "open_fds {{job}}",
"refId": "B"
}
],
"title": "Memory",
"type": "timeseries"
},
{
"datasource": {
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ms"
},
"overrides": [
{
"matcher": {
"id": "byRegexp",
"options": "/count/"
},
"properties": [
{
"id": "unit",
"value": "short"
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 18
},
"id": 6,
"links": [],
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right"
},
"tooltip": {
"mode": "multi"
}
},
"pluginVersion": "8.3.5",
"targets": [
{
"expr": "sum(increase(shadowsocks_tcp_connection_duration_ms_count [10m])) by (access_key, status)",
"format": "time_series",
"hide": false,
"instant": false,
"intervalFactor": 2,
"legendFormat": "count/s {{access_key}} {{status}}",
"metric": "shadowsocks_tcp_connection_duration_ms",
"refId": "A"
},
{
"expr": "sum(rate(shadowsocks_tcp_connection_duration_ms_sum [10m])) by (access_key,status) / sum(rate(shadowsocks_tcp_connection_duration_ms_count [10m])) by (access_key, status)",
"format": "time_series",
"hide": false,
"instant": false,
"intervalFactor": 2,
"legendFormat": "duration {{access_key}} {{status}}",
"refId": "B"
}
],
"title": "Connections",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 18
},
"id": 7,
"links": [],
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.3.5",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "grafanacloud-prom"
},
"exemplar": true,
"expr": "sum(shadowsocks_tcp_connections_opened) - sum(shadowsocks_tcp_connections_closed)",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "current",
"metric": "",
"refId": "B"
}
],
"title": "Open TCP Connections",
"type": "timeseries"
},
{
"datasource": {
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 25
},
"id": 8,
"links": [],
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.3.5",
"targets": [
{
"expr": "sum(increase(shadowsocks_tcp_connections_closed{status=~\"ERR_.*\"} [10m])) by (status, access_key)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{status}} {{access_key}}",
"metric": "shadowsocks_tcp_closed_connections",
"refId": "A"
}
],
"title": "Errors",
"type": "timeseries"
},
{
"datasource": {
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"log": 10,
"type": "log"
},
"showPoints": "never",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "dtdurationms"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 25
},
"id": 22,
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.3.5",
"targets": [
{
"expr": "shadowsocks_time_to_cipher_ms{access_key!=\"\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{access_key}} {{location}} {{proto}} {{quantile}}",
"refId": "A"
}
],
"title": "Time to Cipher",
"type": "timeseries"
}
],
"refresh": "10s",
"schemaVersion": 34,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "grafanacloud-qclaogui-prom",
"value": "grafanacloud-qclaogui-prom"
},
"hide": 0,
"includeAll": false,
"label": "datasource",
"multi": false,
"name": "datasource",
"options": [],
"query": "prometheus",
"queryValue": "",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
}
]
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {
"now": true,
"refresh_intervals": [
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "browser",
"title": "Outline",
"uid": "kQkHzYcmz",
"version": 6,
"weekStart": ""
}

Example Queries

1h active keys by location:

sum(max(increase(shadowsocks_data_bytes{access_key!=""} [1h])) by (access_key, location) > bool 0) by (location)

1h usage by location:

sum(increase(shadowsocks_data_bytes{dir=~"c<p|p>t"} [1h])) by (location)

Open TCP connections:

sum(shadowsocks_tcp_connections_opened) -  sum(shadowsocks_tcp_connections_closed)

Live UDP associations:

shadowsocks_udp_nat_entries_added - shadowsocks_udp_nat_entries_removed

Time to find cipher:

shadowsocks_time_to_cipher_ms{access_key!=""}

CPU seconds per second (averaged over 10m):

rate(process_cpu_seconds_total[10m])

Uptime:

time() - process_start_time_seconds{job="outline-server-main"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment