Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alexey Shapovalov
noc
Commits
14f63e64
Commit
14f63e64
authored
Jan 22, 2022
by
Andrey Vertiprahov
Browse files
Fix typo on interface discovery
parent
c4c05942
Changes
12
Hide whitespace changes
Inline
Side-by-side
inv/migrations/0025_interface_hints_labels.py
0 → 100644
View file @
14f63e64
# ----------------------------------------------------------------------
# Create interface hints labels scope
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Third-party modules
from
pymongo
import
InsertOne
# NOC modules
from
noc.core.migration.base
import
BaseMigration
class
Migration
(
BaseMigration
):
def
migrate
(
self
):
# Create wildcard labels
l_coll
=
self
.
mongo_db
[
"labels"
]
current_labels
=
{
ll
[
"name"
]:
ll
[
"_id"
]
for
ll
in
l_coll
.
find
()}
bulk
=
[]
if
"noc::topology::direction::*"
not
in
current_labels
:
bulk
+=
[
InsertOne
(
{
"name"
:
"noc::topology::direction::*"
,
"description"
:
"Builtin Labels Scope for Interface topology direction: uplink or downlink"
,
"bg_color1"
:
2719929
,
"fg_color1"
:
16777215
,
"bg_color2"
:
9323693
,
"fg_color2"
:
16777215
,
"propagate"
:
True
,
"is_protected"
:
False
,
"is_autogenerated"
:
False
,
"enable_interface"
:
True
,
}
)
]
if
"noc::interface::role::*"
not
in
current_labels
:
bulk
+=
[
InsertOne
(
{
"name"
:
"noc::interface::role::*"
,
"description"
:
"Builtin Labels Scope for Interface role: nni or uni"
,
"bg_color1"
:
15965202
,
"fg_color1"
:
16777215
,
"bg_color2"
:
9323693
,
"fg_color2"
:
16777215
,
"propagate"
:
True
,
"is_protected"
:
False
,
"is_autogenerated"
:
False
,
"enable_interface"
:
True
,
}
)
]
if
"noc::interface::hints::*"
not
in
current_labels
:
bulk
+=
[
InsertOne
(
{
"name"
:
"noc::interface::hints::*"
,
"description"
:
"Builtin Labels Scope for Interface hints"
,
"bg_color1"
:
15965202
,
"fg_color1"
:
16777215
,
"bg_color2"
:
9323693
,
"fg_color2"
:
16777215
,
"propagate"
:
True
,
"is_protected"
:
False
,
"is_autogenerated"
:
False
,
"enable_interface"
:
True
,
}
)
]
if
"noc::sensor::mode::*"
not
in
current_labels
:
bulk
+=
[
InsertOne
(
{
"name"
:
"noc::sensor::mode::*"
,
"description"
:
"Builtin Labels Scope for Sensor mode hints: temperature, voltage, current, impedance, frequence, counter"
,
"bg_color1"
:
15965202
,
"fg_color1"
:
16777215
,
"bg_color2"
:
9323693
,
"fg_color2"
:
16777215
,
"propagate"
:
True
,
"is_protected"
:
False
,
"is_autogenerated"
:
False
,
"enable_sensor"
:
True
,
}
)
]
if
"noc::sensor::placement::*"
not
in
current_labels
:
bulk
+=
[
InsertOne
(
{
"name"
:
"noc::sensor::placement::*"
,
"description"
:
"Builtin Labels Scope for Sensor placement hints: internal, external, ups"
,
"bg_color1"
:
2719929
,
"fg_color1"
:
16777215
,
"bg_color2"
:
9323693
,
"fg_color2"
:
16777215
,
"propagate"
:
True
,
"is_protected"
:
False
,
"is_autogenerated"
:
False
,
"enable_sensor"
:
True
,
}
)
]
if
bulk
:
l_coll
.
bulk_write
(
bulk
,
ordered
=
True
)
inv/models/interface.py
View file @
14f63e64
...
...
@@ -469,9 +469,9 @@ class Interface(Document):
from
noc.inv.models.subinterface
import
SubInterface
yield
list
(
instance
.
labels
or
[])
if
instance
.
hints
:
# Migrate to labels
yield
Label
.
ensure_labels
(
instance
.
hints
,
enable_interface
=
True
)
#
if instance.hints:
#
# Migrate to labels
#
yield Label.ensure_labels(instance.hints, enable_interface=True)
# if instance.profile.labels:
# yield list(instance.profile.labels)
yield
Label
.
get_effective_regex_labels
(
"interface_name"
,
instance
.
name
)
...
...
@@ -493,19 +493,6 @@ class Interface(Document):
enabled_afi__in
=
[
"BRIDGE"
,
"IPv4"
],
interface
=
instance
.
parent
.
id
).
scalar
(
"effective_labels"
):
yield
el
# for ipv4_addresses, tagged_vlans, untagged_vlan in SubInterface.objects.filter(
# enabled_afi__in=["BRIDGE", "IPv4"], interface=instance.parent
# ).scalar("ipv4_addresses", "tagged_vlans", "untagged_vlan"):
# if tagged_vlans:
# lazy_tagged_vlans_labels = list(VCFilter.iter_lazy_labels(tagged_vlans, "tagged"))
# yield Label.ensure_labels(lazy_tagged_vlans_labels, enable_interface=True)
# if untagged_vlan:
# lazy_untagged_vlans_labels = list(
# VCFilter.iter_lazy_labels([untagged_vlan], "untagged")
# )
# yield Label.ensure_labels(lazy_untagged_vlans_labels, enable_interface=True)
# if ipv4_addresses:
# yield list(PrefixTable.iter_lazy_labels(ipv4_addresses))
# Avoid circular references
...
...
sa/interfaces/igetinterfaces.py
View file @
14f63e64
...
...
@@ -372,8 +372,8 @@ class IGetInterfaces(BaseInterface):
# noc::interface::role::uni/nni
# noc::topology::direction::uplink
"hints"
:
LabelListParameter
(
choices
=
[
"uplink"
,
"uni"
,
"nni"
],
required
=
False
,
default_scope
=
"noc::interface::hints"
,
allowed_scopes
=
[
"noc::topology::direction"
,
"noc::interface::role"
,
...
...
sa/profiles/Alcatel/7302/get_interfaces.py
View file @
14f63e64
...
...
@@ -189,7 +189,7 @@ class Script(BaseScript):
port_id
=
"ethernet:"
+
ifname
.
split
(
":"
)[
-
1
]
else
:
port_id
=
ifname
hints
=
[
"nni"
]
hints
=
[
"
noc::topology::direction::
nni"
]
else
:
port_id
=
ifname
.
split
(
":"
,
1
)[
-
1
]
slot_id
=
tuple
(
port_id
.
split
(
"/"
)[:
-
1
])
...
...
@@ -358,7 +358,7 @@ class Script(BaseScript):
hints
=
[]
if
iftype
==
6
:
ifname
=
"ethernet:%s"
%
(
port_id
[
-
1
]
-
2
)
hints
=
[
"nni"
]
hints
=
[
"
noc::topology::direction::
nni"
]
ethernet
[
ifindex
]
=
{
"name"
:
ifname
,
"snmp_ifindex"
:
ifindex
,
...
...
sa/profiles/Alstec/24xx/get_inventory.py
View file @
14f63e64
...
...
@@ -24,6 +24,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"Дверь"
,
"measurement"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::door"
],
"snmp_oid"
:
"1.3.6.1.4.1.27142.1.2.45.1.5.7.0"
,
},
# temp1
...
...
@@ -32,6 +33,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"Значение температуры с датчика"
,
"measurement"
:
"Celsius"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::temperature"
],
"snmp_oid"
:
"1.3.6.1.4.1.27142.1.2.45.1.5.6.0"
,
},
]
...
...
@@ -43,6 +45,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"Напряжени питания"
,
"measurement"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::psu"
,
"noc::sensor::mode::voltage"
],
"snmp_oid"
:
"1.3.6.1.4.1.27142.1.2.45.1.3.6.0"
,
},
# temp1
...
...
@@ -51,6 +54,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"Температура блока питания"
,
"measurement"
:
"Celsius"
,
"labels"
:
[
"noc::sensor::placement::psu"
,
"noc::sensor::mode::temperature"
],
"snmp_oid"
:
"1.3.6.1.4.1.27142.1.2.45.1.3.8.0"
,
},
]
...
...
sa/profiles/ElectronR/KO01M/get_inventory.py
View file @
14f63e64
...
...
@@ -22,6 +22,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"Значение температуры с внутреннего датчика"
,
"measurement"
:
"Celsius"
,
"labels"
:
[
"noc::sensor::placement::internal"
,
"noc::sensor::mode::temperature"
],
"snmp_oid"
:
"1.3.6.1.4.1.35419.20.1.140.0"
,
},
{
...
...
sa/profiles/Huawei/MA5600T/get_interfaces.py
View file @
14f63e64
...
...
@@ -333,7 +333,7 @@ class Script(BaseScript):
"oper_status"
:
oper_status
,
"snmp_ifindex"
:
ifindex
,
"enabled_protocols"
:
[],
"hints"
:
[
"uplink"
],
"hints"
:
[
"
noc::interface::role::
uplink"
],
"subinterfaces"
:
[
{
"name"
:
ifname
,
...
...
@@ -375,7 +375,7 @@ class Script(BaseScript):
for
p_name
,
p
in
ports
.
items
():
if
self
.
is_gpon_uplink
:
ifindex
=
self
.
snmp_index
(
"XG-PON"
,
0
,
slot
,
int
(
p
[
"num"
]))
hints
=
[
"uplink"
]
hints
=
[
"
noc::interface::role::
uplink"
]
else
:
ifindex
=
self
.
snmp_index
(
"GPON"
,
0
,
slot
,
int
(
p
[
"num"
]))
hints
=
[]
...
...
sa/profiles/Qtech/BFC_PBIC_S/get_inventory.py
View file @
14f63e64
...
...
@@ -15,12 +15,24 @@ class Script(BaseScript):
interface
=
IGetInventory
femto_input_config_map
=
{
0
:
{
"type"
:
"in"
,
"units"
:
"StatusEnum"
},
1
:
{
"type"
:
"volt"
,
"units"
:
"Volt AC"
},
2
:
{
"type"
:
"counter"
,
"units"
:
"Scalar"
},
3
:
{
"type"
:
"vibration"
,
"units"
:
"Scalar"
},
4
:
{
"type"
:
"impedance"
,
"units"
:
"Scalar"
},
9
:
{
"type"
:
"ups"
,
"units"
:
"Scalar"
},
0
:
{
"type"
:
"in"
,
"units"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::external"
]},
1
:
{
"type"
:
"volt"
,
"units"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::voltage"
],
},
2
:
{
"type"
:
"counter"
,
"units"
:
"Scalar"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::counter"
],
},
3
:
{
"type"
:
"vibration"
,
"units"
:
"Scalar"
,
"labels"
:
[]},
4
:
{
"type"
:
"impedance"
,
"units"
:
"Scalar"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::impedance"
],
},
9
:
{
"type"
:
"ups"
,
"units"
:
"Scalar"
,
"labels"
:
[
"noc::sensor::placement::ups"
]},
}
def
get_sensors
(
self
):
...
...
@@ -43,6 +55,10 @@ class Script(BaseScript):
"status"
:
-
55
<
temp
<
600
,
"description"
:
"Значение температуры с выносного датчика"
,
"measurement"
:
"Celsius"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::temperature"
,
],
"snmp_oid"
:
"1.3.6.1.3.55.1.2.1.0"
,
},
]
...
...
@@ -60,6 +76,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
f
"Универсальных вход
{
num
}
"
,
"measurement"
:
self
.
femto_input_config_map
[
in_config
][
"units"
],
"labels"
:
self
.
femto_input_config_map
[
in_config
][
"labels"
],
"snmp_oid"
:
oid
,
}
]
...
...
sa/profiles/Rotek/BT/get_inventory.py
View file @
14f63e64
...
...
@@ -22,6 +22,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"Дверь"
,
"measurement"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::external"
],
"snmp_oid"
:
"1.3.6.1.4.1.41752.5.15.1.1.0"
,
},
# v230
...
...
@@ -38,6 +39,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"Температура в шкафу"
,
"measurement"
:
"Celsius"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::temperature"
],
"snmp_oid"
:
"1.3.6.1.4.1.41752.5.15.1.2.0"
,
},
]
...
...
@@ -47,6 +49,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"Ток потребления нагрузки"
,
"measurement"
:
"Ampere"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::current"
],
"snmp_oid"
:
"1.3.6.1.4.1.41752.5.15.1.3.0"
,
},
{
...
...
@@ -54,6 +57,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"ИБП. Напряжение на АКБ"
,
"measurement"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::voltage"
],
"snmp_oid"
:
"1.3.6.1.4.1.41752.5.15.1.6.0"
,
},
{
...
...
@@ -61,6 +65,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
"Ток заряда АКБ"
,
"measurement"
:
"Ampere"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::current"
],
"snmp_oid"
:
"1.3.6.1.4.1.41752.5.15.1.5.0"
,
},
]
...
...
sa/profiles/Rotek/BT/get_version.py
View file @
14f63e64
# ---------------------------------------------------------------------
# Rotek.BT.get_version
# ---------------------------------------------------------------------
# Copyright (C) 2007-20
17
The NOC Project
# Copyright (C) 2007-20
22
The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# NOC modules
...
...
@@ -21,6 +21,9 @@ class Script(BaseScript):
platform
=
v
[
"model"
]
if
","
in
platform
:
platform
=
platform
.
split
(
","
)[
0
]
if
platform
==
"RT-Pwr"
:
# Version 1.4.0-b32048bc return RT-Pwr
platform
=
"RT-Pwr-220-U"
return
{
"vendor"
:
"Rotek"
,
"version"
:
v
[
"fwversion"
],
...
...
@@ -54,6 +57,9 @@ class Script(BaseScript):
version
=
oid
.
split
()[
1
].
strip
()
if
","
in
platform
:
platform
=
platform
.
split
(
","
)[
0
]
if
platform
==
"RT-Pwr"
:
# Version 1.4.0-b32048bc return RT-Pwr
platform
=
"RT-Pwr-220-U"
result
=
{
"vendor"
:
"Rotek"
,
"version"
:
version
,
...
...
sa/profiles/Ttronics/KUB/get_inventory.py
View file @
14f63e64
...
...
@@ -15,11 +15,19 @@ class Script(BaseScript):
interface
=
IGetInventory
nano_input_config_map
=
{
0
:
{
"type"
:
"volt"
,
"units"
:
"Volt AC"
},
1
:
{
"type"
:
"in"
,
"units"
:
"StatusEnum"
},
2
:
{
"type"
:
"relay"
,
"units"
:
"StatusEnum"
},
3
:
{
"type"
:
"counter"
,
"units"
:
"Scalar"
},
4
:
{
"type"
:
"vibration"
,
"units"
:
"Scalar"
},
0
:
{
"type"
:
"volt"
,
"units"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::voltage"
],
},
1
:
{
"type"
:
"in"
,
"units"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::external"
]},
2
:
{
"type"
:
"relay"
,
"units"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::external"
]},
3
:
{
"type"
:
"counter"
,
"units"
:
"Scalar"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::counter"
],
},
4
:
{
"type"
:
"vibration"
,
"units"
:
"Scalar"
,
"labels"
:
[
"noc::sensor::placement::external"
]},
}
def
get_oid
(
self
,
p_type
,
num
):
...
...
@@ -42,6 +50,7 @@ class Script(BaseScript):
"status"
:
1
,
"description"
:
"Значение температуры с внутреннего датчика"
,
"measurement"
:
"Celsius"
,
"labels"
:
[
"noc::sensor::placement::internal"
,
"noc::sensor::mode::temperature"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.1.0"
,
},
# Supply voltage
...
...
@@ -50,6 +59,7 @@ class Script(BaseScript):
"status"
:
1
,
"description"
:
"Напряжение питания устройства"
,
"measurement"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::internal"
,
"noc::sensor::mode::voltage"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.14.0"
,
},
]
...
...
@@ -70,6 +80,10 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
f
"Универсальных вход
{
num
}
"
,
"measurement"
:
"Ampere"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::current"
,
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.19.0"
,
}
]
...
...
@@ -81,6 +95,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
f
"Универсальных вход
{
num
}
"
,
"measurement"
:
self
.
nano_input_config_map
[
num
][
"units"
],
"labels"
:
self
.
nano_input_config_map
[
num
][
"labels"
],
"snmp_oid"
:
oid
,
}
]
...
...
@@ -93,6 +108,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"Электросчётчик. Значение напряжения сети"
,
"measurement"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::elmeter"
,
"noc::sensor::mode::voltage"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.21.0"
,
},
{
...
...
@@ -100,6 +116,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"Электросчётчик. Значение потребляемого тока"
,
"measurement"
:
"Ampere"
,
"labels"
:
[
"noc::sensor::placement::elmeter"
,
"noc::sensor::mode::current"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.22.0"
,
},
{
...
...
@@ -107,6 +124,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"Электросчётчик. Суммарное значение потреблённой мощности по тарифу 1"
,
"measurement"
:
"Kilowatt-hour"
,
"labels"
:
[
"noc::sensor::placement::elmeter"
,
"noc::sensor::mode::kwh"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.23.0"
,
},
{
...
...
@@ -114,6 +132,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"Электросчётчик. Суммарное значение потреблённой мощности по тарифу 2"
,
"measurement"
:
"Kilowatt-hour"
,
"labels"
:
[
"noc::sensor::placement::elmeter"
,
"noc::sensor::mode::kwh"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.24.0"
,
},
{
...
...
@@ -121,6 +140,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"Электросчётчик. Суммарное значение потреблённой мощности"
,
"measurement"
:
"Kilowatt-hour"
,
"labels"
:
[
"noc::sensor::placement::elmeter"
,
"noc::sensor::mode::kwh"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.25.0"
,
},
]
...
...
@@ -132,6 +152,7 @@ class Script(BaseScript):
"status"
:
v
!=
0
,
"description"
:
"Флаг наличия связи с ИБП по порту RS-232"
,
"measurement"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::internal"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.29.0"
,
},
]
...
...
@@ -142,6 +163,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Текущее состояние ИБП"
,
"measurement"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.27.0"
,
},
{
...
...
@@ -149,6 +171,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Текущее состояние батареи ИБП"
,
"measurement"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.38.0"
,
},
{
...
...
@@ -156,6 +179,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Текущий статус bypass"
,
"measurement"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.31.0"
,
},
{
...
...
@@ -163,6 +187,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Текущий режим работы ИБП"
,
"measurement"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.32.0"
,
},
{
...
...
@@ -170,6 +195,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Входное напряжение."
,
"measurement"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.33.0"
,
},
{
...
...
@@ -177,6 +203,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Значение частоты сети"
,
"measurement"
:
"Hertz"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.34.0"
,
},
{
...
...
@@ -184,6 +211,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Выходное напряжение."
,
"measurement"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.35.0"
,
},
{
...
...
@@ -191,6 +219,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Нагрузка ИБП в %."
,
"measurement"
:
"Percent"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.37.0"
,
},
{
...
...
@@ -198,6 +227,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Нагрузка ИБП в W."
,
"measurement"
:
"Watt"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.36.0"
,
},
{
...
...
@@ -205,6 +235,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Напряжение батареи ИБП."
,
"measurement"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::ups"
,
"noc::sensor::mode::voltage"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.40.0"
,
},
{
...
...
@@ -212,6 +243,7 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Ёмкость батареи в %."
,
"measurement"
:
"Percent"
,
"labels"
:
[
"noc::sensor::placement::ups"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.41.0"
,
},
{
...
...
@@ -219,18 +251,31 @@ class Script(BaseScript):
"status"
:
bool
(
v
),
"description"
:
"ИБП. Температура батареи"
,
"measurement"
:
"Celsius"
,
"labels"
:
[
"noc::sensor::placement::ups"
,
"noc::sensor::mode::temperature"
],
"snmp_oid"
:
"1.3.6.1.4.1.51315.1.39.0"
,
},
]
return
r
femto_input_config_map
=
{
0
:
{
"type"
:
"in"
,
"units"
:
"StatusEnum"
},
1
:
{
"type"
:
"volt"
,
"units"
:
"Volt AC"
},
2
:
{
"type"
:
"counter"
,
"units"
:
"Scalar"
},
3
:
{
"type"
:
"vibration"
,
"units"
:
"Scalar"
},
4
:
{
"type"
:
"impedance"
,
"units"
:
"Scalar"
},
9
:
{
"type"
:
"ups"
,
"units"
:
"Scalar"
},
0
:
{
"type"
:
"in"
,
"units"
:
"StatusEnum"
,
"labels"
:
[
"noc::sensor::placement::external"
]},
1
:
{
"type"
:
"volt"
,
"units"
:
"Volt AC"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::voltage"
],
},
2
:
{
"type"
:
"counter"
,
"units"
:
"Scalar"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::counter"
],
},
3
:
{
"type"
:
"vibration"
,
"units"
:
"Scalar"
,
"labels"
:
[]},
4
:
{
"type"
:
"impedance"
,
"units"
:
"Scalar"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::impedance"
],
},
9
:
{
"type"
:
"ups"
,
"units"
:
"Scalar"
,
"labels"
:
[
"noc::sensor::placement::ups"
]},
}
def
get_femto_sensors
(
self
):
...
...
@@ -250,6 +295,7 @@ class Script(BaseScript):
"status"
:
1
,
"description"
:
"Значение температуры с выносного датчика"
,
"measurement"
:
"Celsius"
,
"labels"
:
[
"noc::sensor::placement::external"
,
"noc::sensor::mode::temperature"
],
"snmp_oid"
:
"1.3.6.1.3.55.1.2.1.0"
,
},
]
...
...
@@ -266,6 +312,7 @@ class Script(BaseScript):
"status"
:
True
,
"description"
:
f
"Универсальных вход
{
num
}
"
,
"measurement"
:
self
.
femto_input_config_map
[
in_config
][
"units"
],
"labels"
:
self
.
femto_input_config_map
[
in_config
][
"labels"
],
"snmp_oid"
:
oid
,
}
]
...
...
services/discovery/jobs/box/interface.py
View file @
14f63e64
...
...
@@ -276,7 +276,7 @@ class InterfaceCheck(PolicyDiscoveryCheck):
"enabled_protocols"
:
enabled_protocols
,
"ifindex"
:
ifindex
,
"hints"
:
labels
or
[],
"ext
ernal
_labels"
:
[
ll
for
ll
in
labels
if
Interface
.
can_set_label
(
ll
)],
"ext
ra
_labels"
:
[
ll
for
ll
in
labels
if
Interface
.
can_set_label
(
ll
)],
},
ignore_empty
=
ignore_empty
,
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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