From 950778fb97dd1dd0fde93fe6baa29109bcac0954 Mon Sep 17 00:00:00 2001 From: Dani Louca Date: Mon, 7 Jun 2021 15:39:06 -0400 Subject: [PATCH] fix master link status Signed-off-by: Dani Louca --- redis_info.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/redis_info.py b/redis_info.py index 77d0ace..9fdaf1d 100644 --- a/redis_info.py +++ b/redis_info.py @@ -159,7 +159,17 @@ def dispatch_value(self, value, type, plugin_instance=None, type_instance=None, try: value = int(value) except ValueError: - value = float(value) + try: + value = float(value) + except ValueError: + if type_instance == "master_link_status": + if value == "up": + value = 1 + else: + value = 0 + else: + collectd.warning("redis_info plugin: could not cast value %s for instance %s " % (value, type_instance)) + return self.log_verbose("Sending value: %s=%s (%s)" % (type_instance, value, dimensions))