Commit 06902138 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'telephony-metrics1' into 'master'

Add telephony metrics

See merge request noc/noc!2795
parents 0471fc8c 6dba504c
......@@ -414,3 +414,21 @@ class Script(GetMetricsScript):
scale=scale if m.metric in SCALE_METRICS else 1,
)
#
@metrics(["Telephony | Active DS0s"], volatile=False, access="S")
def get_active_ds0s(self, metrics):
"""
Returns active DS0 channels
:return:
"""
# CISCO-POP-MGMT-MIB::cpmDS1ActiveDS0s
ds0_oid = "1.3.6.1.4.1.9.10.19.1.1.9.1.3"
for oid, v in self.snmp.getnext(ds0_oid, bulk=False):
oid2 = oid.split(ds0_oid + ".")
(slot, port) = oid2[1].split(".")
self.set_metric(
id=("Telephony | Active DS0s", None),
labels=[f"noc::slot::{slot}", f"noc::interface::{port}"],
value=int(v),
multi=True,
)
{
"$metric": "Telephony | ISDN Channels In Use",
"$type": "oid",
"oid": "1.3.6.1.4.1.9.10.19.1.1.3.0",
"type": "gauge"
}
{
"title": "Telephony | Active DS0s",
"aliasColors": {},
"bars": false,
"datasource": null,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": "f1ad2d11-4cee-49ff-a1d6-72146265907a",
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"show": true,
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"dateTimeColDataType": "ts",
"datetimeLoading": false,
"database": "noc",
"dateLoading": false,
"tableLoading": false,
"dateColDataType": "date",
"table": "telephony",
"intervalFactor": 1,
"query": "SELECT \n t, \n groupArray((slot, ActiveDS0)) AS groupArr \nFROM (\n SELECT $timeSeries as t, \n arrayStringConcat(path,'/') as slot, \n avg(active_ds0) as `ActiveDS0` \n FROM \n $table \n WHERE \n managed_object=$bi_id \n and $timeFilter\n and notEmpty(path)\n GROUP BY arrayStringConcat(path,'/'), t ORDER BY t) \nGROUP BY t \nORDER BY t ASC",
"refId": "A",
"resultFormat": "time_series"
}
],
"timeFrom": null,
"timeShift": null,
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"x-axis": true,
"xaxis": {
"show": true
},
"y-axis": true,
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": 0,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
{
"title": "Telephony | ISDN Channels In Use",
"error": false,
"span": 6,
"editable": true,
"type": "graph",
"isNew": true,
"id": "g8b38b89-497c-45c0-9222-1a4237ec04f7",
"targets": [
{
"refId": "A",
"resultFormat": "time_series",
"intervalFactor": 1,
"query": "SELECT $timeSeries as t, \n avg(isdn_channels) as `Telephony | ISDN Channels In Use` \n FROM \n $table \n WHERE \n managed_object=$bi_id \n and $timeFilter\n and empty(path)\nGROUP BY t \nORDER BY t ASC",
"database": "noc",
"tableLoading": false,
"table": "telephony",
"dateLoading": false,
"datetimeLoading": false,
"dateColDataType": "date",
"dateTimeColDataType": "ts"
}
],
"datasource": null,
"renderer": "flot",
"yaxes": [
{
"label": null,
"show": true,
"logBase": 1,
"min": null,
"max": null,
"format": "short"
},
{
"label": null,
"show": true,
"logBase": 1,
"min": null,
"max": null,
"format": "short"
}
],
"xaxis": {
"show": true
},
"grid": {
"threshold1": null,
"threshold2": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"lines": true,
"fill": 1,
"linewidth": 2,
"points": false,
"pointradius": 5,
"bars": false,
"stack": false,
"percentage": false,
"legend": {
"show": true,
"values": false,
"min": false,
"max": false,
"current": false,
"total": false,
"avg": false
},
"nullPointMode": "connected",
"steppedLine": false,
"tooltip": {
"value_type": "cumulative",
"shared": true,
"sort": 0,
"msResolution": false
},
"timeFrom": null,
"timeShift": null,
"aliasColors": {},
"seriesOverrides": [],
"links": []
}
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