From 81b295f4a3933c1978a3c71a9f7070be105412c5 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Thu, 19 Dec 2024 09:48:07 +0100 Subject: [PATCH] Gracefully fail if diskload.ini is not available. --- .../usr/local/emhttp/plugins/zabbix_agent/scripts/disk.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/files/usr/local/emhttp/plugins/zabbix_agent/scripts/disk.sh b/files/usr/local/emhttp/plugins/zabbix_agent/scripts/disk.sh index 12be1a2..9306ab5 100755 --- a/files/usr/local/emhttp/plugins/zabbix_agent/scripts/disk.sh +++ b/files/usr/local/emhttp/plugins/zabbix_agent/scripts/disk.sh @@ -57,5 +57,9 @@ if [ $found = 0 ]; then exit 1 fi -read bytes_read bytes_written _ < <(grep $device"=" /var/local/emhttp/diskload.ini | cut -d"=" -f2) -echo '"bytes_reading":'$bytes_read', "bytes_writing":'$bytes_written'}' +if [ -e /var/local/emhttp/diskload.ini ]; then + read bytes_read bytes_written _ < <(grep $device"=" /var/local/emhttp/diskload.ini | cut -d"=" -f2) + echo '"bytes_reading":'$bytes_read', "bytes_writing":'$bytes_written'}' +else + echo '"diskload_missing":1}' +fi