- class platypush.backend.ping.PingBackend(hosts: List[str], timeout: float = 5.0, interval: float = 60.0, count: int = 1, *args, **kwargs)
This backend allows you to ping multiple remote hosts at regular intervals.
- class Pinger(*args, **kwargs)
- __init__(*args, **kwargs)
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]
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)
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.
Starts the backend thread. To be implemented in the derived classes if the loop method isn’t defined.