Commit a40a2798 authored by Peter Möller's avatar Peter Möller

Merge branch 'master' of https://git.cs.lth.se/marcus/host-monitor

I forgot
parents e812c8d7 89870efb
......@@ -69,6 +69,30 @@ 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)"
# Is reboot required?
UbuntuReboot() {
if [ -f /var/run/reboot-required ]; then
RebootRequired="Yes"
else
RebootRequired="No"
fi
}
RedHatReboot() {
if [ -x /bin/needs-restarting ]; then
if [ -n "$(needs-restarting -r 2>/dev/null | egrep -i "reboot" | egrep "not necessary")" ]; then
RebootRequired="No"
else
RebootRequired="Yes"
fi
fi
}
case "$(echo "${OS,,}" | cut -c-6)" in
"centos") RedHatReboot;;
"red ha") RedHatReboot;;
"ubuntu") UbuntuReboot;;
esac
# Are we in a Virtual environment? This one is a bit tricky since there are many ways to cover this.
# Read this for more info: http://unix.stackexchange.com/questions/89714/easy-way-to-determine-virtualization-technology
VMenv="$(dmesg 2>/dev/null | grep -i " Hypervisor detected: " 2>/dev/null | cut -d: -f2 | sed 's/^ *//')"
......@@ -154,7 +178,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\""
Flags="\"selinux:$SELinux\", \"kernel:${Kernel}\"$CPUBugsStr, \"arch:${Architecture:---}\", \"fail2ban:$Fail2Ban\", \"Uptime-days:$Uptime\", \"Reboot-required:$RebootRequired\""
# partitions
OUTPUT=""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment