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 Monitor

The ping monitor uses the system ping command to check network connectivity to a host. It measures round-trip time and packet loss, making it useful for monitoring network latency and availability.

Configuration

The ping monitor evaluates conditions using the expressions language.

By default, the ping monitor will show:

  • Green if there's no packet loss and the round-trip time is within the warning timeout
  • Orange if there's no packet loss but the round-trip time exceeds the warning timeout, or if there was partial packet loss
  • Yellow if the ping command timed out
  • Red if there was complete packet loss
ping:
  # The host to ping (IP address or hostname)
  host: 8.8.8.8
  
  # How often to perform the ping test
  interval: 60s
  
  # How long to wait for ping responses before timing out
  timeout: 5s
  
  # (optional) Warning threshold for round-trip time (default: 1s)
  warning_timeout: 1s
  
  # (optional) Number of ping packets to send (default: 1)
  count: 1

  # (optional) Condition that determines when the monitor should be red/error (default: "lost == count")
  red: |
    lost == count
  
  # (optional) Condition that determines when the monitor should be orange/warning (default: "lost > 0 or (lost == 0 and rtt_max > warning_timeout)")
  orange: |
    lost > 0 or (lost == 0 and rtt_max > warning_timeout)
  
  # (optional) Condition that determines when the monitor should be green (default: "lost == 0")
  green: |
    lost == 0
  
  # (optional) Condition that determines when the monitor should be blue/highlight (default: "false")
  blue: |
    false
  
  # (optional) Condition that determines when the monitor should be yellow/timeout (default: "false")
  yellow: |
    false

Parameters

Required Parameters

ParameterDescription
hostThe IP address or hostname to ping
intervalHow often to perform ping tests
timeoutHow long to wait for ping responses

Optional Parameters

ParameterDescriptionDefault
warning_timeoutRound-trip time threshold for orange status1s
countNumber of ping packets to send1
redCondition for red status"lost == count"
orangeCondition for orange status"lost > 0 or (lost == 0 and rtt_max > warning_timeout)"
greenCondition for green status"lost == 0"
blueCondition for blue status"false"
yellowCondition for yellow status"false"

Expression variables

VariableDescription
countNumber of ping packets sent
lostNumber of packets lost
rtt_avgAverage round-trip time in microseconds
rtt_minMinimum round-trip time in microseconds
rtt_maxMaximum round-trip time in microseconds
warning_timeoutThe configured warning timeout value in microseconds

Example

Ping Google's DNS server using the default settings:

ping:
  host: 8.8.8.8

Ping Google's DNS server with custom settings:

ping:
  host: 8.8.8.8
  interval: 30s
  timeout: 10s
  warning_timeout: 500ms
  count: 3
  red: |
    lost > 0
  orange: |
    lost == 0 and rtt_min > warning_timeout

This monitor will:

  • Ping Google's DNS server (8.8.8.8) every 30 seconds with three packets
  • Wait up to 10 seconds for responses
  • Show orange/warning status if the shortest round-trip time exceeds 500ms (ie: all pings were slow)
  • Show red/error status if any packets are lost

Requirements

The ping monitor requires the ping command to be available on the system. This is typically installed by default on most Unix-like systems.