Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marcus Klang
Host Monitor
Commits
da7c1035
Commit
da7c1035
authored
Jul 07, 2021
by
root
Browse files
Added flag for unattended-upgrades
parent
fcc93b29
Changes
1
Hide whitespace changes
Inline
Side-by-side
linux/host-monitor.sh
View file @
da7c1035
...
...
@@ -69,6 +69,18 @@ CPUBugs="$(egrep "^bugs" /proc/cpuinfo | cut -d: -f2 | cut -c2- | uniq)"
Kernel
=
"
$(
uname
-r
2>/dev/null
)
"
# Ex: Kernel=5.4.0-62-generic
Architecture
=
"
$(
uname
-m
2>/dev/null
)
"
# Ex: Architecture=x86_64
Uptime
=
"
$(
awk
'{print int($1/86400)}'
/proc/uptime
)
"
# unattended-upgrades
case
$(
systemctl status unattended-upgrades &>/dev/null
;
echo
$?
)
in
0
)
UnattendedUpgrades
=
"Active"
;;
1
)
UnattendedUpgrades
=
"Generic failure or unspecified error"
;;
2
)
UnattendedUpgrades
=
"Invalid or excess arguments"
;;
3
)
UnattendedUpgrades
=
"Unimplemented"
;;
4
)
UnattendedUpgrades
=
"Not installed"
;;
5
)
UnattendedUpgrades
=
"Not installed"
;;
6
)
UnattendedUpgrades
=
"Not configured"
;;
7
)
UnattendedUpgrades
=
"Not running"
;;
esac
# Is reboot required?
UbuntuReboot
()
{
if
[
-f
/var/run/reboot-required
]
;
then
...
...
@@ -178,7 +190,7 @@ FWrules="$(ufw status verbose 2>/dev/null | egrep "(ALLOW|DENY) IN" | awk '{prin
# Create a string for the CPU Bugs (to make the final assemble shorter)
CPUBugsStr
=
"
$(
if
[
-n
"
$CPUBugs
"
]
;
then
echo
",
\"
cpu-bugs:
${
CPUBugs
// /\
",
\"
cpu-bugs:}
\"
"
; fi)
"
# Assemble the Flags string
Flags="
\
"selinux:
$SELinux
\"
,
\"
kernel:
${
Kernel
}
\"
$CPUBugsStr
,
\"
arch:
${
Architecture
:-
--
}
\"
,
\"
fail2ban:
$Fail2Ban
\"
,
\"
Uptime-days:
$Uptime
\"
,
\"
Reboot-required:
$RebootRequired
\"
"
Flags="
\
"selinux:
$SELinux
\"
,
\"
kernel:
${
Kernel
}
\"
$CPUBugsStr
,
\"
arch:
${
Architecture
:-
--
}
\"
,
\"
fail2ban:
$Fail2Ban
\"
,
\"
Uptime-days:
$Uptime
\"
,
\"
Reboot-required:
$RebootRequired
\"
,
\"
unattended-upgrades:
$UnattendedUpgrades
\"
"
# partitions
OUTPUT=
""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment