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

Merge branch 'fix-avs-alcatel-timos-dhcp-metrics' into 'master'

NCN.TIMOS.get_metrics. Fix DHCP Metrics Used.

See merge request !6254
parents fe280b61 63c32d0a
Pipeline #36067 passed with stages
in 43 minutes and 4 seconds
......@@ -114,7 +114,7 @@ class Script(BaseScript):
v = v.lower()
if "door" in v or "heater" in v:
value = self.snmp.get(f"1.3.6.1.4.1.2011.6.1.1.3.1.4.{key}")
if value != self.SNMP_INVALID_VALUE:
if value and value != self.SNMP_INVALID_VALUE:
r += [
{
"name": v,
......@@ -216,39 +216,41 @@ class Script(BaseScript):
current = self.snmp.get(f"1.3.6.1.4.1.2011.6.2.1.6.3.1.6.{key}")
temp = self.snmp.get(f"1.3.6.1.4.1.2011.6.2.1.6.3.1.7.{key}")
if temp != self.SNMP_UNKNOWN_VALUE and volt != self.SNMP_INVALID_VALUE:
metrics = {
"name": "battery_volt",
"status": True,
"description": "Напряжение АКБ",
"measurement": "Volt DC",
"snmp_oid": f"1.3.6.1.4.1.2011.6.2.1.6.3.1.4.{key}",
}
r += [metrics]
if current != self.SNMP_INVALID_VALUE:
metrics = {
"name": "battery_current",
r += [
{
"name": "battery_volt",
"status": True,
"description": "Ток АКБ",
"measurement": "Ampere",
"snmp_oid": f"1.3.6.1.4.1.2011.6.2.1.6.3.1.6.{key}",
"description": "Напряжение АКБ",
"measurement": "Volt DC",
"snmp_oid": f"1.3.6.1.4.1.2011.6.2.1.6.3.1.4.{key}",
}
r += [metrics]
metrics = {
"name": "battery_temp",
"status": True,
"description": "Температура АКБ",
"measurement": "Celsius",
"snmp_oid": f"1.3.6.1.4.1.2011.6.2.1.6.3.1.7.{key}",
}
r += [metrics]
metrics = {
"name": "battery_state",
"status": True,
"description": "Текущее состояние АКБ",
"measurement": "Scalar",
"snmp_oid": f"1.3.6.1.4.1.2011.6.2.1.6.3.1.8.{key}",
}
r += [metrics]
]
if current != self.SNMP_INVALID_VALUE:
r += [
{
"name": "battery_current",
"status": True,
"description": "Ток АКБ",
"measurement": "Ampere",
"snmp_oid": f"1.3.6.1.4.1.2011.6.2.1.6.3.1.6.{key}",
}
]
r += [
{
"name": "battery_temp",
"status": True,
"description": "Температура АКБ",
"measurement": "Celsius",
"snmp_oid": f"1.3.6.1.4.1.2011.6.2.1.6.3.1.7.{key}",
},
{
"name": "battery_state",
"status": True,
"description": "Текущее состояние АКБ",
"measurement": "Scalar",
"snmp_oid": f"1.3.6.1.4.1.2011.6.2.1.6.3.1.8.{key}",
},
]
return r
def parse_elabel(self, out):
......
......@@ -138,6 +138,9 @@ class Script(GetMetricsScript):
)
def get_dhcp_used_metrics_snmp(self, metrics):
for oid, v in self.snmp.getnext("1.3.6.1.4.1.6527.3.1.2.47.1.17.1.21"):
if not oid.startswith("1.3.6.1.4.1.6527.3.1.2.47.1.17.1.21.1."):
# Example - 1.3.6.1.4.1.6527.3.1.2.47.1.17.1.21.4.
continue
_, key = oid.split(".21.1.")
key = key.split(".")
pool = "".join([chr(int(c)) for c in key[1:-7]])
......
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