Skip to content

Commit c1e1c52

Browse files
committed
JSON documentation: reformat
1 parent 32fdb26 commit c1e1c52

File tree

2 files changed

+48
-40
lines changed

2 files changed

+48
-40
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ Next
33

44
## New features
55

6-
- New option -J / --json for the JSON output (#386, thanks @bonkf,
7-
@JoshIPT, @sebast-gsnw and @auerswal)
6+
- New option -J / --json for JSON output. See doc/fping-json.md for
7+
the JSON schema. This feature is still in alpha and the schema
8+
might change in future releases (#386, thanks @bonkf,
9+
@JoshIPT, @sebast-gsnw, and @auerswal).
810
- The -g, --generate option now also supports IPv6 addresses (#376,
911
thanks @auerswal)
1012
- New option --seqmap-timeout to control the time after which sequence

doc/fping-json.md

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# fping JSON Output Format
2+
23
last updated for: fping 5.5
34

4-
> [!IMPORTANT]
5-
> The JSON output feature is currently in **alpha**. The format is subject to change in future versions.
5+
> [!IMPORTANT] The JSON output feature is currently in **alpha**. The format is
6+
> subject to change in future versions.
67
7-
When using the `--json` (or `-J`) option, fping outputs results as a **stream of JSON objects**, separated by newlines. Each line in the output is a valid, independent JSON document representing a specific event or statistic.
8+
When using the `--json` (or `-J`) option, fping outputs results as a **stream of
9+
JSON objects**, separated by newlines. Each line in the output is a valid,
10+
independent JSON document representing a specific event or statistic.
811

912
## General Format
1013

@@ -14,11 +17,14 @@ Every JSON object output by fping follows the following pattern:
1417
{ "type": { "field1": "value1", "field2": "value2" } }
1518
```
1619

17-
Where `type` identifies the type of the object (e.g., `resp`, `summary`) and the inner object contains the fields relevant to that type.
20+
Where `type` identifies the type of the object (e.g., `resp`, `summary`) and the
21+
inner object contains the fields relevant to that type.
1822

1923
## Forward Compatibility
2024

21-
Any unknown object types and any unknown fields should be ignored for forward-compatibility (we might add new objects and fields to objects over time).
25+
Any unknown object types and any unknown fields should be ignored for
26+
forward-compatibility (we might add new objects and fields to objects over
27+
time).
2228

2329
## Example
2430

@@ -34,17 +40,19 @@ $ fping -J -c3 8.8.8.8
3440

3541
## JSON Object Types
3642

37-
> [!NOTE]
38-
> In the actual output, each JSON object is compacted onto a single line. The examples in this document are formatted across multiple lines for readability.
43+
> [!NOTE] In the actual output, each JSON object is compacted onto a single
44+
> line. The examples in this document are formatted across multiple lines for
45+
> readability.
3946
40-
The following top-level keys identify the type of information contained in each JSON object:
47+
The following top-level keys identify the type of information contained in each
48+
JSON object:
4149

42-
* `resp`: Response to a ping packet.
43-
* `timeout`: Timeout waiting for a packet response.
44-
* `summary`: Summary statistics for a host (used with `-c`).
45-
* `vSum`: Summary of all RTT values for a host (used with `-C`).
46-
* `globalSum`: Global statistics for the entire run (used with `-s`).
47-
* `intSum`: Interval summary statistics (used with `-Q`).
50+
- `resp`: Response to a ping packet.
51+
- `timeout`: Timeout waiting for a packet response.
52+
- `summary`: Summary statistics for a host (used with `-c`).
53+
- `vSum`: Summary of all RTT values for a host (used with `-C`).
54+
- `globalSum`: Global statistics for the entire run (used with `-s`).
55+
- `intSum`: Interval summary statistics (used with `-Q`).
4856

4957
### `resp`: Response
5058

@@ -61,16 +69,17 @@ Generated when a ping reply is received.
6169
}
6270
```
6371

64-
* `host`: Target hostname or IP.
65-
* `seq`: Sequence number of the packet (0-indexed).
66-
* `size`: Size of the received packet in bytes.
67-
* `rtt`: Round-trip time in milliseconds.
72+
- `host`: Target hostname or IP.
73+
- `seq`: Sequence number of the packet (0-indexed).
74+
- `size`: Size of the received packet in bytes.
75+
- `rtt`: Round-trip time in milliseconds.
6876

6977
**Optional Fields:**
7078

71-
* `timestamps`: If ICMP timestamp requests are used (`--icmp-timestamp`), contains `originate`, `receive`, `transmit`, and `localreceive` timestamps.
72-
* `tos`: If `--print-tos` is used, contains the Type of Service value.
73-
* `ttl`: If `--print-ttl` is used, contains the Time To Live value.
79+
- `timestamps`: If ICMP timestamp requests are used (`--icmp-timestamp`),
80+
contains `originate`, `receive`, `transmit`, and `localreceive` timestamps.
81+
- `tos`: If `--print-tos` is used, contains the Type of Service value.
82+
- `ttl`: If `--print-ttl` is used, contains the Time To Live value.
7483

7584
### `timeout`: Timeout
7685

@@ -85,8 +94,8 @@ Generated when a packet times out.
8594
}
8695
```
8796

88-
* `host`: Target hostname or IP.
89-
* `seq`: Sequence number of the timed-out packet.
97+
- `host`: Target hostname or IP.
98+
- `seq`: Sequence number of the timed-out packet.
9099

91100
### `summary`: Host Summary
92101

@@ -107,31 +116,28 @@ Generated at end of execution (or interval) when using `-c` (count mode).
107116
}
108117
```
109118

110-
* `xmt`: Packets transmitted.
111-
* `rcv`: Packets received.
112-
* `loss`: Packet loss percentage.
113-
* `outage(ms)`: Total outage time in milliseconds (only if `--outage` is used).
114-
* `rttMin`, `rttAvg`, `rttMax`: Minimum, average, and maximum RTTs.
119+
- `xmt`: Packets transmitted.
120+
- `rcv`: Packets received.
121+
- `loss`: Packet loss percentage.
122+
- `outage(ms)`: Total outage time in milliseconds (only if `--outage` is used).
123+
- `rttMin`, `rttAvg`, `rttMax`: Minimum, average, and maximum RTTs.
115124

116125
### `vSum`: Full RTT Summary
117126

118-
Generated at end of execution when using `-C` (count mode with per-packet RTT reporting).
127+
Generated at end of execution when using `-C` (count mode with per-packet RTT
128+
reporting).
119129

120130
```json
121131
{
122132
"vSum": {
123133
"host": "127.0.0.1",
124-
"values": [
125-
0.054,
126-
0.062,
127-
null,
128-
0.081
129-
]
134+
"values": [0.054, 0.062, null, 0.081]
130135
}
131136
}
132137
```
133138

134-
* `values`: Array of RTT values (in ms) for each sequence number. `null` indicates a timeout/loss.
139+
- `values`: Array of RTT values (in ms) for each sequence number. `null`
140+
indicates a timeout/loss.
135141

136142
### `intSum`: Interval Summary
137143

@@ -152,8 +158,8 @@ Generated periodically when using `-Q` (quiet with interval reporting).
152158
}
153159
```
154160

155-
* `time`: Unix timestamp of the report.
156-
* Other fields are similar to `summary`.
161+
- `time`: Unix timestamp of the report.
162+
- Other fields are similar to `summary`.
157163

158164
### `globalSum`: Global Summary
159165

0 commit comments

Comments
 (0)