Commit 50f464bc authored by Aleksey Shirokih's avatar Aleksey Shirokih
Browse files

link dashboard ported to ch

--HG--
branch : feature/chmetrics
parent 49df406c
......@@ -36,6 +36,8 @@ class LinkDashboard(BaseDashboard):
context = {
"device_a": mos.interfaces[0].managed_object.name.replace('\"', ''),
"device_b": mos.interfaces[1].managed_object.name.replace('\"', ''),
"bi_id_a": mos.interfaces[0].managed_object.get_bi_id(),
"bi_id_b": mos.interfaces[0].managed_object.get_bi_id(),
"interface_a": {
"name": mos.interfaces[0].name,
"descr": mos.interfaces[0].description or mos.interfaces[0].name},
......
......@@ -30,6 +30,42 @@
},
"templating": {
"list": [
{
"current": {
"text": "{{bi_id_a}}",
"value": "{{bi_id_a}}"
},
"datasource": null,
"hide": 2,
"includeAll": false,
"multi": false,
"name": "bi_id_a",
"options": {
"text": "{{bi_id_a}}",
"value": "{{bi_id_a}}"
},
"query": "{{bi_id_a}}",
"refresh": 0,
"type": "custom"
},
{
"current": {
"text": "{{bi_id_b}}",
"value": "{{bi_id_b}}"
},
"datasource": null,
"hide": 2,
"includeAll": false,
"multi": false,
"name": "bi_id_b",
"options": {
"text": "{{bi_id_b}}",
"value": "{{bi_id_b}}"
},
"query": "{{bi_id_b}}",
"refresh": 0,
"type": "custom"
},
{
"current": {
"text": "{{device_a}}",
......@@ -174,10 +210,10 @@
"panels": [
{% from "graph_interface_errors.j2" import errors -%}
{% from "graph_interface_discards.j2" import discards -%}
{{errors("$interface_a", "$device_a", 1)}},
{{discards("$interface_a", "$device_a", 2)}},
{{errors("$interface_b", "$device_b", 3)}},
{{discards("$interface_b", "$device_b", 4)}}
{{errors("$interface_a", "$bi_id_a", "$device_a", 1)}},
{{discards("$interface_a", "$bi_id_a", "$device_a", 2)}},
{{errors("$interface_b", "$bi_id_b", "$device_b", 3)}},
{{discards("$interface_b", "$bi_id_b", "$device_b", 4)}}
]
},
{
......@@ -188,20 +224,20 @@
"height": "250px",
"panels": [
{% from "graph_interface_load_simple.j2" import interface -%}
{{interface("$interface_a", "$device_a", 5)}},
{{interface("$interface_b", "$device_b", 6)}}
{{interface("$interface_a", "$bi_id_a", "$device_a", 5)}},
{{interface("$interface_b", "$bi_id_b", "$device_b", 6)}}
]
},
{
"title": "PPS",
"showTitle": true,
"collapse": true,
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{% from "graph_interface_pps.j2" import pps -%}
{{pps("$interface_a", "$device_a", 7)}},
{{pps("$interface_b", "$device_b", 8)}}
{{pps("$interface_a", "$bi_id_a", "$device_a", 7)}},
{{pps("$interface_b", "$bi_id_a", "$device_b", 8)}}
]
}
]
......
{% macro discards(interface, device, id) -%}
{% macro discards(interface, bi_id, device, id) -%}
{
"cacheTimeout": null,
......@@ -59,52 +59,17 @@
},
"targets": [
{
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "Interface | Discards | Out",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "object",
"operator": "=~",
"value": "/^{{device}}$/"
},
{
"condition": "AND",
"key": "interface",
"operator": "=~",
"value": "/^{{interface}}$/"
}
]
"intervalFactor": 1,
"query": "SELECT $timeSeries as t, avg(discards_out) FROM $table WHERE managed_object ={{bi_id}} and path[4]=toString('{{interface}}') and $timeFilter GROUP BY t ORDER BY t",
"database": "noc",
"tableLoading": false,
"table": "interface",
"dateLoading": false,
"datetimeLoading": false,
"dateColDataType": "date",
"dateTimeColDataType": "ts"
}
],
"thresholds": "",
......
{% macro errors(interface, device, id) -%}
{% macro errors(interface, bi_id, device, id) -%}
{
"cacheTimeout": null,
......@@ -59,52 +59,17 @@
},
"targets": [
{
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "Interface | Errors | In",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "object",
"operator": "=~",
"value": "/^{{device}}$/"
},
{
"condition": "AND",
"key": "interface",
"operator": "=~",
"value": "/^{{interface}}$/"
}
]
"intervalFactor": 1,
"query": "SELECT $timeSeries as t, avg(errors_in) FROM $table WHERE managed_object ={{bi_id}} and path[4]=toString('{{interface}}') and $timeFilter GROUP BY t ORDER BY t",
"database": "noc",
"tableLoading": false,
"table": "interface",
"dateLoading": false,
"datetimeLoading": false,
"dateColDataType": "date",
"dateTimeColDataType": "ts"
}
],
"thresholds": "",
......
{% macro interface(interface, device, id) -%}
{% macro interface(interface, bi_id, device, id) -%}
{
"title": "LOAD {{interface}}",
"aliasColors": {},
......@@ -44,102 +44,17 @@
"steppedLine": false,
"targets": [
{
"alias": "Input",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "Interface | Load | In",
"policy": "default",
"intervalFactor": 1,
"query": "SELECT $timeSeries as t, avg(load_in) as Input, avg(load_out) as Output FROM $table PREWHERE managed_object = {{bi_id}} WHERE path[4]=toString('{{interface}}') and $timeFilter GROUP BY t ORDER BY t",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "object",
"operator": "=~",
"value": "/^{{device}}$/"
},
{
"condition": "AND",
"key": "interface",
"operator": "=~",
"value": "/^{{interface}}$/"
}
]
},
{
"alias": "Output",
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "Interface | Load | Out",
"policy": "default",
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "object",
"operator": "=~",
"value": "/^{{device}}$/"
},
{
"condition": "AND",
"key": "interface",
"operator": "=~",
"value": "/^{{interface}}$/"
}
]
"database": "noc",
"tableLoading": false,
"table": "interface",
"dateLoading": false,
"datetimeLoading": false,
"dateColDataType": "date",
"dateTimeColDataType": "ts"
}
],
"timeFrom": null,
......
{% macro pps(interface,device, id) -%}
{% macro pps(interface, bi_id, device, id) -%}
{
"title": "PPS {{interface}}",
......@@ -39,100 +39,17 @@
"steppedLine": false,
"targets": [
{
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "Interface | Packets | In",
"policy": "default",
"intervalFactor": 1,
"query": "SELECT $timeSeries as t, avg(packets_in) as `Input PPS`, avg(packets_out) as `Output PPS` FROM $table PREWHERE managed_object = {{bi_id}} WHERE path[4]=toString('{{interface}}') and $timeFilter GROUP BY t ORDER BY t",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "object",
"operator": "=~",
"value": "/^{{device}}$/"
},
{
"condition": "AND",
"key": "interface",
"operator": "=~",
"value": "/^{{interface}}$/"
}
]
},
{
"dsType": "influxdb",
"groupBy": [
{
"params": [
"$interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "Interface | Packets | Out",
"policy": "default",
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "object",
"operator": "=~",
"value": "/^{{device}}$/"
},
{
"condition": "AND",
"key": "interface",
"operator": "=~",
"value": "/^{{interface}}$/"
}
]
"database": "noc",
"tableLoading": false,
"table": "interface",
"dateLoading": false,
"datetimeLoading": false,
"dateColDataType": "date",
"dateTimeColDataType": "ts"
}
],
"timeFrom": null,
......
Supports Markdown
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