From 3e4ce75ef95a785efedabe974e2945f2eaa4f06f Mon Sep 17 00:00:00 2001 From: Adam Cecile Date: Thu, 25 Mar 2021 13:47:35 +0100 Subject: [PATCH] Recent pacemaker (e.g: 2.0.5) prefix lines with " * " --- check_crm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/check_crm b/check_crm index c49f45c..fad3c77 100755 --- a/check_crm +++ b/check_crm @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# check_crm_v0_8 +# check_crm_v0_9 # # Copyright © 2013 Philip Garner, Sysnix Consultants Limited # @@ -20,6 +20,8 @@ # threshold ( Zoran Bosnjak & Marko Hrastovec ) # v0.8 01/09/2020 - Make less assumptions about crm output # ( Jan Tlusty ) +# v0.9 25/03/2021 - Handle recent pacemaker prefixing lines with " * " +# ( Adam Cecile ) # # NOTES: Requires Perl 5.8 or higher & the Perl Module Nagios::Plugin @@ -109,6 +111,11 @@ sub gather_crm_output { @crm_output = <$filehandle>; + # Recent pacemaker version (e.g: 2.0.5) prefix lines with " * " which breaks parsing + foreach (@crm_output) { + s/^\s+\*\s+//g; + } + close($filehandle) or $np->nagios_exit( CRITICAL, $errormessage ); }