Skip to content

Commit

Permalink
Routing stats metrics adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
akpw committed Oct 20, 2024
1 parent ae77bf9 commit ae6d475
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions deploy/kubernetes/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ stringData:
queue = True # Queues metrics
bgp = False # BGP sessions metrics
routing_stats = False # Routing process stats
certificate = False # Certificates metrics
remote_dhcp_entry = None # An MKTXP entry to provide for remote DHCP info / resolution
Expand Down
3 changes: 2 additions & 1 deletion mktxp/cli/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class MKTXPConfigKeys:
FE_USER_KEY = 'user'
FE_QUEUE_KEY = 'queue'
FE_BGP_KEY = 'bgp'
FE_ROUTING_STATS_KEY = 'routing_stats'

FE_REMOTE_DHCP_ENTRY = 'remote_dhcp_entry'
FE_REMOTE_CAPSMAN_ENTRY = 'remote_capsman_entry'
Expand All @@ -113,7 +112,9 @@ class MKTXPConfigKeys:

FE_KID_CONTROL_DEVICE = 'kid_control_assigned'
FE_KID_CONTROL_DYNAMIC = 'kid_control_dynamic'

FE_CERTIFICATE_KEY = 'certificate'
FE_ROUTING_STATS_KEY = 'routing_stats'

MKTXP_SOCKET_TIMEOUT = 'socket_timeout'
MKTXP_INITIAL_DELAY = 'initial_delay_on_failure'
Expand Down
2 changes: 1 addition & 1 deletion mktxp/cli/config/mktxp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
queue = True # Queues metrics

bgp = False # BGP sessions metrics
routing_stats = False # routing process stats
routing_stats = False # Routing process stats
certificate = False # Certificates metrics

remote_dhcp_entry = None # An MKTXP entry to provide for remote DHCP info / resolution
Expand Down
11 changes: 11 additions & 0 deletions mktxp/collector/routing_stats_collector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# coding=utf8
## Copyright (c) 2020 Arseniy Kuznetsov
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.

from mktxp.collector.base_collector import BaseCollector
from mktxp.datasource.routing_stats_ds import RoutingStatsMetricsDataSource
Expand Down
14 changes: 13 additions & 1 deletion mktxp/datasource/routing_stats_ds.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# coding=utf8
## Copyright (c) 2020 Arseniy Kuznetsov
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.

from mktxp.datasource.base_ds import BaseDSProcessor
from mktxp.datasource.system_resource_ds import SystemResourceMetricsDataSource
Expand All @@ -17,7 +29,7 @@ def metric_records(router_entry, *, metric_labels = None, translation_table = No
# legacy 6.x versions are untested
ver = SystemResourceMetricsDataSource.os_version(router_entry)
if not routerOS7_version(ver):
return
raise Exception("Routing stats for legacy 6.x versions are not supported at the moment")

routing_stats_records = router_entry.api_connection.router_api().get_resource(routing_stats).get()
return BaseDSProcessor.trimmed_records(router_entry, router_records = routing_stats_records, metric_labels = metric_labels, translation_table = translation_table)
Expand Down
2 changes: 1 addition & 1 deletion mktxp/flow/collector_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ def __init__(self):

self.register(CollectorKeys.KID_CONTROL_DEVICE_COLLECTOR, KidDeviceCollector.collect)
self.register(CollectorKeys.BGP_COLLECTOR, BGPCollector.collect)
self.register(CollectorKeys.ROUTING_STATS_COLLECTOR, RoutingStatsCollector.collect)
self.register(CollectorKeys.LTE_COLLECTOR, LTECollector.collect)
self.register(CollectorKeys.SWITCH_PORT_COLLECTOR, SwitchPortCollector.collect)

self.register(CollectorKeys.ROUTING_STATS_COLLECTOR, RoutingStatsCollector.collect)
self.register(CollectorKeys.CERTIFICATE_COLLECTOR, CertificateCollector.collect)

self.register(CollectorKeys.MKTXP_COLLECTOR, MKTXPCollector.collect)
Expand Down

0 comments on commit ae6d475

Please sign in to comment.