atef.tools.Ping

class atef.tools.Ping(hosts: ~typing.List[str] = <factory>, count: int = 3, encoding: str = 'utf-8')[source]

Tool for pinging one or more hosts and summarizing the results.

Methods

check_result_key(key)

Check that the result key is valid for the given tool.

ping(host)

Ping the given host.

run()

Run the "Ping" tool with the current settings.

Methods

__init__(hosts: ~typing.List[str] = <factory>, count: int = 3, encoding: str = 'utf-8') None
check_result_key(key: str) None

Check that the result key is valid for the given tool.

For example, PingResult keys can include "min_time", "max_time", and so on.

Parameters:
keystr

The key to check.

Raises:
ValueError

If the key is invalid.

async ping(host: str) PingResult[source]

Ping the given host.

Parameters:
hoststr

The host to ping.

Returns:
PingResult
async run() PingResult[source]

Run the “Ping” tool with the current settings.

Returns:
PingResult

Attributes

count: int = 3

The number of ping attempts to make per host.

encoding: str = 'utf-8'

The assumed output encoding of the ‘ping’ command.

hosts: List[str]

The hosts to ping.