From ec8bd0a1fb270e96701451a9ba7fdec29d54951c Mon Sep 17 00:00:00 2001 From: newrain Date: Thu, 17 Jun 2021 21:29:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zabbix_agentd.d/script/osMonitor.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zabbix_agentd.d/script/osMonitor.sh b/zabbix_agentd.d/script/osMonitor.sh index 5f2a62c..63807a5 100644 --- a/zabbix_agentd.d/script/osMonitor.sh +++ b/zabbix_agentd.d/script/osMonitor.sh @@ -98,11 +98,13 @@ function services() { local s case $1 in servicesList) - s="$(systemctl list-unit-files|grep enabled |wc -l)" + + s="$(systemctl list-unit-files|grep enabled |awk '{print $1}' | awk -F '.' '{print $1}')" echo $s ;; service) - systemctl list-unit-files|grep enabled |awk '{print $1}' | awk -F '.' '{print $1}' + s=$(systemctl list-unit-files|grep enabled) + echo $s ;; esac }