- class platypush.backend.ping.PingBackend(hosts: List[str], timeout: float = 5.0, interval: float = 60.0, count: int = 1, *args, **kwargs)[source]
This backend allows you to ping multiple remote hosts at regular intervals.
platypush.message.event.ping.HostDownEventif a host stops responding ping requests
platypush.message.event.ping.HostUpEventif a host starts responding ping requests
- class Pinger(*args, **kwargs)[source]
- __init__(*args, **kwargs)[source]
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]
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.