From 708033283f64f366c68976d0da4e5ece5b7bea78 Mon Sep 17 00:00:00 2001
From: Pelle Koster <pelle.koster@geant.org>
Date: Wed, 8 May 2024 07:46:59 +0200
Subject: [PATCH] get-interface-stats error code to match sensu's expectations

---
 brian_polling_manager/interface_stats/cli.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/brian_polling_manager/interface_stats/cli.py b/brian_polling_manager/interface_stats/cli.py
index 6b32276..44f09cf 100644
--- a/brian_polling_manager/interface_stats/cli.py
+++ b/brian_polling_manager/interface_stats/cli.py
@@ -329,8 +329,11 @@ def cli(
         logger.exception(
             f"Error while processing {str(vendor).capitalize()} router {router_fqdn}"
         )
+        # Exit code 2 indicates CRITICAL in Sensu
+        raise click.exceptions.Exit(2)
 
     if error_counter.count:
+        # Exit code 1 indicates WARNING in Sensu
         raise click.ClickException(
             "Errors were encountered while processing interface stats"
         )
-- 
GitLab