Skip to content

Commit

Permalink
fix alert manager and grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
c_mismaila authored and mmd-afegbua committed Jul 20, 2022
1 parent e21cd35 commit b92d6d7
Show file tree
Hide file tree
Showing 5 changed files with 255 additions and 2 deletions.
14 changes: 14 additions & 0 deletions alertmanager/alertmanager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
route:
receiver: 'mail'
repeat_interval: 4h
group_by: [ alertname ]


receivers:
- name: 'mail'
email_configs:
- smarthost: 'smtp.gmail.com:465'
auth_username: 'your_mail@gmail.com'
auth_password: ""
from: 'your_mail@gmail.com'
to: 'some_mail@gmail.com'
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ networks:
volumes:
prometheus_data: {}
grafana_data: {}
alertmanager-data: {}

services:
prometheus:
image: prom/prometheus:v2.20.1
Expand All @@ -18,5 +20,40 @@ services:
- 9090:9090
expose:
- 9090
networks:
- monitoring

grafana:
image: grafana/grafana:9.0.3
container_name: grafana
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
restart: unless-stopped
ports:
- 3000:3000
expose:
- 3000
networks:
- monitoring

alertmanager:
image: prom/alertmanager:v0.24.0
container_name: alertmanager
volumes:
- "./alertmanager:/config"
- alertmanager-data:/data
command:
- '--config.file=/config/alertmanager.yml'
- '--log.level=debug'
restart: unless-stopped
ports:
- 9093:9093
expose:
- 9093
networks:
- monitoring
196 changes: 196 additions & 0 deletions grafana/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
{
"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": 0,
"id": 2,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "tuuhJ0g4z"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"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": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 3,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"editorMode": "builder",
"expr": "avg_over_time(node_publishing_time{instance=\"host.docker.internal:8080\"}[1m])",
"instant": true,
"key": "Q-1d94722c-550c-49e0-983c-2b3fdc0922ae-0",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Block Publishing Time",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "tuuhJ0g4z"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"id": 2,
"options": {
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true
},
"pluginVersion": "9.0.3",
"targets": [
{
"editorMode": "builder",
"expr": "max by(instance) (node_chain_height{instance=\"host.docker.internal:8080\"})",
"instant": true,
"key": "Q-344edb02-075b-4973-b133-335c47319b12-0",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Block Height",
"type": "gauge"
}
],
"schemaVersion": 36,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "test",
"uid": "Dfy1H1RVk",
"version": 4,
"weekStart": ""
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const ACTIONS = {
AddedNode: 0x03,
RemovedNode: 0x04,
LocatedNode: 0x05,
ImportedBlock: 0x06,
ImportedBlock: 0x06, //payload[1] [height, hash, blockTime, blockTimestamp, propagationTime]
FinalizedBlock: 0x07,
NodeStats: 0x08,
NodeHardware: 0x09,
Expand Down
8 changes: 7 additions & 1 deletion prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ scrape_configs:
# scheme defaults to 'http'.

static_configs:
- targets: ['host.docker.internal:8080']
- targets: ['host.docker.internal:8080']

alerting:
alertmanagers:
- scheme: http
static_configs:
- targets: [ 'host.docker.internal:9093' ]

0 comments on commit b92d6d7

Please sign in to comment.