ping
Platypush documentation
ping
- class platypush.backend.ping.PingBackend(hosts: List[str], timeout: float = 5.0, interval: float = 60.0, count: int = 1, *args, **kwargs)[source]
Bases:
Backend
This backend allows you to ping multiple remote hosts at regular intervals.
Triggers:
platypush.message.event.ping.HostDownEvent
if a host stops responding ping requestsplatypush.message.event.ping.HostUpEvent
if a host starts responding ping requests
- class Pinger(*args, **kwargs)[source]
Bases:
Worker
- __init__(*args, **kwargs)[source]
- Parameters:
request_queue – The worker will listen for messages to process over this queue
response_queue – The worker will return responses over this queue
- process(host: str) Tuple[str, bool] [source]
This method must be implemented by the derived classes. It will take as argument a message received over the request_queue and will return a value that will be processed by the consumer or None.
If this function raises an exception then the exception will be pushed to the response queue and can be handled by the consumer.
- __init__(hosts: List[str], timeout: float = 5.0, interval: float = 60.0, count: int = 1, *args, **kwargs)[source]
- Parameters:
hosts – List of IP addresses or host names to monitor.
timeout – Ping timeout.
interval – Interval between two scans.
count – Number of pings per host. A host will be considered down if all the ping requests fail.