mirror of
https://github.com/KevinMidboe/mktxp-no-cli.git
synced 2025-10-29 17:50:23 +00:00
firewall/mktxp colllectors, fixes/optimizations
This commit is contained in:
@@ -13,19 +13,17 @@
|
||||
|
||||
from mktxp.collectors.base_collector import BaseCollector
|
||||
|
||||
|
||||
class HealthCollector(BaseCollector):
|
||||
''' System Health Metrics collector
|
||||
'''
|
||||
@staticmethod
|
||||
def collect(router_metric):
|
||||
health_labels = ['voltage', 'temperature']
|
||||
health_records = router_metric.health_records(health_labels)
|
||||
if not health_records:
|
||||
return range(0)
|
||||
|
||||
voltage_metrics = BaseCollector.gauge_collector('system_routerboard_voltage', 'Supplied routerboard voltage', health_records, 'voltage')
|
||||
yield voltage_metrics
|
||||
|
||||
temperature_metrics = BaseCollector.gauge_collector('system_routerboard_temperature', ' Routerboard current temperature', health_records, 'temperature')
|
||||
yield temperature_metrics
|
||||
health_records = router_metric.health_records(health_labels)
|
||||
if health_records:
|
||||
voltage_metrics = BaseCollector.gauge_collector('system_routerboard_voltage', 'Supplied routerboard voltage', health_records, 'voltage')
|
||||
yield voltage_metrics
|
||||
|
||||
temperature_metrics = BaseCollector.gauge_collector('system_routerboard_temperature', ' Routerboard current temperature', health_records, 'temperature')
|
||||
yield temperature_metrics
|
||||
|
||||
Reference in New Issue
Block a user