mirror of
https://codeberg.org/icewind/palantir.git
synced 2026-06-03 18:24:08 +02:00
fix network output
This commit is contained in:
parent
8e6dcac354
commit
5b8448143b
1 changed files with 7 additions and 2 deletions
|
|
@ -137,12 +137,16 @@ pub fn network_stats() -> Result<impl Iterator<Item = IoStats>> {
|
|||
Ok(stat
|
||||
.lines()
|
||||
.filter_map(Result::ok)
|
||||
.filter(|line: &String| line.starts_with("enp"))
|
||||
.filter(|line: &String| {
|
||||
let trimmed = line.trim_start();
|
||||
trimmed.starts_with("en") || trimmed.starts_with("eth")
|
||||
})
|
||||
.filter_map(|line: String| {
|
||||
let mut parts = line.split_ascii_whitespace();
|
||||
let mut parts = line.trim_start().split_ascii_whitespace();
|
||||
if let (
|
||||
Some(interface),
|
||||
Some(bytes_received),
|
||||
_packets,
|
||||
_err,
|
||||
_drop,
|
||||
_fifo,
|
||||
|
|
@ -160,6 +164,7 @@ pub fn network_stats() -> Result<impl Iterator<Item = IoStats>> {
|
|||
parts.next(),
|
||||
parts.next(),
|
||||
parts.next(),
|
||||
parts.next(),
|
||||
) {
|
||||
Some(IoStats {
|
||||
interface: interface.trim_end_matches(':').into(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue