Connectivity
Whether the host reaches an address, by ICMP ping.
osapi dsl behavior get --name connectivity and osapi dsl behavior method get
show the same.
Behavior
| Name | connectivity |
| Description | Whether the host reaches an address, by ICMP ping |
| Placement | node |
| Area | networking |
| Internal | no |
| API | yes |
| CLI | yes |
| Next | no |
| Platforms | linux, darwin |
| Sudo | none |
| Runs | ping |
| Writes | none |
| Keeps state | no |
| Uses | none |
| Used by | none |
Methods (1)
| NAME | VERB | HTTP | ROUTE | PERMISSION | DESCRIPTION |
|---|---|---|---|---|---|
| ping | write | POST | /api/node/{hostname}/connectivity/ping | connectivity:write | Ping an address from the host |
Types (1)
| NAME | INPUT | OUTPUT |
|---|---|---|
| ping | PingInput { address* } | PingResult { packets_sent, packets_received, packet_loss, min_rtt, avg_rtt, max_rtt, changed } |
Settings (0)
None. Declare them with behavior.Config.
Telemetry
| Span | behavior.connectivity.<method> |
| Child spans | exec ping, exec ping6 |
| Metrics | osapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total |
| Attributes | osapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed |
| Recorded inputs | address (ping) |
Method ping
| Name | ping |
| Verb | write |
| Description | Ping an address from the host |
| Detail | Sends three ICMP echo requests from the host and reports how many came back, and their round-trip times. A host that does not answer is 100% loss, not an error. It changes nothing, so it reports changed: false. On Linux the agent pings without root when net.ipv4.ping_group_range admits its group. |
| HTTP | POST |
| Route | /api/node/{hostname}/connectivity/ping |
| Permission | connectivity:execute |
| Command | osapi client node connectivity ping |
| Input type | PingInput |
| Output type | PingResult |
Input (1)
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| address | string | yes | The IPv4 or IPv6 address to ping, or an @fact. reference that the agent resolves |
Output (7)
| FIELD | TYPE | DESCRIPTION |
|---|---|---|
| packets_sent | integer | Number of packets sent |
| packets_received | integer | Number of packets received |
| packet_loss | number | Percentage of packet loss |
| min_rtt | string | Minimum round-trip time in milliseconds, with two decimals. Absent when no reply came back. |
| avg_rtt | string | Average round-trip time in milliseconds, with two decimals. Absent when no reply came back. |
| max_rtt | string | Maximum round-trip time in milliseconds, with two decimals. Absent when no reply came back. |
| changed | boolean | Always false: a ping changes nothing on the host |
Examples (3)
| EXAMPLE | INPUT | OUTPUT |
|---|---|---|
| A host that answers | address=127.0.0.1 | packets_sent=3, packets_received=3, packet_loss=0, min_rtt=0.04ms, avg_rtt=0.05ms, max_rtt=0.06ms, changed=false |
| A host that answers, on macOS | address=127.0.0.1 | packets_sent=3, packets_received=3, packet_loss=0, min_rtt=0.08ms, avg_rtt=0.14ms, max_rtt=0.17ms, changed=false |
| A host that does not answer | address=192.0.2.1 | packets_sent=3, packets_received=0, packet_loss=100, changed=false |