Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Merge requests
!1
Timesync
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Timesync
timesync
into
master
Overview
0
Commits
2
Pipelines
0
Changes
1
Merged
Gasser Martin (mg20u947)
requested to merge
timesync
into
master
3 years ago
Overview
0
Commits
2
Pipelines
0
Changes
1
check_timesync with chrony ans timedatectl
0
0
Merge request reports
Viewing commit
57a3ec7e
Prev
Next
Show latest version
1 file
+
8
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
57a3ec7e
check_timesync for centos8
· 57a3ec7e
Martin
authored
3 years ago
check_timesync
+
8
−
5
View file @ 57a3ec7e
Edit in single-file editor
Open in Web IDE
Show full file
@@ -36,16 +36,16 @@ fi
# ph.execIfReady "timedatectl status | grep '^NTP synchronized'" >/dev/null
# echo ----- output of timedatectl status >$tmpfile
# timedatectl status >>$tmpfile
ph.execIfReady
"timedatectl s
tatus
>
$tmpfile
; grep '^NTP
s
ynchronized'
$tmpfile
>/dev/null"
ph.execIfReady
"timedatectl s
how
>
$tmpfile
; grep '^NTP
S
ynchronized'
$tmpfile
>/dev/null"
cat
$tmpfile
|
grep
"^NTP
s
ynchronized"
>
/dev/null
cat
$tmpfile
|
grep
"^NTP
S
ynchronized"
>
/dev/null
if
[
$?
-ne
0
]
;
then
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"
cat
$tmpfile
else
cat
$tmpfile
|
grep
"^NTP
s
ynchronized
:
yes"
>
/dev/null
cat
$tmpfile
|
grep
"^NTP
S
ynchronized
=
yes"
>
/dev/null
if
[
$?
-eq
0
]
;
then
ph.status
"timesync: a timesync service is active on this
${
myos
}
host"
else
@@ -66,6 +66,9 @@ fi
if
[
-f
/etc/chrony.conf
]
;
then
sSyncService
=
"chronyd"
fi
if
[
-f
/etc/chrony/chrony.conf
]
;
then
sSyncService
=
"chronyd"
fi
if
[
-z
$sSyncService
]
;
then
echo
"REMARK: no sync service detected ... or this sensu check does not support it"
>>
$tmpfile
else
@@ -78,7 +81,7 @@ fi
# output & exit
# ----------------------------------------------------------------------
cat
$tmpfile
|
grep
"^NTP
s
ynchronized"
cat
$tmpfile
|
grep
"^NTP
S
ynchronized"
echo
cat
$tmpfile
@@ -86,4 +89,4 @@ rm -f $tmpfile
ph.exit
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
\ No newline at end of file
Loading