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
2ed5bae7
Commit
2ed5bae7
authored
3 months ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
reboot: add default banner for IML checks; add support for manjaro
parent
2c29a17e
No related branches found
No related tags found
1 merge request
!295
Simple task/7546 icinga check für ablaufende gitlab tokens
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_reboot_required
+45
-14
45 additions, 14 deletions
check_reboot_required
with
45 additions
and
14 deletions
check_reboot_required
+
45
−
14
View file @
2ed5bae7
...
@@ -5,23 +5,24 @@
...
@@ -5,23 +5,24 @@
#
#
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# works for sure on
# works for sure on
# - centos7
,8
# - centos7
+
# - debian6
..10
# - debian6
+
# - ubuntu10
,12
# - ubuntu10
+
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# 2016-08-12 added ouput of packages
# 2016-08-12 added ouput of packages
# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2022-10-14 v1.3 <axel.hahn@unibe.ch> fix debian output if /var/run/reboot-required.pkgs does not exist
# 2022-10-14 v1.3 <axel.hahn@unibe.ch> fix debian output if /var/run/reboot-required.pkgs does not exist
# Shellfixes; add help
# Shellfixes; add help
# 2023-03-29 v1.4 <martin.gasser@unibe.ch> add almalinux as distro
# 2023-03-29 v1.4 <martin.gasser@unibe.ch> add almalinux as distro
# 2024-03-7 v1.4 <martin.gasser@unibe.ch> add rocky as distro
# 2024-03-07 v1.4 <martin.gasser@unibe.ch> add rocky as distro
# 2025-02-11 v1.5 <axel.hahn@unibe.ch> add default banner for IML checks; add support for manjaro
# ======================================================================
# ======================================================================
.
$(
dirname
$0
)
/inc_pluginfunctions
.
$(
dirname
$0
)
/inc_pluginfunctions
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
1.
3
self_APPVERSION
=
1.
5
distro
=
$(
ph.getOS
)
distro
=
$(
ph.getOS
)
...
@@ -31,21 +32,20 @@ distro=$( ph.getOS )
...
@@ -31,21 +32,20 @@ distro=$( ph.getOS )
function
showHelp
(){
function
showHelp
(){
cat
<<
EOF
cat
<<
EOF
______________________________________________________________________
$(
ph.showImlHelpHeader
)
$self_APPNAME
v
$self_APPVERSION
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
Check if a reboot is required.
Check if a reboot is required.
It works for Centos and Debian/ Ubuntu
.
It works for Centos and Debian/ Ubuntu
and Manjaro
If the reboot is required:
If the reboot is required:
* On Centos it shows the kernel number that will be installed,
* On Centos it shows the kernel number that will be installed,
* On Debian/ Ubuntu it shows the packages that require the reboot,
* On Debian/ Ubuntu it shows the packages that require the reboot,
* On Manjaro it shows if a newer kernel or which libs require the reboot.
The check for libs uses lsof.
If your distro is based on Arch, Centos or Debian then it easily can be added
in the script if it does not work. Report the distro name to the author.
SYNTAX:
SYNTAX:
$(
basename
$0
)
$(
basename
$0
)
...
@@ -99,8 +99,39 @@ case $distro in
...
@@ -99,8 +99,39 @@ case $distro in
fi
fi
;;
;;
#
"manjaro"
)
kernel_current
=
"
$(
uname
-r
|
sed
's/-[a-z]*$//i'
)
"
kernel_installed
=
"
$(
pacman
-Q
linux |
cut
-f
2
-d
" "
)
"
sReason
=
""
if
[
"
$kernel_current
"
!=
"
$kernel_installed
"
]
;
then
sReason+
=
"Kernel
$kernel_installed
was installed ... "
fi
libs
=
""
if
which lsof
>
/dev/null
;
then
libs
=
$(
lsof
-n
+c 0 2> /dev/null |
grep
'DEL.*lib'
|
awk
'1 { print $1 ": " $NF }'
|
sort
-u
)
if
[[
-n
$libs
]]
;
then
sReason+
=
"Libs reqire a reboot ... "
fi
fi
if
[
-n
"
$sReason
"
]
;
then
ph.setStatus
"warning"
ph.status
"[
$distro
]
$sReason
"
cat
<<<
$libs
else
ph.status
"[
$distro
] No reboot required."
if
!
which lsof
>
/dev/null
;
then
echo
"Remark: Install lsof to search for libs that require a reboot."
fi
fi
;;
*
)
*
)
ph.abort
"UNKNOWN: distro [
$distro
] was detected but is not supported (yet)."
ph.abort
"UNKNOWN: distro [
$distro
] was detected but is not supported (yet)."
echo
"If your distro is based on Arch, Centos or Debian then it easily can be added in the script. Report the distro name to the author."
;;
;;
esac
esac
...
...
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