Skip to main content

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​

Nameconnectivity
DescriptionWhether the host reaches an address, by ICMP ping
Placementnode
Areanetworking
Internalno
APIyes
CLIyes
Nextno
Platformslinux, darwin
Sudonone
Runsping
Writesnone
Keeps stateno
Usesnone
Used bynone

Methods (1)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
pingwritePOST/api/node/{hostname}/connectivity/pingconnectivity:writePing an address from the host

Types (1)​

NAMEINPUTOUTPUT
pingPingInput { address* }PingResult { packets_sent, packets_received, packet_loss, min_rtt, avg_rtt, max_rtt, changed }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.connectivity.<method>
Child spansexec ping, exec ping6
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputsaddress (ping)

Method ping​

Nameping
Verbwrite
DescriptionPing an address from the host
DetailSends 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.
HTTPPOST
Route/api/node/{hostname}/connectivity/ping
Permissionconnectivity:execute
Commandosapi client node connectivity ping
Input typePingInput
Output typePingResult

Input (1)​

FIELDTYPEREQUIREDDESCRIPTION
addressstringyesThe IPv4 or IPv6 address to ping, or an @fact. reference that the agent resolves

Output (7)​

FIELDTYPEDESCRIPTION
packets_sentintegerNumber of packets sent
packets_receivedintegerNumber of packets received
packet_lossnumberPercentage of packet loss
min_rttstringMinimum round-trip time in milliseconds, with two decimals. Absent when no reply came back.
avg_rttstringAverage round-trip time in milliseconds, with two decimals. Absent when no reply came back.
max_rttstringMaximum round-trip time in milliseconds, with two decimals. Absent when no reply came back.
changedbooleanAlways false: a ping changes nothing on the host

Examples (3)​

EXAMPLEINPUTOUTPUT
A host that answersaddress=127.0.0.1packets_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 macOSaddress=127.0.0.1packets_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 answeraddress=192.0.2.1packets_sent=3, packets_received=0, packet_loss=100, changed=false