Skip to content
jc-rs
GitHub

iftop

--iftopv1.1.0

Converts `iftop` command output to JSON

Linuxcommand
$ iftop | jc-rs --iftop

A real pair

From the reference corpus (ubuntu-20.10/iftop-b-n1-noport.json). The left pane is the input the fixture ships; the right pane is the corpus's expected JSON. The coverage note below explains why this pair does not enter the measured comparison. Hover a value to see where it came from.

iftopubuntu-20.10
interface: enp0s3
IP address is: 10.10.15.129
MAC address is: 08:00:27:c0:4a:4f
Listening on enp0s3
   # Host name (port/service if enabled)            last 2s   last 10s   last 40s cumulative
--------------------------------------------------------------------------------------------
   1 ubuntu-2004-clean-01                     =>     4.82KB     4.82KB     4.82KB     9.63KB
     10.10.15.72                              <=     14.5KB     14.5KB     14.5KB     29.1KB
   2 ubuntu-2004-clean-02                     =>         0B         0B         0B         0B
     10.10.15.72                              <=     2.02KB     2.02KB     2.02KB     4.04KB
--------------------------------------------------------------------------------------------
Total send rate:                                     4.82KB     4.82KB     4.82KB
Total receive rate:                                  16.6KB     16.6KB     16.6KB
Total send and receive rate:                         21.4KB     21.4KB     21.4KB
--------------------------------------------------------------------------------------------
Peak rate (sent/received/total):                     4.82KB     16.6KB     21.4KB
Cumulative (sent/received/total):                    9.63KB     33.1KB     42.8KB
============================================================================================
expected outputjson
Use the Left and Right arrow keys to highlight the matching value in the input.
[
  {
    "device": "enp0s3",
    "ip_address": "10.10.15.129",
    "mac_address": "08:00:27:c0:4a:4f",
    "total_send_rate": {
      "last_2s": 4820,
      "last_10s": 4820,
      "last_40s": 4820
    },
    "total_receive_rate": {
      "last_2s": 16600,
      "last_10s": 16600,
      "last_40s": 16600
    },
    "total_send_and_receive_rate": {
      "last_2s": 21400,
      "last_10s": 21400,
      "last_40s": 21400
    },
    "peak_rate": {
      "last_2s": 4820,
      "last_10s": 16600,
      "last_40s": 21400
    },
    "cumulative_rate": {
      "last_2s": 9630,
      "last_10s": 33100,
      "last_40s": 42800
    },
    "clients": []
  }
]

Fixture coverage

noneThe reference corpus ships no oracle-valid fixture for this parser, so the differential cannot speak for it. That is reported, not hidden.

Magic syntax

jc-rs iftopjc-rs runs the command itself and parses what it prints. Recognised for: `iftop`

Source: crates/jc-rs-parsers/src/network/iftop.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare