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
1c3a6817
Commit
1c3a6817
authored
Jul 08, 2021
by
Peter Möller
Browse files
Added clarification on the firewall: is it active or not?
parent
da7c1035
Changes
1
Hide whitespace changes
Inline
Side-by-side
linux/host-monitor.sh
View file @
1c3a6817
...
...
@@ -48,7 +48,13 @@ Authentication="$(if [ -n "$(egrep -v "#|^$" /etc/pam.d/common-account | egrep p
AuthStr
=
"
\"
authentication
\"
:
\"
${
Authentication
}
\"
"
# Ex: AuthStr='"authentication": "Lucat"'
# Firewall. Ex: Firewall=ufw
Firewall
=
"
$(
systemctl list-units
--type
=
service
--state
=
active | egrep
-i
"^
\
*(iptables|firewalld|ufw)"
|
awk
'{print $1}'
|
cut
-d
\.
-f1
)
"
FirewWStr
=
"
\"
firewall
\"
:
\"
${
Firewall
}
\"
"
# Ex: FirewWStr='"firewall":"ufw"'
# Is it acive?
case
"
$Firewall
"
in
"ufw"
)
FirewallStatus
=
"
$(
/usr/sbin/ufw status 2>/dev/null |
awk
'/Status:/ {print $NF}'
)
"
;;
"firewalld"
)
FirewallStatus
=
"
$(
firewall-cmd
--state
)
"
;;
"*"
)
FirewallStatus
=
"unknown status"
;;
esac
FirewallStr
=
"
${
Firewall
}
(
$FirewallStatus
)"
# Ex: FirewallStr='ufw (inactive)'
# Disks
Filesystems
=
"
$(
df
-kB1
-T
-t
xfs
-t
ext4 | egrep
"
\/
"
|
awk
'{print $1" "$2" "$3" "$7}'
)
"
# Ex: a number of rows with
...
...
@@ -240,7 +246,7 @@ NetworkStr="\"network\": { \"hostname\": \"$(hostname -f)\"$AliasName }"
CPUstr=
"
\"
cpu
\"
: {
\"
name
\"
:
\"
${
CPUModel
:-
--
}
\"
,
\"
threads
\"
:
${
NbrCPUs
:-
--
}
}"
RAMStr=
"
\"
memory
\"
: {
\"
total-kb
\"
:
${
RAM
:-
--
}
,
\"
type
\"
:
\"
${
ECC
:-
--
}
\"
}"
SysinfoStr=
"
\"
sysinfo
\"
: {
\"
os
\"
:
\"
${
OS
:-
--
}
\"
,
\"
authentication
\"
:
\"
${
Authentication
}
\"
,
\"
firewall
\"
:
\"
${
Firewall
}
\"
,
\"
flags
\"
: [
${
Flags
}
],
$CPUstr
,
$RAMStr
,
$FilesystemStr
,
$NIStr
,
$PlatformStr
,
$NetworkStr
}"
SysinfoStr=
"
\"
sysinfo
\"
: {
\"
os
\"
:
\"
${
OS
:-
--
}
\"
,
\"
authentication
\"
:
\"
${
Authentication
}
\"
,
\"
firewall
\"
:
\"
${
Firewall
Str
}
\"
,
\"
flags
\"
: [
${
Flags
}
],
$CPUstr
,
$RAMStr
,
$FilesystemStr
,
$NIStr
,
$PlatformStr
,
$NetworkStr
}"
# Ex
:
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
...
...
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