flake8 linting
This commit is contained in:
+44
-9
@@ -3,16 +3,16 @@ from __future__ import annotations
|
||||
import ipaddress
|
||||
import sys
|
||||
import typing
|
||||
import time
|
||||
|
||||
import trio
|
||||
|
||||
import capport.utils.ipneigh
|
||||
import capport.utils.nft_set
|
||||
|
||||
from . import cptypes
|
||||
|
||||
|
||||
def print_metric(name: str, mtype: str, value, *, now: typing.Optional[int]=None, help: typing.Optional[str]=None):
|
||||
def print_metric(name: str, mtype: str, value, *, now: typing.Optional[int] = None, help: typing.Optional[str] = None):
|
||||
# no labels in our names for now, always print help and type
|
||||
if help:
|
||||
print(f'# HELP {name} {help}')
|
||||
@@ -47,13 +47,48 @@ async def amain(client_ifname: str):
|
||||
else:
|
||||
total_ipv6 += 1
|
||||
unique_ipv6.add(mac)
|
||||
print_metric('capport_allowed_macs', 'gauge', len(captive_allowed_entries), help='Number of allowed client mac addresses')
|
||||
print_metric('capport_allowed_neigh_macs', 'gauge', len(seen_allowed_entries), help='Number of allowed client mac addresses seen in neighbor cache')
|
||||
print_metric('capport_unique', 'gauge', len(unique_clients), help='Number of clients (mac addresses) in client network seen in neighbor cache')
|
||||
print_metric('capport_unique_ipv4', 'gauge', len(unique_ipv4), help='Number of IPv4 clients (unique per mac) in client network seen in neighbor cache')
|
||||
print_metric('capport_unique_ipv6', 'gauge', len(unique_ipv6), help='Number of IPv4 clients (unique per mac) in client network seen in neighbor cache')
|
||||
print_metric('capport_total_ipv4', 'gauge', total_ipv4, help='Number of IPv4 addresses seen in neighbor cache')
|
||||
print_metric('capport_total_ipv6', 'gauge', total_ipv6, help='Number of IPv6 addresses seen in neighbor cache')
|
||||
print_metric(
|
||||
'capport_allowed_macs',
|
||||
'gauge',
|
||||
len(captive_allowed_entries),
|
||||
help='Number of allowed client mac addresses',
|
||||
)
|
||||
print_metric(
|
||||
'capport_allowed_neigh_macs',
|
||||
'gauge',
|
||||
len(seen_allowed_entries),
|
||||
help='Number of allowed client mac addresses seen in neighbor cache',
|
||||
)
|
||||
print_metric(
|
||||
'capport_unique',
|
||||
'gauge',
|
||||
len(unique_clients),
|
||||
help='Number of clients (mac addresses) in client network seen in neighbor cache',
|
||||
)
|
||||
print_metric(
|
||||
'capport_unique_ipv4',
|
||||
'gauge',
|
||||
len(unique_ipv4),
|
||||
help='Number of IPv4 clients (unique per mac) in client network seen in neighbor cache',
|
||||
)
|
||||
print_metric(
|
||||
'capport_unique_ipv6',
|
||||
'gauge',
|
||||
len(unique_ipv6),
|
||||
help='Number of IPv4 clients (unique per mac) in client network seen in neighbor cache',
|
||||
)
|
||||
print_metric(
|
||||
'capport_total_ipv4',
|
||||
'gauge',
|
||||
total_ipv4,
|
||||
help='Number of IPv4 addresses seen in neighbor cache',
|
||||
)
|
||||
print_metric(
|
||||
'capport_total_ipv6',
|
||||
'gauge',
|
||||
total_ipv6,
|
||||
help='Number of IPv6 addresses seen in neighbor cache',
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user