0b2718a4af
Simple chain stats tool for graphing the chain using influxdb and grafana. License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
30 lines
719 B
Bash
Executable File
30 lines
719 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
GRAFANA_HOST="localhost:3000"
|
|
|
|
curl -s -XPOST http://admin:admin@$GRAFANA_HOST/api/datasources -H 'Content-Type: text/json' --data-binary @- > /dev/null << EOF
|
|
{
|
|
"name":"InfluxDB",
|
|
"type":"influxdb",
|
|
"database":"lotus",
|
|
"url": "http://influxdb:8086",
|
|
"basicAuth":false,
|
|
"access": "proxy"
|
|
}
|
|
EOF
|
|
|
|
curl -s -XPOST http://admin:admin@$GRAFANA_HOST/api/dashboards/import -H 'Content-Type: text/json' --data-binary @- << EOF | jq -r "\"http://$GRAFANA_HOST\" + .importedUrl"
|
|
{
|
|
"dashboard": $(cat ./chain.dashboard.json),
|
|
"overwrite": true,
|
|
"inputs": [
|
|
{
|
|
"name": "DS_INFLUXDB",
|
|
"pluginId": "influxdb",
|
|
"type": "datasource",
|
|
"value": "InfluxDB"
|
|
}
|
|
]
|
|
}
|
|
EOF
|