feat: terra-exporter

This commit is contained in:
auricom
2021-08-23 01:31:01 +02:00
parent cbec144344
commit 4f5600afea
6 changed files with 514 additions and 0 deletions

View File

@@ -0,0 +1,439 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": false,
"gnetId": null,
"graphTooltip": 0,
"id": 4,
"links": [],
"panels": [
{
"collapsed": false,
"datasource": "Prometheus",
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 6,
"panels": [],
"title": "bLUNA / LUNA LP",
"type": "row"
},
{
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": null
},
{
"color": "dark-green",
"value": 20
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 3,
"x": 0,
"y": 1
},
"id": 4,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.5",
"targets": [
{
"exemplar": true,
"expr": "terra_pool_pairs_apr{slug=\"bluna-luna\"}",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"title": "APR",
"type": "stat"
},
{
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 3,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "dark-green",
"value": null
}
]
},
"unit": "currencyUSD"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 2,
"x": 3,
"y": 1
},
"id": 9,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.5",
"targets": [
{
"exemplar": true,
"expr": "terra_pool_pairs_liquidity{slug=\"bluna-luna\"}",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"title": "Liquidity",
"type": "stat"
},
{
"datasource": "Prometheus",
"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",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "area"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 20
}
]
},
"unit": "percent"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "APR"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "yellow",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 19,
"x": 5,
"y": 1
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "hidden",
"placement": "right"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"exemplar": true,
"expr": "terra_pool_pairs_apr{slug=\"bluna-luna\"}",
"instant": false,
"interval": "",
"legendFormat": "APR",
"refId": "A"
}
],
"title": "APR",
"type": "timeseries"
},
{
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 3,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "dark-green",
"value": null
}
]
},
"unit": "currencyUSD"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 2,
"x": 3,
"y": 4
},
"id": 10,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.5",
"targets": [
{
"exemplar": true,
"expr": "terra_pool_pairs_vol_24h{slug=\"bluna-luna\"}",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"title": "Volume (24h)",
"type": "stat"
},
{
"datasource": "Prometheus",
"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",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "dark-green",
"value": null
}
]
},
"unit": "currencyUSD"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "APR"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "yellow",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 19,
"x": 5,
"y": 10
},
"id": 11,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"exemplar": true,
"expr": "terra_pool_pairs_liquidity{slug=\"bluna-luna\"}",
"instant": false,
"interval": "",
"legendFormat": "Liquidity",
"refId": "A"
},
{
"exemplar": true,
"expr": "terra_pool_pairs_vol_24h{slug=\"bluna-luna\"}",
"hide": false,
"interval": "",
"legendFormat": "Volume (24h)",
"refId": "B"
}
],
"title": "Stats",
"type": "timeseries"
}
],
"schemaVersion": 30,
"style": "dark",
"tags": [
"crypto",
"terra"
],
"templating": {
"list": []
},
"time": {
"from": "now-24h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Terra",
"uid": "2A-Ckrn7z",
"version": 1
}

View File

@@ -137,6 +137,9 @@ spec:
sonarr: sonarr:
url: https://raw.githubusercontent.com/k8s-at-home/grafana-dashboards/main/sonarr.json url: https://raw.githubusercontent.com/k8s-at-home/grafana-dashboards/main/sonarr.json
datasource: Prometheus datasource: Prometheus
terra:
url: https://raw.githubusercontent.com/auricom/home-cluster/main/cluster/apps/monitoring/kube-prometheus-stack/grafana-dashboards/terra.json
datasource: Prometheus
deploymentStrategy: deploymentStrategy:
type: Recreate type: Recreate
persistence: persistence:

View File

@@ -7,5 +7,6 @@ resources:
- healthchecks - healthchecks
- kube-prometheus-stack - kube-prometheus-stack
- loki-stack - loki-stack
- terra-exporter
- thanos - thanos
- uptime-kuma - uptime-kuma

View File

@@ -0,0 +1,50 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: terra-exporter
namespace: monitoring
labels:
app.kubernetes.io/instance: terra-exporter
app.kubernetes.io/name: terra-exporter
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: terra-exporter
app.kubernetes.io/name: terra-exporter
template:
metadata:
labels:
app.kubernetes.io/instance: terra-exporter
app.kubernetes.io/name: terra-exporter
spec:
imagePullSecrets:
- name: regcred
containers:
- image: registry.${SECRET_CLUSTER_DOMAIN}/homelab/terra-exporter:develop
imagePullPolicy: Always
name: terra-exporter
ports:
- containerPort: 9000
name: http
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/instance: terra-exporter
app.kubernetes.io/name: terra-exporter
name: terra-exporter
namespace: monitoring
spec:
ports:
- name: http
port: 9000
protocol: TCP
targetPort: 9000
selector:
app.kubernetes.io/instance: terra-exporter
app.kubernetes.io/name: terra-exporter
type: ClusterIP
---

View File

@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- podmonitor.yaml

View File

@@ -0,0 +1,16 @@
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: terra-exporter
namespace: monitoring
spec:
podMetricsEndpoints:
- interval: 5m
path: /
port: http
scrapeTimeout: 30s
selector:
matchLabels:
app.kubernetes.io/instance: terra-exporter
app.kubernetes.io/name: terra-exporter