Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Ping Monitoring

The simplest monitor is a ping script. One ping is usually enough for most cases. You can pass a timeout to ping, but Stylus will automatically kill processes if they run too long.

Built-in Ping Monitor

Stylus has a built-in ping monitor that can be used to monitor network connectivity.

ping:
  host: 8.8.8.8
  interval: 30s
  timeout: 10s
  count: 1

Custom Ping Script

You can also write a custom ping script to test the connectivity to a host.

test:
  id: my-ping-host
  interval: 30s
  timeout: 10s
  command: ping.sh

With a corresponding ping.sh script:

#!/bin/bash
# Pings the host with the same name as the monitor's ID
ping -c 1 ${STYLUS_MONITOR_ID}

Pinging a custom host:

#!/bin/bash
ping -c 1 8.8.8.8

Pinging with a custom per-packet timeout:

#!/bin/bash
# -W is in seconds on Linux
ping -c 1 -W 5 ${STYLUS_MONITOR_ID}

Alternatives

For more complex monitoring scenarios, consider using SSH, SNMP, or HTML/API scraping.