oglog/etc/grafana/resources/alerts/alert-rules.json

149 lines
3.6 KiB
JSON

[
{
"id": 1,
"uid": "fehoe93yzz20wf",
"orgID": 1,
"folderUID": "eehoe7oh9bs3kd",
"ruleGroup": "grupo-cada-1m",
"title": "Subred alta ocupación",
"condition": "C",
"data": [
{
"refId": "A",
"queryType": "",
"relativeTimeRange": {
"from": 600,
"to": 0
},
"datasourceUid": "dea978mh1bncwf",
"model": {
"dataset": "mysql",
"datasource": {
"type": "mysql",
"uid": "dea978mh1bncwf"
},
"editorMode": "code",
"format": "table",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"rawQuery": true,
"rawSql": "SELECT\n s.name AS metric,\n ROUND(100 * COUNT(c.id) / (POW(2, 32 - BIT_COUNT(INET_ATON(s.netmask))) - 2), 2) AS usage_percentage\nFROM subnet s\nLEFT JOIN client c ON c.subnet_id = s.id\nGROUP BY s.id, s.name, s.netmask\nHAVING usage_percentage >= 80;\n",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
},
{
"refId": "B",
"queryType": "",
"relativeTimeRange": {
"from": 0,
"to": 0
},
"datasourceUid": "__expr__",
"model": {
"conditions": [
{
"evaluator": {
"params": [],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"B"
]
},
"reducer": {
"params": [],
"type": "last"
},
"type": "query"
}
],
"datasource": {
"type": "__expr__",
"uid": "__expr__"
},
"expression": "A",
"intervalMs": 1000,
"maxDataPoints": 43200,
"reducer": "last",
"refId": "B",
"type": "reduce"
}
},
{
"refId": "C",
"queryType": "",
"relativeTimeRange": {
"from": 0,
"to": 0
},
"datasourceUid": "__expr__",
"model": {
"conditions": [
{
"evaluator": {
"params": [
80
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"C"
]
},
"reducer": {
"params": [],
"type": "last"
},
"type": "query"
}
],
"datasource": {
"type": "__expr__",
"uid": "__expr__"
},
"expression": "A",
"intervalMs": 1000,
"maxDataPoints": 43200,
"refId": "C",
"type": "threshold"
}
}
],
"updated": "2025-04-02T07:36:00Z",
"noDataState": "NoData",
"execErrState": "Error",
"for": "1m",
"isPaused": false,
"notification_settings": {
"receiver": "grafana-default-email"
},
"record": null
}
]