Commit b1271c43 by marwan

init flowengine grafana influxdb package

parent 84f4b05a
#!/bin/bash
ORG_NAME="$1"
BUCKET_NAME="influxdb_monitoring"
INFLUX_TOKEN="$2"
URI="$3"
echo ORG_NAME: $ORG_NAME
echo INFLUX_TOKEN: $INFLUX_TOKEN
echo URI: $URI
OrgID=''
LengthOrgID=0
while [ "$LengthOrgID" -ne 16 ]
do
sleep 1
orgInfo=$(influx org list --token $INFLUX_TOKEN --host $URI)
orgInfo=$(echo "$orgInfo" | sed -e 's/^[ \t]*//')
#ID Name
#ae4907f2f6f4ac66 primary
name=''
while read -r line; do
echo $line
name=$(echo "$line" | awk '{print $2}' | sed 's/[^a-zA-Z0-9]//g')
echo $name
if [ "$ORG_NAME" == "$name" ]; then
OrgID=($(echo "$line" | awk '{print $1}'))
fi
done <<< "$(echo "$orgInfo" | awk 'NR > 1')"
LengthOrgID=${#OrgID}
#echo $LengthOrgID
#if [ "$LengthOrgID" -ne 16 ]; then
# echo cannot get orgID
# exit 0;
#fi
done
echo "OrgID: ${OrgID[@]}"
curl --request POST ${URI}/api/v2/buckets -H "Authorization: Token ${INFLUX_TOKEN}" -H "Accept: application/json" -H "Content-Type: application/json" -d "{ \"name\": \"${BUCKET_NAME}\", \"description\": \"A bucket holding air sensor data\", \"orgID\": \"${OrgID[@]}\", \"retentionRules\": [ { \"type\": \"expire\", \"everySeconds\": 15552000 } ] }" #2592000
output=$(influx bucket list --token $INFLUX_TOKEN --org $ORG_NAME --host $URI)
echo output :$output
#"
#ID Name Retention Shard group duration Organization ID Schema Type
#94d1807ef7a7a5f7 _monitoring 168h0m0s 24h0m0s 57e96428672da980 implicit
#dd7cb4ebd0ba6dec _tasks 72h0m0s 24h0m0s 57e96428672da980 implicit
#5b72652dc7c001c4 primary infinite 168h0m0s 57e96428672da980 implicit
#"
# Remove leading and trailing whitespace from each line
output=$(echo "$output" | sed -e 's/^[ \t]*//')
# Parse the data using awk into separate arrays
# The field separator is one or more spaces or tabs
# Check if "Name" is "primary" before storing it in the array
ID=''
Name=''
Retention=''
ShardDuration=''
OrgID=''
SchemaType=''
while read -r line; do
name=$(echo "$line" | awk '{print $2}')
if [ "$name" == "$BUCKET_NAME" ]; then
ID=($(echo "$line" | awk '{print $1}'))
Name=("$name")
Retention=($(echo "$line" | awk '{print $3}'))
ShardDuration=($(echo "$line" | awk '{print $4}'))
OrgID=($(echo "$line" | awk '{print $5}'))
SchemaType=($(echo "$line" | awk '{print $6}'))
fi
done <<< "$(echo "$output" | awk 'NR > 1')"
# Check if "Name" is "primary" for each matching row
# Print the arrays
echo "ID: ${ID[@]}"
echo "Name: ${Name[@]}"
echo "Retention: ${Retention[@]}"
echo "Shard Duration: ${ShardDuration[@]}"
echo "Organization ID: ${OrgID[@]}"
echo "Schema Type: ${SchemaType[@]}"
#echo curl -X POST http://localhost:8086/api/v2/scrapers -H "Authorization: Token ${INFLUX_TOKEN}" -H "Content-Type: application/json" -d "{ \"allowInsecure\": false, \"orgID\": \"${OrgID[@]}\", \"bucketID\": \"${ID[@]}\", \"name\": \"string\", \"type\": \"prometheus\", \"url": \"http://localhost:8086/metrics\" }"
curl -X POST ${URI}/api/v2/scrapers -H "Authorization: Token ${INFLUX_TOKEN}" -H "Content-Type: application/json" -d "{ \"allowInsecure\": false, \"orgID\": \"${OrgID[@]}\", \"bucketID\": \"${ID[@]}\", \"name\": \"string\", \"type\": \"prometheus\", \"url\": \"http://localhost:8086/metrics\" }" -i
echo ----success----
exit 1
services:
app:
image: dock.nexpie.com/stack/flowengine:1.3.5-2-f633d8d2
volumes:
- ./flow-data:/usr/local/flowengine
- ./store-data:/usr/local/store-data
# - Gluster/
- flow_data:/usr/local/flowengine
- store_data:/usr/local/store-data
ports:
- 30081:80
environment:
PROJECT_ID: "${SH_PROJECT_ID}"
OAUTH_LOGIN: "TRUE"
PASSWORD_LOGIN: "TRUE"
AUTH_ENDPOINT: https://auth.nexiiot.io/dialog/authorize
AUTH_PLATFORM_NAME: NEXIIOT
GQLV2_ENDPOINT: https://gqlv2.nexiiot.io
INSTANCE_NAME: NEXIIOT FlowEngine
OAUTH_CLIENT_ID: ${SH_OAUTH_CLIENT_ID}
OAUTH_CLIENT_SECRET: ${SH_OAUTH_CLIENT_SECRET}
TOKEN_ENDPOINT: https://auth.nexiiot.io/oauth/token
USERINFO_API_ENDPOINT: https://auth.nexiiot.io/api/userinfo
# environment:
# PROJECT_ID: "${SH_PROJECT_ID}"
# OAUTH_LOGIN: "TRUE"
# PASSWORD_LOGIN: "TRUE"
# AUTH_ENDPOINT: https://auth.nexiiot.io/dialog/authorize
# AUTH_PLATFORM_NAME: NEXIIOT
# GQLV2_ENDPOINT: https://gqlv2.nexiiot.io
# INSTANCE_NAME: NEXIIOT FlowEngine
# OAUTH_CLIENT_ID: ${SH_OAUTH_CLIENT_ID}
# OAUTH_CLIENT_SECRET: ${SH_OAUTH_CLIENT_SECRET}
# TOKEN_ENDPOINT: https://auth.nexiiot.io/oauth/token
# USERINFO_API_ENDPOINT: https://auth.nexiiot.io/api/userinfo
influxdb:
image: docker.io/bitnami/influxdb:2.7.1
ports:
......@@ -27,9 +29,9 @@ services:
environment:
- INFLUXDB_ADMIN_USER_PASSWORD=nexiiotpassword
- INFLUXDB_ADMIN_USER_TOKEN=nexiiottoken
- influxdb_primary_bucket=primary
- influxdb_admin_organization=primary
- influxdb_retention_period=4320 #24 * 180 อายุข้อมูล
- INFLUXDB_PRIMARY_BUCKET=primary
- INFLUXDB_ADMIN_ORGANIZATION=primary
- INFLUXDB_RETENTION_PERIOD=4320 #24 * 180 อายุข้อมูล
- INFLUXDB_MONITOR_STORE_DATABASE="primary"
- INFLUXD_UI_DISABLED=false
- INFLUXD_REPORTING_DISABLED=false
......@@ -39,6 +41,19 @@ services:
- influxdb:/bitnami/influxdb
- ./bash-influx:/bitnami/
influxdb_init:
image: docker.io/bitnami/influxdb:2.7.1
depends_on:
- influxdb
entrypoint: ["bash","-c","bash /bitnami/script/init.bash $${INFLUXDB_ADMIN_ORGANIZATION} $${INFLUXDB_ADMIN_USER_TOKEN} http://influxdb:8086"]
environment:
- INFLUXDB_ADMIN_USER_TOKEN=nexiiottoken
- INFLUXDB_ADMIN_ORGANIZATION=primary
volumes:
- ./bash-influx:/bitnami/script
grafana:
image: docker.io/bitnami/grafana:10
ports:
......@@ -56,3 +71,7 @@ volumes:
driver: local
influxdb:
driver: local
flow_data:
driver: local
store_data:
driver: local
apiVersion: 1
providers:
- name: dashboards
type: file
updateIntervalSeconds: 30
options:
path: /var/lib/dashboards
{
"__inputs": [],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "7.3.7"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "table",
"name": "Table",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "InfluxDB 2.0 OSS Metrics",
"editable": true,
"gnetId": 13315,
"graphTooltip": 0,
"id": null,
"iteration": 1611672268418,
"links": [],
"panels": [
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 4,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"influxdb_uptime_seconds\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\r\n |> last()",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Uptime",
"type": "stat"
},
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {
"align": null,
"displayMode": "color-text",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 20,
"x": 4,
"y": 0
},
"id": 15,
"options": {
"showHeader": true
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"influxdb_info\")\r\n |> last()\r\n |> drop(columns: [\"_start\", \"_stop\",\"_time\",\"_field\",\"_value\",\"_measurement\"])\r\n |> rename(columns: {arch: \"Architecture\", build_date: \"Build Date\", commit: \"Github Commit\", cpus: \"CPUs\", os: \"OS\", version: \"Version\"})\r\n |> yield(name: \"last\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Instance Info",
"type": "table"
},
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 0,
"y": 4
},
"id": 16,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"influxdb_organizations_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> last()",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Orgs",
"type": "stat"
},
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 6,
"y": 4
},
"id": 17,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"influxdb_users_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> last()\r\n |> yield(name: \"last\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Users",
"type": "stat"
},
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 12,
"y": 4
},
"id": 19,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"influxdb_buckets_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> last()",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Buckets",
"type": "stat"
},
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 18,
"y": 4
},
"id": 21,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"influxdb_tokens_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> last()\r\n |> yield(name: \"last\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Tokens",
"type": "stat"
},
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 0,
"y": 7
},
"id": 3,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"influxdb_telegrafs_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> last()\r\n |> yield(name: \"last\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Telegrafs",
"type": "stat"
},
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 6,
"y": 7
},
"id": 18,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"influxdb_dashboards_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> last()\r\n |> yield(name: \"last\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Dashboards",
"type": "stat"
},
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 12,
"y": 7
},
"id": 20,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"influxdb_scrapers_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> last()\r\n |> yield(name: \"last\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Scrapers",
"type": "stat"
},
{
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#00c9ff",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 18,
"y": 7
},
"id": 22,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "7.3.7",
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"task_executor_total_runs_active\")\r\n |> filter(fn: (r) => r._field == \"gauge\")\r\n |> last()\r\n |> yield(name: \"last\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Tasks active",
"type": "stat"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"unit": "reqps"
},
"overrides": [
{
"matcher": {
"id": "byName"
},
"properties": []
}
]
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 6,
"w": 12,
"x": 0,
"y": 10
},
"hiddenSeries": false,
"id": 7,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": false,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.7",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"http_api_requests_total\")\r\n |> filter(fn: (r) => r.path == \"/api/v2/query\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> derivative(unit: v.windowPeriod, nonNegative: true)\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"derivative\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Query Requests",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1034",
"format": "reqps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1035",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"unit": "iops"
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 6,
"w": 12,
"x": 12,
"y": 10
},
"hiddenSeries": false,
"id": 5,
"legend": {
"avg": true,
"current": true,
"max": true,
"min": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.7",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"boltdb_reads_total\" or r._measurement == \"boltdb_writes_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> derivative(unit: v.windowPeriod, nonNegative: true)\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> drop(columns: [\"_field\"])\r\n |> yield(name: \"derivative\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Local Object Store IO",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:880",
"format": "iops",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:881",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"unit": "bytes"
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 6,
"w": 8,
"x": 0,
"y": 16
},
"hiddenSeries": false,
"id": 9,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.7",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"go_memstats_alloc_bytes_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> derivative(unit: v.windowPeriod, nonNegative: true)\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"derivative\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Memory Allocations",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1127",
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1128",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"unit": "bytes"
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 6,
"w": 8,
"x": 8,
"y": 16
},
"hiddenSeries": false,
"id": 13,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.7",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"go_memstats_mallocs_total\" or r._measurement == \"go_memstats_frees_total\")\r\n |> filter(fn: (r) => r._field == \"counter\")\r\n |> derivative(unit: v.windowPeriod, nonNegative: false)\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"derivative\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Memory Alloc & Frees",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1313",
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1314",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "InfluxDB_v2_Flux",
"fieldConfig": {
"defaults": {
"custom": {},
"unit": "percent"
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 6,
"w": 8,
"x": 16,
"y": 16
},
"hiddenSeries": false,
"id": 11,
"legend": {
"avg": false,
"current": true,
"max": true,
"min": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.7",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "bytes_used = from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"go_memstats_alloc_bytes\")\r\n |> filter(fn: (r) => r._field == \"gauge\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> drop(columns: [\"_start\", \"_stop\"])\r\n \r\ntotal_bytes = from(bucket: \"influxdb_monitoring\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"go_memstats_sys_bytes\")\r\n |> filter(fn: (r) => r._field == \"gauge\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> drop(columns: [\"_start\", \"_stop\"])\r\n\r\njoin(tables: {key1: bytes_used, key2: total_bytes}, on: [\"_time\", \"_field\"], method: \"inner\")\r\n |> map(fn: (r) => ({\r\n _time: r._time,\r\n _value: (float(v: r._value_key1) / float(v: r._value_key2)) * 100.0,\r\n _field: \"Memory Usage Percent\"\r\n }))\r\n |> yield(name: \"percentage\")",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Memory Usage [%]",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:1220",
"format": "percent",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:1221",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"refresh": false,
"schemaVersion": 26,
"style": "dark",
"tags": [
"influxdb",
"flux"
],
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "InfluxDB 2.0 OSS Metrics",
"uid": "iZYe3m2Gz",
"version": 76
}
apiVersion: 1
datasources:
- name: InfluxDB_v2_Flux
type: influxdb
access: proxy
url: http://influxdb:8086
jsonData:
version: Flux
organization: primary
defaultBucket: admin
tlsSkipVerify: true
secureJsonData:
token: nexiiottoken
apiVersion: 1
datasources:
- name: InfluxDB_v2_InfluxQL
type: influxdb
access: proxy
url: http://influxdb:8086
jsonData:
# This database should be mapped to a bucket
dbName: primary
httpMode: GET
httpHeaderName1: 'Authorization'
secureJsonData:
httpHeaderValue1: 'Token nexiiottoken'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment