diff --git a/stack_orchestrator/data/config/monitoring/grafana/dashboards/subgraphs-dashboard.json b/stack_orchestrator/data/config/monitoring/grafana/dashboards/subgraphs-dashboard.json index e4f6d16a..8a600b5e 100644 --- a/stack_orchestrator/data/config/monitoring/grafana/dashboards/subgraphs-dashboard.json +++ b/stack_orchestrator/data/config/monitoring/grafana/dashboards/subgraphs-dashboard.json @@ -743,25 +743,41 @@ "list": [ { "current": { - "selected": true, - "text": "QmZLNyJ1JmUXUrzvQKtsJSwLoFvE28rsWeb7dAVuZYVKY2", - "value": "QmZLNyJ1JmUXUrzvQKtsJSwLoFvE28rsWeb7dAVuZYVKY2" + "isNone": true, + "selected": false, + "value": "" }, "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" + "type": "grafana-postgresql-datasource", + "uid": "PA8D093265C513DCC" }, - "definition": "label_values(deployment_head,deployment)", + "definition": "SELECT name\nFROM subgraphs.subgraph\nWHERE current_version IS NOT NULL;", + "description": "Name of deployed subgraph", "hide": 0, "includeAll": false, + "label": "Subgraph Name", + "multi": false, + "name": "subgraph_name", + "options": [], + "query": "SELECT name\nFROM subgraphs.subgraph\nWHERE current_version IS NOT NULL;", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PA8D093265C513DCC" + }, + "definition": "SELECT deployment\nFROM subgraphs.subgraph_version\n JOIN subgraphs.subgraph ON subgraph.current_version = subgraph_version.id\nWHERE subgraph.name = '$subgraph_name';", + "hide": 0, + "includeAll": false, + "label": "Subgraph Deployment", "multi": false, "name": "subgraph_hash", - "options": [], - "query": { - "qryType": 1, - "query": "label_values(deployment_head,deployment)", - "refId": "PrometheusVariableQueryEditor-VariableQuery" - }, + "query": "SELECT deployment\nFROM subgraphs.subgraph_version\n JOIN subgraphs.subgraph ON subgraph.current_version = subgraph_version.id\nWHERE subgraph.name = '$subgraph_name';", "refresh": 1, "regex": "", "skipUrlSync": false, @@ -778,6 +794,6 @@ "timezone": "", "title": "Graph Node Subgraphs", "uid": "b54352dd-35f6-4151-97dc-265bab0c67e9", - "version": 25, + "version": 6, "weekStart": "" } \ No newline at end of file diff --git a/stack_orchestrator/data/config/monitoring/grafana/provisioning/datasources/graph-node-postgres.yml b/stack_orchestrator/data/config/monitoring/grafana/provisioning/datasources/graph-node-postgres.yml new file mode 100644 index 00000000..6ae2ef5f --- /dev/null +++ b/stack_orchestrator/data/config/monitoring/grafana/provisioning/datasources/graph-node-postgres.yml @@ -0,0 +1,20 @@ +apiVersion: 1 + +datasources: + - name: Graph Node Postgres + type: postgres + jsonData: + database: graph-node + sslmode: 'disable' + maxOpenConns: 100 + maxIdleConns: 100 + maxIdleConnsAuto: true + connMaxLifetime: 14400 + postgresVersion: 1411 # 903=9.3, 1000=10, 1411=14.11 + timescaledb: false + user: graph-node + # # Add URL for graph-node database + # url: graph-node-db:5432 + # # Set password for graph-node database + # secureJsonData: + # password: 'passsword' diff --git a/stack_orchestrator/data/config/monitoring/update-grafana-alerts-config.sh b/stack_orchestrator/data/config/monitoring/update-grafana-alerts-config.sh index b6ec932c..9f81203f 100755 --- a/stack_orchestrator/data/config/monitoring/update-grafana-alerts-config.sh +++ b/stack_orchestrator/data/config/monitoring/update-grafana-alerts-config.sh @@ -4,4 +4,6 @@ echo Using CERC_GRAFANA_ALERTS_SUBGRAPH_IDS ${CERC_GRAFANA_ALERTS_SUBGRAPH_IDS} # Replace subgraph ids in subgraph alerting config # Note: Requires the grafana container to be run with user root -sed -i "s/REPLACE_WITH_SUBGRAPH_IDS/$CERC_GRAFANA_ALERTS_SUBGRAPH_IDS/g" /etc/grafana/provisioning/alerting/subgraph-alert-rules.yml +if [ -n "$CERC_GRAFANA_ALERTS_SUBGRAPH_IDS" ]; then + sed -i "s/REPLACE_WITH_SUBGRAPH_IDS/$CERC_GRAFANA_ALERTS_SUBGRAPH_IDS/g" /etc/grafana/provisioning/alerting/subgraph-alert-rules.yml +fi diff --git a/stack_orchestrator/data/stacks/monitoring/README.md b/stack_orchestrator/data/stacks/monitoring/README.md index 99502902..94f2a6e1 100644 --- a/stack_orchestrator/data/stacks/monitoring/README.md +++ b/stack_orchestrator/data/stacks/monitoring/README.md @@ -134,6 +134,29 @@ Note: Use `host.docker.internal` as host to access ports on the host machine Place the dashboard json files in grafana dashboards config directory (`monitoring-deployment/config/monitoring/grafana/dashboards`) in the deployment folder +#### Graph Node Config + +For graph-node dashboard postgres datasource needs to be setup in `monitoring-deployment/config/monitoring/grafana/provisioning/datasources/graph-node-postgres.yml` (in deployment folder) + +```yml +# graph-node-postgres.yml +... +datasources: + - name: Graph Node Postgres + type: postgres + jsonData: + # Set name to remote graph-node database name + database: graph-node + ... + # Set user to remote graph-node database username + user: graph-node + # Add URL for remote graph-node database + url: graph-node-db:5432 + # Set password for graph-node database + secureJsonData: + password: 'password' +``` + ### Env Set the following env variables in the deployment env config file (`monitoring-deployment/config.env`):