Skip to content
Snippets Groups Projects
Commit 57a3ec7e authored by Martin's avatar Martin
Browse files

check_timesync for centos8

parent 8d86c0b7
No related branches found
No related tags found
1 merge request!1Timesync
...@@ -36,16 +36,16 @@ fi ...@@ -36,16 +36,16 @@ fi
# ph.execIfReady "timedatectl status | grep '^NTP synchronized'" >/dev/null # ph.execIfReady "timedatectl status | grep '^NTP synchronized'" >/dev/null
# echo ----- output of timedatectl status >$tmpfile # echo ----- output of timedatectl status >$tmpfile
# timedatectl status >>$tmpfile # timedatectl status >>$tmpfile
ph.execIfReady "timedatectl status >$tmpfile; grep '^NTP synchronized' $tmpfile >/dev/null" ph.execIfReady "timedatectl show >$tmpfile; grep '^NTPSynchronized' $tmpfile >/dev/null"
cat $tmpfile | grep "^NTP synchronized" >/dev/null cat $tmpfile | grep "^NTPSynchronized" >/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
ph.setStatus "unknown" ph.setStatus "unknown"
# ph.status "timesync: timedatectl has no line NTP synchronized ... maybe your OS ${myos} is not supported" # ph.status "timesync: timedatectl has no line NTP synchronized ... maybe your OS ${myos} is not supported"
ph.status "timesync: timedatectl has no line NTP synchronized" ph.status "timesync: timedatectl has no line NTP synchronized"
cat $tmpfile cat $tmpfile
else else
cat $tmpfile | grep "^NTP synchronized: yes" >/dev/null cat $tmpfile | grep "^NTPSynchronized=yes" >/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
ph.status "timesync: a timesync service is active on this ${myos} host" ph.status "timesync: a timesync service is active on this ${myos} host"
else else
...@@ -66,6 +66,9 @@ fi ...@@ -66,6 +66,9 @@ fi
if [ -f /etc/chrony.conf ]; then if [ -f /etc/chrony.conf ]; then
sSyncService="chronyd" sSyncService="chronyd"
fi fi
if [ -f /etc/chrony/chrony.conf ]; then
sSyncService="chronyd"
fi
if [ -z $sSyncService ]; then if [ -z $sSyncService ]; then
echo "REMARK: no sync service detected ... or this sensu check does not support it" >>$tmpfile echo "REMARK: no sync service detected ... or this sensu check does not support it" >>$tmpfile
else else
...@@ -78,7 +81,7 @@ fi ...@@ -78,7 +81,7 @@ fi
# output & exit # output & exit
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
cat $tmpfile | grep "^NTP synchronized" cat $tmpfile | grep "^NTPSynchronized"
echo echo
cat $tmpfile cat $tmpfile
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment