-
Notifications
You must be signed in to change notification settings - Fork 12
overview board
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- 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": 1,
"id": 137,
"links": [],
"liveNow": true,
"panels": [
{
"datasource": {
"type": "datasource",
"uid": "-- Mixed --"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "fixed"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Active"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-purple",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "InActive"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "text",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "firing"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "semi-dark-red",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 4,
"w": 6,
"x": 0,
"y": 0
},
"id": 105,
"links": [],
"maxDataPoints": 100,
"options": {
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": false
},
"pluginVersion": "9.4.7",
"targets": [
{
"alias": "Active",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT sum(alive) as Active FROM (SELECT last(is_up) as alive FROM instance_up WHERE cluster_name =~ /^$clustername$/ AND $timeFilter GROUP BY cluster_name)",
"rawQuery": true,
"refId": "A",
"resultFormat": "table",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
},
{
"alias": "Alert",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": true,
"orderByTime": "ASC",
"policy": "default",
"query": "select count(\"ip\") as Alert from\n( select last(\"threshold_cpu_util\") + last(\"threshold_mem_usage\") as health\nFROM \"db_health\" where $timeFilter group by dbname\n) where health > 0",
"rawQuery": true,
"refId": "D",
"resultFormat": "table",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
},
{
"alias": "InActive",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"hide": false,
"query": "SELECT $registers-sum(alive) as InActive FROM (SELECT last(is_up) as alive FROM instance_up WHERE cluster_name =~ /^$clustername$/ AND $timeFilter GROUP BY cluster_name)",
"rawQuery": true,
"refId": "C",
"resultFormat": "time_series"
},
{
"datasource": {
"type": "postgres",
"uid": "2"
},
"editorMode": "code",
"format": "table",
"hide": false,
"rawQuery": true,
"rawSql": "SELECT\r\n COUNT(DISTINCT label_value) as firing\r\nFROM\r\n (\r\n SELECT\r\n current_state,\r\n current_state_since,\r\n last_eval_time,\r\n current_state_end,\r\n current_reason,\r\n (json_array_elements(labels::json)->>0) as label_key,\r\n (json_array_elements(labels::json)->>1) as label_value\r\n FROM\r\n alert_instance\r\n ) AS subquery\r\nWHERE\r\n current_state = 'Alerting' and label_key='dbname' and label_value in ($clustername);",
"refId": "B",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "Summary",
"transformations": [],
"type": "gauge"
},
{
"datasource": {
"type": "influxdb",
"uid": "0"
},
"description": "<Click> on a point in the graph, then go to the <font color=\"#00ccff\">single cluster</font> and <font color=\"#00ccff\">session work load</font> panel for the current time range.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 3,
"gradientMode": "hue",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"decimals": 1,
"links": [],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "percent"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "load_5"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#BA43A9",
"mode": "fixed"
}
},
{
"id": "links",
"value": []
}
]
},
{
"matcher": {
"id": "byName",
"options": "avg_query_runtime"
},
"properties": [
{
"id": "unit",
"value": "ms"
},
{
"id": "custom.axisPlacement",
"value": "hidden"
},
{
"id": "links",
"value": []
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "links",
"value": []
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value"
},
"properties": [
{
"id": "links",
"value": [
{
"title": "[${__series.name}] Go to Single cluster.",
"url": "/d/experdb-single-cluster/experdb-single-cluster?orgId=1&var-group=${group}&var-clustername=${__series.name}&var-dbname=${__field.labels.dbname}&${__url_time_range}&refresh=30s"
},
{
"title": "[${__series.name}] Go to Session workload.",
"url": "/d/experdb-session-workload/session-workload?orgId=1&var-group=${group}&var-clustername=${__series.name}&var-dbname=${__field.labels.dbname}&${__url_time_range}&refresh=10s"
}
]
}
]
}
]
},
"gridPos": {
"h": 4,
"w": 6,
"x": 6,
"y": 0
},
"id": 6,
"interval": "5m",
"links": [],
"maxDataPoints": 1702,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "8.5.1",
"targets": [
{
"alias": "$tag_dbname",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"hide": false,
"query": "SELECT mean(cpu_utilization) as load_average \n FROM \"psutil_cpu\" \n WHERE $timeFilter\n AND \"dbname\" =~ /^$cputop$/ \n GROUP BY dbname,time($agg_interval)",
"rawQuery": true,
"refId": "B",
"resultFormat": "time_series"
}
],
"title": "CPU load",
"transformations": [],
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "0"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMin": 0,
"fillOpacity": 80,
"gradientMode": "scheme",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"links": [],
"mappings": [],
"max": 100,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 6,
"x": 12,
"y": 0
},
"id": 8,
"links": [],
"maxDataPoints": 100,
"options": {
"barRadius": 0.05,
"barWidth": 0.79,
"fullHighlight": false,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"orientation": "auto",
"showValue": "auto",
"stacking": "none",
"text": {
"valueSize": 9
},
"tooltip": {
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"pluginVersion": "9.0.7",
"targets": [
{
"alias": "$tag_dbname",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT dbname as memtop, top(value, $Top) as mem from \n(SELECT \"ip\",last(\"percent\") as value FROM \"psutil_mem\" \nWHERE $timeFilter \nand cluster_name =~ /^$clustername$/\nGROUP BY dbname fill(none))",
"rawQuery": true,
"refId": "B",
"resultFormat": "table",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"title": "Memory Usage",
"transformations": [
{
"id": "sortBy",
"options": {
"fields": {},
"sort": [
{
"desc": false,
"field": "mem"
}
]
}
}
],
"type": "barchart"
},
{
"datasource": {
"type": "influxdb",
"uid": "0"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "read_bytes"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "write_bytes"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "dark-yellow",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "read_bytes(172.31.4.212)"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "orange",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "read_bytes(172.31.4.211)"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "write_bytes(172.31.4.211)"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "green",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "write_bytes(172.31.4.212)"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "yellow",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 4,
"w": 6,
"x": 18,
"y": 0
},
"id": 37,
"interval": "2m",
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "9.0.7",
"targets": [
{
"alias": "$tag_dbname",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"hide": false,
"query": "SELECT \n non_negative_derivative(max(\"read_bytes\"), $agg_interval) + non_negative_derivative(max(\"write_bytes\"), $agg_interval)\nFROM \n \"psutil_disk_io_total\" \nWHERE \n $timeFilter \n AND \"dbname\" =~ /^$diskiotop$/ \n AND cluster_name =~ /^$clustername$/ \nGROUP BY \n dbname, time($agg_interval)\nFILL(none)",
"rawQuery": true,
"refId": "C",
"resultFormat": "time_series"
}
],
"title": "Disk I/O Totals",
"type": "timeseries"
},
{
"datasource": {
"type": "datasource",
"uid": "-- Mixed --"
},
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 18,
"x": 0,
"y": 4
},
"id": 99,
"maxDataPoints": 100000000000000000000,
"options": {
"afterRender": "",
"content": "{{#each data}}\r\n{{#if (layout16 (variable \"layout\"))}}\r\n<table style=\"width:11%; height:196px; overflow:hidden; float: left; font-size:130%; cursor: pointer; margin-left: 10px;\">\r\n <tr>\r\n <th style=\"width:100%; height:196px; overflow:hidden; float: left; font-size:90%; cursor: pointer; \"\r\n OnClick=\"location.href='d/experdb-single-cluster/single-cluster?orgId=1&var-group={{variable \"‘${group}’\"}}&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\"\r\n title=' IP : {{ip}} [{{dbname}}] Go to Single cluster.'>\r\n{{else}}\r\n{{#if (layout32 (variable \"layout\"))}} \r\n<table style=\"width:11%; height:110px; overflow:hidden; float: left; font-size:130%; cursor: pointer; margin-left: 10px;\">\r\n <tr>\r\n <th style=\"width:100%; height:110px; overflow:hidden; float: left; font-size:90%;\"\r\n OnClick=\"location.href='d/experdb-single-cluster/single-cluster?orgId=1&var-group={{variable \"‘${group}’\"}}&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\"\r\n title=' IP : {{ip}} [{{dbname}}] Go to Single cluster.'>\r\n{{else}}\r\n{{#if (layout64 (variable \"layout\"))}}\r\n<table style=\"width:11%; height:50px; overflow:hidden; float: left; font-size:130%; cursor: pointer; margin-left:10px;\">\r\n <tr>\r\n <th style=\"width:100%; height:50px; overflow:hidden; float: left; font-size:90%; cursor: pointer; \"\r\n OnClick=\"location.href='d/experdb-single-cluster/single-cluster?orgId=1&var-group={{variable \"‘${group}’\"}}&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\"\r\n title=' IP : {{ip}} [{{dbname}}] Go to Single cluster.'>\r\n{{/if}}\r\n{{/if}}\r\n{{/if}}\r\n {{#if (eq threshold_dbms_stat 1)}}\r\n <div class=\"blinking2\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_cpu_util 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_mem_usage 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_swap_usage 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_disk_usage 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_sessions 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_buffer_hitratio 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_commit_ratio 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_longrun_sql 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_query_runtime 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_lock_count 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_dead_lock 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_idle_in_txn 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_txid_max_age 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_inact_slot 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_replication_delay 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_wal_size 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_table_bloat 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_duplication_index 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_unused_index 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n {{#if (eq threshold_invalid_index 1)}}\r\n <div class=\"blinking\" style=\" text-align:center; color:#fefefe; \">\r\n {{dbname}}\r\n </div>\r\n {{else}}\r\n <div class=\"blinking1\"\r\n OnClick=\"location.href='d/experdb-single-cluster/experdb-single-cluster?orgId=1&var-group={{variable \"‘${group}’\"}}&var-clustername={{dbname}}&refresh=30s'\"\r\n style=\" text-align:center; color:#fefefe; ;\"\r\n >\r\n {{dbname}}\r\n </div>\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n <div class=\"alertList\">\r\n {{#if (eq threshold_cpu_util 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> CPU Util:{{cpu_util}} %</div>\r\n {{/if}}\r\n {{#if (eq threshold_mem_usage 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Mem Usage:{{mem_usage}} %</div>\r\n {{/if}}\r\n {{#if (eq threshold_swap_usage 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Swap Usage:{{swap_usage}} %</div>\r\n {{/if}}\r\n {{#if (eq threshold_disk_usage 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Disk Usage:{{disk_usage}} % </div>\r\n {{/if}}\r\n {{#if (eq threshold_sessions 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Session:{{integer sessions}} %</div>\r\n {{/if}}\r\n {{#if (eq threshold_buffer_hitratio 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Buf Hidivatio:{{roundNum1 buffer_hidivatio}}\r\n %\r\n </div>\r\n {{/if}}\r\n {{#if (eq threshold_commit_ratio 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Commit Ratio:{{roundNum1 commit_ratio}} %\r\n </div>\r\n {{/if}}\r\n {{#if (eq threshold_longrun_sql 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Longrun SQL:{{longrun_sql}} s</div>\r\n {{/if}}\r\n {{#if (eq threshold_query_runtime 1)}}\r\n <div style=\"width: 100%; text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Query Runtime:{{roundNum2 query_runtime}} s\r\n </div>\r\n {{/if}}\r\n {{#if (eq threshold_lock_count 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Lock Count:{{lock_count}} ea</div>\r\n {{/if}}\r\n {{#if (eq threshold_dead_lock 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Dead Lock:{{dead_lock}} ea</div>\r\n {{/if}}\r\n {{#if (eq threshold_idle_in_txn 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Idle in TXN:{{idle_in_txn}} ea</div>\r\n {{/if}}\r\n {{#if (eq threshold_txid_max_age 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> TXID Max Age:{{integer txid_max_age}} %\r\n </div>\r\n {{/if}}\r\n {{#if (eq threshold_inact_slot 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> InAct Slot:{{inact_slot}} ea</div>\r\n {{/if}}\r\n {{#if (eq threshold_replication_delay 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Repl Delay:{{replication_delay}}</div>\r\n {{/if}}\r\n {{#if (eq threshold_wal_size 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> WAL Size:{{volConvert wal_size}}</div>\r\n {{/if}}\r\n {{#if (eq threshold_table_bloat 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Table Bloat:{{table_bloat}}</div>\r\n {{/if}}\r\n {{#if (eq threshold_duplication_index 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Duplicate Index:{{duplication_index}}</div>\r\n {{/if}}\r\n {{#if (eq threshold_unused_index 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Unused Index:{{unused_index}}</div>\r\n {{/if}}\r\n {{#if (eq threshold_invalid_index 1)}}\r\n <div style=\"text-align:left; color:#ff0000e9; font-size:75%; white-space: nowrap; \"> Invalid Index:{{invalid_index}}</div>\r\n {{/if}}\r\n </div>\r\n </th>\r\n </tr>\r\n</table>\r\n{{/each}}",
"defaultContent": "The query didn't return any results.",
"editor": {
"format": "none",
"height": 627,
"language": "handlebars"
},
"editors": [
"helpers",
"styles"
],
"externalScripts": [],
"externalStyles": [],
"helpers": "// Register a custom Handlebars helper\r\nhandlebars.registerHelper('layout16', function (value) {\r\n if(value ==16){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n});\r\n\r\nhandlebars.registerHelper('layout32', function (value) {\r\n if(value ==32){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n});\r\n\r\nhandlebars.registerHelper('layout64', function (value) {\r\n if(value ==64){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n});\r\n\r\n\r\n//wal_size Byte기준 용량 Convert\r\nhandlebars.registerHelper('volConvert', (wal_size) => {\r\n if (wal_size < 1024) {\r\n return wal_size + \" bytes\";\r\n } else if (wal_size < 1024 * 1024) {\r\n return (wal_size / 1024).toFixed(2) + \" KB\";\r\n } else if (wal_size < 1024 * 1024 * 1024) {\r\n return (wal_size / (1024 * 1024)).toFixed(2) + \" MB\";\r\n } else {\r\n return (wal_size / (1024 * 1024 * 1024)).toFixed(2) + \" GB\";\r\n }\r\n});\r\n//정수 표현\r\nhandlebars.registerHelper('integer', (number) => {\r\n return parseInt(number);\r\n});\r\n//소수점 1자리 까지만 표현\r\nhandlebars.registerHelper('roundNum1', (number) => {\r\n return parseFloat(number).toFixed(1);\r\n});\r\n//소수점 2자리 까지만 표현\r\nhandlebars.registerHelper('roundNum2', (number) => {\r\n return parseFloat(number).toFixed(2);\r\n})\r\n// layout = replaceVariables(\"${layout}\");\r\n// if (layout == 16) {\r\n// // let tableElements = document.querySelectorAll(\"table\");\r\n// let thElements = document.querySelectorAll(\"table th\");\r\n// let divElements = document.querySelectorAll(\"table th div\");\r\n \r\n\r\n// // tableElements.forEach(function (table) {\r\n// // table.style.width = \"11%\";\r\n// // table.style.height = \"217px\"; \r\n// // });\r\n\r\n// thElements.forEach(function (th) {\r\n// th.style.width = \"100%\"; \r\n// th.style.height=\"217px\";\r\n// });\r\n\r\n// divElements.forEach(function (div){\r\n// if (div.classList.contains(\"blinking\") || div.classList.contains(\"blinking1\") || div.classList.contains(\"blinking2\")) {\r\n// div.style.fontSize = \"16px\";\r\n// }else{\r\n// div.style.fontSize=\"13px\";\r\n// }\r\n// })\r\n// } else if (layout == 32) {\r\n// let tableElements = document.querySelectorAll(\"table\");\r\n// let thElements = document.querySelectorAll(\"table th\");\r\n// let divElements = document.querySelectorAll(\"table th div\");\r\n \r\n \r\n\r\n// tableElements.forEach(function (table) {\r\n// table.style.width = \"11%\";\r\n// table.style.height = \"110px\";\r\n// });\r\n\r\n// thElements.forEach(function (th) {\r\n// th.style.width = \"100%\";\r\n// th.style.height=\"110px\";\r\n// });\r\n\r\n// divElements.forEach(function (div){\r\n// if (div.classList.contains(\"blinking\") || div.classList.contains(\"blinking1\") || div.classList.contains(\"blinking2\")) {\r\n// div.style.fontSize = \"16px\";\r\n// }else{\r\n// div.style.fontSize=\"13px\";\r\n// }\r\n// })\r\n// } else {\r\n// let tableElements = document.querySelectorAll(\"table\");\r\n// let thElements = document.querySelectorAll(\"table th\");\r\n// let divElements = document.querySelectorAll(\"table th div\");\r\n\r\n// tableElements.forEach(function (table) {\r\n// table.style.width = \"11%\";\r\n// table.style.height = \"60px\";\r\n// });\r\n\r\n// thElements.forEach(function (th) {\r\n// th.style.width = \"100%\";\r\n// th.style.height = \"60px\";\r\n// });\r\n\r\n// divElements.forEach(function (div){\r\n// if (div.classList.contains(\"blinking\") || div.classList.contains(\"blinking1\") || div.classList.contains(\"blinking2\")) {\r\n// div.style.fontSize = \"16px\";\r\n// }else{\r\n// div.style.fontSize=\"13px\";\r\n// }\r\n// })\r\n// }\r\nhandlebars.registerHelper('integer', (number) => {\r\n return parseInt(number);\r\n});",
"renderMode": "allRows",
"styles": " @keyframes blink {\r\n 0% {\r\n background-color: #ff0000e9;\r\n }\r\n\r\n 50% {\r\n background-color: #7a9ada00;\r\n // background-color: #0f52d900;\r\n }\r\n\r\n 100% {\r\n background-color: #ff0000e9;\r\n }\r\n }\r\n\r\n.blinking {\r\n animation: blink 4s infinite; \r\n border-radius: 3px;\r\n}\r\n\r\n.blinking1 {\r\n background-color: #42b159C0;\r\n border-radius: 3px; \r\n}\r\n.blinking2 {\r\n background-color: #5e605f;\r\n border-radius: 3px;\r\n}\r\n",
"wrap": true
},
"pluginVersion": "4.5.0",
"refresh_intervals": 0,
"targets": [
{
"alias": "healthCheck",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"hide": false,
"query": "SELECT\n(last(threshold_buffer_hitratio)\n+ last(threshold_commit_ratio)\n+ last(threshold_cpu_util)\n+ last(threshold_dead_lock)\n+ last(threshold_disk_usage)\n+ last(threshold_duplication_index)\n+ last(threshold_idle_in_txn)\n+ last(threshold_inact_slot)\n+ last(threshold_invalid_index)\n+ last(threshold_lock_count)\n+ last(threshold_longrun_sql)\n+ last(threshold_mem_usage)\n+ last(threshold_query_runtime)\n+ last(threshold_replication_delay)\n+ last(threshold_session)\n+ last(threshold_swap_usage)\n+ last(threshold_table_bloat)\n+ last(threshold_tx_freeze_age)\n+ last(threshold_txid_max_age)\n+ last(threshold_unused_index)\n+ last(threshold_wal_size)) as \"health\",\nlast(\"dbms_stat\") as \"dbms_stat\",\nlast(\"cpu_util\") as \"cpu_util\",\nlast(\"mem_usage\") as \"mem_usage\", \nlast(\"swap_usage\") as \"swap_usage\", \nlast(\"disk_usage\") as \"disk_usage\",\nlast(\"sessions\") as \"sessions\", \nlast(\"buffer_hitratio\") as \"buffer_hitratio\",\nlast(\"commit_ratio\") as \"commit_ratio\", \nlast(\"longrun_sql\") as \"longrun_sql\", \nlast(\"query_runtime\") as \"query_runtime\",\nlast(\"lock_count\") as \"lock_count\",\nlast(\"dead_lock\") as \"dead_lock\",\nlast(\"idle_in_txn\") as \"idle_in_txn\", \nlast(\"txid_max_age\") as \"txid_max_age\",\nlast(\"inact_slot\") as \"inact_slot\",\nlast(\"replication_delay\") as \"replication_delay\", \nlast(\"wal_size\") as \"wal_size\", \nlast(\"table_bloat\") as \"table_bloat\",\nlast(\"duplication_index\") as \"duplication_index\",\nlast(\"unused_index\") as \"unused_index\",\nlast(\"invalid_index\") as \"invalid_index\",\nlast(\"threshold_dbms_stat\") as \"threshold_dbms_stat\",\nlast(\"threshold_cpu_util\") as \"threshold_cpu_util\",\nlast(\"threshold_mem_usage\") as \"threshold_mem_usage\", \nlast(\"threshold_swap_usage\") as \"threshold_swap_usage\", \nlast(\"threshold_disk_usage\") as \"threshold_disk_usage\",\nlast(\"threshold_sessions\") as \"threshold_sessions\", \nlast(\"threshold_buffer_hitratio\") as \"threshold_buffer_hitratio\",\nlast(\"threshold_commit_ratio\") as \"threshold_commit_ratio\", \nlast(\"threshold_longrun_sql\") as \"threshold_longrun_sql\", \nlast(\"threshold_query_runtime\") as \"threshold_query_runtime\",\nlast(\"threshold_lock_count\") as \"threshold_lock_count\",\nlast(\"threshold_dead_lock\") as \"threshold_dead_lock\",\nlast(\"threshold_idle_in_txn\") as \"threshold_idle_in_txn\", \nlast(\"threshold_txid_max_age\") as \"threshold_txid_max_age\",\nlast(\"threshold_inact_slot\") as \"threshold_inact_slot\",\nlast(\"threshold_replication_delay\") as \"threshold_replication_delay\", \nlast(\"threshold_wal_size\") as \"threshold_wal_size\", \nlast(\"threshold_table_bloat\") as \"threshold_table_bloat\",\nlast(\"threshold_duplication_index\") as \"threshold_duplication_index\",\nlast(\"threshold_unused_index\") as \"threshold_unused_index\",\nlast(\"threshold_invalid_index\") as \"threshold_invalid_index\"\nFROM \"db_health\" where dbname =~ /^$clustername$/\nAND $timeFilter\ngroup by dbname",
"rawQuery": true,
"refId": "A",
"resultFormat": "table"
},
{
"datasource": {
"type": "postgres",
"uid": "1"
},
"editorMode": "code",
"format": "table",
"hide": false,
"rawQuery": true,
"rawSql": "select\r\na.md_unique_name as dbname,\r\na.md_hostname as ip,\r\nb.ms_hagroup_id,\r\nb.ms_upstream_hostname\r\nFROM monitored_db a, monitored_server b\r\nwhere a.md_unique_name = b.ms_unique_name",
"refId": "C",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
},
{
"alias": "",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"hide": false,
"query": "SELECT last(is_up) as \"dbms_stat\" FROM instance_up where cluster_name =~ /^$clustername$/ AND $timeFilter group by cluster_name",
"rawQuery": true,
"refId": "B",
"resultFormat": "table"
}
],
"transformations": [
{
"id": "joinByField",
"options": {
"byField": "dbname",
"mode": "inner"
}
},
{
"id": "organize",
"options": {
"excludeByName": {},
"indexByName": {
"Time": 2,
"buffer_hitratio": 10,
"commit_ratio": 11,
"cpu_util": 5,
"dbms_stat": 4,
"dbname": 0,
"dead_lock": 15,
"disk_usage": 8,
"duplication_index": 22,
"health": 3,
"idle_in_txn": 16,
"inact_slot": 18,
"invalid_index": 24,
"ip": 1,
"lock_count": 14,
"longrun_sql": 12,
"mem_usage": 6,
"query_runtime": 13,
"replication_delay": 19,
"sessions": 9,
"swap_usage": 7,
"table_bloat": 21,
"threshold_buffer_hitratio": 30,
"threshold_commit_ratio": 31,
"threshold_cpu_util": 25,
"threshold_dead_lock": 35,
"threshold_disk_usage": 28,
"threshold_duplication_index": 42,
"threshold_idle_in_txn": 36,
"threshold_inact_slot": 38,
"threshold_invalid_index": 44,
"threshold_lock_count": 34,
"threshold_longrun_sql": 32,
"threshold_mem_usage": 26,
"threshold_query_runtime": 33,
"threshold_replication_delay": 39,
"threshold_sessions": 29,
"threshold_swap_usage": 27,
"threshold_table_bloat": 41,
"threshold_txid_max_age": 37,
"threshold_unused_index": 43,
"threshold_wal_size": 40,
"txid_max_age": 17,
"unused_index": 23,
"wal_size": 20
},
"renameByName": {}
}
},
{
"id": "sortBy",
"options": {
"fields": {},
"sort": [
{
"field": "ms_hagroup_id"
}
]
}
}
],
"type": "marcusolsson-dynamictext-panel"
},
{
"datasource": {
"type": "postgres",
"uid": "2"
},
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 6,
"x": 18,
"y": 4
},
"id": 101,
"options": {
"afterRender": "",
"content": "{{#each data}}\r\n<div style=\"font-size:110%; margin-left:25px;\" >{{alertname}}</div>\r\n{{#if (contains alertname \"dead_lock\")}}\r\n<strong onclick=\"location.href='/d/experdb-wait-analysis/2-2-wait-analysis?orgId=1&refresh=10s&var-clustername={{dbname}}&var-dbname={{dbname}}&var-agg_interval=10s&var-top_queries=10'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Wait analysis.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"swap_usage\")}}\r\n<strong onclick=\"location.href='/d/experdb-single-cluster/1-2-single-cluster?orgId=1&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Single cluster.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"table_bloat\")}}\r\n<strong onclick=\"location.href='/d/experdb-table-overview/4-2-table-overview?orgId=1&var-clustername={{dbname}}&var-dbname={{dbname}}&var-top=10'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Table overview.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"txid_max_age\")}}\r\n<strong onclick=\"location.href='/d/experdb-table-overview/4-2-table-overview?orgId=1&var-clustername={{dbname}}&var-dbname={{dbname}}&var-top=10'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Table overview.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"inact_slot\")}}\r\n<strong onclick=\"location.href='/d/experdb-replication-state/5-2-replication-state?orgId=1&refresh=10s&var-clustername={{dbname}}&var-dbname={{dbname}}&var-agg_interval=10s&var-blank='\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Table overview.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"longrun_sql\")}}\r\n<strong onclick=\"location.href='/d/experdb-session-workload/2-1-session-workload?orgId=1&refresh=10s&var-clustername={{dbname}}&var-dbname={{dbname}}&var-agg_interval=10s&var-top_queries=10&var-time=%7B%7B$timeFilter%7D%7D'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Session workload.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"invalid_index\")}}\r\n<strong onclick=\"location.href='/d/experdb-index-overview/4-1-index-overview?orgId=1&var-clustername={{dbname}}&var-dbname={{dbname}}&var-top=20'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Index overview.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"buffer_hitratio\")}}\r\n<strong onclick=\"location.href='/d/experdb-single-cluster/1-2-single-cluster?orgId=1&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Single cluster.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"duplication_index\")}}\r\n<strong onclick=\"location.href='/d/experdb-index-overview/4-1-index-overview?orgId=1&var-clustername={{dbname}}&var-dbname={{dbname}}&var-top=20'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Index overview.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"idle_in_txn\")}}\r\n<strong onclick=\"location.href='/d/experdb-wait-analysis/2-2-wait-analysis?orgId=1&refresh=10s&var-clustername={{dbname}}&var-dbname={{dbname}}&var-agg_interval=10s&var-top_queries=10'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Wait analysis.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"commit_ratio\")}}\r\n<strong onclick=\"location.href='/d/experdb-single-cluster/1-2-single-cluster?orgId=1&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Single cluster.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"lock_count\")}}\r\n<strong onclick=\"location.href='/d/experdb-wait-analysis/2-2-wait-analysis?orgId=1&refresh=10s&var-clustername={{dbname}}&var-dbname={{dbname}}&var-agg_interval=10s&var-top_queries=10'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Wait analysis.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"sessions\")}}\r\n<strong onclick=\"location.href='/d/experdb-session-workload/2-1-session-workload?orgId=1&refresh=10s&var-clustername={{dbname}}&var-dbname={{dbname}}&var-agg_interval=10s&var-top_queries=10&var-time=%7B%7B$timeFilter%7D%7D'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Session workload.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"query_runtime\")}}\r\n<strong onclick=\"location.href='/d/experdb-statements-statistics/3-2-statements-statistics?orgId=1&refresh=1m&var-clustername={{dbname}}&var-dbname={{dbname}}&var-top=10&var-calls_q=All&var-runtime_q=All&var-agg_interval=5m'\"\r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Statements statistics.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"cpu_util\")}}\r\n<strong onclick=\"location.href='/d/experdb-single-cluster/1-2-single-cluster?orgId=1&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Single cluster.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"disk_usage\")}}\r\n<strong onclick=\"location.href='/d/experdb-single-cluster/1-2-single-cluster?orgId=1&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Single cluster.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"mem_usage\")}}\r\n<strong onclick=\"location.href='/d/experdb-single-cluster/1-2-single-cluster?orgId=1&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Single cluster.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"replication_delay\")}}\r\n<strong onclick=\"location.href='/d/experdb-replication-state/5-2-replication-state?orgId=1&refresh=10s&var-clustername={{dbname}}&var-dbname={{dbname}}&var-agg_interval=10s&var-blank='\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Table overview.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"unused_index\")}}\r\n<strong onclick=\"location.href='/d/experdb-index-overview/4-1-index-overview?orgId=1&var-clustername={{dbname}}&var-dbname={{dbname}}&var-top=20'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Index overview.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (contains alertname \"wal_size\")}}\r\n<strong onclick=\"location.href='/d/experdb-single-cluster/1-2-single-cluster?orgId=1&var-clustername={{dbname}}&refresh=30s&var-dbname={{dbname}}&var-agg_interval=1m'\" \r\nstyle=\"margin-right:5%; float: right; cursor: pointer; text-decoration: underline;\" title='[{{dbname}}] Go to Single cluster.'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-ln3h1p\"><path fill=\"#ccccdc\" d=\"M10,17.55,8.23,19.27a2.47,2.47,0,0,1-3.5-3.5l4.54-4.55a2.46,2.46,0,0,1,3.39-.09l.12.1a1,1,0,0,0,1.4-1.43A2.75,2.75,0,0,0,14,9.59a4.46,4.46,0,0,0-6.09.22L3.31,14.36a4.48,4.48,0,0,0,6.33,6.33L11.37,19A1,1,0,0,0,10,17.55ZM20.69,3.31a4.49,4.49,0,0,0-6.33,0L12.63,5A1,1,0,0,0,14,6.45l1.73-1.72a2.47,2.47,0,0,1,3.5,3.5l-4.54,4.55a2.46,2.46,0,0,1-3.39.09l-.12-.1a1,1,0,0,0-1.4,1.43,2.75,2.75,0,0,0,.23.21,4.47,4.47,0,0,0,6.09-.22l4.55-4.55A4.49,4.49,0,0,0,20.69,3.31Z\"></path></svg></strong>\r\n{{/if}}\r\n{{#if (eq state \"Pending\")}}\r\n<div style=\"color:#f5b73d;\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" data-name=\"Layer 1\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-14jc7gd\"><path fill=\"#f5b73d\" d=\"M18.9917,21.002h-1V19.335a5.00057,5.00057,0,0,0-.29956-1.67773c-.01093-.02936-.0224-.05658-.03589-.08454a4.97694,4.97694,0,0,0-.66455-1.23675l-1.3999-1.86719a3.01933,3.01933,0,0,1-.6001-1.80078V11.6582a3.02108,3.02108,0,0,1,.87842-2.12109l.65722-.65723A4.94566,4.94566,0,0,0,17.92365,6.0415c.00054-.01391.008-.02551.008-.03955l-.00281-.01373a5.01836,5.01836,0,0,0,.06287-.64349V3.002h1a1,1,0,0,0,0-2h-14a1,1,0,0,0,0,2h1V5.34473a5.01836,5.01836,0,0,0,.06287.64349L6.05176,6.002c0,.014.00744.02564.008.03955a4.94571,4.94571,0,0,0,1.3963,2.83838l.65723.65723A3.02108,3.02108,0,0,1,8.9917,11.6582V12.668a3.02212,3.02212,0,0,1-.59961,1.80078L6.99121,16.33594a4.98221,4.98221,0,0,0-.66437,1.23718c-.0133.02771-.02472.05463-.03552.08368A5.00309,5.00309,0,0,0,5.9917,19.335v1.667h-1a1,1,0,0,0,0,2h14a1,1,0,0,0,0-2Zm-11-16v-2h8v2Zm.87842,2.46387A2.97036,2.97036,0,0,1,8.49323,7.002h6.99694a2.97094,2.97094,0,0,1-.37689.46387l-.65723.65723a4.9603,4.9603,0,0,0-1.42187,2.8789h-2.085A4.96025,4.96025,0,0,0,9.52734,8.123ZM9.99219,15.668a5.03688,5.03688,0,0,0,.98828-2.666h2.02246a5.03332,5.03332,0,0,0,.98877,2.666l1.00012,1.334H8.99133Zm5.99951,5.334h-8V19.335a2.954,2.954,0,0,1,.02722-.333h7.94556a2.954,2.954,0,0,1,.02722.333Z\"></path></svg>\r\n <div style=\"display: inline; margin-left:5px;\">Pending</div>\r\n</div>\r\n{{!-- <button id=\"arrow{{@index}}\" style=\"background-color: transparent; border: none; margin-left:20px;\" onmouseover=\"toggleTable('{{@index}}', true)\" onmouseout=\"toggleTable('{{@index}}', false)\" >▶ 1 instance</button> --}}\r\n<div> </div>\r\n{{else}}\r\n{{#if (eq state \"Alerting\")}}\r\n<div style=\"color:#d10e5c\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" data-name=\"Layer 1\" viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" class=\"css-1xud2co\"><path fill=\"#d10e5c\" d=\"M8.46777,8.39453l-.00225.00183-.00214.00208ZM18.42188,8.208a1.237,1.237,0,0,0-.23-.17481.99959.99959,0,0,0-1.39941.41114,5.78155,5.78155,0,0,1-1.398,1.77734,8.6636,8.6636,0,0,0,.1333-1.50977,8.71407,8.71407,0,0,0-4.40039-7.582,1.00009,1.00009,0,0,0-1.49121.80567A7.017,7.017,0,0,1,7.165,6.87793l-.23047.1875a8.51269,8.51269,0,0,0-1.9873,1.8623A8.98348,8.98348,0,0,0,8.60254,22.83594.99942.99942,0,0,0,9.98,21.91016a1.04987,1.04987,0,0,0-.0498-.3125,6.977,6.977,0,0,1-.18995-2.58106,9.004,9.004,0,0,0,4.3125,4.0166.997.997,0,0,0,.71534.03809A8.99474,8.99474,0,0,0,18.42188,8.208ZM14.51709,21.03906a6.964,6.964,0,0,1-3.57666-4.40234,8.90781,8.90781,0,0,1-.17969-.96387,1.00025,1.00025,0,0,0-.79931-.84473A.982.982,0,0,0,9.77,14.80957a.99955.99955,0,0,0-.8667.501,8.9586,8.9586,0,0,0-1.20557,4.71777,6.98547,6.98547,0,0,1-1.17529-9.86816,6.55463,6.55463,0,0,1,1.562-1.458.74507.74507,0,0,0,.07422-.05469s.29669-.24548.30683-.2511a8.96766,8.96766,0,0,0,2.89874-4.63269,6.73625,6.73625,0,0,1,1.38623,8.08789,1.00024,1.00024,0,0,0,1.18359,1.418,7.85568,7.85568,0,0,0,3.86231-2.6875,7.00072,7.00072,0,0,1-3.2793,10.457Z\"></path></svg>\r\n <div style=\"display: inline; margin-left:5px;\">Firing </div>\r\n <div style=\"color:#ccccdc; display: inline;\"> for {{time_difference}}</div>\r\n</div>\r\n<button id=\"arrow{{@index}}\" style=\"background-color: transparent; border: none; margin-left:20px;\" onmouseover=\"toggleTable('{{@index}}', true)\" onmouseout=\"toggleTable('{{@index}}', false)\" >▶ 1 instance</button>\r\n{{/if}}\r\n<div id=\"alertTable{{@index}}\" style=\"display: none; margin-left:15px;\" onmouseover=\"toggleTable('{{@index}}', true)\" onmouseout=\"toggleTable('{{@index}}', false)\">\r\n <table border=\"1\" style=\"width:60%; margin-left:5%;\">\r\n <tr>\r\n <td style=\"font-size:90%; font-weight: bold; text-align: left; background-color:rgb(34, 37, 43);\">State</td>\r\n <td style=\"font-size:90%; text-align: left; height: 10%; color:#d10e5c\">{{state}}</td>\r\n </tr>\r\n {{!-- <tr style=\"font-size:90%; text-align: left; height: 10%;\">\r\n <td style=\"font-size:97%; font-weight: bold; text-align: left; background-color:rgb(34, 37, 43);\">Time elapsed</td>\r\n <td style=\"font-size:97%; text-align: left; height: 10%;\">{{time_difference}}</td>\r\n </tr> --}}\r\n <tr>\r\n <td style=\"font-size:90%; font-weight: bold; text-align: left; background-color:rgb(34, 37, 43);\">Created</td>\r\n <td style=\"font-size:90%; text-align: left; height: 10%;\">{{converted_current_state_since}}</td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size:90%; font-weight: bold; text-align: left; background-color:rgb(34, 37, 43);\">Dbname</td>\r\n <td style=\"font-size:90%; text-align: left; height: 10%;\">{{dbname}}</td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size:90%; font-weight: bold; text-align: left; background-color:rgb(34, 37, 43);\">IP</td>\r\n <td style=\"font-size:90%; text-align: left; height: 10%;\">{{ip}}</td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size:90%; font-weight: bold; text-align: left; background-color:rgb(34, 37, 43);\">Alert Value</td>\r\n <td style=\"font-size:90%; text-align: left; height: 10%;\">\r\n {{#if (startsWith alertname \"cpu_\")}}\r\n <strong id=\"alertValue\">{{data}} %</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"disk_\")}}\r\n <strong id=\"alertValue\">{{data}} %</strong> \r\n {{else}}\r\n {{#if (startsWith alertname \"mem_\")}}\r\n <strong id=\"alertValue\">{{data}} %</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"swap_\")}}\r\n <strong id=\"alertValue\">{{data}} %</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"sessions\")}}\r\n <strong id=\"alertValue\">{{data}} %</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"commit_ratio\")}}\r\n <strong id=\"alertValue\">{{data}} %</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"buffer_hitratio\")}}\r\n <strong id=\"alertValue\">{{data}} %</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"txid_\")}}\r\n <strong id=\"alertValue\">{{data}} %</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"table_bloat\")}}\r\n <strong id=\"alertValue\">{{data}} %</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"wal_size\")}}\r\n <strong id=\"alertValue\">{{volConvert data}}</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"replication_delay\")}}\r\n <strong id=\"alertValue\">{{data}} GB</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"longrun_sql\")}}\r\n <strong id=\"alertValue\">{{data}} Sec</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"query_\")}}\r\n <strong id=\"alertValue\">{{data}} Sec</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"lock_count\")}}\r\n <strong id=\"alertValue\">{{data}}</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"idle_in_txn\")}}\r\n <strong id=\"alertValue\">{{data}}</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"dead_lock\")}}\r\n <strong id=\"alertValue\">{{data}}</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"inact_slot\")}}\r\n <strong id=\"alertValue\">{{data}}</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"unused_index\")}}\r\n <strong id=\"alertValue\">{{data}}</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"invalid_index\")}}\r\n <strong id=\"alertValue\">{{data}}</strong>\r\n {{else}}\r\n {{#if (startsWith alertname \"duplication_index\")}}\r\n <strong id=\"alertValue\">{{data}}</strong>\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n {{/if}}\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size:90%; font-weight: bold; text-align: left; background-color:rgb(34, 37, 43);\">Threshold</td>\r\n <td style=\"font-size:90%; text-align: left; height: 10%;\">{{threshold}}</td>\r\n </tr>\r\n </table>\r\n</div>\r\n{{/if}}\r\n<div class=\"horizontal-line\"></div>\r\n{{/each}}",
"defaultContent": "<div style=\"text-align:center; margin-top:35%;\">No alerts matching filters<div>",
"editor": {
"format": "auto",
"height": 487,
"language": "handlebars"
},
"editors": [
"helpers",
"styles"
],
"externalScripts": [],
"externalStyles": [],
"helpers": "toggleTable = (index, isMouseOver) => {\r\n let table = document.getElementById(\"alertTable\" + index);\r\n let tableValue = table.getAttribute(\"data-value\");\r\n let arrow = document.getElementById(\"arrow\" + index);\r\n if (isMouseOver) {\r\n table.style.display = \"block\";\r\n arrow.innerHTML = \"▼ 1 instance\";\r\n } else {\r\n table.style.display = \"none\";\r\n arrow.innerHTML = \"▶ 1 instance\";\r\n }\r\n return true;\r\n}\r\n\r\n//wal_size Byte기준 용량 Convert\r\nhandlebars.registerHelper('volConvert', (wal_size) => {\r\n if (wal_size < 1024) {\r\n return wal_size + \" bytes\";\r\n } else if (wal_size < 1024 * 1024) {\r\n return (wal_size / 1024).toFixed(2) + \" KB\";\r\n } else if (wal_size < 1024 * 1024 * 1024) {\r\n return (wal_size / (1024 * 1024)).toFixed(2) + \" MB\";\r\n } else {\r\n return (wal_size / (1024 * 1024 * 1024)).toFixed(2) + \" GB\";\r\n }\r\n});\r\n",
"renderMode": "allRows",
"styles": "tr td:nth-child(1),\r\ntr td:nth-child(2),\r\ntr td:nth-child(3),\r\ntr td:nth-child(5) {\r\n white-space: nowrap;\r\n}\r\n\r\n.horizontal-line {\r\n border-bottom: 0.1px solid #0a0a0a;\r\n margin-top: 10px;\r\n margin-bottom: 5px;\r\n\r\n /* 선 아래 여백을 설정할 수 있습니다. */\r\n}\r\n\r\n\r\nstrong,\r\nbutton {\r\n transition: transform 0.3s ease-in-out;\r\n display: inline-block;\r\n}\r\n\r\n#alertValue {\r\n color: #d10e5c;\r\n}\r\n\r\nstrong:hover,\r\nbutton:hover {\r\n transform: scale(1.2);\r\n}",
"wrap": false
},
"pluginVersion": "4.5.0",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "2"
},
"editorMode": "code",
"format": "table",
"hide": false,
"rawQuery": true,
"rawSql": "select * from (\r\nWITH query1 AS (\r\n SELECT\r\n rule_uid,\r\n current_state as state,\r\n TO_CHAR(TO_TIMESTAMP(current_state_since), 'YYYY-MM-DD HH24:MI:SS') as converted_current_state_since,\r\n last_eval_time,\r\n TO_CHAR(TO_TIMESTAMP(current_state_end), 'YYYY-MM-DD HH24:MI:SS') as current_state_end,\r\n current_reason,\r\n EXTRACT(DAY FROM AGE(TO_TIMESTAMP(current_state_end), TO_TIMESTAMP(current_state_since))) || 'd ' ||\r\n TO_CHAR(AGE(TO_TIMESTAMP(current_state_end), TO_TIMESTAMP(current_state_since)), 'HH24h MIm SSs') as time_difference,\r\n-- MAX(CASE WHEN label_key = '__alert_rule_namespace_uid__' THEN label_value END) as alert_rule_namespace_uid,\r\n-- MAX(CASE WHEN label_key = '__alert_rule_uid__' THEN label_value END) as alert_rule_uid,\r\n MAX(CASE WHEN label_key = 'alertname' THEN label_value END) as alertname,\r\n MAX(CASE WHEN label_key = 'dbname' THEN label_value END) as dbname,\r\n-- MAX(CASE WHEN label_key = 'grafana_folder' THEN label_value END) as grafana_folder,\r\n MAX(CASE WHEN label_key = 'ip' THEN label_value END) as ip,\r\n MAX(CASE WHEN label_key = 'threshold' THEN label_value END) as threshold\r\n FROM (\r\n SELECT\r\n rule_uid,\r\n (json_array_elements(labels::json)->>0) as label_key,\r\n (json_array_elements(labels::json)->>1) as label_value,\r\n current_state,\r\n current_state_since,\r\n last_eval_time,\r\n current_state_end,\r\n current_reason\r\n FROM\r\n alert_instance\r\n WHERE\r\n current_state != 'Normal'\r\n ) subquery\r\n GROUP BY\r\n rule_uid,current_state, current_state_since, last_eval_time, current_state_end, current_reason\r\n),\r\nquery2 AS (\r\n SELECT\r\n sub.alertname,\r\n sub.dbname,\r\n sub.grafana_folder,\r\n sub.ip,\r\n sub.data\r\nFROM (\r\n SELECT DISTINCT ON (alertname)\r\n split_part(split_part(text, ',', 1), '=', 2) AS alertname,\r\n split_part(split_part(text, ',', 2), '=', 2) AS dbname,\r\n split_part(split_part(text, ',', 3), '=', 2) AS grafana_folder,\r\n split_part(split_part(text, ',', 4), '=', 2) AS ip,\r\n round((data::json->'values'->>'B')::numeric,1) AS data\r\n FROM annotation\r\n WHERE new_state = 'Alerting'\r\n ORDER BY alertname, data DESC\r\n) AS sub\r\nORDER BY sub.alertname, sub.data DESC\r\n)\r\nSELECT \r\n\tquery1.rule_uid,\r\n query1.state,\r\n query1.converted_current_state_since,\r\n query1.last_eval_time,\r\n query1.current_state_end,\r\n query1.current_reason,\r\n query1.time_difference,\r\n query1.alertname,\r\n query1.dbname,\r\n query1.ip,\r\n query1.threshold,\r\n query2.data\r\nFROM query1\r\ninner JOIN query2\r\nON query1.alertname = query2.alertname\r\nORDER BY converted_current_state_since DESC, alertname, state DESC, rule_uid DESC\r\n) q\r\nwhere dbname in ($clustername)",
"refId": "B",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "Alert list",
"transformations": [],
"type": "marcusolsson-dynamictext-panel"
},
{
"datasource": {
"type": "influxdb",
"uid": "0"
},
"description": "<Click> on a point in the graph, then go to the <font color=\"#00ccff\">session work load</font> panel for the current time range.\n",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 3,
"gradientMode": "hue",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"links": [
{
"title": "[${__series.name}] Go to Session workload.",
"url": "/d/experdb-session-workload/session-workload??orgId=1&var-group=${group}&var-clustername=${__series.name}&${__url_time_range}&refresh=10s"
}
],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 6,
"x": 0,
"y": 15
},
"id": 20,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"alias": "$tag_cluster_name",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"hide": false,
"query": "SELECT sum(active) as active FROM (\nSELECT last(active) as active\nFROM backends where $timeFilter\nAND \"cluster_name\" =~ /^$sessiontop$/ \nGROUP BY time($agg_interval), cluster_name, dbname\n) GROUP BY time($agg_interval), cluster_name",
"rawQuery": true,
"refId": "D",
"resultFormat": "time_series"
},
{
"alias": "$tag_cluster_name",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"hide": true,
"query": "select \nmax(\"active\")\nFROM\n(\nSELECT\n (\"active\") \nFROM backends where\n$timeFilter\nAND \"cluster_name\" =~/^$sessiontop$/ \n) \nGROUP BY cluster_name, time($agg_interval) fill(0)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series"
}
],
"title": "Active Sessions ",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "0"
},
"description": "<Click> on the graph and then go to the <font color=\"#00ccff\">table overview</font> panel for the current time range.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 80,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"links": [
{
"title": "[${__data.fields.cluster_name}] Go to table overview.",
"url": "/d/experdb-table-overview/experdb-table-overview?orgId=1&var-group=${group}&var-clustername=${__data.fields.cluster_name}&var-dbname=${__data.fields.cluster_name}&${Top:queryparam}&${__url_time_range}"
}
],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 6,
"x": 6,
"y": 15
},
"id": 13,
"options": {
"barRadius": 0,
"barWidth": 0.97,
"fullHighlight": false,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right",
"showLegend": true
},
"orientation": "horizontal",
"showValue": "never",
"stacking": "normal",
"tooltip": {
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"pluginVersion": "9.4.7",
"targets": [
{
"$$hashKey": "object:24",
"aggregation": "Last",
"alias": "$tag_dbname",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"decimals": 2,
"displayAliasType": "Warning / Critical",
"displayType": "Regular",
"displayValueWithAlias": "Never",
"hide": false,
"query": " SELECT sum(inserted) as inserted, sum(updated) as updated, sum(deleted) as deleted\nFROM (\n SELECT\n spread(tup_inserted) AS inserted,\n spread(tup_updated) AS updated,\n spread(tup_deleted) AS deleted\n FROM db_stats\n WHERE $timeFilter\n AND cluster_name =~/^$logicaliotop$/\n group by dbname\n)\nGROUP BY cluster_name",
"rawQuery": true,
"refId": "A",
"resultFormat": "table",
"units": "none",
"valueHandler": "Number Threshold"
}
],
"title": "Logical I/O",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {},
"renameByName": {}
}
}
],
"type": "barchart"
},
{
"datasource": {
"type": "influxdb",
"uid": "0"
},
"description": "<p>The information collected from pg_stat_database is used to display the number of transactions per second. \nIt represents \"(xact_commit+xact_rollback)/sec\". \nNB! This index includes all executed queries, including Read transaction. There may be a numerical difference with the transaction statistics from the application.<p>\n",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"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": "line"
}
},
"links": [],
"mappings": [],
"thresholds": {
"mode": "percentage",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Temp bytes written"
},
"properties": [
{
"id": "unit",
"value": "Bps"
}
]
}
]
},
"gridPos": {
"h": 4,
"w": 6,
"x": 12,
"y": 15
},
"id": 89,
"interval": "5m",
"links": [],
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "8.5.1",
"targets": [
{
"$$hashKey": "object:76",
"aggregation": "Last",
"alias": "$tag_cluster_name",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"decimals": 2,
"displayAliasType": "Warning / Critical",
"displayType": "Regular",
"displayValueWithAlias": "Never",
"hide": false,
"query": "SELECT sum(TPS) from (\nSELECT non_negative_derivative(mean(\"xact_rollback\"), 1s) + non_negative_derivative(mean(\"xact_commit\"), 1s) as \"TPS\" FROM \"db_stats\" WHERE $timeFilter AND cluster_name =~ /^$sessiontop$/ GROUP BY time(1m), cluster_name, dbname fill(none)\n) group by time($agg_interval), cluster_name fill(none)",
"rawQuery": true,
"refId": "B",
"resultFormat": "time_series",
"units": "none",
"valueHandler": "Number Threshold"
},
{
"$$hashKey": "object:76",
"aggregation": "Last",
"alias": "$tag_cluster_name",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"decimals": 2,
"displayAliasType": "Warning / Critical",
"displayType": "Regular",
"displayValueWithAlias": "Never",
"hide": true,
"query": "SELECT non_negative_derivative(mean(\"xact_rollback\"), 1s) + non_negative_derivative(mean(\"xact_commit\"), 1s) FROM \"db_stats\" WHERE \"cluster_name\" =~/^$sessiontop$/ AND cluster_name =~ /^$clustername$/ AND $timeFilter GROUP BY cluster_name, time($agg_interval) fill(none)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"units": "none",
"valueHandler": "Number Threshold"
}
],
"title": "TPS",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "0"
},
"description": "<p>The Replication replay lag measures the delay in the replication process between the current write-ahead log (WAL) location and the replay location of PostgreSQL. It reflects the time difference between when changes are written to the primary database's WAL and when they are replayed on the replica.</p>",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"links": [
{
"title": "[${__series.name}]go to Replication state.",
"url": "/d/experdb-replication-state/5-2-replication-state?orgId=1&refresh=10s&var-clustername=${__series.name}"
}
],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "decbytes"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 6,
"x": 18,
"y": 15
},
"id": 93,
"options": {
"legend": {
"calcs": [],
"displayMode": "table",
"placement": "right",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "9.4.7",
"targets": [
{
"alias": "$tag_cluster_name",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"hide": false,
"query": "SELECT\ncluster_name,\nlast(\"replay_lag_b\") as \"lag\"\nFROM \"replication\"\n WHERE $timeFilter\n AND cluster_name =~/^$logicaliotop$/\nGROUP BY time($agg_interval), cluster_name fill(none)\n\n",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series"
}
],
"title": "Replication replay lag",
"transformations": [
{
"disabled": true,
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {},
"renameByName": {}
}
}
],
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "0"
},
"description": "<p>Clicking on the PID will take you to the [$clustername]'s <font color=\"#00ccff\"> session history</font> with the same time range.</p>",
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 18,
"x": 0,
"y": 19
},
"id": 109,
"options": {
"afterRender": " const buttonsDiv = document.getElementById('buttons');\r\n\r\n\r\n if(this.refreshed){\r\n const selectAllCheckbox = document.getElementById('selectAll');\r\n // if(selectAllCheckbox){\r\n // selectAllCheckbox.checked = this.allChecked;\r\n // }\r\n }\r\n\r\n if(buttonsDiv){\r\n if (!this.checked && !this.refreshed){\r\n if(this.timefilter.includes('now')){\r\n buttonsDiv.style.display = 'block'; // show the buttons\r\n }else{\r\n buttonsDiv.style.display = 'none'; // hide the buttons\r\n }\r\n }else if (!this.checked) {\r\n buttonsDiv.style.display = 'block'; // Show the buttons\r\n }else if(this.checked && this.refreshed && this.timefilter && this.from){\r\n const timestampRegex = /\\d+(?=ms)/g; // Match one or more digits followed by 'ms'\r\n const matches = this.timefilter.match(timestampRegex);\r\n if (matches && matches.length >= 2) {\r\n const toTimestamp = (matches[0]);\r\n if(toTimestamp == this.from){\r\n buttonsDiv.style.display = 'block'; // Show the buttons\r\n // Clear the existing rows in the tbody\r\n const tbody = document.getElementById('tbody_overview'); \r\n tbody.innerHTML = '';\r\n // Iterate over each row in this.rows and append it to the tbody\r\n this.rows.forEach(row => {\r\n tbody.appendChild(row.cloneNode(true));\r\n });\r\n }else{\r\n buttonsDiv.style.display = 'none'; // hide the buttons\r\n }\r\n } \r\n }else{\r\n buttonsDiv.style.display = 'none'; // hide the buttons\r\n }\r\n }\r\n\r\n\r\n \r\n // Get all hidden query elements\r\n const hiddenQueries = document.querySelectorAll('#query_hidden');\r\n\r\n // console.log('Hidden queries count:', hiddenQueries.length);\r\n\r\n // Loop through each hidden query element\r\n hiddenQueries.forEach(hiddenQuery => {\r\n // Get the full query from the hidden element's text content\r\n const fullQuery = hiddenQuery.textContent.trim();\r\n\r\n // Get the corresponding query cell\r\n const queryCell = hiddenQuery.nextElementSibling;\r\n\r\n // Set the full query as the title attribute of the query cell\r\n if(fullQuery.length > 47){\r\n\t\t\t\t queryCell.title = fullQuery;\r\n }\r\n });",
"content": "<div>\n <div id=\"buttons\" style=\"float:left; width:100%\">\n <button class=\"kill-button\" onclick=\"openConfirmationModal('{{variable \"‘${__user.login}’\"}}','{{variable \"__user.id\"}}','kill')\">Kill process</button>\n <button class=\"cancel-button\" onclick=\"openConfirmationModal('{{variable \"‘${__user.login}’\"}}','{{variable \"__user.id\"}}', 'cancel')\">Cancel Query</button>\n {{#if (isRefresh (variable \"__to\"))}}\n <button id=\"refresh\" class=\"custom-button\" onclick=\"stopRefresh()\">Restart Refresh</button>\n {{else}} \n <button id=\"refresh\" class=\"custom-button\" onclick=\"stopRefresh()\">Hold Refresh</button>\n {{/if}}\n</div>\n<div>\n<table id=\"table_overview\" style=\"width: 12%; height: 110px;\">\n <thead>\n <tr>\n <th style=\"width: 30px;\"><input type=\"checkbox\" id=\"selectAll\" onclick=\"selectAllRows()\"></th>\n <th id=\"cluster_name\" style=\"min-width: 150px\" onclick=\"sortTable('cluster_name')\">cluster name</th>\n <th id=\"dbname\" style=\"min-width: 150px\" class=\"sortable\" onclick=\"sortTable('dbname')\">dbname</th>\n <th id=\"pid\" style=\"min-width:100px\" class=\"sortable\" onclick=\"sortTable('pid')\">pid</th>\n <th id=\"user\" style=\"min-width:150px\" onclick=\"sortTable('user')\">user</th>\n <th id=\"state\" style=\"min-width:210px\" onclick=\"sortTable('state')\">state</th> \n <th id=\"duration\" style=\"min-width:100px\" onclick=\"sortTable('duration')\">duration</th>\n <th id=\"query\" style=\"min-width: 380px\" onclick=\"sortTable('query')\">query</th>\n <th id=\"queryid\" style=\"min-width: 200px\" onclick=\"sortTable('queryid')\">query id</th> \n <th id=\"wait_event\" style=\"min-width:150px\" onclick=\"sortTable('wait_event')\">wait event</th>\n <th id=\"appname\" style=\"min-width: 160px\" onclick=\"sortTable('appname')\">appname</th>\n <th id=\"client_ip\" style=\"min-width: 180px\" onclick=\"sortTable('client_ip')\">client ip</th>\n {{!-- <th id=\"blocking_pids\" style=\"min-width: 150px\" onclick=\"sortTable('blocking_pids')\">blocking pids</th> --}}\n <th id=\"backend_start\" style=\"min-width: 200px\" class=\"sortable\" onclick=\"sortTable('backend_start')\">backend start</th>\n </tr>\n </thead>\n <tbody id=\"tbody_overview\">\n {{#each data}}\n <tr>\n <td style=\"width: 30px;\"><input type=\"checkbox\" class=\"rowCheckbox\" onClick=\"updateSelectAllCheckbox()\"></td>\n <td title=\"{{title cluster_name 15}}\" data-column=\"cluster_name\" style='color:#73BF69;min-width:150px;max-width:150px;'>{{reduce2 cluster_name}}</td>\n <td title=\"{{title dbname 15}}\" data-column=\"dbname\" style='color:#73BF69;max-width:150px;min-width:150px;'>{{reduce2 dbname}}</td>\n <td data-column=\"pid\" style='color:#73BF69;min-width:100px;max-width:100px;'>\n\t\t\t <a title=\"[pid : {{pid}}] Go to session history.\" \n\t\t\t id=\"pid{{@index}}\" style='color:#73BF69;min-width:100px; max-width:100px;cursor: pointer; text-decoration: underline; ' onclick=\"goLink('pid', '{{pid}}', '{{cluster_name}}', '{{dbname}}')\">{{pid}}</a>\n\t\t\t</td>\n <td title=\"{{title user 15}}\" data-column=\"user\" style='color:#73BF69;min-width:150px;max-width:150px;'>\n {{reduce2 user}}</td>\n <td data-column=\"state\" style='color:#73BF69;min-width:210px;max-width:210px;'>\n {{reduce3 state}}</td>\n <td data-column=\"duration\" style='color:#73BF69;min-width:100px;max-width:100px;'>\n {{#if (isNull duration)}}\n 0s\n {{else}}\n {{\"duration\"}}s\n {{/if}}</td>\n <td data-column=\"query\" style='color:#73BF69;min-width:380px;max-width:380px;'>\n {{reduce query}}</td>\n {{!-- <td id=\"query_hidden\" hidden>{{query}}</td>\n <td id=\"queryCell\" class=\"query-cell\" data-column=\"query\" style='color:#73BF69;min-width:380px;max-width:380px;'>\n {{reduce query}}\n </td> --}}\n {{#if (isNull queryid)}}\n <td data-column=\"queryid\" style='color:#73BF69;min-width:200px;max-width:200px;'>\n\t\t {{queryid}}</td>\n {{else}}\n <td data-column=\"queryid\" style='color:#73BF69;min-width:200px;max-width:200px;'>\n\t\t\t <a title=\"[QueryID : {{queryid}}] Go to statements details.\"\n style='color:#73BF69;min-width:200px; cursor: pointer; text-decoration: underline;' onclick=\"goLink('queryid', '{{queryid}}', '{{cluster_name}}', '{{dbname}}')\">{{queryid}}\n\t\t\t\t\t\t\t</a></td>\n {{/if}}\n <td data-column=\"wait_event\" style='color:#73BF69;min-width:150px;max-width:150px;'>\n {{wait_event}}</td>\n <td title=\"{{title appname 15}}\" data-column=\"appname\" style='color:#73BF69;min-width:160px;'>\n {{reduce2 appname}}</td>\n <td data-column=\"client_ip\" style='color:#73BF69;min-width:180px;max-width:180px;'>\n {{client_ip}}</td>\n {{!-- <td data-column=\"blocking_pids\" style='color:#73BF69;min-width:150px;'>{{blocking_pids}}</td> --}}\n <td data-column=\"backend_start\" style='color:#73BF69;min-width:200px;'>{{backend_start}}</td>\n\t\t\t<td id=\"dbname{{@index}}\" hidden>{{dbname}}</td>\n\t\t\t<td id=\"clustername{{@index}}\" hidden>{{cluster_name}}</td>\n <td id=\"time\" hidden>{{Time}}</td>\n </tr>\n {{/each}}\n </tbody>\n</table>\n</div>\n</div>\n<!-- Modal -->\n<div id=\"confirmationModal\" class=\"modal\" hidden>\n <div class=\"modal-content\">\n\t <p style=\"color:white;\" id=\"modalMessage\"></p>\n\t <p id=\"username\" hidden></p>\n <p id=\"pids\" hidden></p>\n <p id=\"userid\" hidden></p>\n <p id=\"status\" hidden></p>\n\t <div class=\"button-container\">\n\t <button style=\"border-color:transparent;\" onclick=\"confirmAction()\">Confirm</button>\n\t <button style=\"border-color:transparent;\" onclick=\"closeModal('confirmationModal')\">Cancel</button>\n </div>\n </div>\n</div>\n\n<!-- Modal -->\n<div id=\"promptModal\" class=\"modal\" hidden>\n <div class=\"modal-content\">\n <p style=\"color:white;\" id=\"promptMessage\"></p>\n <input type=\"text\" id=\"promptInput\" placeholder=\"Enter your reason...\">\n <div class=\"button-container\">\n <button style=\"border-color:transparent;\" onclick=\"fn_SessionKill('{{variable \"clustername\"}}','{{variable \"dbname\"}}','{{pid}}','{{variable \"‘${__user.login}’\"}}','{{variable \"__user.id\"}}')\">Confirm</button>\n <button style=\"border-color:transparent;\" onclick=\"closeModal('promptModal')\">Cancel</button>\n </div>\n </div>\n</div>\n\n<!-- Modal -->\n<div id=\"alertModal\" class=\"modal\" hidden>\n <div class=\"modal-content\">\n <p style=\"color:white;\" id=\"alertMessage\"></p>\n <div class=\"button-container\">\n <button style=\"border-color:transparent;\" onclick=\"closeModal('alertModal')\">Confirm</button>\n </div>\n </div>\n</div>\n\n<!-- Modal -->\n<div id=\"confirmationModal2\" class=\"modal\" hidden>\n <div class=\"modal-content\">\n <p style=\"color:white;\" id=\"modalMessage2\"></p>\n <div class=\"button-container\">\n <button style=\"border-color:transparent;\" onclick=\"movePage()\">Confirm</button>\n <button style=\"border-color:transparent;\" onclick=\"closeModal('confirmationModal2')\">Cancel</button>\n </div>\n </div>\n</div>\n",
"defaultContent": " <div id=\"buttons\" style=\"float:left; width:100%\">\r\n</div>\r\n<div id=\"error\">\r\n <p id=\"errtxt\" style=\"align-items: center; color:#8D8E9A;font-size:18px;\">No data</p>\r\n</div>\r\n",
"editor": {
"format": "none",
"height": 593,
"language": "handlebars"
},
"editors": [
"helpers",
"styles",
"afterRender"
],
"externalScripts": [],
"externalStyles": [],
"helpers": "let bind_flag = false\r\nlet click = 0;\r\nlet originalOrder = null;\r\nlet sortOrders = {}; // Object to store sort order for each column\r\nlet sortedColumn = null;\r\nconst timefilter = replaceVariables('$timeFilter');\r\nconst timerange = replaceVariables('${__url_time_range}');\r\nlet count = false;\r\nconst from = replaceVariables('$__from');\r\nconst to = replaceVariables('$__to');\r\nconst toDate = new Date(parseInt(to));\r\nconst fromDate = new Date(parseInt(from));\r\nconst group = replaceVariables('$group');\r\nconst clustername = replaceVariables('$clustername');\r\nconst dbname = replaceVariables('$dbname');\r\n\r\n\r\n\r\nthis.timefilter = timefilter;\r\n\r\n\r\n\r\nupdateSelectAllCheckbox = () => {\r\n var selectAllCheckbox = document.getElementById(\"selectAll\");\r\n var rowCheckboxes = document.getElementsByClassName(\"rowCheckbox\");\r\n var allChecked = true;\r\n var allChecked2 = false;\r\n\r\n // Check if all checkboxes in the table body are checked\r\n for (var i = 0; i < rowCheckboxes.length; i++) {\r\n if (!rowCheckboxes[i].checked) {\r\n allChecked = false;\r\n }\r\n if (rowCheckboxes[i].checked) {\r\n allChecked2 = true;\r\n }\r\n }\r\n if(rowCheckboxes.length == 1 && rowCheckboxes[0].checked){\r\n this.allChecked = true;\r\n }\r\n\r\n // Update the state of the \"Select All\" checkbox\r\n if(!allChecked || allChecked2){\r\n selectAllCheckbox.checked = allChecked;\r\n }\r\n // if (this.buttons) {\r\n // if(!allChecked2){\r\n // stopRefresh();\r\n // }else if (!this.refreshed){\r\n // stopRefresh();\r\n // }else{\r\n // }\r\n // }\r\n}\r\n\r\nselectAllRows = () => {\r\n const checkboxes = document.querySelectorAll('.rowCheckbox');\r\n const selectAllCheckbox = document.getElementById('selectAll');\r\n checkboxes.forEach(checkbox => {\r\n checkbox.checked = selectAllCheckbox.checked;\r\n });\r\n // if (this.buttons) {\r\n // if(selectAllCheckbox.checked){\r\n // this.allChecked = true;\r\n // stopRefresh();\r\n // }else{\r\n // this.allChecked = false;\r\n // stopRefresh();\r\n // }\r\n // }\r\n}\r\n\r\n\r\n\r\n\r\n\r\nstopRefresh = () => {\r\n const refreshButton = document.getElementById('refresh');\r\n \r\n if (timefilter.includes('now')) {\r\n this.checked = true;\r\n this.refreshed = true;\r\n // Get the URL from the window location\r\n const url = window.location.href;\r\n // Parse the URL using URLSearchParams\r\n const params = new URLSearchParams(url);\r\n // Get the value of the 'from' parameter\r\n const fromValue = params.get('from');\r\n this.originalFrom = fromValue;\r\n this.originalTo = to;\r\n // Push the new URL to the browser's history without reloading the page\r\n this.from = from\r\n this.to = to\r\n this.timefilter = timefilter\r\n // Initialize an empty array to store the rows\r\n this.rows = [];\r\n\r\n // Get all the rows in the tbody\r\n const rows = document.querySelectorAll('#tbody_overview tr');\r\n\r\n // Iterate over each row and push it into the this.rows array\r\n rows.forEach(row => {\r\n this.rows.push(row);\r\n });\r\n locationService.partial({ from: from, to: to });\r\n refreshButton.innerText = 'Restart Refresh';\r\n } else {\r\n this.checked = false;\r\n this.refreshed = false;\r\n // Update the URL with the original 'from' parameter\r\n locationService.partial({ from: this.originalFrom, to: 'now', refresh: '10s' });\r\n }\r\n}\r\n\r\n\r\n\r\nsortTable = (column) => {\r\n const table = document.getElementById('table_overview');\r\n const rows = Array.from(table.querySelectorAll('#tbody_overview tr'));\r\n\r\n if (click == 0) {\r\n originalOrder = [...rows];\r\n click += 1;\r\n }\r\n if (sortedColumn === column) {\r\n sortOrders[column] *= -1;\r\n if (sortOrders[column] === 1) {\r\n if(rows){\r\n rows.length = 0;\r\n rows.push(...originalOrder);\r\n sortedColumn = null;\r\n }else{\r\n rows.length = 0;\r\n rows.push(...originalOrder);\r\n sortedColumn = null;\r\n }\r\n }\r\n } else {\r\n sortOrders[column] = 1;\r\n sortedColumn = column;\r\n }\r\n\r\n const allColumnHeaders = table.querySelectorAll('th');\r\n allColumnHeaders.forEach(header => {\r\n header.classList.remove('sorted');\r\n removeSortIcon(header);\r\n });\r\n\r\n if (sortedColumn) {\r\n const currentSortedColumn = table.querySelector(`th[id=\"${column}\"]`);\r\n if (currentSortedColumn) {\r\n currentSortedColumn.classList.add('sorted');\r\n addSortIcon(currentSortedColumn, sortOrders[column]);\r\n }\r\n }\r\n\r\n rows.sort((a, b) => {\r\n const aValueElement = a.querySelector(`td[data-column=\"${column}\"]`);\r\n const bValueElement = b.querySelector(`td[data-column=\"${column}\"]`);\r\n\r\n const aValue = aValueElement ? aValueElement.textContent.trim() : '';\r\n const bValue = bValueElement ? bValueElement.textContent.trim() : '';\r\n\r\n if (column === 'duration') {\r\n const aDuration = parseDuration(aValue);\r\n const bDuration = parseDuration(bValue);\r\n\r\n return sortOrders[column] * (aDuration - bDuration);\r\n } \r\n else if (column === 'blocking_pids') {\r\n // Custom sorting for 'blocking_pids' column\r\n if (aValue === '' && bValue === '') {\r\n return 0;\r\n } else if (aValue === '') {\r\n return -1;\r\n } else if (bValue === '') {\r\n return 1;\r\n } else {\r\n // If both values are not blank, use the sortOrder\r\n return sortOrders[column] * (parseFloat(aValue) - parseFloat(bValue));\r\n }\r\n } \r\n else if (isNaN(aValue) || isNaN(bValue)) {\r\n return sortOrders[column] * aValue.localeCompare(bValue, 'en', { sensitivity: 'base' });\r\n } else {\r\n return sortOrders[column] * (parseFloat(aValue) - parseFloat(bValue));\r\n }\r\n });\r\n\r\n if(!sortedColumn){\r\n rows.length = 0;\r\n rows.push(...originalOrder);\r\n }\r\n const tbody = table.querySelector('tbody');\r\n tbody.innerHTML = '';\r\n rows.forEach(row => tbody.appendChild(row));\r\n};\r\n\r\n// Function to add the sort icon to the header\r\nfunction addSortIcon(header, sortOrder) {\r\n const icon = document.createElement('i');\r\n icon.classList.add('material-icons'); // You can adjust the icon class based on your icon library\r\n icon.textContent = sortOrder === 1 ? '▲' : '▼';\r\n icon.style.textAlign = 'right';\r\n header.appendChild(icon);\r\n}\r\n\r\n// Function to remove the sort icon from the header\r\nfunction removeSortIcon(header) {\r\n const icon = header.querySelector('.material-icons');\r\n if (icon) {\r\n header.removeChild(icon);\r\n }\r\n}\r\n// Function to parse duration string and convert it to seconds\r\nfunction parseDuration(durationString) {\r\n const durationParts = durationString.split(' ');\r\n let totalSeconds = 0;\r\n\r\n for (const part of durationParts) {\r\n const match = part.match(/(\\d*\\.?\\d+)([a-z]+)/i); // Updated regex to allow floating-point numbers\r\n if (match) {\r\n const value = parseFloat(match[1]); // Parse float instead of int\r\n const unit = match[2].toLowerCase();\r\n\r\n // Convert different time units to seconds\r\n switch (unit) {\r\n case 's':\r\n totalSeconds += value;\r\n break;\r\n case 'm':\r\n totalSeconds += value * 60;\r\n break;\r\n case 'h':\r\n totalSeconds += value * 60 * 60;\r\n break;\r\n // Add more cases if needed (e.g., 'd' for days)\r\n }\r\n }\r\n }\r\n\r\n return totalSeconds;\r\n}\r\n\r\n// Function to parse duration string and convert it to seconds\r\nfunction parseBlocking(blockingString) {\r\n const value = parseInt(blockingString);\r\n return value;\r\n}\r\n\r\nkillall = async (username, userid,status) => {\r\n let reason = \"kill all\"\r\n if(status == \"cancel\"){\r\n\t\t\t\t\treason = \"cancel all\";\r\n\t\t\t}\r\n\t const checkboxes = document.querySelectorAll('.rowCheckbox');\r\n\t const selectedRows = [];\r\n\t\t\tconst currentURL = window.location.href;\r\n\t\t // Create a URL object\r\n\t\t const urlObject = new URL(currentURL);\r\n\t\t const redirectURL = `${urlObject.protocol}//${urlObject.host}`;\r\n\t\t url_workbench = redirectURL;\r\n\t\t // Change the port to 9030\r\n\t\t urlObject.port = '9030';\r\n\t\t // Extract the base URL\r\n\t\t const baseURL = `${urlObject.protocol}//${urlObject.host}`;\r\n\t\t var url = baseURL + \"/processKill\";\r\n if(status == \"cancel\"){\r\n\t\t\t\turl = baseURL + \"/processStop\";\r\n\t\t\t}\r\n\t checkboxes.forEach((checkbox, i) => {\r\n\t if (checkbox.checked) {\r\n\t selectedRows.push(i);\r\n\t }\r\n\t });\r\n for (const [index, selectedIndex] of selectedRows.entries()) {\r\n await new Promise((resolve) => {\r\n setTimeout(() => {\r\n let pid = document.getElementById(\"pid\" + selectedIndex).innerText;\r\n let dbname = document.getElementById(\"dbname\" + index).innerText;\r\n let clustername = document.getElementById(\"clustername\" + index).innerText;\r\n const data = {\r\n hostname: clustername,\r\n dbname: dbname,\r\n pid: pid,\r\n user: username,\r\n userid: userid,\r\n reason: reason,\r\n url: \"\"\r\n };\r\n fn_SessionKill_multi(data, url).then((result) => {\r\n if (result === 1) {\r\n if (index === selectedRows.length - 1) {\r\n if(status == \"cancel\"){\r\n showAlertModal(\"Cancel query success\");\r\n } else {\r\n showAlertModal(\"Process Kill success\");\r\n }\r\n }\r\n resolve();\r\n } else {\r\n if(status == \"cancel\"){\r\n showAlertModal(\"Fail to Cancel Query\");\r\n } else {\r\n showAlertModal(\"Fail to Kill process\");\r\n }\r\n }\r\n })\r\n }, 1);\r\n });\r\n }\r\n};\r\n\r\nfn_SessionKill_multi = (data,url) => {\r\n\treturn new Promise((resolve) => {\r\n setTimeout(() => {\r\n fetch(url, {\r\n\t\t\t\t\t\t\t method: 'post',\r\n\t\t\t\t\t\t\t body: JSON.stringify(data)\r\n\t\t\t\t\t\t\t })\r\n\t\t\t\t\t\t\t .then(res => res.json())\r\n\t\t\t\t\t\t\t .then(res => {\r\n\t\t\t\t\t\t\t if (res.success) {\r\n\t\t\t\t\t\t\t resolve(1);\r\n\t\t\t\t\t\t\t } else if (res == 1) {\r\n\t\t\t\t\t\t\t\t\t\t\tresolve(1);\r\n\t\t\t\t\t\t\t } else if (res == 0) {\r\n\t\t\t\t\t\t\t resolve(0);\r\n\t\t\t\t\t\t\t } else if (res == -1) {\r\n\t\t\t\t\t\t\t resolve(0);\r\n\t\t\t\t\t\t\t } else if (res == -2) {\r\n\t\t\t\t\t\t\t\t resolve(0);\r\n\t\t\t\t\t\t\t } else {\r\n\t\t\t\t\t\t\t\t resolve(0);\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t })\r\n .catch((error) => {\r\n // Check if the error is due to CORS\r\n if (error.name === 'TypeError' && error.message === 'Failed to fetch') {\r\n //console.error('CORS Error occurred:', error);\r\n resolve(1);\r\n } else {\r\n // Handle other errors\r\n console.error('Error occurred:', error);\r\n resolve(0);\r\n }\r\n \r\n });\r\n }, 50);\r\n });\r\n} \r\n\r\n\r\n\r\ngetUser = (clustername, dbname, pid, userLogin, userId, action, port) => {\r\n const currentURL = window.location.href;\r\n const urlObject = new URL(currentURL);\r\n const redirectURL = `${urlObject.protocol}//${urlObject.host}`;\r\n const url = redirectURL + '/api/user/orgs';\r\n action_temp = action;\r\n fetch(url, {\r\n method: 'get',\r\n })\r\n .then(res => res.json())\r\n .then(res => {\r\n if (res[0].role == 'Viewer') {\r\n var question = '';\r\n if (action == 'kill') {\r\n question = \"Viewers do not have the privilege to kill this session.\"\r\n } else {\r\n question = \"Viewers do not have the privilege to stop this query.\"\r\n }\r\n showAlertModal(question);\r\n } else {\r\n openConfirmationModal(clustername, dbname, pid, userLogin, userId, action, port);\r\n }\r\n })\r\n .catch(error => {\r\n console.error('Error fetching user data:', error);\r\n });\r\n}\r\n\r\ngoLink= (category, params,clustername,dbname) => {\r\n\tvar link = '';\r\n\t// Get the current URL\r\n const currentURL = window.location.href;\r\n // Create a URL object\r\n const urlObject = new URL(currentURL);\r\n const redirectURL = `${urlObject.protocol}//${urlObject.host}`;\r\n\tif(category == 'pid'){\r\n link = '/d/experdb-session-history?orgId=1&var-clustername=' +\r\n clustername + '&var-dbname=' + dbname + '&var-group=' + group +\r\n '&var-pid=' +\r\n params\r\n + '&' + timerange\r\n\t}else{\r\n\t link = '/d/experdb-query-details/query-details?orgId=1&var-clustername=' +\r\n clustername + '&var-dbname=' + dbname + \r\n '&var-queryid=' +\r\n params\r\n\t}\r\n window.location.href = redirectURL + link\r\n}\r\n\r\n\r\n\r\n\r\nopenConfirmationModal = (username, userid,status) => {\r\n const role = this.grafanaBootData.user.orgRole;\r\n var action = status\r\n if(role == 'Viewer'){\r\n var question = '';\r\n this.message = \"Pid does not exist\"\r\n if (action == 'kill') {\r\n question = \"Viewers do not have the privilege to kill this session.\"\r\n } else {\r\n question = \"Viewers do not have the privilege to stop this query.\"\r\n }\r\n showAlertModal(question);\r\n }else{\r\n const checkboxes = document.querySelectorAll('.rowCheckbox');\r\n const selectedRows = [];\r\n var pids = [];\r\n checkboxes.forEach((checkbox, i) => {\r\n if (checkbox.checked) {\r\n selectedRows.push(i);\r\n }\r\n });\r\n for (const [index, selectedIndex] of selectedRows.entries()) {\r\n let pid = document.getElementById(\"pid\" + selectedIndex).innerText;\r\n pids.push(pid)\r\n }\r\n\r\n if (pids.length) {\r\n var question = '';\r\n var pid_new = pids;\r\n if (pids.length > 8) {\r\n pids = pids.slice(0, 8);\r\n pid_new = pids.join(', ');\r\n pid_new += \"...\";\r\n }\r\n if (action == 'kill') {\r\n question = \"Are you sure you want to kill this session?\"\r\n } else {\r\n question = \"Are you sure you want to cancel this query?\"\r\n }\r\n question += \"\\n pid: \" + pid_new \r\n this.message = question\r\n\r\n const dynamicMessage = question;\r\n document.getElementById('modalMessage').innerText = dynamicMessage;\r\n document.getElementById('username').innerText = username;\r\n document.getElementById('userid').innerText = userid;\r\n document.getElementById('status').innerText = status;\r\n document.getElementById('pids').innerText = pids;\r\n\r\n // Show the modal\r\n const modal = document.getElementById('confirmationModal');\r\n modal.removeAttribute('hidden');\r\n } else {\r\n this.message = \"Pid does not exist\"\r\n showAlertModal(\"Pid does not exist\");\r\n }\r\n }\r\n}\r\n\r\nconfirmAction = () => {\r\n var username = document.getElementById('username').innerText;\r\n var userid= document.getElementById('userid').innerText ;\r\n var status = \tdocument.getElementById('status').innerText ;\r\n // After performing the action, close the modal\r\n closeModal('confirmationModal');\r\n killall(username, userid,status);\r\n}\r\n\r\nopenPromptModal = (clustername, dbname, pid, userLogin, userId, action, message) => {\r\n // Set dynamic message based on parameters\r\n const dynamicMessage = message;\r\n document.getElementById('promptMessage').innerText = dynamicMessage;\r\n // Show the modal\r\n const modal = document.getElementById('promptModal');\r\n modal.removeAttribute('hidden');\r\n}\r\n\r\nfn_SessionKill = (hostname, dbname, pid, username, userid) => {\r\n\thostname = document.getElementById('cluster_name').innerText\r\n\tdbname = document.getElementById('dbname').innerText \r\n pid = document.getElementById('pid').innerText;\r\n var userInput = $('#promptInput').val();\r\n closeModal('promptModal');\r\n var dbname_temp = dbname;\r\n var pid = pid;\r\n // Get the current URL\r\n const currentURL = window.location.href;\r\n // Create a URL object\r\n const urlObject = new URL(currentURL);\r\n const redirectURL = `${urlObject.protocol}//${urlObject.host}`;\r\n url_workbench = redirectURL;\r\n // Change the port to 9030\r\n urlObject.port = '9030';\r\n // Extract the base URL\r\n const baseURL = `${urlObject.protocol}//${urlObject.host}`;\r\n var status = document.getElementById('action').innerText;\r\n \r\n\r\n var url = baseURL + \"/processKill\";\r\n //var url = \"http://localhost:9030/processKill\";\r\n if (status == 'stop') {\r\n url = baseURL + \"/processStop\";\r\n //userInput = $('#promptInput').val();\r\n //url = \"http://localhost:9030/processStop\";\r\n } \r\n\r\n const data = {\r\n hostname: hostname,\r\n dbname: dbname,\r\n pid: pid,\r\n url: redirectURL,\r\n user: username,\r\n userid: userid,\r\n reason: userInput\r\n };\r\n // User clicked \"OK\" or confirmed\r\n fetch(url, {\r\n method: 'post',\r\n body: JSON.stringify(data)\r\n })\r\n .then(res => res.json())\r\n .then(res => {\r\n var process = 'Process ';\r\n var process2 = ' process';\r\n if (status == 'stop') {\r\n process = 'Query '\r\n process2 = ' query'\r\n status = 'cancel'\r\n }\r\n if (res.success) {\r\n showAlertModal(process + status + \" success\");\r\n } else if (res == 1) {\r\n showAlertModal(process + status + \" success\");\r\n hostname_workbench = hostname;\r\n dbname_workbench = dbname;\r\n showPageModal(\"Do you want to move to session workload page?\");\r\n } else if (res == 0) {\r\n showAlertModal(\"Failed to \" + status + process2);\r\n } else if (res == -1) {\r\n showAlertModal(\"Failed to connect to the database\");\r\n } else if (res == -2) {\r\n //showAlertModal (\"Viewer cannot \" + status + process2);\r\n } else {\r\n showAlertModal(\"Failed to \" + status + process2);\r\n }\r\n })\r\n\r\n}\r\nmovePage = () => {\r\n // User clicked \"OK\"\r\n window.location.href = url_workbench + '/d/experdb-session-workload/session-workload?orgId=1&var-clustername='\r\n + hostname_workbench\r\n + '&var-dbname='\r\n + dbname_workbench\r\n + '&var-agg_interval=10s&var-top_queries=10';\r\n // Add your logic for the \"OK\" case here\r\n}\r\n\r\nshowAlertModal = (question) => {\r\n const dynamicMessage = question;\r\n document.getElementById('alertMessage').innerText = dynamicMessage;\r\n\r\n // Show the modal\r\n const modal = document.getElementById('alertModal');\r\n modal.removeAttribute('hidden');\r\n}\r\n\r\nshowPageModal = (question) => {\r\n const dynamicMessage = question;\r\n document.getElementById('modalMessage2').innerText = dynamicMessage;\r\n\r\n // Show the modal\r\n const modal = document.getElementById('confirmationModal2');\r\n modal.removeAttribute('hidden');\r\n}\r\n\r\ncloseModal = (id) => {\r\n // Hide the modal\r\n const modal = document.getElementById(id);\r\n modal.setAttribute('hidden', true);\r\n if(id == 'alertModal'){\r\n if(this.message == \"Pid does not exist\"){\r\n }else{\r\n const selectAllCheckbox = document.getElementById('selectAll');\r\n selectAllCheckbox.checked = false;\r\n this.allChecked = false;\r\n // Get the current URL\r\n const currentURL = window.location.href;\r\n // Create a URL object\r\n const urlObject = new URL(currentURL);\r\n const redirectURL = `${urlObject.protocol}//${urlObject.host}`;\r\n link = '/d/experdb-session-workload/2-1-session-workload?orgId=1&var-group=${group}&var-clustername=' +\r\n clustername + '&var-dbname=' + dbname + '&from=30m&to=now' \r\n //window.location.href = redirectURL + link\r\n locationService.partial({ from: this.originalFrom, to: 'now', refresh: '10s' });\r\n } \r\n\t}\r\n}\r\n\r\n// Register a custom Handlebars helper\r\n\r\nhandlebars.registerHelper('title', function (value, length) {\r\n if(value){\r\n if(value.length > length){\r\n return value;\r\n }else{\r\n return null;\r\n }\r\n }else{\r\n return null;\r\n }\r\n});\r\n\r\nhandlebars.registerHelper('isRefresh', function (value) {\r\n if(timefilter.indexOf('now()') == -1 ){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n});\r\n\r\nhandlebars.registerHelper('isCurrent', function (value) {\r\n const current = new Date(); // Use new Date() to get the current date and time\r\n const timeDifferenceInSeconds = Math.abs(Math.floor((current - toDate) / 1000));\r\n\r\n // Check if the difference is less than 10 seconds\r\n if (timeDifferenceInSeconds < 10) { \r\n return false;\r\n } else {\r\n return true;\r\n }\r\n});\r\n\r\nhandlebars.registerHelper('reduce3', function (value) {\r\n if(value){\r\n\t\t\tif(value.length > 8){\r\n\t\t\t\treturn value.substr(0,8) + \"...\";\r\n }else{\r\n\t\t\t\treturn value;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\treturn value;\r\n\t\t}\r\n\r\n});\r\n\r\n\r\nhandlebars.registerHelper('reduce2', function (value) {\r\n if(value){\r\n\t\t\tif(value.length > 15){\r\n\t\t\t\treturn value.substr(0,15) + \"...\";\r\n }else{\r\n\t\t\t\treturn value;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\treturn value;\r\n\t\t}\r\n\r\n});\r\n\r\n\r\nhandlebars.registerHelper('reduce', function (value) {\r\n if(value){\r\n value = value.trim();\r\n\t\t\tif(value.length >47){\r\n\t\t\t\treturn value.substr(0,47) + \"...\";\r\n }else{\r\n\t\t\t\treturn value;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\treturn value;\r\n\t\t}\r\n\r\n});\r\n\r\nhandlebars.registerHelper('isNull', function (value) {\r\n return value === null;\r\n});\r\n\r\nhandlebars.registerHelper('replace', function (context, pattern, replacement) {\r\n var context_temp = \"\";\r\n if (context) {\r\n context_temp = context.replaceAll(pattern, replacement);\r\n }\r\n return context_temp;\r\n});\r\n\r\nhandlebars.registerHelper('merge', (str, sep, query) => {\r\n let tempStr = \"\";\r\n\r\n let tempQuery = \"\";\r\n if (str) {\r\n tempStr = str.split(sep)\r\n tempStr.map((v, i) => tempQuery = tempQuery.replace(\"$\" + (i + 1), v))\r\n tempQuery = query[0];\r\n } else {\r\n\r\n }\r\n\r\n return tempQuery\r\n});\r\n\r\nhandlebars.registerHelper('time_formatter', (time) => {\r\n let tempTime = new Date(time)\r\n let month = tempTime.getMonth() + 1;\r\n let day = tempTime.getDate();\r\n let hour = tempTime.getHours();\r\n let minute = tempTime.getMinutes();\r\n let second = tempTime.getSeconds();\r\n\r\n month = month >= 10 ? month : '0' + month;\r\n day = day >= 10 ? day : '0' + day;\r\n hour = hour >= 10 ? hour : '0' + hour;\r\n minute = minute >= 10 ? minute : '0' + minute;\r\n second = second >= 10 ? second : '0' + second;\r\n\r\n let formatted_date = tempTime.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;\r\n return formatted_date;\r\n});\r\n",
"renderMode": "allRows",
"styles": "\r\n/* Adjustments for Dark Mode */\r\n@media (prefers-color-scheme: dark) {\r\n :root {\r\n --background-color: var(--background-dark);\r\n --text-color: var(--text-dark);\r\n }\r\n\r\n /* Additional styling for dark mode */\r\n thead, tbody tr {\r\n background-color: var(--background-dark);\r\n }\r\n}\r\n\r\n/* Adjustments for Light Mode */\r\n@media (prefers-color-scheme: light) {\r\n :root {\r\n --background-color: var(--background-light);\r\n --text-color: var(--text-light);\r\n }\r\n\r\n /* Additional styling for light mode */\r\n thead, tbody tr {\r\n background-color: var(--background-light);\r\n }\r\n\r\n .cancel-button {\r\n color: rgb(6, 6, 6); \r\n }\r\n}\r\n\r\n\r\n.panel-loading{\r\n display:none !important;\r\n}\r\n\r\nthead {\r\n max-height: 35px !important;\r\n display: flex;\r\n //background: black;\r\n}\r\n\r\n\r\nth {\r\n text-align: left;\r\n background-color: #f2f2f2;\r\n height: 35px;\r\n line-height: 30px;\r\n}\r\n\r\n\r\nthead tr {\r\n display: flex;\r\n width: 100%;\r\n table-layout: fixed;\r\n max-height: 54px !important;\r\n}\r\n\r\ntbody tr {\r\n display: flex;\r\n width: 100%;\r\n table-layout: fixed;\r\n max-height: 30px !important;\r\n //background-color: #111214;\r\n \r\n}\r\ntbody {\r\n\t//border-color: rgb(30, 33, 37);\r\n}\r\n\r\n\r\ntable {\r\n border-collapse: collapse;\r\n width: 100%;\r\n height: 70px !important;\r\n //border-color: rgb(30, 33, 37);\r\n}\r\n\r\ntable th {\r\n //display: flex;\r\n background: transparent;\r\n width: 100%;\r\n table-layout: fixed;\r\n max-height: 54px !important;\r\n}\r\ntable td {\r\n //display: flex;\r\n width: 100%;\r\n table-layout: fixed;\r\n max-height: 30px !important;\r\n}\r\n\r\n\r\ntd {\r\n //font-size: 9pt;\r\n font-size: 1rem;\r\n //border-color: rgb(30, 33, 37) !important;\r\n}\r\n\r\n.custom-button {\r\n -webkit-text-size-adjust: 100%;\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n font-kerning: normal;\r\n color-scheme: dark;\r\n --sash-size: 4px;\r\n font-weight: 400;\r\n letter-spacing: 0.01071em;\r\n font-family: Inter, Helvetica, Arial, sans-serif;\r\n box-sizing: inherit;\r\n touch-action: manipulation;\r\n display: inline-block;\r\n position: relative;\r\n font-size: 14px;\r\n height: 32px;\r\n line-height: 26px;\r\n padding: 0px 16px;\r\n border-radius: 2px;\r\n background: rgba(0, 0, 0, 0.5); /* 다크 테마에 맞는 배경색 */\r\n cursor: pointer;\r\n z-index: 1;\r\n flex: 0 0 auto;\r\n text-align: center;\r\n user-select: none;\r\n white-space: nowrap;\r\n color: rgb(204, 204, 220);\r\n border: none; /* 테두리 제거 */\r\n margin-bottom: 5px;\r\n}\r\n\r\n\r\n.kill-button {\r\n -webkit-text-size-adjust: 100%;\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n color-scheme: dark;\r\n --sash-size: 4px;\r\n box-sizing: inherit;\r\n font: inherit;\r\n overflow: visible;\r\n text-transform: none;\r\n -webkit-appearance: button;\r\n touch-action: manipulation;\r\n margin: 0;\r\n letter-spacing: 0.01071em;\r\n display: inline-flex;\r\n -webkit-box-align: center;\r\n align-items: center;\r\n font-size: 14px;\r\n font-weight: 500;\r\n font-family: Inter, Helvetica, Arial, sans-serif;\r\n padding: 0px 16px;\r\n height: 32px;\r\n line-height: 30px;\r\n vertical-align: middle;\r\n cursor: pointer;\r\n border-radius: 2px;\r\n background: rgb(209, 14, 92);\r\n color: rgb(204, 204, 220);\r\n border: 1px solid transparent;\r\n transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\r\n margin-right: 5px;\r\n margin-bottom: 5px;\r\n}\r\n\r\n.cancel-button {\r\n -webkit-text-size-adjust: 100%;\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n color-scheme: dark;\r\n --sash-size: 4px;\r\n visibility: visible;\r\n box-sizing: inherit;\r\n font: inherit;\r\n overflow: visible;\r\n text-transform: none;\r\n -webkit-appearance: button;\r\n touch-action: manipulation;\r\n margin: 0;\r\n letter-spacing: 0.01071em;\r\n display: inline-flex;\r\n -webkit-box-align: center;\r\n align-items: center;\r\n font-size: 14px;\r\n font-weight: 500;\r\n font-family: Inter, Helvetica, Arial, sans-serif;\r\n padding: 0px 16px;\r\n height: 32px;\r\n line-height: 22px;\r\n vertical-align: middle;\r\n cursor: pointer;\r\n border-radius: 2px;\r\n background: rgba(204, 204, 220, 0.16);\r\n border: 1px solid transparent;\r\n transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\r\n margin-right: 5px;\r\n margin-bottom: 5px;\r\n color: rgb(204, 204, 220);\r\n}\r\n\r\n\r\ncustom-button2 {\r\n -webkit-text-size-adjust: 100%;\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n color-scheme: dark;\r\n --sash-size: 4px;\r\n pointer-events: auto;\r\n box-sizing: inherit;\r\n font: inherit;\r\n overflow: visible;\r\n text-transform: none;\r\n -webkit-appearance: button;\r\n touch-action: manipulation;\r\n margin: 0;\r\n letter-spacing: 0.01071em;\r\n display: inline-flex;\r\n -webkit-box-align: center;\r\n align-items: center;\r\n font-size: 14px;\r\n font-weight: 500;\r\n font-family: Inter, Helvetica, Arial, sans-serif;\r\n padding: 0px 15px;\r\n height: 32px;\r\n line-height: 30px;\r\n vertical-align: middle;\r\n cursor: pointer;\r\n border-radius: 2px;\r\n background: transparent;\r\n color: rgb(204, 204, 220);\r\n border: 1px solid rgba(204, 204, 220, 0.25);\r\n transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\r\n margin-bottom: 5px;\r\n}\r\n\r\n\r\n\r\n.custom-button2 {\r\n margin-top: 9px;\r\n display: inline-flex;\r\n font-size:11px;\r\n //font-weight: 500;\r\n font-family: Inter, Helvetica, Arial, sans-serif;\r\n //padding: 0px 15px;\r\n height: 32px;\r\n line-height: 30px;\r\n cursor: pointer;\r\n border-radius: 2px;\r\n background: rgba(204, 204, 220, 0.16);\r\n color: rgb(204, 204, 220);\r\n border: 1px solid transparent;\r\n transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\r\n}\r\n.button-container {\r\n display: flex; /* Use flexbox to make the buttons appear in the same row */\r\n gap: 10px; /* Optional: Add some space between the buttons */\r\n}\r\n\r\n\r\n\r\n#confirmationModal,\r\n#confirmationModal2,\r\n#confirmationModal3,\r\n#confirmationModal4,\r\n#promptModal,\r\n#promptModal_s {\r\n background-color: black;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n position: fixed;\r\n top: 40%;\r\n //left: 50%;\r\n transform: translate(50%, -50%) translateX(-50%);\r\n}\r\n\r\n#alertModal {\r\n background-color: black;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n position: fixed;\r\n top: 40%;\r\n //left: 50%;\r\n transform: translate(50%, -50%) translateX(-50%);\r\n}\r\n\r\n\r\n#error {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n height: 16vh;\r\n margin: 0;\r\n overflow: hidden; /* Set overflow to hidden */\r\n}\r\n\r\n#errtxt {\r\n text-align: center;\r\n overflow: hidden; /* Set overflow to hidden */\r\n margin: 0; /* Remove default margin */\r\n}",
"wrap": true
},
"pluginVersion": "4.5.0",
"targets": [
{
"datasource": "0",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"orderByTime": "ASC",
"policy": "default",
"query": " SELECT\n last(\"user\") AS \"user\",\nlast(\"backend_start_text\") as \"backend_start\",\n last(\"appname\") AS \"appname\",\n last(\"client_ip\") AS \"client_ip\",\n last(\"duration_s\") AS \"duration\",\n last(\"query_text\") AS \"query\",\n last(\"state\") AS \"state\",\nlast(\"bind_variables\") AS \"bind_variables\"\n FROM\n stat_activity_realtime\n WHERE\n $timeFilter\n AND duration_s >= 1\n -- AND \"duration_s\" <= $max\n AND \"cluster_name\" =~ /^$clustername$/ \n GROUP BY pid, wait_event,queryid, dbname,cluster_name, query_start\n-- LIMIT 100",
"rawQuery": true,
"refId": "B",
"resultFormat": "table",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": "11s",
"title": "Active sessions realtime",
"transformations": [],
"type": "marcusolsson-dynamictext-panel"
},
{
"datasource": {
"type": "influxdb",
"uid": "0"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "dark-orange",
"mode": "fixed"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 44,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "db_health.threshold_buffer_hitratio"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "yellow",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "db_health.threshold_commit_ratio"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "yellow",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "db_health.threshold_dbms_stat"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "threshold_cpu_util"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "green",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "threshold_mem_usage"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "green",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "threshold_query_runtime"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "super-light-blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "db_health.threshold_wal_size"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "light-orange",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "db_health.threshold_disk_usage"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "purple",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 6,
"w": 6,
"x": 18,
"y": 19
},
"id": 72,
"links": [],
"maxDataPoints": 100,
"options": {
"barRadius": 0.1,
"barWidth": 0.57,
"fullHighlight": false,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"orientation": "auto",
"showValue": "never",
"stacking": "normal",
"tooltip": {
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"pluginVersion": "9.4.7",
"targets": [
{
"alias": "",
"datasource": {
"type": "influxdb",
"uid": "0"
},
"hide": false,
"query": "SELECT\nsum(\"threshold_buffer_hitratio\") as threshold_buffer_hitratio,\nsum(\"threshold_commit_ratio\") as threshold_commit_ratio,\nsum(\"threshold_dbms_stat\") as threshold_dbms_stat,\nsum(\"threshold_dead_lock\") as threshold_dead_lock,\nsum(\"threshold_disk_usage\") as threshold_disk_usage,\nsum(\"threshold_duplication_index\") as threshold_duplication_index,\nsum(\"threshold_idle_in_txn\") as threshold_idle_in_txn,\nsum(\"threshold_inact_slot\") as threshold_inact_slot,\nsum(\"threshold_invalid_index\") as threshold_invalid_index,\nsum(\"threshold_lock_count\") as threshold_lock_count,\nsum(\"threshold_longrun_sql\") as threshold_longrun_sql,\nsum(\"threshold_query_runtime\") as threshold_query_runtime,\nsum(\"threshold_replication_delay\") as threshold_replication_delay,\nsum(\"threshold_sessions\") as threshold_sessions,\nsum(\"threshold_swap_usage\") as threshold_swap_usage,\nsum(\"threshold_table_bloat\") as threshold_table_bloat,\nsum(\"threshold_tx_freeze_age\") as threshold_tx_freeze_age,\nsum(\"threshold_txid_max_age\") as threshold_txid_max_age,\nsum(\"threshold_unused_index\") as threshold_unused_index,\nsum(\"threshold_wal_size\") as threshold_wal_size,\nsum(\"threshold_cpu_util\") as threshold_cpu_util,\nsum(\"threshold_mem_usage\") as threshold_mem_usage\nFROM \"db_health\" where $timeFilter AND cluster_name =~ /^$clustername$/ group by time(30m) fill(none)",
"rawQuery": true,
"refId": "G",
"resultFormat": "time_series"
}
],
"title": "Alert Event History",
"transformations": [],
"type": "barchart"
}
],
"refresh": "10s",
"revision": 1,
"schemaVersion": 38,
"style": "dark",
"tags": [
"experdb"
],
"templating": {
"list": [
{
"current": {
"selected": false
},
"datasource": {
"type": "postgres",
"uid": "1"
},
"definition": "SELECT 'All' AS __text, 0 AS __value where $role_id in (2, 3) \nUNION ALL\nselect g_name AS __text, g_id AS __value from cluster_group cg where $role_id in (2, 3) or exists (select 1 from cluster_group_user cgu where cgu.g_id = cg.g_id and cgu.u_id = ${__user.id}) ",
"hide": 0,
"includeAll": false,
"multi": false,
"name": "group",
"options": [],
"query": "SELECT 'All' AS __text, 0 AS __value where $role_id in (2, 3) \nUNION ALL\nselect g_name AS __text, g_id AS __value from cluster_group cg where $role_id in (2, 3) or exists (select 1 from cluster_group_user cgu where cgu.g_id = cg.g_id and cgu.u_id = ${__user.id}) ",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false
},
"datasource": {
"type": "postgres",
"uid": "1"
},
"definition": "\nselect ms.ms_unique_name \n from monitored_server ms \n join monitored_db md on ms.ms_unique_name = md.md_unique_name \n left join cluster_group_server cgs on ms.ms_unique_name = cgs.ms_unique_name \n where md_is_enabled = true and ($group = 0 or cgs.g_id=$group);",
"hide": 0,
"includeAll": true,
"multi": true,
"name": "clustername",
"options": [],
"query": "\nselect ms.ms_unique_name \n from monitored_server ms \n join monitored_db md on ms.ms_unique_name = md.md_unique_name \n left join cluster_group_server cgs on ms.ms_unique_name = cgs.ms_unique_name \n where md_is_enabled = true and ($group = 0 or cgs.g_id=$group);",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"current": {
"selected": false
},
"datasource": {
"type": "influxdb",
"uid": "0"
},
"definition": "SHOW TAG VALUES FROM \"db_health\" WITH KEY = \"dbname\"",
"hide": 2,
"includeAll": true,
"multi": true,
"name": "dbname",
"options": [],
"query": "SHOW TAG VALUES FROM \"db_health\" WITH KEY = \"dbname\"",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"current": {
"selected": false,
"text": "16",
"value": "16"
},
"hide": 0,
"includeAll": false,
"multi": false,
"name": "layout",
"options": [
{
"selected": true,
"text": "16",
"value": "16"
},
{
"selected": false,
"text": "32",
"value": "32"
},
{
"selected": false,
"text": "64",
"value": "64"
}
],
"query": "16,32,64",
"queryValue": "",
"skipUrlSync": false,
"type": "custom"
},
{
"current": {
"selected": false,
"text": "5",
"value": "5"
},
"hide": 0,
"includeAll": false,
"label": "top",
"multi": false,
"name": "Top",
"options": [
{
"selected": false,
"text": "3",
"value": "3"
},
{
"selected": true,
"text": "5",
"value": "5"
},
{
"selected": false,
"text": "10",
"value": "10"
}
],
"query": "3,5,10",
"queryValue": "",
"skipUrlSync": false,
"type": "custom"
},
{
"auto": true,
"auto_count": 30,
"auto_min": "5s",
"current": {
"selected": false,
"text": "auto",
"value": "$__auto_interval_agg_interval"
},
"hide": 2,
"name": "agg_interval",
"options": [
{
"selected": true,
"text": "auto",
"value": "$__auto_interval_agg_interval"
},
{
"selected": false,
"text": "5s",
"value": "5s"
},
{
"selected": false,
"text": "10s",
"value": "10s"
},
{
"selected": false,
"text": "30s",
"value": "30s"
},
{
"selected": false,
"text": "1m",
"value": "1m"
},
{
"selected": false,
"text": "5m",
"value": "5m"
},
{
"selected": false,
"text": "15m",
"value": "15m"
},
{
"selected": false,
"text": "1h",
"value": "1h"
},
{
"selected": false,
"text": "3h",
"value": "3h"
},
{
"selected": false,
"text": "6h",
"value": "6h"
},
{
"selected": false,
"text": "12h",
"value": "12h"
},
{
"selected": false,
"text": "1d",
"value": "1d"
},
{
"selected": false,
"text": "7d",
"value": "7d"
},
{
"selected": false,
"text": "30d",
"value": "30d"
}
],
"query": "5s,10s,30s,1m,5m,15m,1h,3h,6h,12h,1d,7d,30d",
"queryValue": "",
"refresh": 2,
"skipUrlSync": false,
"type": "interval"
},
{
"current": {
"selected": false,
"text": "3",
"value": "3"
},
"datasource": {
"type": "influxdb",
"uid": "0"
},
"definition": "select count(last) from (SELECT last(deadlocks) FROM kpi where $timeFilter and cluster_name =~ /^$clustername$/ group by cluster_name)",
"hide": 2,
"includeAll": false,
"multi": false,
"name": "registers",
"options": [],
"query": "select count(last) from (SELECT last(deadlocks) FROM kpi where $timeFilter and cluster_name =~ /^$clustername$/ group by cluster_name)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false
},
"datasource": {
"type": "influxdb",
"uid": "0"
},
"definition": "select dbname as cputop, top(load_average, $Top) from\n(SELECT mean(\"load_5min\") as load_average FROM \"cpu_load\" WHERE $timeFilter GROUP BY dbname fill(none)) where dbname =~ /^$clustername$/",
"hide": 2,
"includeAll": true,
"multi": true,
"name": "cputop",
"options": [],
"query": "select dbname as cputop, top(load_average, $Top) from\n(SELECT mean(\"load_5min\") as load_average FROM \"cpu_load\" WHERE $timeFilter GROUP BY dbname fill(none)) where dbname =~ /^$clustername$/",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false
},
"datasource": {
"type": "influxdb",
"uid": "0"
},
"definition": "SELECT cluster_name as sessiontop, top(active, $Top) from \n(SELECT last(\"active\") as active FROM backends where $timeFilter GROUP BY cluster_name fill(none)) where cluster_name =~ /^$clustername$/",
"hide": 2,
"includeAll": true,
"multi": true,
"name": "sessiontop",
"options": [],
"query": "SELECT cluster_name as sessiontop, top(active, $Top) from \n(SELECT last(\"active\") as active FROM backends where $timeFilter GROUP BY cluster_name fill(none)) where cluster_name =~ /^$clustername$/",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false
},
"datasource": {
"type": "influxdb",
"uid": "0"
},
"definition": "SELECT cluster_name as logicaliotop, top(logicalio, $Top) from \n (SELECT (max(tup_inserted) - min(tup_inserted) + max(tup_updated) - min(tup_updated) + max(tup_deleted) - min(tup_deleted)) as logicalio\n from db_stats WHERE $timeFilter\n GROUP BY cluster_name fill(0)) \n WHERE logicalio >= 0 and cluster_name =~ /^$clustername$/\n",
"hide": 2,
"includeAll": true,
"multi": true,
"name": "logicaliotop",
"options": [],
"query": "SELECT cluster_name as logicaliotop, top(logicalio, $Top) from \n (SELECT (max(tup_inserted) - min(tup_inserted) + max(tup_updated) - min(tup_updated) + max(tup_deleted) - min(tup_deleted)) as logicalio\n from db_stats WHERE $timeFilter\n GROUP BY cluster_name fill(0)) \n WHERE logicalio >= 0 and cluster_name =~ /^$clustername$/\n",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false
},
"datasource": {
"type": "influxdb",
"uid": "0"
},
"definition": "select dbname as disktop, top(diskio, $Top) as diskio from\n(SELECT max(\"read_bytes\") + max(\"write_bytes\") as diskio\nFROM \"psutil_disk_io_total\" WHERE $timeFilter GROUP BY dbname fill(0)) where dbname =~ /^$clustername$/",
"hide": 2,
"includeAll": true,
"multi": true,
"name": "diskiotop",
"options": [],
"query": "select dbname as disktop, top(diskio, $Top) as diskio from\n(SELECT max(\"read_bytes\") + max(\"write_bytes\") as diskio\nFROM \"psutil_disk_io_total\" WHERE $timeFilter GROUP BY dbname fill(0)) where dbname =~ /^$clustername$/",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false,
"text": "3",
"value": "3"
},
"datasource": {
"type": "postgres",
"uid": "2"
},
"definition": "select role_id from user_role where user_id = ${__user.id} and org_id = 1",
"hide": 2,
"includeAll": false,
"multi": false,
"name": "role_id",
"options": [],
"query": "select role_id from user_role where user_id = ${__user.id} and org_id = 1",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-30m",
"to": "now"
},
"timepicker": {
"hidden": false,
"nowDelay": "",
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "browser",
"title": "1.1. eXperDB Overview(board)",
"uid": "experdb-experdb-overview",
"version": 0,
"weekStart": ""
}
#exclude detail
SELECT /* SELECTCPUMEMINFO */ A.INSTANCE_ID
, C.COLLECT_DT AS REG_DATE
, CASE WHEN C.USER_UTIL_RATE + C.NICE_UTIL_RATE + C.SYS_UTIL_RATE + C.WAIT_UTIL_RATE > 100 THEN 100 ELSE C.USER_UTIL_RATE + C.NICE_UTIL_RATE + C.SYS_UTIL_RATE + C.WAIT_UTIL_RATE END AS CPU_MAIN --PT_03_03_001, PT_04_02_001(AVG)
, 0 as CPU_LOGICAL_ID --PT_04_02_001
, 0 AS CORE_CPU_RATE
--, D.CPU_LOGICAL_ID --PT_04_02_001
--, CASE WHEN D.USER_UTIL_RATE + D.NICE_UTIL_RATE + D.SYS_UTIL_RATE + D.WAIT_UTIL_RATE > 100 THEN 100 ELSE D.USER_UTIL_RATE + D.NICE_UTIL_RATE + D.SYS_UTIL_RATE + D.WAIT_UTIL_RATE END AS CORE_CPU_RATE --PT_04_02_001
--, (SELECT SUM(PROC_CPU_UTIL) FROM TB_BACKEND_RSC RSC WHERE RSC.REG_DATE = B.REG_DATE AND RSC.RSC_REG_SEQ = B.RSC_REG_SEQ) AS PGSQL_UTIL_RATE --PT_04_05_001(CPU_PG)
, C.WAIT_UTIL_RATE --PT_04_05_001(CPU_WAIT)
, CASE WHEN E.MEM_TOTAL_KB != 0 THEN (((E.MEM_TOTAL_KB - (E.MEM_FREE_KB +E.MEM_BUFFERED_KB + E.MEM_CACHED_KB)) / E.MEM_TOTAL_KB ) * 100)::int ELSE E.MEM_TOTAL_KB END AS MEM_USED_RATE --PT_03_03_001, PT_04_02_001(MEM_AVG)
, CASE WHEN E.SWP_TOTAL_KB != 0 THEN (((E.SWP_TOTAL_KB - (E.SWP_FREE_KB + E.SWP_CACHED_KB)) / E.SWP_TOTAL_KB) * 100)::int ELSE E.SWP_TOTAL_KB END AS SWP_USED_RATE --PT_03_03_001(MEM SWAP_RATE), PT_04_05_001(PG_MEMORY)
, (E.MEM_TOTAL_KB / 1024)::int AS MEM_TOTAL_MB --PT_04_05_001(TOTAL MEM)
, (E.MEM_USED_KB / 1024)::int AS MEM_USED_MB --PT_04_05_001(USED MEM)
, (E.MEM_FREE_KB / 1024)::int AS MEM_FREE_MB --PT_04_05_001(FREE MEM)
, (E.SHM_KB / 1024)::int AS SHM_MB --PT_04_05_001(SHARED MEM)
, (E.MEM_BUFFERED_KB / 1024)::int AS MEM_BUFFERED_MB --PT_04_05_001(BUFFERS MEM)
, (E.MEM_CACHED_KB / 1024)::int AS MEM_CACHED_MB --PT_04_05_001(CACHED MEM)
, (E.SWP_TOTAL_KB / 1024)::int AS SWP_TOTAL_MB --PT_04_05_001(SWAP_TOTAL MEM)
, (E.SWP_USED_KB / 1024)::int AS SWP_USED_MB --PT_04_05_001(SWAP_USED MEM)
, (E.SWP_FREE_KB / 1024)::int AS SWP_FREE_MB --PT_04_05_001(SWAP_FREE MEM)
, (E.SWP_CACHED_KB / 1024)::int AS SWP_CACHED_MB --PT_04_05_001(SWAP_CACHED MEM)
, (((E.MEM_TOTAL_KB - (E.MEM_FREE_KB )) / E.MEM_TOTAL_KB ) * 100) AS BUFFER_RATE --PT_03_03_001, PT_04_02_001(MEM_AVG)
, CASE WHEN 0=0 THEN A.HOST_NAME ELSE A.CONN_NAME END AS HOST_NAME
, A.HA_GROUP
, CASE WHEN 0=0 THEN TO_CHAR(A.INSTANCE_ID, '00')||A.HOST_NAME ELSE TO_CHAR(A.INSTANCE_ID, '00')||A.CONN_NAME END AS SORTED_HOST_NAME
FROM TB_INSTANCE_INFO A
, (SELECT MAX(REG_DATE) AS REG_DATE, MAX(REG_TIME) AS REG_TIME, MAX(RSC_REG_SEQ) AS RSC_REG_SEQ, INSTANCE_ID
FROM TB_RSC_COLLECT_INFO
WHERE REG_DATE=TO_CHAR(NOW(),'YYYYMMDD')
AND RSC_REG_SEQ >= (SELECT (LAST_VALUE - (SELECT COUNT(*) * 2 + 1 FROM TB_INSTANCE_INFO)) + 1 AS LAST_VALUE FROM RSC_REG_SEQ)
GROUP BY INSTANCE_ID) B
, TB_CPU_STAT_MASTER C, TB_MEMORY_STAT E
WHERE A.COLLECT_YN = 'Y'
AND A.DELETE_YN = 'N'
--AND A.INSTANCE_ID IN ({0})
AND B.REG_DATE = C.REG_DATE
AND C.REG_DATE = E.REG_DATE
AND A.INSTANCE_ID = B.INSTANCE_ID
AND B.RSC_REG_SEQ = C.RSC_REG_SEQ
AND C.RSC_REG_SEQ = E.RSC_REG_SEQ
#include detail
SELECT /* SELECTCPUMEMINFO */ A.INSTANCE_ID
, C.COLLECT_DT AS REG_DATE
, CASE WHEN C.USER_UTIL_RATE + C.NICE_UTIL_RATE + C.SYS_UTIL_RATE + C.WAIT_UTIL_RATE > 100 THEN 100 ELSE C.USER_UTIL_RATE + C.NICE_UTIL_RATE + C.SYS_UTIL_RATE + C.WAIT_UTIL_RATE END AS CPU_MAIN --PT_03_03_001, PT_04_02_001(AVG)
, 0 as CPU_LOGICAL_ID --PT_04_02_001
, 0 AS CORE_CPU_RATE
--, D.CPU_LOGICAL_ID --PT_04_02_001
--, CASE WHEN D.USER_UTIL_RATE + D.NICE_UTIL_RATE + D.SYS_UTIL_RATE + D.WAIT_UTIL_RATE > 100 THEN 100 ELSE D.USER_UTIL_RATE + D.NICE_UTIL_RATE + D.SYS_UTIL_RATE + D.WAIT_UTIL_RATE END AS CORE_CPU_RATE --PT_04_02_001
--, (SELECT SUM(PROC_CPU_UTIL) FROM TB_BACKEND_RSC RSC WHERE RSC.REG_DATE = B.REG_DATE AND RSC.RSC_REG_SEQ = B.RSC_REG_SEQ) AS PGSQL_UTIL_RATE --PT_04_05_001(CPU_PG)
, C.WAIT_UTIL_RATE --PT_04_05_001(CPU_WAIT)
, CASE WHEN E.MEM_TOTAL_KB != 0 THEN (((E.MEM_TOTAL_KB - (E.MEM_FREE_KB +E.MEM_BUFFERED_KB + E.MEM_CACHED_KB)) / E.MEM_TOTAL_KB ) * 100)::int ELSE E.MEM_TOTAL_KB END AS MEM_USED_RATE --PT_03_03_001, PT_04_02_001(MEM_AVG)
, CASE WHEN E.SWP_TOTAL_KB != 0 THEN (((E.SWP_TOTAL_KB - (E.SWP_FREE_KB + E.SWP_CACHED_KB)) / E.SWP_TOTAL_KB) * 100)::int ELSE E.SWP_TOTAL_KB END AS SWP_USED_RATE --PT_03_03_001(MEM SWAP_RATE), PT_04_05_001(PG_MEMORY)
, (E.MEM_TOTAL_KB / 1024)::int AS MEM_TOTAL_MB --PT_04_05_001(TOTAL MEM)
, (E.MEM_USED_KB / 1024)::int AS MEM_USED_MB --PT_04_05_001(USED MEM)
, (E.MEM_FREE_KB / 1024)::int AS MEM_FREE_MB --PT_04_05_001(FREE MEM)
, (E.SHM_KB / 1024)::int AS SHM_MB --PT_04_05_001(SHARED MEM)
, (E.MEM_BUFFERED_KB / 1024)::int AS MEM_BUFFERED_MB --PT_04_05_001(BUFFERS MEM)
, (E.MEM_CACHED_KB / 1024)::int AS MEM_CACHED_MB --PT_04_05_001(CACHED MEM)
, (E.SWP_TOTAL_KB / 1024)::int AS SWP_TOTAL_MB --PT_04_05_001(SWAP_TOTAL MEM)
, (E.SWP_USED_KB / 1024)::int AS SWP_USED_MB --PT_04_05_001(SWAP_USED MEM)
, (E.SWP_FREE_KB / 1024)::int AS SWP_FREE_MB --PT_04_05_001(SWAP_FREE MEM)
, (E.SWP_CACHED_KB / 1024)::int AS SWP_CACHED_MB --PT_04_05_001(SWAP_CACHED MEM)
, (((E.MEM_TOTAL_KB - (E.MEM_FREE_KB )) / E.MEM_TOTAL_KB ) * 100) AS BUFFER_RATE --PT_03_03_001, PT_04_02_001(MEM_AVG)
, CASE WHEN 0=0 THEN A.HOST_NAME ELSE A.CONN_NAME END AS HOST_NAME
, A.HA_GROUP
, CASE WHEN 0=0 THEN TO_CHAR(A.INSTANCE_ID, '00')||A.HOST_NAME ELSE TO_CHAR(A.INSTANCE_ID, '00')||A.CONN_NAME END AS SORTED_HOST_NAME
FROM TB_INSTANCE_INFO A
, (SELECT MAX(REG_DATE) AS REG_DATE, MAX(REG_TIME) AS REG_TIME, MAX(RSC_REG_SEQ) AS RSC_REG_SEQ, INSTANCE_ID
FROM TB_RSC_COLLECT_INFO
WHERE REG_DATE=TO_CHAR(NOW(),'YYYYMMDD')
AND RSC_REG_SEQ >= (SELECT (LAST_VALUE - (SELECT COUNT(*) * 2 + 1 FROM TB_INSTANCE_INFO)) + 1 AS LAST_VALUE FROM RSC_REG_SEQ)
GROUP BY INSTANCE_ID) B
, TB_CPU_STAT_MASTER C, TB_CPU_STAT_DETAIL D, TB_MEMORY_STAT E
WHERE A.COLLECT_YN = 'Y'
AND A.DELETE_YN = 'N'
--AND A.INSTANCE_ID IN ({0})
AND B.REG_DATE = C.REG_DATE
AND C.REG_DATE = D.REG_DATE
AND D.REG_DATE = E.REG_DATE
AND A.INSTANCE_ID = B.INSTANCE_ID
AND B.RSC_REG_SEQ = C.RSC_REG_SEQ
AND C.RSC_REG_SEQ = D.RSC_REG_SEQ
AND D.RSC_REG_SEQ = E.RSC_REG_SEQ
tuned query
with RC as (
SELECT /* SELECTCPUMEMINFO */ A.INSTANCE_ID
, C.COLLECT_DT AS REG_DATE
, B.reg_date as RDATE
, b.rsc_reg_seq
, CASE WHEN C.USER_UTIL_RATE + C.NICE_UTIL_RATE + C.SYS_UTIL_RATE + C.WAIT_UTIL_RATE > 100 THEN 100 ELSE C.USER_UTIL_RATE + C.NICE_UTIL_RATE + C.SYS_UTIL_RATE + C.WAIT_UTIL_RATE END AS CPU_MAIN --PT_03_03_001, PT_04_02_001(AVG)
, C.WAIT_UTIL_RATE --PT_04_05_001(CPU_WAIT)
, CASE WHEN E.MEM_TOTAL_KB != 0 THEN (((E.MEM_TOTAL_KB - (E.MEM_FREE_KB +E.MEM_BUFFERED_KB + E.MEM_CACHED_KB)) / E.MEM_TOTAL_KB ) * 100)::int ELSE E.MEM_TOTAL_KB END AS MEM_USED_RATE --PT_03_03_001, PT_04_02_001(MEM_AVG)
, CASE WHEN E.SWP_TOTAL_KB != 0 THEN (((E.SWP_TOTAL_KB - (E.SWP_FREE_KB + E.SWP_CACHED_KB)) / E.SWP_TOTAL_KB) * 100)::int ELSE E.SWP_TOTAL_KB END AS SWP_USED_RATE --PT_03_03_001(MEM SWAP_RATE), PT_04_05_001(PG_MEMORY)
, (E.MEM_TOTAL_KB / 1024)::int AS MEM_TOTAL_MB --PT_04_05_001(TOTAL MEM)
, (E.MEM_USED_KB / 1024)::int AS MEM_USED_MB --PT_04_05_001(USED MEM)
, (E.MEM_FREE_KB / 1024)::int AS MEM_FREE_MB --PT_04_05_001(FREE MEM)
, (E.SHM_KB / 1024)::int AS SHM_MB --PT_04_05_001(SHARED MEM)
, (E.MEM_BUFFERED_KB / 1024)::int AS MEM_BUFFERED_MB --PT_04_05_001(BUFFERS MEM)
, (E.MEM_CACHED_KB / 1024)::int AS MEM_CACHED_MB --PT_04_05_001(CACHED MEM)
, (E.SWP_TOTAL_KB / 1024)::int AS SWP_TOTAL_MB --PT_04_05_001(SWAP_TOTAL MEM)
, (E.SWP_USED_KB / 1024)::int AS SWP_USED_MB --PT_04_05_001(SWAP_USED MEM)
, (E.SWP_FREE_KB / 1024)::int AS SWP_FREE_MB --PT_04_05_001(SWAP_FREE MEM)
, (E.SWP_CACHED_KB / 1024)::int AS SWP_CACHED_MB --PT_04_05_001(SWAP_CACHED MEM)
, (((E.MEM_TOTAL_KB - (E.MEM_FREE_KB )) / E.MEM_TOTAL_KB ) * 100) AS BUFFER_RATE --PT_03_03_001, PT_04_02_001(MEM_AVG)
, CASE WHEN 0=0 THEN A.HOST_NAME ELSE A.CONN_NAME END AS HOST_NAME
, A.HA_GROUP
, CASE WHEN 0=0 THEN TO_CHAR(A.INSTANCE_ID, '00')||A.HOST_NAME ELSE TO_CHAR(A.INSTANCE_ID, '00')||A.CONN_NAME END AS SORTED_HOST_NAME
FROM TB_INSTANCE_INFO A
, (SELECT MAX(REG_DATE) AS REG_DATE, MAX(REG_TIME) AS REG_TIME, MAX(RSC_REG_SEQ) AS RSC_REG_SEQ, INSTANCE_ID
FROM TB_RSC_COLLECT_INFO
WHERE REG_DATE=TO_CHAR(NOW(),'YYYYMMDD')
AND RSC_REG_SEQ >= (SELECT (LAST_VALUE - (SELECT COUNT(*) * 2 + 1 FROM TB_INSTANCE_INFO)) + 1 AS LAST_VALUE FROM RSC_REG_SEQ)
GROUP BY INSTANCE_ID) B
, TB_CPU_STAT_MASTER C, TB_MEMORY_STAT E
WHERE A.COLLECT_YN = 'Y'
AND A.DELETE_YN = 'N'
and B.REG_DATE=TO_CHAR(NOW(),'YYYYMMDD')
AND B.REG_DATE = C.REG_DATE
AND B.REG_DATE = E.REG_DATE
AND A.INSTANCE_ID = B.INSTANCE_ID
AND B.RSC_REG_SEQ = C.RSC_REG_SEQ
AND B.RSC_REG_SEQ = E.RSC_REG_SEQ
)
SELECT RC.*
, D.CPU_LOGICAL_ID --PT_04_02_001
, CASE WHEN D.USER_UTIL_RATE + D.NICE_UTIL_RATE + D.SYS_UTIL_RATE + D.WAIT_UTIL_RATE > 100 THEN 100 ELSE D.USER_UTIL_RATE + D.NICE_UTIL_RATE + D.SYS_UTIL_RATE + D.WAIT_UTIL_RATE END AS CORE_CPU_RATE --PT_04_02_001
FROM RC
join TB_CPU_STAT_DETAIL D on D.REG_DATE=TO_CHAR(NOW(),'YYYYMMDD') and RC.RDATE = D.reg_date and RC.rsc_reg_seq = D.rsc_reg_seq
/* SELECTBACKEND /
WITH PGSTA AS (SELECT INSTANCE_ID FROM TB_INSTANCE_INFO WHERE instance_id IN (1,2,3,4) AND (EXTENSIONS & 4) = 0),
PGACT AS (SELECT INSTANCE_ID FROM TB_INSTANCE_INFO WHERE instance_id IN (1,2,3,4) AND (EXTENSIONS & 4) > 0)
SELECT BACKEND. , CASE WHEN (BACKEND.SQL1 = '') THEN Q.QUERY ELSE BACKEND.SQL1 END AS SQL
FROM
(
SELECT A.INSTANCE_ID
, E.COLLECT_DT AS REG_DATE
, ROW_NUMBER() OVER (PARTITION BY A.INSTANCE_ID ORDER BY E.ELAPSED_TIME DESC, E.PROC_CPU_UTIL DESC) AS RNUM
, E.DB_NAME --PT_04_04_001(RESRCUTILPERBACK : DB)
, COALESCE(E.USER_NAME, '') AS USER_NAME
, E.CLIENT_ADDR
, E.CLIENT_APP
, CASE WHEN (E.STATE = 'active') THEN 'active' ELSE 'idle' END AS "STATE"
, E.PROCESS_ID --PT_04_04_001(RESRCUTILPERBACK : PID)
, E.CURRENT_PROC_READ_KB --PT_03_06_001(BACKEND PROCS : MEM USEAGE READ KB)
, E.CURRENT_PROC_WRITE_KB --PT_04_04_001(RESRCUTILPERBACK : MEM USAGE WRITE KB)
, ROUND(E.PROC_CPU_UTIL / 100,2) AS "CPU_USAGE" --PT_03_06_001(BACKEND PROCS : CPU_USAGE PER), PT_04_04_001(RESRCUTILPERBACK : CPU_USAGE PER)
, E.QUERY_START AS "START_TIME" --PT_03_06_001(BACKEND PROCS : QUERY_START)
, CASE WHEN (E.STATE = 'active' AND E.ELAPSED_TIME >= 0 ) THEN E.ELAPSED_TIME ELSE '0' END AS "ELAPSED_TIME" --PT_03_06_001(BACKEND PROCS : )
, E.SQL AS SQL1 --PT_03_06_001(BACKEND PROCS : SQL), PT_04_04_001(RESRCUTILPERBACK : SQL)
, E.ELAPSED_TIME
, CASE WHEN 0=0 THEN A.HOST_NAME ELSE A.CONN_NAME END AS HOST_NAME
, E.CURRENT_PROC_READ_KB + E.CURRENT_PROC_WRITE_KB AS "MEM_USAGE_KB"
, B.ACTV_REG_SEQ
, CD.CODE_NAME AS WAIT_EVENT
, E.QUERYID
FROM TB_INSTANCE_INFO A,
(SELECT MAX(REG_DATE) AS REG_DATE, MAX(ACTV_REG_SEQ) AS ACTV_REG_SEQ, INSTANCE_ID, MAX(REG_TIME) AS REG_TIME
FROM TB_ACTV_COLLECT_INFO
WHERE REG_DATE = '20201117'
--AND ACTV_REG_SEQ >= (SELECT (LAST_VALUE - (SELECT COUNT(*) * 3 FROM TB_INSTANCE_INFO)) + 1 AS LAST_VALUE FROM ACTV_REG_SEQ)
AND reg_time BETWEEN '15:00:00' AND '15:30:00'
GROUP BY INSTANCE_ID) B, TB_BACKEND_RSC E, TB_SYS_CODE CD
WHERE B.REG_DATE = E.REG_DATE
AND A.INSTANCE_ID = B.INSTANCE_ID
AND B.ACTV_REG_SEQ = E.ACTV_REG_SEQ
AND A.INSTANCE_ID IN (SELECT INSTANCE_ID FROM PGSTA)
AND A.COLLECT_YN = 'Y'
AND A.DELETE_YN = 'N'
AND E.SQL != 'BACKGROUND PROC'
AND E.SQL IS NOT NULL
--AND a.INSTANCE_ID = 1
AND COALESCE(E.WAIT_EVENT, 200) = CD.CODE
ORDER BY E.ELAPSED_TIME DESC, E.PROC_CPU_UTIL DESC
) BACKEND,
(SELECT DISTINCT instance_id, QUERYID, QUERY FROM TB_QUERY_INFO) Q
--TB_QUERY_INFO Q
WHERE BACKEND.RNUM <= 8
AND Q.INSTANCE_ID = BACKEND.INSTANCE_ID
AND Q.QUERYID = BACKEND.QUERYID
AND ELAPSED_TIME >= 0
WITH PGSTA AS (SELECT INSTANCE_ID FROM TB_INSTANCE_INFO WHERE (EXTENSIONS & 4) = 0),
PGACT AS (SELECT INSTANCE_ID FROM TB_INSTANCE_INFO WHERE (EXTENSIONS & 4) > 0)
SELECT BACKEND.* , CASE WHEN (BACKEND.SQL1 = '') THEN Q.QUERY ELSE BACKEND.SQL1 END AS SQL
FROM
(SELECT A.INSTANCE_ID
, E.COLLECT_DT AS REG_DATE
, ROW_NUMBER() OVER (PARTITION BY A.INSTANCE_ID ORDER BY E.ELAPSED_TIME DESC, E.PROC_CPU_UTIL DESC) AS RNUM
, E.DB_NAME --PT_04_04_001(RESRCUTILPERBACK : DB)
, COALESCE(E.USER_NAME, '') AS USER_NAME
, E.CLIENT_ADDR
, E.CLIENT_APP
, CASE WHEN (E.STATE = 'active') THEN 'active' ELSE 'idle' END AS "STATE"
, E.PROCESS_ID --PT_04_04_001(RESRCUTILPERBACK : PID)
, E.CURRENT_PROC_READ_KB --PT_03_06_001(BACKEND PROCS : MEM USEAGE READ KB)
, E.CURRENT_PROC_WRITE_KB --PT_04_04_001(RESRCUTILPERBACK : MEM USAGE WRITE KB)
, ROUND(E.PROC_CPU_UTIL / 100,2) AS "CPU_USAGE" --PT_03_06_001(BACKEND PROCS : CPU_USAGE PER), PT_04_04_001(RESRCUTILPERBACK : CPU_USAGE PER)
, E.QUERY_START AS "START_TIME" --PT_03_06_001(BACKEND PROCS : QUERY_START)
, CASE WHEN (E.STATE = 'active' AND E.ELAPSED_TIME >= 0 ) THEN E.ELAPSED_TIME ELSE '0' END AS "ELAPSED_TIME" --PT_03_06_001(BACKEND PROCS : )
, E.SQL AS SQL1 --PT_03_06_001(BACKEND PROCS : SQL), PT_04_04_001(RESRCUTILPERBACK : SQL)
, E.ELAPSED_TIME
, CASE WHEN 0=0 THEN A.HOST_NAME ELSE A.CONN_NAME END AS HOST_NAME
, E.CURRENT_PROC_READ_KB + E.CURRENT_PROC_WRITE_KB AS "MEM_USAGE_KB"
, B.ACTV_REG_SEQ
, CD.CODE_NAME AS WAIT_EVENT
, E.QUERYID
FROM TB_INSTANCE_INFO A,
(SELECT MAX(REG_DATE) AS REG_DATE, MAX(ACTV_REG_SEQ) AS ACTV_REG_SEQ, INSTANCE_ID, MAX(REG_TIME) AS REG_TIME
FROM TB_ACTV_COLLECT_INFO
WHERE REG_DATE = TO_CHAR(NOW(), 'YYYYMMDD')
AND ACTV_REG_SEQ >= (SELECT (LAST_VALUE - (SELECT COUNT(*) * 3 FROM TB_INSTANCE_INFO)) + 1 AS LAST_VALUE FROM ACTV_REG_SEQ)
GROUP BY INSTANCE_ID) B, TB_BACKEND_RSC E, TB_SYS_CODE CD
WHERE B.REG_DATE = E.REG_DATE
AND A.INSTANCE_ID = B.INSTANCE_ID
AND B.ACTV_REG_SEQ = E.ACTV_REG_SEQ
AND A.INSTANCE_ID IN (SELECT INSTANCE_ID FROM PGSTA)
AND A.COLLECT_YN = 'Y'
AND A.DELETE_YN = 'N'
AND E.SQL != 'BACKGROUND PROC'
AND E.SQL IS NOT NULL
AND COALESCE(E.WAIT_EVENT, 200) = CD.CODE
ORDER BY E.ELAPSED_TIME DESC, E.PROC_CPU_UTIL DESC) BACKEND, (SELECT DISTINCT instance_id, QUERYID, QUERY FROM TB_QUERY_INFO) Q --TB_QUERY_INFO Q
WHERE BACKEND.RNUM <= 1000
AND Q.INSTANCE_ID = BACKEND.INSTANCE_ID
AND Q.QUERYID = BACKEND.QUERYID
AND ELAPSED_TIME >= 0
order by instance_id, rnum
(SELECT DISTINCT instance_id, QUERYID, QUERY FROM TB_QUERY_INFO) Q to (SELECT DISTINCT QUERYID, QUERY FROM TB_QUERY_INFO)
------------------------SELECTREPLICATIONCURR
--
WITH MAXS AS (
SELECT INSTANCE_ID, MAX(REPL_REG_SEQ) REPL_REG_SEQ, MAX(COLLECT_DT) COLLECT_DT FROM TB_REPLICATION_INFO
WHERE REG_DATE = TO_CHAR(NOW(),'YYYYMMDD')
--AND INSTANCE_ID IN ({0})
AND COLLECT_DT >= (now() - ((5000/500)::varchar)::INTERVAL)
GROUP BY INSTANCE_ID
)
, MAXR AS
(
SELECT /* SELECTREPLICATIONCURR */
B.INSTANCE_ID,
C.REPL_INSTANCE_ID,
B.COLLECT_DT COLLECT_DT,
C.REPLAY_LAG REPLAY_LAG,
B.REPL_REG_SEQ REPL_REG_SEQ,
--C.REPL_REG_SEQ,
(C.REPLAY_LAG_SIZE / 1024 / 1024) AS REPLAY_LAG_SIZE
FROM TB_INSTANCE_INFO A, MAXS B JOIN TB_REPLICATION_LAG_INFO C
ON B.INSTANCE_ID = C.INSTANCE_ID
AND B.REPL_REG_SEQ = C.REPL_REG_SEQ
WHERE C.reg_date = TO_CHAR(NOW(),'YYYYMMDD')
and A.INSTANCE_ID = B.INSTANCE_ID
AND A.COLLECT_YN = 'Y'
AND A.DELETE_YN = 'N'
ORDER BY B.INSTANCE_ID, REPL_REG_SEQ
)
SELECT A.INSTANCE_ID INSTANCE_ID,
A.COLLECT_DT COLLECT_DT,
B.REPLAY_LAG REPLAY_LAG,
A.REPL_REG_SEQ REPL_REG_SEQ,
B.REPLAY_LAG_SIZE
FROM MAXS A LEFT OUTER JOIN MAXR B
ON A.INSTANCE_ID = B.REPL_INSTANCE_ID
---------------\
SELECT /* SELECTLOCKINFOACCUM */
MAX(C.COLLECT_DT) AS REG_DATE
,DB_NAME
,BLOCKING_USER
,BLOCKING_PID
,(SELECT query FROM TB_QUERY_INFO WHERE REG_DATE = TO_CHAR(NOW(), 'YYYYMMDD') AND INSTANCE_ID IN (1) AND QUERYID = BLOCKING_QUERY LIMIT 1) BLOCKING_QUERY
,BLOCKED_USER
,BLOCKED_PID
,(SELECT query FROM TB_QUERY_INFO WHERE REG_DATE = TO_CHAR(NOW(), 'YYYYMMDD') AND INSTANCE_ID IN (1) AND QUERYID = BLOCKED_QUERY LIMIT 1) BLOCKED_QUERY
,MAX(BLOCKED_DURATION) AS BLOCKED_DURATION
,LOCK_MODE
,QUERY_START
,XACT_START
,MAX(C.ACTV_REG_SEQ) AS ACTV_REG_SEQ
FROM TB_INSTANCE_INFO A, TB_ACTV_COLLECT_INFO B, TB_CURRENT_LOCK C
WHERE B.REG_DATE = '20210112'
AND B.REG_TIME BETWEEN '03:59:00' AND '04:01:00'
AND A.INSTANCE_ID = B.INSTANCE_ID
AND A.INSTANCE_ID IN (1)
AND B.REG_DATE = C.REG_DATE
AND B.ACTV_REG_SEQ = C.ACTV_REG_SEQ
AND A.COLLECT_YN = 'Y'
AND A.DELETE_YN = 'N'
GROUP BY A.INSTANCE_ID, B.REG_DATE, DB_NAME, BLOCKING_USER, XACT_START, blocking_pid, BLOCKING_QUERY, BLOCKED_USER, blocked_pid, BLOCKED_QUERY, LOCK_MODE, QUERY_START, ORDER_NO
ORDER BY B.REG_DATE, DB_NAME, blocking_pid, ORDER_NO, XACT_START LIMIT 1000;
SELECT A.INSTANCE_ID, MAX(A.REPL_REG_SEQ) MAX_REG_SEQ, ha_role
FROM TB_REPLICATION_INFO A
WHERE A.REG_DATE = TO_CHAR(NOW(), 'YYYYMMDD')
AND REPL_REG_SEQ >= (SELECT (LAST_VALUE - (SELECT COUNT(*) * 2 + 5 FROM TB_INSTANCE_INFO)) + 1 AS LAST_VALUE FROM REPL_REG_SEQ)
GROUP BY A.INSTANCE_ID, ha_role
)
SELECT C.INSTANCE_ID --PT_03_01_001
, COLLECT_REG_DATE AS REG_DATE
, B.COLLECT_REG_SEQ AS REG_SEQ
, C.HCHK_NAME AS HCHK_NAME
, CASE WHEN B.VALUE IS NULL THEN 0 ELSE ROUND(B.VALUE,2) END AS VALUE
, (CASE /* FIXED_THRESHOLD ='0' CRITICAL -> 300 WARNING -> 200 NORMAL -> 100 */
WHEN (B.VALUE >= CRITICAL_THRESHOLD AND IS_HIGHER ='0' AND FIXED_THRESHOLD ='0') THEN 300
WHEN (B.VALUE > WARNING_THRESHOLD AND B.VALUE < CRITICAL_THRESHOLD AND IS_HIGHER ='0' AND FIXED_THRESHOLD ='0') THEN 200
WHEN (B.VALUE <= WARNING_THRESHOLD AND IS_HIGHER ='0' AND FIXED_THRESHOLD ='0') THEN 100
WHEN (B.VALUE > WARNING_THRESHOLD AND IS_HIGHER ='1' AND FIXED_THRESHOLD ='0') THEN 100
WHEN (B.VALUE >= CRITICAL_THRESHOLD AND B.VALUE < WARNING_THRESHOLD AND IS_HIGHER ='1' AND FIXED_THRESHOLD ='0') THEN 200
WHEN (B.VALUE < CRITICAL_THRESHOLD AND IS_HIGHER ='1' AND FIXED_THRESHOLD ='0') THEN 300
WHEN (B.VALUE > WARNING_THRESHOLD AND IS_HIGHER ='0' AND FIXED_THRESHOLD ='1') THEN 200
WHEN (B.VALUE <= WARNING_THRESHOLD AND IS_HIGHER ='0' AND FIXED_THRESHOLD ='1') THEN 100
WHEN (B.VALUE > WARNING_THRESHOLD AND IS_HIGHER ='1' AND FIXED_THRESHOLD ='1') THEN 100
WHEN (B.VALUE <= WARNING_THRESHOLD AND IS_HIGHER ='1' AND FIXED_THRESHOLD ='1') THEN 200
WHEN (B.VALUE >= CRITICAL_THRESHOLD AND IS_HIGHER ='0' AND FIXED_THRESHOLD ='2') THEN 300
WHEN (B.VALUE < CRITICAL_THRESHOLD AND IS_HIGHER ='0' AND FIXED_THRESHOLD ='2') THEN 100
WHEN (B.VALUE >= CRITICAL_THRESHOLD AND IS_HIGHER ='1' AND FIXED_THRESHOLD ='2') THEN 100
WHEN (B.VALUE < CRITICAL_THRESHOLD AND IS_HIGHER ='1' AND FIXED_THRESHOLD ='2') THEN 300
WHEN (FIXED_THRESHOLD ='9') THEN 100
WHEN B.VALUE IS NULL THEN 100
ELSE 999
END) HCHK_VALUE
FROM TB_HCHK_COLLECT_INFO B
RIGHT OUTER JOIN TB_HCHK_THRD_LIST C
ON B.INSTANCE_ID = C.INSTANCE_ID
AND B.HCHK_NAME = C.HCHK_NAME
AND B.REG_DATE = TO_CHAR(NOW(), 'YYYYMMDD')
AND B.HCHK_REG_SEQ = (SELECT MAX(X.HCHK_REG_SEQ) FROM TB_HCHK_COLLECT_INFO X WHERE X.REG_DATE = TO_CHAR(NOW(), 'YYYYMMDD'))
, TEMP_MAX_SEQ D
WHERE B.INSTANCE_ID IN (1);
select instance_id,hchk_name,unit,is_higher,warning_threshold,critical_threshold,fixed_threshold from tb_hchk_thrd_list thtl where instance_id = 1
SELECT /* SELECTLOCKINFOACCUM */
--A.INSTANCE_ID
MAX(C.COLLECT_DT) AS REG_DATE,
DB_NAME
,BLOCKING_USER
,BLOCKING_PID
,BLOCKING_QUERY
,BLOCKED_QUERY
,(SELECT query FROM TB_QUERY_INFO WHERE REG_DATE = '20220408' AND INSTANCE_ID IN (50) AND QUERYID = BLOCKING_QUERY LIMIT 1) BLOCKING_QUERY
,BLOCKED_USER
,BLOCKED_PID
,(SELECT query FROM TB_QUERY_INFO WHERE REG_DATE = '20220408' AND INSTANCE_ID IN (50) AND QUERYID = BLOCKED_QUERY LIMIT 1) BLOCKED_QUERY
,MAX(BLOCKED_DURATION) AS BLOCKED_DURATION
,LOCK_MODE
,QUERY_START
,XACT_START
,MAX(C.ACTV_REG_SEQ) AS ACTV_REG_SEQ
FROM TB_INSTANCE_INFO A, TB_ACTV_COLLECT_INFO B, TB_CURRENT_LOCK C
WHERE B.REG_DATE = '20220408'
AND B.REG_TIME between '2022-04-08 13:10' and '2022-04-08 13:15'
AND A.INSTANCE_ID = B.INSTANCE_ID
AND A.INSTANCE_ID IN (50)
AND B.REG_DATE = C.REG_DATE
AND B.ACTV_REG_SEQ = C.ACTV_REG_SEQ
AND A.COLLECT_YN = 'Y'
AND A.DELETE_YN = 'N'
GROUP BY A.INSTANCE_ID, B.REG_DATE, DB_NAME, BLOCKING_USER, XACT_START, blocking_pid, BLOCKING_QUERY, BLOCKED_USER, blocked_pid, BLOCKED_QUERY, LOCK_MODE, QUERY_START, ORDER_NO
-------------=-=-=-=-
SELECT p.pid, now() - a.xact_start AS duration, coalesce(wait_event_type ||'.'|| wait_event, 'f') AS waiting, CASE WHEN a.query ~*'^autovacuum.*to prevent wraparound' THEN 'wraparound' WHEN a.query ~*'^vacuum' THEN 'user' ELSE 'regular' END AS mode, p.datname AS database, p.relid::regclass AS table, p.phase, pg_size_pretty(p.heap_blks_total * current_setting('block_size')::int) AS table_size, pg_size_pretty(pg_total_relation_size(relid)) AS total_size, pg_size_pretty(p.heap_blks_scanned * current_setting('block_size')::int) AS scanned, pg_size_pretty(p.heap_blks_vacuumed * current_setting('block_size')::int) AS vacuumed, round(100.0 * p.heap_blks_scanned / p.heap_blks_total, 1) AS scanned_pct, round(100.0 * p.heap_blks_vacuumed / p.heap_blks_total, 1) AS vacuumed_pct, p.index_vacuum_count, round(100.0 * p.num_dead_tuples / p.max_dead_tuples,1) AS dead_pct FROM pg_stat_progress_vacuum p JOIN pg_stat_activity a using (pid) ORDER BY now() - a.xact_start DESC;
WITH IST AS (SELECT * FROM TB_INSTANCE_INFO WHERE COLLECT_YN = 'Y' AND DELETE_YN='N' AND INSTANCE_ID = 42)
,TTE AS (
SELECT O.INSTANCE_ID, O.REG_DATE, O.OBJT_REG_SEQ, CAST(MAX(T.MAXAGE) AS REAL) M1, MAX(T.COLLECT_DT) COLLECT_DT, relid
FROM IST,
TB_OBJT_COLLECT_INFO O,
TB_TABLE_EXT_INFO T
WHERE O.REG_DATE='20220621'
and O.REG_DATE=T.reg_date
--AND O.OBJT_REG_SEQ = 2583
AND O.OBJT_REG_SEQ = (SELECT MAX(X.OBJT_REG_SEQ) FROM TB_OBJT_COLLECT_INFO X WHERE X.REG_DATE = TO_CHAR(NOW(), 'YYYYMMDD') AND X.INSTANCE_ID=O.INSTANCE_ID )
AND O.OBJT_REG_SEQ = T.OBJT_REG_SEQ
AND O.INSTANCE_ID = IST.INSTANCE_ID
GROUP BY O.REG_DATE,O.OBJT_REG_SEQ,O.INSTANCE_ID, relid
order by m1 desc
limit 1
)
SELECT DB_NAME, M1::NUMERIC(12,0) FROZENMAXAGE, TTE.COLLECT_DT
FROM TTE, TB_TABLE_INFO TTI
WHERE TTE.REG_DATE = TTI.REG_DATE
AND TTE.OBJT_REG_SEQ = TTI.OBJT_REG_SEQ
and tte.relid = tti.relid
LIMIT 1
create table svc_mntg_alarm ( alarm_id varchar(5) not null , alarm_prop varchar(2000) not null , alarm_val varchar(2000) not null , alarm_cntt varchar(2000) , occ_dts timestamp with time zone );
COMMENT ON column svc_mntg_alarm.alarm_id IS '알람ID' ; COMMENT ON column svc_mntg_alarm.alarm_prop IS '알람항목' ; COMMENT ON column svc_mntg_alarm.alarm_val IS '알람값' ; COMMENT ON column svc_mntg_alarm.alarm_cntt IS '알람내용' ; COMMENT ON column svc_mntg_alarm.occ_dts IS '발생일시' ; COMMENT ON TABLE svc_mntg_alarm IS '서비스모니터링알람' ;
alter table svc_mntg_alarm add constraint svc_mntg_alarm_pk primary key (alarm_id);
temp