monitoring-plugins/monitoring-plugins — pull request #1284 by ziesemer (2014-08-01 21:05:38+00:00)
Title: Add support for showing name (DNS) resolution in the `check_ping` plugin output (STDOUT).

Add support for showing name (DNS) resolution in the `check_ping` plugin output (STDOUT).

As written (alternate suggestions welcome), after being enabled with `-s` or `--show-resolution`, the output of a sample command (including the shorthand `-s` combined with the standard `-H`):

check_ping -sH someHost -w 3000.0,80% -c 5000.0,100% -p 5

... will be presented as:

PING OK - Packet loss = 0%, RTA = 0.63 ms - someHost.myDomain.com (10.1.2.3)

.. instead of the typical:

PING OK - Packet loss = 0%, RTA = 0.63 ms

In my monitoring configurations, DNS names are used whenever possible - to ensure that any failures in DNS resolution (either of the DNS service as a whole, or just for a given entry) are also reflected in the status of a host check. The reduces the cost of recurring maintenance, as the monitoring configurations don't also need to be updated every time there is something as simple as an IP change. Having a local DNS cache on the server (e.g. `dnsmasq`) makes any added performance expense trivial.

The default `ping` output already includes the following as the first line (as of version `iputils-sss20071127`):

PING someHost (10.1.2.3) 56(84) bytes of data.

This is potentially useful information, and this change simply makes the resolved hostname (potentially different than an input hostname) and resolved IP address available for display on the plugin output.