Source code for platypush.message.event.ping
from platypush.message.event import Event
[docs]
class PingEvent(Event):
"""Ping event, used for testing purposes"""
[docs]
def __init__(self, *args, message=None, **kwargs):
"""
:param message: Ping message
:type message: object
"""
super().__init__(*args, message=message, **kwargs)
[docs]
class HostDownEvent(Event):
"""
Event triggered when a remote host stops responding ping requests.
"""
[docs]
def __init__(self, host: str, *args, **kwargs):
super().__init__(host=host, *args, **kwargs)
[docs]
class HostUpEvent(Event):
"""
Event triggered when a remote host starts responding ping requests.
"""
[docs]
def __init__(self, host: str, *args, **kwargs):
super().__init__(host=host, *args, **kwargs)
[docs]
class PingResponseEvent(Event):
"""
Event triggered when a ping response is received.
"""
[docs]
def __init__(
self,
host: str,
min: float,
max: float,
avg: float,
mdev: float,
*args,
**kwargs
):
"""
:param host: Remote host IP or name.
:param min: Minimum round-trip time (in ms).
:param max: Maximum round-trip time (in ms).
:param avg: Average round-trip time (in ms).
:param mdev: Standard deviation of the round-trip time (in ms).
"""
super().__init__(
host=host, min=min, max=max, avg=avg, mdev=mdev, *args, **kwargs
)
# vim:sw=4:ts=4:et: