Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Vladimir
noc
Commits
63c32d0a
Verified
Commit
63c32d0a
authored
Apr 27, 2022
by
Andrey Vertiprahov
Browse files
NCN.TIMOS.get_metrics. Fix DHCP Metrics Used.
parent
96052492
Changes
2
Hide whitespace changes
Inline
Side-by-side
sa/profiles/Huawei/MA5600T/get_inventory.py
View file @
63c32d0a
...
...
@@ -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
):
...
...
sa/profiles/NSN/TIMOS/get_metrics.py
View file @
63c32d0a
...
...
@@ -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
]])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment