-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
270 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,270 @@ | ||
{ | ||
"annotations": { | ||
"list": [ | ||
{ | ||
"builtIn": 1, | ||
"datasource": "-- Grafana --", | ||
"enable": true, | ||
"hide": true, | ||
"iconColor": "rgba(0, 211, 255, 1)", | ||
"name": "Annotations & Alerts", | ||
"type": "dashboard" | ||
} | ||
] | ||
}, | ||
"editable": true, | ||
"gnetId": null, | ||
"graphTooltip": 0, | ||
"id": 10, | ||
"iteration": 1595574658327, | ||
"links": [], | ||
"panels": [ | ||
{ | ||
"alert": { | ||
"alertRuleTags": {}, | ||
"conditions": [ | ||
{ | ||
"evaluator": { | ||
"params": [ | ||
2000 | ||
], | ||
"type": "gt" | ||
}, | ||
"operator": { | ||
"type": "and" | ||
}, | ||
"query": { | ||
"params": [ | ||
"A", | ||
"5m", | ||
"now" | ||
] | ||
}, | ||
"reducer": { | ||
"params": [], | ||
"type": "avg" | ||
}, | ||
"type": "query" | ||
} | ||
], | ||
"executionErrorState": "alerting", | ||
"for": "5m", | ||
"frequency": "1m", | ||
"handler": 1, | ||
"message": "Alert 2K threshold", | ||
"name": "sql logic histogram alert", | ||
"noDataState": "alerting", | ||
"notifications": [] | ||
}, | ||
"aliasColors": {}, | ||
"bars": false, | ||
"dashLength": 10, | ||
"dashes": false, | ||
"datasource": "clickhouse", | ||
"description": "example how to Sql logic in clickhouse scripting", | ||
"fieldConfig": { | ||
"defaults": { | ||
"custom": {} | ||
}, | ||
"overrides": [] | ||
}, | ||
"fill": 1, | ||
"fillGradient": 0, | ||
"gridPos": { | ||
"h": 8, | ||
"w": 12, | ||
"x": 0, | ||
"y": 0 | ||
}, | ||
"hiddenSeries": false, | ||
"id": 2, | ||
"legend": { | ||
"avg": false, | ||
"current": false, | ||
"max": false, | ||
"min": false, | ||
"show": true, | ||
"total": false, | ||
"values": false | ||
}, | ||
"lines": true, | ||
"linewidth": 1, | ||
"nullPointMode": "null", | ||
"percentage": false, | ||
"pluginVersion": "7.1.0", | ||
"pointradius": 2, | ||
"points": false, | ||
"renderer": "flot", | ||
"seriesOverrides": [], | ||
"spaceLength": 10, | ||
"stack": false, | ||
"steppedLine": false, | ||
"targets": [ | ||
{ | ||
"database": "default", | ||
"dateColDataType": "", | ||
"dateLoading": false, | ||
"dateTimeColDataType": "d", | ||
"dateTimeType": "DATETIME", | ||
"datetimeLoading": false, | ||
"extrapolate": true, | ||
"format": "time_series", | ||
"formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t", | ||
"hide": false, | ||
"intervalFactor": 1, | ||
"query": "<%var m=1;switch(\"$multiplier\"){case \"unchanged\":m=1;break;case \"doubled\":m=2;break;case \"tripled\":m=3;break;case \"alert!\":m=10;break;}%>\n<%if(\"$type\"==\"constant\"){%>\n SELECT\n $timeSeries as t,\n count()*100 * <%m%>\n FROM $table\n WHERE $timeFilter\n GROUP BY t\n ORDER BY t\n<%}else{%>\n SELECT\n $timeSeries as t,\n rand()/10000000 * <%m%> as x\n FROM $table\n WHERE $timeFilter\n GROUP BY t\n ORDER BY t\n<%}%>", | ||
"rawQuery": " SELECT (intDiv(toUInt32(d), 15) * 15) * 1000 as t, count()*100 * 10 FROM default.test_interval WHERE d >= toDateTime(1595553123) GROUP BY t ORDER BY t ", | ||
"refId": "A", | ||
"round": "0s", | ||
"table": "test_interval", | ||
"tableLoading": false | ||
} | ||
], | ||
"thresholds": [ | ||
{ | ||
"colorMode": "critical", | ||
"fill": true, | ||
"line": true, | ||
"op": "gt", | ||
"value": 2000 | ||
} | ||
], | ||
"timeFrom": null, | ||
"timeRegions": [], | ||
"timeShift": null, | ||
"title": "sql logic histogram", | ||
"tooltip": { | ||
"shared": true, | ||
"sort": 0, | ||
"value_type": "individual" | ||
}, | ||
"type": "graph", | ||
"xaxis": { | ||
"buckets": null, | ||
"mode": "time", | ||
"name": null, | ||
"show": true, | ||
"values": [] | ||
}, | ||
"yaxes": [ | ||
{ | ||
"format": "short", | ||
"label": null, | ||
"logBase": 1, | ||
"max": null, | ||
"min": null, | ||
"show": true | ||
}, | ||
{ | ||
"format": "short", | ||
"label": null, | ||
"logBase": 1, | ||
"max": null, | ||
"min": null, | ||
"show": true | ||
} | ||
], | ||
"yaxis": { | ||
"align": false, | ||
"alignLevel": null | ||
} | ||
} | ||
], | ||
"refresh": "5s", | ||
"schemaVersion": 26, | ||
"style": "dark", | ||
"tags": [], | ||
"templating": { | ||
"list": [ | ||
{ | ||
"allValue": null, | ||
"current": { | ||
"selected": true, | ||
"text": "tripled", | ||
"value": "tripled" | ||
}, | ||
"hide": 0, | ||
"includeAll": false, | ||
"label": "", | ||
"multi": false, | ||
"name": "multiplier", | ||
"options": [ | ||
{ | ||
"selected": false, | ||
"text": "unchanged", | ||
"value": "unchanged" | ||
}, | ||
{ | ||
"selected": false, | ||
"text": "doubled", | ||
"value": "doubled" | ||
}, | ||
{ | ||
"selected": true, | ||
"text": "tripled", | ||
"value": "tripled" | ||
}, | ||
{ | ||
"selected": false, | ||
"text": "alert!", | ||
"value": "alert!" | ||
} | ||
], | ||
"query": "unchanged,doubled,tripled,alert!", | ||
"queryValue": "", | ||
"skipUrlSync": false, | ||
"type": "custom" | ||
}, | ||
{ | ||
"allValue": null, | ||
"current": { | ||
"selected": true, | ||
"text": "random", | ||
"value": "random" | ||
}, | ||
"hide": 0, | ||
"includeAll": false, | ||
"label": null, | ||
"multi": false, | ||
"name": "type", | ||
"options": [ | ||
{ | ||
"selected": false, | ||
"text": "constant", | ||
"value": "constant" | ||
}, | ||
{ | ||
"selected": true, | ||
"text": "random", | ||
"value": "random" | ||
} | ||
], | ||
"query": "constant,random", | ||
"queryValue": "", | ||
"skipUrlSync": false, | ||
"type": "custom" | ||
} | ||
] | ||
}, | ||
"time": { | ||
"from": "now-6h", | ||
"to": "now" | ||
}, | ||
"timepicker": { | ||
"refresh_intervals": [ | ||
"10s", | ||
"30s", | ||
"1m", | ||
"5m", | ||
"15m", | ||
"30m", | ||
"1h", | ||
"2h", | ||
"1d" | ||
] | ||
}, | ||
"timezone": "", | ||
"title": "sql logic", | ||
"uid": "fhm5om4Gz", | ||
"version": 4 | ||
} |