Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e_zombie
noc
Commits
ee0c5a57
Commit
ee0c5a57
authored
Jun 27, 2022
by
Andrey Vertiprahov
Committed by
Dmitry Volodin
Jun 27, 2022
Browse files
Generic.get_metrics. Add units (Measurement Units) param to set_metrics.
parent
18b3646a
Changes
103
Hide whitespace changes
Inline
Side-by-side
core/script/oidrules/capindex.py
View file @
ee0c5a57
...
...
@@ -18,8 +18,8 @@ class CapabilityIndexRule(OIDRule):
name
=
"capindex"
def
__init__
(
self
,
oid
,
type
=
None
,
scale
=
1
,
start
=
0
,
capability
=
None
):
super
().
__init__
(
oid
,
type
=
type
,
scale
=
scale
)
def
__init__
(
self
,
oid
,
type
=
None
,
scale
=
1
,
units
=
"1"
,
start
=
0
,
capability
=
None
):
super
().
__init__
(
oid
,
type
=
type
,
scale
=
scale
,
units
=
units
)
self
.
start
=
start
self
.
capability
=
capability
...
...
@@ -28,4 +28,4 @@ class CapabilityIndexRule(OIDRule):
for
i
in
range
(
self
.
start
,
script
.
capabilities
[
self
.
capability
]
+
self
.
start
):
oid
=
self
.
expand_oid
(
index
=
i
)
if
oid
:
yield
oid
,
self
.
type
,
self
.
scale
,
cfg
.
labels
yield
oid
,
self
.
type
,
self
.
scale
,
self
.
units
,
cfg
.
labels
core/script/oidrules/caplist.py
View file @
ee0c5a57
...
...
@@ -24,13 +24,14 @@ class CapabilityListRule(OIDRule):
oid
,
type
=
None
,
scale
=
1
,
units
=
"1"
,
capability
=
None
,
separator
=
","
,
strip
=
True
,
default
=
None
,
labels
=
None
,
):
super
().
__init__
(
oid
,
type
=
type
,
scale
=
scale
)
super
().
__init__
(
oid
,
type
=
type
,
scale
=
scale
,
units
=
units
)
self
.
capability
=
capability
self
.
separator
=
separator
self
.
strip
=
strip
...
...
@@ -53,9 +54,9 @@ class CapabilityListRule(OIDRule):
labels
=
self
.
labels
[:]
labels
[
self
.
labels
.
index
(
item
)]
=
item
.
replace
(
"item"
,
i
)
if
oid
:
yield
oid
,
self
.
type
,
self
.
scale
,
labels
yield
oid
,
self
.
type
,
self
.
scale
,
self
.
units
,
labels
else
:
if
self
.
default
is
not
None
:
oid
=
self
.
expand_oid
(
item
=
self
.
default
)
if
oid
:
yield
oid
,
self
.
type
,
self
.
scale
,
cfg
.
labels
yield
oid
,
self
.
type
,
self
.
scale
,
self
.
units
,
cfg
.
labels
core/script/oidrules/ifindex.py
View file @
ee0c5a57
...
...
@@ -20,4 +20,4 @@ class InterfaceRule(OIDRule):
if
cfg
.
ifindex
is
not
None
:
oid
=
self
.
expand_oid
(
ifIndex
=
cfg
.
ifindex
)
if
oid
:
yield
oid
,
self
.
type
,
self
.
scale
,
cfg
.
labels
yield
oid
,
self
.
type
,
self
.
scale
,
self
.
units
,
cfg
.
labels
core/script/oidrules/oid.py
View file @
ee0c5a57
...
...
@@ -22,13 +22,15 @@ class OIDRule(object):
name
=
"oid"
default_type
=
"gauge"
default_units
=
"1"
_scale_locals
=
{}
def
__init__
(
self
,
oid
,
type
=
None
,
scale
=
1
,
labels
=
None
):
def
__init__
(
self
,
oid
,
type
=
None
,
scale
=
1
,
units
=
None
,
labels
=
None
):
self
.
oid
=
oid
self
.
is_complex
=
not
isinstance
(
oid
,
str
)
self
.
type
=
type
or
self
.
default_type
self
.
units
=
units
or
self
.
default_units
self
.
scale
=
self
.
_convert_scale
(
scale
)
self
.
labels
=
labels
or
[]
...
...
@@ -50,9 +52,9 @@ class OIDRule(object):
:return:
"""
if
self
.
is_complex
:
yield
tuple
(
self
.
oid
),
self
.
type
,
self
.
scale
,
self
.
labels
yield
tuple
(
self
.
oid
),
self
.
type
,
self
.
scale
,
self
.
units
,
self
.
labels
else
:
yield
self
.
oid
,
self
.
type
,
self
.
scale
,
self
.
labels
yield
self
.
oid
,
self
.
type
,
self
.
scale
,
self
.
units
,
self
.
labels
@
classmethod
def
from_json
(
cls
,
data
):
...
...
sa/interfaces/igetmetrics.py
View file @
ee0c5a57
...
...
@@ -54,5 +54,7 @@ class IGetMetrics(BaseInterface):
"type"
:
StringParameter
(
choices
=
[
"gauge"
,
"counter"
,
"bool"
,
"delta"
]),
# Measurement scale
"scale"
:
IntParameter
(
default
=
1
),
# Measurement units
"units"
:
StringParameter
(
required
=
False
)
}
)
sa/profiles/AcmePacket/NetNet/snmp_metrics/cpu_usage.json
View file @
ee0c5a57
{
"$metric"
:
"CPU | Usage"
,
"$type"
:
"oid"
,
"oid"
:
"1.3.6.1.4.1.9148.3.2.1.1.1.0"
"oid"
:
"1.3.6.1.4.1.9148.3.2.1.1.1.0"
,
"units"
:
"%"
}
sa/profiles/AcmePacket/NetNet/snmp_metrics/memory_usage.json
View file @
ee0c5a57
{
"$metric"
:
"Memory | Usage"
,
"$type"
:
"oid"
,
"oid"
:
"1.3.6.1.4.1.9148.3.2.1.1.2.0"
"oid"
:
"1.3.6.1.4.1.9148.3.2.1.1.2.0"
,
"units"
:
"%"
}
\ No newline at end of file
sa/profiles/Alcatel/7302/oidrules/slot.py
View file @
ee0c5a57
...
...
@@ -79,8 +79,8 @@ class SlotRule(OIDRule):
if
self
.
is_complex
:
gen
=
[
mib
[
self
.
expand
(
o
,
{
"hwSlotIndex"
:
r
[
i
]})]
for
o
in
self
.
oid
]
if
gen
:
yield
tuple
(
gen
),
self
.
type
,
self
.
scale
,
list
(
i
)
yield
tuple
(
gen
),
self
.
type
,
self
.
scale
,
self
.
units
,
list
(
i
)
else
:
oid
=
mib
[
self
.
expand
(
self
.
oid
,
{
"hwSlotIndex"
:
r
[
i
]})]
if
oid
:
yield
oid
,
self
.
type
,
self
.
scale
,
list
(
i
)
yield
oid
,
self
.
type
,
self
.
scale
,
self
.
units
,
list
(
i
)
sa/profiles/Alcatel/7302/snmp_metrics/cpu_usage.json
View file @
ee0c5a57
{
"$metric"
:
"CPU | Usage"
,
"$type"
:
"oid"
,
"oid"
:
"1.3.6.1.4.1.637.61.1.9.29.1.1.4.4353"
"oid"
:
"1.3.6.1.4.1.637.61.1.9.29.1.1.4.4353"
,
"units"
:
"%"
}
sa/profiles/Alcatel/7302/snmp_metrics/memory_usage.json
View file @
ee0c5a57
...
...
@@ -5,5 +5,6 @@
"1.3.6.1.4.1.637.61.1.9.29.2.1.2.4353"
,
"1.3.6.1.4.1.637.61.1.9.29.2.1.1.4353"
],
"scale"
:
"percent"
"scale"
:
"percent"
,
"units"
:
"%"
}
sa/profiles/Alcatel/AOS/oidrules/slot.py
View file @
ee0c5a57
...
...
@@ -54,4 +54,4 @@ class SlotRule(OIDRule):
]
)
if
oid
:
yield
oid
,
self
.
type
,
self
.
scale
,
labels
yield
oid
,
self
.
type
,
self
.
scale
,
self
.
units
,
labels
sa/profiles/Alcatel/AOS/snmp_metrics/cpu_usage.json
View file @
ee0c5a57
{
"$metric"
:
"CPU | Usage"
,
"$type"
:
"oid"
,
"oid"
:
"1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.13.0"
"oid"
:
"1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.13.0"
,
"units"
:
"%"
}
sa/profiles/Alcatel/AOS/snmp_metrics/cpu_usage_5sec.json
View file @
ee0c5a57
{
"$metric"
:
"CPU | Usage | 5sec"
,
"$type"
:
"slot"
,
"oid"
:
"1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.10.{{ hwSlotIndex }}"
"oid"
:
"1.3.6.1.4.1.6486.800.1.2.1.16.1.1.2.1.1.10.{{ hwSlotIndex }}"
,
"units"
:
"%"
}
sa/profiles/Alcatel/AOS/snmp_metrics/memory_usage_5sec.json
View file @
ee0c5a57
...
...
@@ -5,5 +5,6 @@
"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"
:
"%"
}
sa/profiles/Cisco/IOS/snmp_metrics/cpu_usage.json
View file @
ee0c5a57
...
...
@@ -13,11 +13,13 @@
"$type"
:
"oid"
,
"oid"
:
"1.3.6.1.4.1.9.9.109.1.1.1.1.7.7"
,
"type"
:
"gauge"
,
"scale"
:
1
"scale"
:
1
,
"units"
:
"%"
},{
"$type"
:
"oid"
,
"oid"
:
"1.3.6.1.4.1.9.9.109.1.1.1.1.7.1"
,
"type"
:
"gauge"
,
"scale"
:
1
"scale"
:
1
,
"units"
:
"%"
}]
}
sa/profiles/Cisco/IOS/snmp_metrics/memory_usage.json
View file @
ee0c5a57
...
...
@@ -5,5 +5,6 @@
"1.3.6.1.4.1.9.9.48.1.1.1.6.1"
,
"1.3.6.1.4.1.9.9.48.1.1.1.5.1"
],
"scale"
:
"percent_usage"
"scale"
:
"percent_usage"
,
"units"
:
"%"
}
sa/profiles/Cisco/WLC/snmp_metrics/cpu_usage.json
View file @
ee0c5a57
{
"$metric"
:
"CPU | Usage"
,
"$type"
:
"oid"
,
"oid"
:
"1.3.6.1.4.1.14179.1.1.5.1.0"
"oid"
:
"1.3.6.1.4.1.14179.1.1.5.1.0"
,
"units"
:
"%"
}
sa/profiles/Cisco/WLC/snmp_metrics/memory_usage.json
View file @
ee0c5a57
...
...
@@ -5,5 +5,6 @@
"1.3.6.1.4.1.14179.1.1.5.3.0"
,
"1.3.6.1.4.1.14179.1.1.5.2.0"
],
"scale"
:
"percent"
"scale"
:
"percent"
,
"units"
:
"%"
}
sa/profiles/EdgeCore/ES/snmp_metrics/cpu_usage.json
View file @
ee0c5a57
...
...
@@ -13,11 +13,13 @@
"$type"
:
"oid"
,
"oid"
:
"1.3.6.1.4.1.259.10.1.46.1.39.2.3.0"
,
"type"
:
"gauge"
,
"scale"
:
1
"scale"
:
1
,
"units"
:
"%"
},{
"$type"
:
"oid"
,
"oid"
:
"1.3.6.1.4.1.259.6.10.94.1.39.2.3.0"
,
"type"
:
"gauge"
,
"scale"
:
1
"scale"
:
1
,
"units"
:
"%"
}]
}
sa/profiles/EdgeCore/ES/snmp_metrics/memory_usage.json
View file @
ee0c5a57
...
...
@@ -15,13 +15,15 @@
"1.3.6.1.4.1.259.10.1.46.1.39.3.2.0"
,
"1.3.6.1.4.1.259.10.1.46.1.39.3.1.0"
],
"scale"
:
"percent"
"scale"
:
"percent"
,
"units"
:
"%"
},{
"$type"
:
"oid"
,
"oid"
:
[
"1.3.6.1.4.1.259.6.10.94.1.39.3.2.0"
,
"1.3.6.1.4.1.259.6.10.94.1.39.3.1.0"
],
"scale"
:
"percent"
"scale"
:
"percent"
,
"units"
:
"%"
}]
}
Prev
1
2
3
4
5
6
Next
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