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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Commits
6665307d
Commit
6665307d
authored
3 years ago
by
Gasser Martin (mg20u947)
Browse files
Options
Downloads
Plain Diff
Merge branch 'timesync' into 'master'
Timesync See merge request
!1
parents
8d86c0b7
39f67a60
No related branches found
No related tags found
1 merge request
!1
Timesync
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_timesync
+10
-5
10 additions, 5 deletions
check_timesync
with
10 additions
and
5 deletions
check_timesync
+
10
−
5
View file @
6665307d
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
# 2018-10-26 v1.0 <axel.hahn@iml.unibe.ch>
# 2018-10-26 v1.0 <axel.hahn@iml.unibe.ch>
# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2020-05-13 v1.2 <axel.hahn@iml.unibe.ch> update pre detect output of timedatectl
# 2020-05-13 v1.2 <axel.hahn@iml.unibe.ch> update pre detect output of timedatectl
# 2021-08-19 v1.3 <martin.gasser@iml.unibe.ch> update for chrony with timedatectl
# ======================================================================
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
.
`
dirname
$0
`
/inc_pluginfunctions
...
@@ -36,16 +38,16 @@ fi
...
@@ -36,16 +38,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 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
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
s
ynchronized
:
yes"
>
/dev/null
cat
$tmpfile
|
grep
"^NTP
S
ynchronized
=
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 +68,9 @@ fi
...
@@ -66,6 +68,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 +83,7 @@ fi
...
@@ -78,7 +83,7 @@ fi
# output & exit
# output & exit
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
cat
$tmpfile
|
grep
"^NTP
s
ynchronized"
cat
$tmpfile
|
grep
"^NTP
S
ynchronized"
echo
echo
cat
$tmpfile
cat
$tmpfile
...
@@ -86,4 +91,4 @@ rm -f $tmpfile
...
@@ -86,4 +91,4 @@ rm -f $tmpfile
ph.exit
ph.exit
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment