From 5e0c60c0f9d1a97c0ff25ecfe28aea188a903bd4 Mon Sep 17 00:00:00 2001 From: Niels Huylebroeck Date: Fri, 29 Jan 2021 19:42:19 +0100 Subject: [PATCH] Handle empty/default Hostname parameter See issue #6 --- check-yum-updates/check-yum-updates.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/check-yum-updates/check-yum-updates.sh b/check-yum-updates/check-yum-updates.sh index 71a4f1c..3a7112e 100644 --- a/check-yum-updates/check-yum-updates.sh +++ b/check-yum-updates/check-yum-updates.sh @@ -5,6 +5,10 @@ ### Set Some Variables ### ZBX_DATA=/tmp/zabbix-sender-yum.data HOSTNAME=$(egrep ^Hostname= /etc/zabbix/zabbix_agentd.conf | cut -d = -f 2) +if [[ "$HOSTNAME" == "" ]] +then + HOSTNAME=$(hostname) +fi ZBX_SERVER_IP=$(egrep ^ServerActive /etc/zabbix/zabbix_agentd.conf | cut -d = -f 2) RELEASE=$(cat "/etc/redhat-release") ENFORCING=$(getenforce)