From bca4d152ea572a79fe214381d53bd6cfa432cc71 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Thu, 24 Aug 2023 07:41:37 +0200 Subject: [PATCH] bundles/zfs: print `zfs status` output if pool is not online --- bundles/zfs/files/check_zpool_online | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bundles/zfs/files/check_zpool_online b/bundles/zfs/files/check_zpool_online index 9fb0cae..0e7c16c 100644 --- a/bundles/zfs/files/check_zpool_online +++ b/bundles/zfs/files/check_zpool_online @@ -5,11 +5,14 @@ if [ $# -eq 0 ] ; then exit 3 fi -if [ "$(zpool status "$1" | grep '^ state:')" = ' state: ONLINE' ] +status="$(zpool status "$1")" + +if [ "$(echo "$status" | grep '^ state:')" = ' state: ONLINE' ] then echo "OK - Pool '$1' is online" exit 0 else echo "CRITICAL - Pool '$1' is FAULTY or NOT ONLINE" + echo "$status" exit 2 fi