Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zyxel Exporter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nico
Zyxel Exporter
Commits
233e0c17
Unverified
Commit
233e0c17
authored
10 months ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
add example output
parent
028b1998
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
zyxel.py
+56
-0
56 additions, 0 deletions
zyxel.py
with
56 additions
and
0 deletions
zyxel.py
+
56
−
0
View file @
233e0c17
...
...
@@ -38,6 +38,12 @@ class ZyxelClient:
def
collect
(
self
):
slots
=
{}
"""
Router> show fqdn
host name : ffs01
domain name: none
FQDN : ffs01
"""
resp
=
self
.
_run_cmd
(
"
show fqdn
"
)
for
line
in
resp
.
split
(
"
\n
"
):
line
=
line
.
strip
()
...
...
@@ -45,6 +51,23 @@ class ZyxelClient:
_
,
hostname
=
line
.
split
(
"
:
"
,
maxsplit
=
1
)
hostname
=
hostname
.
strip
()
"""
Router> show interface lan
active: yes
interface name: br0
description:
join count: 1
member: vlan88
IP type: dhcp
IP address: 192.168.88.61
netmask: 255.255.255.0
gateway: 192.168.88.252
metric: 0
MTU: 1500
MSS: 0
forward delay time: 0
stp: off
"""
resp
=
self
.
_run_cmd
(
"
show interface lan
"
)
for
line
in
resp
.
split
(
"
\n
"
):
line
=
line
.
strip
()
...
...
@@ -95,6 +118,11 @@ class ZyxelClient:
uptime
+=
60
*
int
(
up_minutes
)
uptime
+=
int
(
up_seconds
)
"""
Router> show wireless-hal current channel
Slot1: 9 (20 MHz)
Slot2: 104 (40 MHz)
"""
resp
=
self
.
_run_cmd
(
"
show wireless-hal current channel
"
)
for
line
in
resp
.
split
(
"
\n
"
):
line
=
line
.
strip
()
...
...
@@ -107,7 +135,13 @@ class ZyxelClient:
slots
[
slot
][
"
hostname
"
]
=
hostname
slots
[
slot
][
"
ip
"
]
=
ip
slots
[
slot
][
"
uptime
"
]
=
uptime
slots
[
slot
][
"
location
"
]
=
location
"""
Router> show wireless-hal station number
Slot1: 8
Slot2: 38
"""
resp
=
self
.
_run_cmd
(
"
show wireless-hal station number
"
)
for
line
in
resp
.
split
(
"
\n
"
):
line
=
line
.
strip
()
...
...
@@ -115,6 +149,27 @@ class ZyxelClient:
slot
,
client_count
=
line
.
split
(
"
:
"
,
maxsplit
=
2
)
slots
[
slot
][
"
client_count
"
]
=
int
(
client_count
.
strip
())
"""
Router> show wireless-hal statistic
Slot: 1
ReceivedPktCount: 2718430
TransmittedPktCount: 1875083
wlanReceivedByte: 384667289
wlanTransmittedByte: 1954443927
RetryCount: 0
FCSErrorCount: 1560481
TxPower: 19
Channel Utilization: 37
Slot: 2
ReceivedPktCount: 3377503
TransmittedPktCount: 3073845
wlanReceivedByte: 1567639988
wlanTransmittedByte: 3247054240
RetryCount: 0
FCSErrorCount: 2186819
TxPower: 26
Channel Utilization: 21
"""
resp
=
self
.
_run_cmd
(
"
show wireless-hal statistic
"
)
current_slot
=
""
for
line
in
resp
.
split
(
"
\n
"
):
...
...
@@ -128,6 +183,7 @@ class ZyxelClient:
_
,
util
=
line
.
split
(
"
:
"
,
maxsplit
=
2
)
slots
[
current_slot
][
"
util
"
]
=
int
(
util
.
strip
())
statobjs
=
[]
for
slot
,
stats
in
slots
.
items
():
if
stats
[
"
channel
"
]
in
[
"
1
"
,
"
2
"
,
"
3
"
,
"
4
"
,
"
5
"
,
"
6
"
,
"
7
"
,
"
8
"
,
"
9
"
,
"
10
"
,
"
11
"
,
"
12
"
,
"
13
"
]:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment