Commit ee0c5a57 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov Committed by Dmitry Volodin
Browse files

Generic.get_metrics. Add units (Measurement Units) param to set_metrics.

parent 18b3646a
......@@ -7,7 +7,8 @@
"$type": "gponports",
"oid": "{{ oid_prifix }}.{{ ifindex }}",
"type": "counter",
"scale": 8
"scale": 8,
"units": "byte"
},
{
"$type": "hires",
......@@ -15,13 +16,15 @@
"$type": "ifindex",
"oid": "IF-MIB::ifHCOutOctets.{{ ifIndex }}",
"type": "counter",
"scale": 8
"scale": 8,
"units": "byte"
},
"normal": {
"$type": "ifindex",
"oid": "IF-MIB::ifOutOctets.{{ ifIndex }}",
"type": "counter",
"scale": 8
"scale": 8,
"units": "byte"
}
}]
}
......@@ -6,19 +6,22 @@
"$match": "is_gpon_ports",
"$type": "gponports",
"oid": "{{ oid_prifix }}.{{ ifindex }}",
"type": "counter"
"type": "counter",
"units": "pkt"
},
{
"$type": "hires",
"hires": {
"$type": "ifindex",
"oid": "IF-MIB::ifHCInUcastPkts..{{ ifIndex }}",
"type": "counter"
"type": "counter",
"units": "pkt"
},
"normal": {
"$type": "ifindex",
"oid": "IF-MIB::ifInUcastPkts.{{ ifIndex }}",
"type": "counter"
"type": "counter",
"units": "pkt"
}
}]
}
......@@ -6,19 +6,22 @@
"$match": "is_gpon_ports",
"$type": "gponports",
"oid": "{{ oid_prifix }}.{{ ifindex }}",
"type": "counter"
"type": "counter",
"units": "pkt"
},
{
"$type": "hires",
"hires": {
"$type": "ifindex",
"oid": "IF-MIB::ifHCOutUcastPkts..{{ ifIndex }}",
"type": "counter"
"type": "counter",
"units": "pkt"
},
"normal": {
"$type": "ifindex",
"oid": "IF-MIB::ifOutUcastPkts.{{ ifIndex }}",
"type": "counter"
"type": "counter",
"units": "pkt"
}
}]
}
......@@ -43,7 +43,7 @@ class SlotRule(OIDRule):
]
)
if gen:
yield tuple(gen), self.type, self.scale, labels
yield tuple(gen), self.type, self.scale, self.units, labels
else:
oid = mib[self.expand(self.oid, {"hwSlotIndex": r[i]})]
labels = (
......@@ -57,4 +57,4 @@ class SlotRule(OIDRule):
]
)
if oid:
yield oid, self.type, self.scale, labels
yield oid, self.type, self.scale, self.units, labels
......@@ -35,7 +35,7 @@ class SSlotRule(OIDRule):
f"noc::cpu::CPU Slot {si}/{cp}",
]
if gen:
yield tuple(gen), self.type, self.scale, labels
yield tuple(gen), self.type, self.scale, self.units, labels
else:
oid = mib[self.expand(self.oid, {"hwSlotIndex": r[(si, cp)]})]
labels = [
......@@ -45,4 +45,4 @@ class SSlotRule(OIDRule):
f"noc::cpu::CPU Slot {si}/{cp}",
]
if oid:
yield oid, self.type, self.scale, labels
yield oid, self.type, self.scale, self.units, labels
......@@ -4,7 +4,8 @@
"$match": [{
"$match": "is_stack",
"$type": "slot",
"oid": "1.3.6.1.4.1.2011.6.3.4.1.2.{{ hwSlotIndex }}"
"oid": "1.3.6.1.4.1.2011.6.3.4.1.2.{{ hwSlotIndex }}",
"units": "%"
},{
"$match": "is_extended_entity_mib_supported",
"$type": "caplist",
......@@ -13,12 +14,14 @@
"oid": "1.3.6.1.4.1.2011.5.25.31.1.1.1.1.5.{{ item }}",
"labels": ["noc::chassis::0", "noc::slot::0", "noc::module::item", "noc::cpu::CPU item"],
"type": "gauge",
"scale": 1
"scale": 1,
"units": "%"
},{
"$type": "oid",
"oid": "1.3.6.1.4.1.2011.6.3.4.1.3.0.0.0",
"labels": ["noc::chassis::0", "noc::slot::0", "noc::module::0", "noc::cpu::CPU item"],
"type": "gauge",
"scale": 1
"scale": 1,
"units": "%"
}]
}
{
"$metric": "CPU | Usage | 5sec",
"$type": "slot",
"oid": "1.3.6.1.4.1.2011.6.3.4.1.2.{{ hwSlotIndex }}"
"oid": "1.3.6.1.4.1.2011.6.3.4.1.2.{{ hwSlotIndex }}",
"units": "%"
}
......@@ -8,7 +8,8 @@
"1.3.6.1.4.1.2011.6.3.5.1.1.3.{{ hwSlotIndex }}",
"1.3.6.1.4.1.2011.6.3.5.1.1.2.{{ hwSlotIndex }}"
],
"scale": "percent"
"scale": "percent",
"units": "%"
},{
"$match": "is_extended_entity_mib_supported",
"$type": "caplist",
......@@ -17,13 +18,15 @@
"oid": "1.3.6.1.4.1.2011.5.25.31.1.1.1.1.7.{{ item }}",
"labels": ["noc::chassis::0", "noc::slot::item", "noc::module::0"],
"type": "gauge",
"scale": 1
"scale": 1,
"units": "%"
},{
"$type": "oid",
"oid": [
"1.3.6.1.4.1.2011.6.1.2.1.1.3.65536",
"1.3.6.1.4.1.2011.6.1.2.1.1.2.65536"
],
"scale": "percent"
"scale": "percent",
"units": "%"
}]
}
......@@ -4,11 +4,13 @@
"hires": {
"$type": "ifindex",
"oid": "1.3.6.1.2.1.10.251.1.1.1.1.21.{{ ifIndex }}",
"type": "gauge"
"type": "gauge",
"units": "bit/s"
},
"normal": {
"$type": "ifindex",
"oid": "1.3.6.1.2.1.10.251.1.1.1.1.21.{{ ifIndex }}",
"type": "gauge"
"type": "gauge",
"units": "bit/s"
}
}
......@@ -4,11 +4,13 @@
"hires": {
"$type": "ifindex",
"oid": "1.3.6.1.2.1.10.251.1.1.1.1.20.{{ ifIndex }}",
"type": "gauge"
"type": "gauge",
"units": "byte"
},
"normal": {
"$type": "ifindex",
"oid": "1.3.6.1.2.1.10.251.1.1.1.1.20.{{ ifIndex }}",
"type": "gauge"
"type": "gauge",
"units": "byte"
}
}
......@@ -44,7 +44,7 @@ class SlotRule(OIDRule):
]
else:
labels = [int(slotid.split(".")[1]) - 1, int(slotid.split(".")[2]) - 1, desc]
yield oid, self.type, self.scale, labels
yield oid, self.type, self.scale, self.units, labels
elif desc.startswith("MIC:"):
# Only MS modules return values in this slot
continue
......@@ -62,7 +62,7 @@ class SlotRule(OIDRule):
]
else:
labels = [int(slotid.split(".")[1]) - 1, slotid.split(".")[2], desc]
yield oid, self.type, self.scale, labels
yield oid, self.type, self.scale, self.units, labels
elif "Routing Engine" in desc:
if "CPU" in metric.metric or "Environment" in metric.metric:
if "Temperature" in metric.metric and "Environment" in metric.metric:
......@@ -77,7 +77,7 @@ class SlotRule(OIDRule):
]
else:
labels = [int(slotid.split(".")[1]), int(slotid.split(".")[2]), desc]
yield oid, self.type, self.scale, labels
yield oid, self.type, self.scale, self.units, labels
else:
if "Environment" in metric.metric:
if "Temperature" in metric.metric:
......@@ -90,4 +90,4 @@ class SlotRule(OIDRule):
if "Environment" in metric.metric
else f"noc::cpu::{desc}",
]
yield oid, self.type, self.scale, labels
yield oid, self.type, self.scale, self.units, labels
{
"$metric": "CPU | Usage",
"$type": "slot",
"oid": "1.3.6.1.4.1.2636.3.1.13.1.8.{{ hwSlotIndex }}"
"oid": "1.3.6.1.4.1.2636.3.1.13.1.8.{{ hwSlotIndex }}",
"units": "%"
}
{
"$metric": "Memory | Usage",
"$type": "slot",
"oid": "1.3.6.1.4.1.2636.3.1.13.1.11.{{ hwSlotIndex }}"
"oid": "1.3.6.1.4.1.2636.3.1.13.1.11.{{ hwSlotIndex }}",
"units": "%"
}
......@@ -51,7 +51,7 @@ class SlotRule(OIDRule):
)
gen = [mib[self.expand(o, {"hwSlotIndex": r[i]})] for o in self.oid]
if gen:
yield tuple(gen), self.type, self.scale, labels
yield tuple(gen), self.type, self.scale, self.units, labels
else:
oid = mib[self.expand(self.oid, {"hwSlotIndex": r[i]})]
labels = (
......@@ -65,4 +65,4 @@ class SlotRule(OIDRule):
]
)
if oid:
yield oid, self.type, self.scale, labels
yield oid, self.type, self.scale, self.units, labels
{
"$metric": "CPU | Usage",
"$type": "oid",
"oid": "1.3.6.1.4.1.2011.2.23.1.18.1.3.0"
"oid": "1.3.6.1.4.1.2011.2.23.1.18.1.3.0",
"units": "%"
}
{
"$metric": "CPU | Usage | 5sec",
"$type": "slot",
"oid": "1.3.6.1.4.1.4874.2.2.2.1.3.5.1.9.{{ hwSlotIndex }}"
"oid": "1.3.6.1.4.1.4874.2.2.2.1.3.5.1.9.{{ hwSlotIndex }}",
"units": "%"
}
{
"$metric": "Memory | Usage | 5sec",
"$type": "slot",
"oid": "1.3.6.1.4.1.4874.2.2.2.1.3.5.1.4.{{ hwSlotIndex }}"
"oid": "1.3.6.1.4.1.4874.2.2.2.1.3.5.1.4.{{ hwSlotIndex }}",
"units": "%"
}
{
"$metric": "CPU | Load | 1min",
"$type": "oid",
"oid": "1.3.6.1.4.1.2021.10.1.3.1"
"oid": "1.3.6.1.4.1.2021.10.1.3.1",
"units": "%"
}
{
"$metric": "CPU | Load | 5min",
"$type": "oid",
"oid": "1.3.6.1.4.1.2021.10.1.3.2"
"oid": "1.3.6.1.4.1.2021.10.1.3.2",
"units": "%"
}
{
"$metric": "CPU | Usage",
"$type": "oid",
"oid": "1.3.6.1.4.1.2021.11.10.0"
"oid": "1.3.6.1.4.1.2021.11.10.0",
"units": "%"
}
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