⚠️ Warning
This is an experimental extension for k6. It is not officially supported yet.
We are actively working on it to make it officially supported in the future.
xk6-icmp is a k6 extension that adds support for sending ICMP echo requests (ping) to measure network latency and availability.
This allows you to measure network latency and reachability of
hosts directly within your load testing and synthetic monitoring scenarios.
The main use case for this extension is integration with Grafana's Synthetic Monitoring product
to make a quick reachability check after a scripted check fails.
It can also be used directly in k6 scripts, for example as a pre-check to verify network connectivity
before running your main test.
Example: Basic Usage
Here is a basic example showing how to use the ping function:
import { ping } from"k6/x/icmp"
exportdefaultfunction () { consthost = "8.8.8.8"
console.log(`Pinging ${host}:`);
if (ping(host)) { console.log(`Host ${host} is reachable`); } else { console.error(`Host ${host} is unreachable`); } }
Example: Advanced Usage
A more advanced example below demonstrates how to use the PingCallback to access detailed
ping results for each request.
ICMP protocol support for k6
xk6-icmp is a k6 extension that adds support for sending ICMP echo requests (ping) to measure network latency and availability. This allows you to measure network latency and reachability of hosts directly within your load testing and synthetic monitoring scenarios.
The main use case for this extension is integration with Grafana's Synthetic Monitoring product to make a quick reachability check after a scripted check fails. It can also be used directly in k6 scripts, for example as a pre-check to verify network connectivity before running your main test.
Example: Basic Usage
Here is a basic example showing how to use the ping function:
Example: Advanced Usage
A more advanced example below demonstrates how to use the PingCallback to access detailed ping results for each request.