Squashed 'bridges/' content from commit 062554430

git-subtree-dir: bridges
git-subtree-split: 0625544309ff299307f7e110f252f04eac383102
This commit is contained in:
Branislav Kontur committed 2022-12-01 22:32:52 +01:00
commit d2b7ee2575
357 files changed
+79920

No files matched your search

@@ -0,0 +1,15 @@
FROM ruby:alpine3.13
RUN apk add --no-cache git
ENV APP_HOME /app
ENV RACK_ENV production
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
RUN git clone https://github.com/ananace/ruby-grafana-matrix.git $APP_HOME
RUN bundle install --without development
RUN mkdir /config && touch /config/config.yml && ln -s /config/config.yml ./config.yml
CMD ["bundle", "exec", "rackup", "-p4567"]
+15
View File
@@ -0,0 +1,15 @@
# A disabled version of monitoring.
#
# We replace each service with a no-op container. We can't simply not include this file,
# cause the bridge-specific compose files might have overrides.
version: '3.5'
services:
prometheus-metrics:
image: alpine
grafana-dashboard:
image: alpine
grafana-matrix-notifier:
image: alpine
+34
View File
@@ -0,0 +1,34 @@
version: '3.5'
services:
prometheus-metrics:
image: prom/prometheus:v2.38.0
volumes:
- ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
grafana-dashboard:
image: grafana/grafana:8.2.6
environment:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASS:-admin}
GF_SERVER_ROOT_URL: ${GRAFANA_SERVER_ROOT_URL}
GF_SERVER_DOMAIN: ${GRAFANA_SERVER_DOMAIN}
volumes:
- ./monitoring/grafana/provisioning/:/etc/grafana/provisioning/:ro
- ./monitoring/grafana/dashboards/:/etc/grafana/dashboards/common:ro
ports:
- "3000:3000"
depends_on:
- prometheus-metrics
entrypoint: sh -c "echo 'sleeping for 10m' && sleep 600 && /run.sh"
grafana-matrix-notifier:
build:
context: .
dockerfile: ./monitoring/GrafanaMatrix.Dockerfile
volumes:
- ./monitoring/grafana-matrix:/config
ports:
- "4567:4567"
depends_on:
- grafana-dashboard
@@ -0,0 +1,47 @@
---
# Webhook server configuration
# Or use the launch options `-o '::' -p 4567`
# Set up your HS connections
matrix:
- name: matrix-parity-io
url: https://matrix.parity.io
# Create a user - log that user in using a post request
# curl -XPOST -d '{"type": "m.login.password",
# "user":"grafana",
# "password":"dummy-password"}'
# "https://my-matrix-server/_matrix/client/r0/login"
# Fill that access token in here
access_token: "<access_token>"
#device_id: <device> # Optional
# The default message type for messages, should be either m.text or m.notice,
# defaults to m.text
msgtype: m.text
# Set up notification ingress rules
rules:
- name: bridge # Name of the rule
room: "#bridges-rialto-millau-alerts:matrix.parity.io" # Room or ID
matrix: matrix-parity-io # The Matrix HS to use - defaults to first one
msgtype: m.notice
# The following values are optional:
image: true # Attach image to the notification?
embed_image: true # Upload and embed the image into the message?
#templates:
# Templates to use when rendering the notification, available placeholders:
# %TEMPLATES% - lib/grafana_matrix/templates
# $<env> - Environment variables
#html: "%TEMPLATES%/html.erb" # Path to HTML template
#plain: "%TEMPLATES%/plain.erb" # Path to plaintext template
#auth:
#user: example
#pass: any HTTP encodable string
#- name: other-hq
# room: "#hq:private.matrix.org
# matrix: matrix-priv
# To use the webhook, you need to configure it into Grafana as:
#
# Url: http://<server address>:<port>/hook?rule=<rule name>
# Http Method: POST
@@ -0,0 +1,200 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"description": "Running nodes",
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": null,
"graphTooltip": 0,
"links": [],
"liveNow": false,
"panels": [
{
"alert": {
"alertRuleTags": {},
"conditions": [
{
"evaluator": {
"params": [
1
],
"type": "lt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"A",
"15m",
"now"
]
},
"reducer": {
"params": [],
"type": "min"
},
"type": "query"
}
],
"executionErrorState": "alerting",
"for": "3m",
"frequency": "1m",
"handler": 1,
"name": "Nodes are not running",
"noDataState": "alerting",
"notifications": []
},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"description": "",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"interval": null,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"maxDataPoints": null,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.2.6",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "up",
"format": "time_series",
"instant": false,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "lt",
"value": 1,
"visible": true
}
],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Running nodes",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:111",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:112",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"refresh": "",
"schemaVersion": 32,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Running nodes",
"uid": "DHl-xSW4z",
"version": 1
}
@@ -0,0 +1,6 @@
- name: 'default'
orgId: 1
folder: ''
type: file
options:
path: '/etc/grafana/dashboards'
@@ -0,0 +1,16 @@
# list of datasources to insert/update depending
# whats available in the database
datasources:
# <string, required> name of the datasource. Required
- name: Prometheus
# <string, required> datasource type. Required
type: prometheus
# <string, required> access mode. direct or proxy. Required
access: proxy
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> url
url: http://prometheus-metrics:9090
# <bool> mark as default datasource. Max one per org
isDefault: true
version: 1
@@ -0,0 +1,15 @@
notifiers:
- name: Matrix
type: webhook
uid: notifier1
is_default: true
send_reminder: true
frequency: 1h
disable_resolve_message: false
settings:
url: http://grafana-matrix-notifier:4567/hook?rule=bridge
http_method: POST
delete_notifiers:
- name: Matrix
uid: notifier1
@@ -0,0 +1,7 @@
global:
scrape_interval: 15s
scrape_configs:
- job_name: dummy
file_sd_configs:
- files:
- /etc/prometheus/targets-*.yml