Skip to content

Commit

Permalink
Merge pull request #221 from Altinity/fix_github_issues
Browse files Browse the repository at this point in the history
add dashboard with Alerts, try to reproduce Alerts gRPC error
  • Loading branch information
Slach committed Jul 5, 2020
2 parents 0d9e241 + fabdcb8 commit 26d04a4
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docker/clickhouse/init_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ CREATE TABLE default.test_alerts
`EventDate` Date,
`EventTime` DateTime,
`Value` UInt64
) ENGINE = Memory;
) ENGINE = MergeTree()
PARTITION BY toYYYYMM(EventTime)
ORDER BY (EventTime, Name);

-- INSERT INTO default.test_alerts SELECT concat('test',toString(rand() % 10)) AS Name, toDate(now()) AS EventDate, now() AS EventTime, rand() AS Value FROM numbers(1000);

Expand Down
191 changes: 191 additions & 0 deletions docker/grafana/dashboards/test_alerts_dashboard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
{
"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": 4,
"links": [],
"panels": [
{
"alert": {
"alertRuleTags": {},
"conditions": [
{
"evaluator": {
"params": [
20
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"A",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"executionErrorState": "alerting",
"for": "5m",
"frequency": "1m",
"handler": 1,
"name": "Panel Title alert",
"noDataState": "no_data",
"notifications": []
},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "clickhouse",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"interval": "5m",
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"database": "default",
"dateColDataType": "EventDate",
"dateLoading": false,
"dateTimeColDataType": "EventTime",
"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",
"interval": "",
"intervalFactor": 1,
"query": "$columns(Name, sum(Value) c) FROM $table",
"rawQuery": "SELECT t, groupArray((Name, c)) AS groupArr FROM ( SELECT (intDiv(toUInt32(EventTime), 300) * 300) * 1000 AS t, Name, sum(Value) c FROM default.test_alerts WHERE EventDate >= toDate(1593937994) AND EventTime >= toDateTime(1593937994) GROUP BY t, Name ORDER BY t, Name) GROUP BY t ORDER BY t",
"refId": "A",
"round": "0s",
"table": "test_alerts",
"tableLoading": false
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 20
}
],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Test Alerts",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:60",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:61",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"refresh": "5s",
"schemaVersion": 25,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-15m",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Test Alerts Dashboard",
"uid": "Rln7U1GGk",
"version": 3
}

0 comments on commit 26d04a4

Please sign in to comment.