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
99c1d93f
Commit
99c1d93f
authored
Jul 08, 2021
by
root
Browse files
Presents network speed in Gb/s instead of Mb/s
parent
1c3a6817
Changes
1
Hide whitespace changes
Inline
Side-by-side
linux/host-monitor.sh
View file @
99c1d93f
...
...
@@ -229,7 +229,7 @@ do
MAC=
"
$(
ip
link
show dev
${
iname
%%@if[0-9]*
}
|awk
'/link/{print $2}'
)
"
MAC_P=
$(
ethtool
-P
${
iname
%%@if[0-9]*
}
|
awk
'{print $NF}'
)
Speed=
"
$(
ethtool
${
iname
%%@if[0-9]*
}
|
grep
"Speed:"
|
awk
'{print $NF}'
)
"
OUTPUT+=
"{
\"
interface
\"
:
\"
$iname
\"
,
\"
ip4
\"
:
\"
${
IP4
}
\"
,
\"
ip6
\"
:
\"
${
IP6
}
\"
,
\"
mac
\"
:
\"
${
MAC
}
\"
,
\"
mac-p
\"
:
\"
${
MAC_P
}
\"
,
\"
speed
\"
:
\"
${
Speed
}
\"
},"
OUTPUT+=
"{
\"
interface
\"
:
\"
$iname
\"
,
\"
ip4
\"
:
\"
${
IP4
}
\"
,
\"
ip6
\"
:
\"
${
IP6
}
\"
,
\"
mac
\"
:
\"
${
MAC
}
\"
,
\"
mac-p
\"
:
\"
${
MAC_P
}
\"
,
\"
speed
\"
:
\"
${
Speed
/000Mb/ Gb
}
\"
},"
done
NIStr=
"
\"
network-interfaces
\"
: [
$(
echo
"
${
OUTPUT
}
"
|
sed
's/,$//'
)
]"
# Ex
:
NIStr=
'"network-interfaces": [ { "interface": "ens192", "ip4": "130.235.16.11/23", "ip6": "fe80::250:56ff:feb6:b194/64", "mac": "00:50:56:b6:b1:94", "mac-p": "00:50:56:b6:b1:94", "speed": "10000Mb/s" } ]'
...
...
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