From f74cb8438025de1d4a925e71847cdfafb7663b66 Mon Sep 17 00:00:00 2001 From: Pelle Koster <pelle.koster@geant.org> Date: Wed, 24 Apr 2024 08:50:23 +0200 Subject: [PATCH] update get-interface-stats cli args --- brian_polling_manager/configuration.py | 2 +- brian_polling_manager/interfaces.py | 1 + test/conftest.py | 2 +- test/test_sensu_checks.py | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/brian_polling_manager/configuration.py b/brian_polling_manager/configuration.py index 0d67e47..699633a 100644 --- a/brian_polling_manager/configuration.py +++ b/brian_polling_manager/configuration.py @@ -29,7 +29,7 @@ _DEFAULT_CONFIG = { 'interface-check': { 'script': '/home/brian_checks/venv/get-interface-stats', 'config': '/var/lib/sensu/conf/get-interface-stats.config.json', - 'command': '{script} --config {config} --juniper {hostname} --all', + 'command': '{script} --config {config} {args}', }, 'gws-direct-interface-check': { 'script': '/var/lib/sensu/bin/poll-gws-direct.sh', diff --git a/brian_polling_manager/interfaces.py b/brian_polling_manager/interfaces.py index 0c64f0b..a665d64 100644 --- a/brian_polling_manager/interfaces.py +++ b/brian_polling_manager/interfaces.py @@ -53,6 +53,7 @@ class NetconfRouterCheck(sensu.AbstractCheck): hostname=self.router, config=self.ifc_check_params["config"], script=self.ifc_check_params["script"], + args=f'--juniper {self.router} --all' ) @sensu.AbstractCheck.proxy_entity_name.getter diff --git a/test/conftest.py b/test/conftest.py index 2e47821..f70af73 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -42,7 +42,7 @@ def config(): "interface-check": { "script": "/home/brian_checks/venv/get-interface-stats", "config": "/var/lib/sensu/conf/get-interface-stats.config.json", - "command": "{script} --config {config} --juniper {hostname}", + "command": "{script} --config {config} {args}", }, "gws-direct-interface-check": { "script": "/var/lib/sensu/bin/poll-gws-direct.sh", diff --git a/test/test_sensu_checks.py b/test/test_sensu_checks.py index 24e6695..31e0998 100644 --- a/test/test_sensu_checks.py +++ b/test/test_sensu_checks.py @@ -44,7 +44,8 @@ def test_router_check(config): ).to_dict() assert check["command"] == ( "/home/brian_checks/venv/get-interface-stats " - "--config /var/lib/sensu/conf/get-interface-stats.config.json --juniper xyz" + "--config /var/lib/sensu/conf/get-interface-stats.config.json " + "--juniper xyz --all" ) assert check["proxy_entity_name"] == "xyz" assert check["metadata"]["name"] == "rtr-xyz" -- GitLab