Skip to content
Snippets Groups Projects
Commit e860e26d authored by Hannes Feldt's avatar Hannes Feldt
Browse files

Migrate to docker image for grafana dashboards

parent 391ac61b
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,3 @@ ...@@ -2,6 +2,3 @@
path = alerta-web path = alerta-web
url = https://github.com/jjdmol/alerta-webui url = https://github.com/jjdmol/alerta-webui
branch = add-isa-18-2-states branch = add-isa-18-2-states
[submodule "grafana-central/dashboards/Station"]
path = grafana-central/dashboards/Station
url = https://git.astron.nl/lofar2.0/grafana-station-dashboards.git
FROM grafana/grafana FROM git.astron.nl:5000/lofar2.0/grafana-station-dashboards:
# Install some plugins
RUN grafana-cli plugins install briangann-datatable-panel
RUN grafana-cli plugins install ae3e-plotly-panel
RUN grafana-cli plugins install yesoreyeram-infinity-datasource
RUN grafana-cli plugins install aceiot-svg-panel
RUN grafana-cli plugins install yesoreyeram-boomtable-panel
RUN grafana-cli plugins install orchestracities-map-panel
RUN wget https://algenty.github.io/flowcharting-repository/archives/agenty-flowcharting-panel-1.0.0b-SNAPSHOT.zip -O /tmp/agenty-flowcharting-panel.zip
RUN cd /var/lib/grafana/plugins/ && unzip /tmp/agenty-flowcharting-panel.zip && mv grafana-flowcharting agenty-flowcharting-panel
COPY grafana.ini /etc/grafana/
# Add default configuration through provisioning (see https://grafana.com/docs/grafana/latest/administration/provisioning) # Add default configuration through provisioning (see https://grafana.com/docs/grafana/latest/administration/provisioning)
COPY datasources /etc/grafana/provisioning/datasources/ COPY datasources /etc/grafana/provisioning/datasources/
......
{
"template_files": {},
"alertmanager_config": {
"route": {
"receiver": "Alerta",
"repeat_interval": "10m"
},
"templates": null,
"receivers": [
{
"name": "Alerta",
"grafana_managed_receiver_configs": [
{
"name": "Alerta",
"type": "webhook",
"disableResolveMessage": false,
"settings": {
"url": "http://alerta-server:8080/api/webhooks/prometheus?api-key=demo-key"
},
"secureFields": {}
}
]
}
]
}
}
...@@ -19,6 +19,6 @@ providers: ...@@ -19,6 +19,6 @@ providers:
allowUiUpdates: true allowUiUpdates: true
options: options:
# <string, required> path to dashboard files on disk. Required when using the 'file' type # <string, required> path to dashboard files on disk. Required when using the 'file' type
path: /var/lib/grafana-static/dashboards path: /var/lib/grafana/dashboards
# <bool> use folder names from filesystem to create folders in Grafana # <bool> use folder names from filesystem to create folders in Grafana
foldersFromFilesStructure: true foldersFromFilesStructure: true
Subproject commit 276dc03f3fac30fa618e795db1df9cf8f6794cad
apiVersion: 1
datasources:
# <string, required> name of the datasource. Required
- name: Alerta UI
# <string, required> datasource type. Required
type: yesoreyeram-infinity-datasource
# <string, required> access mode. proxy or direct (Server or Browser in the UI). Required
access: proxy
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> custom UID which can be used to reference this datasource in other parts of the configuration, if not specified will be generated automatically
uid: alertaui
# <string> url
url: http://alerta-server:8080/api
# <string> Deprecated, use secureJsonData.password
password:
# <string> database user, if used
user: postgres
# <string> database name, if used
database: hdb
# <bool> enable/disable basic auth
basicAuth: false
# <string> basic auth username
basicAuthUser:
# <string> Deprecated, use secureJsonData.basicAuthPassword
basicAuthPassword:
# <bool> enable/disable with credentials headers
withCredentials:
# <bool> mark as default datasource. Max one per org
isDefault: false
# <map> fields that will be converted to json and stored in jsonData
jsonData:
secureQueryName1: "api-key"
# <string> json object of data that will be encrypted.
secureJsonData:
secureQueryValue1: "demo-key"
version: 1
# <bool> allow users to edit datasources from the UI.
editable: false
This diff is collapsed.
// Lookup an alert in Grafana
get_grafana_alert = (data, name) => {
series = data.series.find(
x => x.refId == "GrafanaAlerts"
)
return series.meta.custom.data.find(
x => x.labels.alertname == name
)
}
// Lookup an alert in Alerta
get_alerta_alert = (data, name) => {
series = data.series.find(
x => x.refId == "AlertaAlerts"
)
return series.meta.custom.data.alerts.find(
x => x.event == name
)
}
// Return everything about an alert
get_alert = (data, name) => {
let grafana_alert = get_grafana_alert(data, name)
let alerta_alert = get_alerta_alert(data, name)
if (alerta_alert) {
href = alerta_alert.href
if (grafana_alert)
colour = 'red'
else
colour = 'orange'
} else if (grafana_alert) {
// firing
colour = 'red'
href = '/alerting/grafana/'+ grafana_alert.labels.__alert_rule_uid__ +'/view'
} else {
colour = 'green'
href = undefined
}
return {
name: name,
alerta_alert: alerta_alert,
grafana_alert: grafana_alert,
colour: colour,
href: href
}
}
{"station":[{"name":"FPGA processing error","interval":"10s","rules":[{"expr":"","for":"20s","labels":{"severity":"major"},"annotations":{"__dashboardUid__":"nC8N_kO7k","__panelId__":"9","summary":"One or more FPGAs are unusable."},"grafana_alert":{"id":1,"orgId":1,"title":"FPGA processing error","condition":"B","data":[{"refId":"A","queryType":"","relativeTimeRange":{"from":600,"to":0},"datasourceUid":"timescaledb","model":{"format":"time_series","group":[],"hide":false,"intervalMs":1000,"maxDataPoints":43200,"metricColumn":"none","rawQuery":true,"rawSql":"SELECT\n $__timeGroup(data_time, $__interval),\n x::text,\n device,\n name,\n value\nFROM lofar_array_boolean\nWHERE\n $__timeFilter(data_time) AND\n name = 'fpga_error_r'\nORDER BY 1,2","refId":"A","select":[[{"params":["value_r"],"type":"column"}]],"table":"att_scalar_devdouble","timeColumn":"data_time","timeColumnType":"timestamp","where":[{"name":"$__timeFilter","params":[],"type":"macro"}]}},{"refId":"B","queryType":"","relativeTimeRange":{"from":0,"to":0},"datasourceUid":"-100","model":{"conditions":[{"evaluator":{"params":[0],"type":"gt"},"operator":{"type":"and"},"query":{"params":["A"]},"reducer":{"params":[],"type":"last"},"type":"query"}],"datasource":{"type":"__expr__","uid":"-100"},"expression":"A","hide":false,"intervalMs":1000,"maxDataPoints":43200,"reducer":"last","refId":"B","settings":{"mode":"dropNN"},"type":"reduce"}}],"updated":"2022-04-04T18:01:53Z","intervalSeconds":10,"version":3,"uid":"kujybCynk","namespace_uid":"R_jsbCynz","namespace_id":6,"rule_group":"FPGA processing error","no_data_state":"NoData","exec_err_state":"Alerting"}}]}]}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment