diff --git a/etherlink/scripts/grafana/Alert_README.md b/etherlink/scripts/grafana/Alert_README.md index c8d4efee5897e38661d7c98e79e26a8cf1170621..53051e47746545c28ff841ec9e5281e2e024ba0f 100644 --- a/etherlink/scripts/grafana/Alert_README.md +++ b/etherlink/scripts/grafana/Alert_README.md @@ -6,5 +6,7 @@ An example for `${receiver}` is `slack`. As for `${datasourceUid}`, you need to retrieve the UID of your datasource. +Replace ${DB_SOURCE} by the uid of your choice. + To import the alert, place the JSON file in the Grafana provisioning alerting directory. -An example of the path is `/etc/grafana/provisioning/alerting/`. \ No newline at end of file +An example of the path is `/etc/grafana/provisioning/alerting/`. diff --git a/etherlink/scripts/grafana/alert-etherlink-kernel-governance.json b/etherlink/scripts/grafana/alert-etherlink-kernel-governance.json new file mode 100644 index 0000000000000000000000000000000000000000..7f2e4fca7db7a13d640e969809ff492cc1b028fe --- /dev/null +++ b/etherlink/scripts/grafana/alert-etherlink-kernel-governance.json @@ -0,0 +1,322 @@ +{ + "apiVersion": 1, + "groups": [ + { + "orgId": 1, + "name": "10s", + "folder": "Governance", + "interval": "10s", + "rules": [ + { + "uid": "${DB_SOURCE}", + "title": "Kernel Governance Proposal", + "condition": "A", + "data": [ + { + "refId": "A", + "relativeTimeRange": { + "from": 600, + "to": 0 + }, + "datasourceUid": "${datasourceUid}", + "model": { + "disableTextWrap": false, + "editorMode": "builder", + "exemplar": false, + "expr": "group by(proposal) (count by(proposal) (etherlink_governance_kernel_proposal))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "intervalMs": 1000, + "legendFormat": "__auto", + "maxDataPoints": 43200, + "range": true, + "refId": "A", + "useBackend": false + } + }, + { + "refId": "B", + "relativeTimeRange": { + "from": 600, + "to": 0 + }, + "datasourceUid": "__expr__", + "model": { + "conditions": [ + { + "evaluator": { + "params": [ + 2, + 0 + ], + "type": "lt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [] + }, + "reducer": { + "params": [], + "type": "avg" + }, + "type": "query" + } + ], + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "A", + "intervalMs": 1000, + "maxDataPoints": 43200, + "refId": "B", + "type": "threshold" + } + } + ], + "noDataState": "NoData", + "execErrState": "Error", + "for": "0s", + "annotations": { + "description": "", + "runbook_url": "", + "summary": "" + }, + "labels": { + "": "" + }, + "isPaused": false, + "notification_settings": { + "receiver": "${receiver}" + } + }, + { + "uid": "${DB_SOURCE}", + "title": "Kernel Governance Voting", + "condition": "C", + "data": [ + { + "refId": "A", + "relativeTimeRange": { + "from": 600, + "to": 0 + }, + "datasourceUid": "${datasourceUid}", + "model": { + "editorMode": "code", + "expr": "etherlink_governance_kernel_vote", + "instant": true, + "intervalMs": 1000, + "legendFormat": "__auto", + "maxDataPoints": 43200, + "range": false, + "refId": "A" + } + }, + { + "refId": "C", + "relativeTimeRange": { + "from": 600, + "to": 0 + }, + "datasourceUid": "__expr__", + "model": { + "conditions": [ + { + "evaluator": { + "params": [ + 0 + ], + "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" + } + } + ], + "noDataState": "NoData", + "execErrState": "Error", + "for": "0s", + "isPaused": false, + "notification_settings": { + "receiver": "${receiver}" + } + }, + { + "uid": "${DB_SOURCE}", + "title": "Kernel Governance Upgrade", + "condition": "C", + "data": [ + { + "refId": "A", + "relativeTimeRange": { + "from": 600, + "to": 0 + }, + "datasourceUid": "${datasourceUid}", + "model": { + "editorMode": "code", + "expr": "etherlink_governance_kernel_trigger_upgrade", + "instant": true, + "intervalMs": 1000, + "legendFormat": "__auto", + "maxDataPoints": 43200, + "range": false, + "refId": "A" + } + }, + { + "refId": "C", + "relativeTimeRange": { + "from": 600, + "to": 0 + }, + "datasourceUid": "__expr__", + "model": { + "conditions": [ + { + "evaluator": { + "params": [ + 0 + ], + "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" + } + } + ], + "noDataState": "NoData", + "execErrState": "Error", + "for": "0s", + "isPaused": false, + "notification_settings": { + "receiver": "${receiver}" + } + }, + { + "uid": "${DB_SOURCE}", + "title": "Kernel Governance Period Type", + "condition": "A", + "data": [ + { + "refId": "A", + "relativeTimeRange": { + "from": 600, + "to": 0 + }, + "datasourceUid": "${datasourceUid}", + "model": { + "editorMode": "code", + "expr": "etherlink_governance_kernel_current_period_type", + "instant": true, + "intervalMs": 1000, + "legendFormat": "__auto", + "maxDataPoints": 43200, + "range": false, + "refId": "A" + } + }, + { + "refId": "B", + "relativeTimeRange": { + "from": 0, + "to": 0 + }, + "datasourceUid": "__expr__", + "model": { + "conditions": [ + { + "evaluator": { + "params": [ + 0, + 0 + ], + "type": "gt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [] + }, + "reducer": { + "params": [], + "type": "avg" + }, + "type": "query" + } + ], + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "A", + "intervalMs": 1000, + "maxDataPoints": 43200, + "refId": "B", + "type": "threshold" + } + } + ], + "noDataState": "NoData", + "execErrState": "Error", + "for": "0s", + "isPaused": false, + "notification_settings": { + "receiver": "${receiver}" + } + } + ] + } + ] +}