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
{
"$metric": "CPU | Usage",
"$type": "oid",
"oid": "1.3.6.1.4.1.6527.3.1.2.1.1.1.0"
"oid": "1.3.6.1.4.1.6527.3.1.2.1.1.1.0",
"units": "%"
}
......@@ -5,5 +5,6 @@
"1.3.6.1.4.1.6527.3.1.2.1.1.2.0",
"1.3.6.1.4.1.6527.3.1.2.1.1.3.0"
],
"scale": "percent"
"scale": "percent",
"units": "%"
}
......@@ -7,13 +7,15 @@
"$type": "oid",
"oid": "1.3.6.1.4.1.27514.103.0.12.0",
"type": "gauge",
"scale": "scale(0.01)"
"scale": "scale(0.01)",
"units": "s"
},
{
"$type": "oid",
"oid": "1.3.6.1.4.1.27514.102.0.19.0",
"type": "gauge",
"scale": "scale(0.01)"
"scale": "scale(0.01)",
"units": "s"
}
]
}
......@@ -13,11 +13,13 @@
"$type": "oid",
"oid": "1.3.6.1.4.1.27514.1.2.1.1.2.11.0",
"type": "gauge",
"scale": 1
"scale": 1,
"units": "%"
},{
"$type": "oid",
"oid": "1.3.6.1.4.1.27514.100.1.11.10.0",
"type": "gauge",
"scale": 1
"scale": 1,
"units": "%"
}]
}
......@@ -15,13 +15,15 @@
"1.3.6.1.4.1.27514.1.2.1.1.2.13.0",
"1.3.6.1.4.1.27514.1.2.1.1.2.12.0"
],
"scale": "percent_invert"
"scale": "percent_invert",
"units": "%"
},{
"$type": "oid",
"oid": [
"1.3.6.1.4.1.27514.100.1.11.7.0",
"1.3.6.1.4.1.27514.100.1.11.6.0"
],
"scale": "percent"
"scale": "percent",
"units": "%"
}]
}
......@@ -25,7 +25,7 @@ class EnterpriseRule(OIDRule):
]
labels = ["noc::cpu::"]
if gen:
yield tuple(gen), self.type, self.scale, labels
yield tuple(gen), self.type, self.scale, self.units, labels
else:
labels = ["noc::cpu::"]
gen = mib[
......@@ -34,4 +34,4 @@ class EnterpriseRule(OIDRule):
)
]
if gen:
yield gen, self.type, self.scale, labels
yield gen, self.type, self.scale, self.units, labels
......@@ -44,7 +44,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 = (
......@@ -58,4 +58,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": "enterprise",
"oid": "1.3.6.1.4.1.{{ enterprise }}.100.1.11.10.0"
"oid": "1.3.6.1.4.1.{{ enterprise }}.100.1.11.10.0",
"units": "%"
}
{
"$metric": "CPU | Usage | 5sec",
"$type": "slot",
"oid": "1.3.6.1.4.1.27514.100.1.8.1.11.{{ hwSlotIndex }}"
"oid": "1.3.6.1.4.1.27514.100.1.8.1.11.{{ hwSlotIndex }}",
"units": "%"
}
......@@ -12,7 +12,8 @@
"$type": "enterprise",
"oid": "1.3.6.1.4.1.{{ enterprise }}.100.1.11.11.0",
"type": "gauge",
"scale": 1
"scale": 1,
"units": "%"
},
{
"$type": "enterprise",
......@@ -20,7 +21,8 @@
"1.3.6.1.4.1.{{ enterprise }}.100.1.11.7.0",
"1.3.6.1.4.1.{{ enterprise }}.100.1.11.6.0"
],
"scale": "percent"
"scale": "percent",
"units": "%"
}
]
}
......@@ -5,5 +5,6 @@
"1.3.6.1.4.1.27514.100.1.8.1.8.{{ hwSlotIndex }}",
"1.3.6.1.4.1.27514.100.1.8.1.7.{{ hwSlotIndex }}"
],
"scale": "percent"
"scale": "percent",
"units": "%"
}
......@@ -13,11 +13,13 @@
"$type": "oid",
"oid": "1.3.6.1.4.1.41752.1.1.1.4.2.0",
"type": "gauge",
"scale": 1
"scale": 1,
"units": "%"
},{
"$type": "oid",
"oid": "1.3.6.1.4.1.8886.1.1.1.2.0",
"type": "gauge",
"scale": 1
"scale": 1,
"units": "%"
}]
}
......@@ -15,13 +15,15 @@
"1.3.6.1.4.1.41752.1.1.3.2.0",
"1.3.6.1.4.1.41752.1.1.3.1.0"
],
"scale": "percent_invert"
"scale": "percent_invert",
"units": "%"
},{
"$type": "oid",
"oid": [
"1.3.6.1.4.1.8886.1.1.3.2.0",
"1.3.6.1.4.1.8886.1.1.3.1.0"
],
"scale": "percent_invert"
"scale": "percent_invert",
"units": "%"
}]
}
......@@ -18,4 +18,4 @@ class PlatformRule(OIDRule):
obj = ver.split(".")[-1]
oid = mib[self.expand(self.oid, {"platform": obj, "ifIndex": cfg.ifindex})]
if oid:
yield oid, self.type, self.scale, cfg.labels
yield oid, self.type, self.scale, self.units, cfg.labels
{
"$metric": "CPU | Usage",
"$type": "oid",
"oid": "1.3.6.1.4.1.2021.10.1.5.2"
"oid": "1.3.6.1.4.1.2021.10.1.5.2",
"units": "%"
}
\ No newline at end of file
......@@ -5,5 +5,6 @@
"1.3.6.1.4.1.2021.4.5.0",
"1.3.6.1.4.1.2021.4.6.0"
],
"scale": "percent_usage"
"scale": "percent_usage",
"units": "%"
}
{
"$metric": "CPU | Usage",
"$type": "oid",
"oid": "1.3.6.1.4.1.10002.1.1.1.4.2.1.3.3"
"oid": "1.3.6.1.4.1.10002.1.1.1.4.2.1.3.3",
"units": "%"
}
\ No newline at end of file
......@@ -5,5 +5,6 @@
"1.3.6.1.4.1.10002.1.1.1.1.1.0",
"1.3.6.1.4.1.10002.1.1.1.1.2.0"
],
"scale": "percent_usage"
"scale": "percent_usage",
"units": "%"
}
......@@ -5,5 +5,6 @@
"1.3.6.1.4.1.9.9.48.1.1.1.5.1",
"1.3.6.1.4.1.9.9.48.1.1.1.6.1"
],
"scale": "percent"
"scale": "percent",
"units": "%"
}
......@@ -5,5 +5,6 @@
"1.3.6.1.4.1.9.9.48.1.1.1.5.1",
"1.3.6.1.4.1.9.9.48.1.1.1.6.1"
],
"scale": "percent"
"scale": "percent",
"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