Perimetr
A dead hand system that monitor changes in network device and act accordingly.
Installation
python3 -m pip install Perimetr
Usage
from Perimetr import Monitor
monitor = Monitor("IP", "192.168.0.1", 15, print, "Target is offline")
monitor.activate()
>> Target is offline
Documentation
def __init__(self, method, target, interval, callback, *args, retry=0,
offline=True, all=True, delay=None, **kwargs):
"""Init the monitor with appropriate parameters. Currently support
monitor device status with IP address and MAC address. Require the
target device to be within same network.
Parameters
----------
method : str
Takes "IP" or "MAC" as values. Used to specifies the ways to probe
target devices. Must match the type of `target` parameter. Currently
only check by IP address is supported.
target : str || [str]
The IP or MAC address of the target device(s). Must match the type
of `method` parameter. If multiple target passed in, then all of
them will be checked.
interval : int
The number of seconds until next check.
callback : callable
The callback function when device status change meets the required
criteria. Will be called with `args` and `kwargs`.
retry : int, optional
Number of times to retry with `interval` apart until the system
is considered triggered. Default is no retry.
offline : bool, optional
Triggers the callback function when device went offline or online.
Default to when device went offline.
all : bool, optional
Used when multiple targets are passed in. If true, then all targets
need to meet criteria before system triggered. Else, only one device
status is required. Default to True.
delay : int, optional
The number of seconds delay of execute callback after triggered.
Default is None.
*args : arguments
Used for callback function.
**kwargs : keyword arguments
Used for callback function.
Raises
------
ValueError
When method provided is incorrect, or target provided mismatch
with the method.
"""
Metadata
Release files for Perimetr 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Perimetr-0.0.3.tar.gz | 15.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Perimetr-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.5 kB
Release files / Perimetr-0.0.3.tar.gz
| Download URL | Perimetr-0.0.3.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2457a75e32a3e274f3d856210404daeb2c73baa45f6579c33a322e1ee76cbb65
|
|
BLAKE2b-256 checksum How to use checksums |
10bec669b86d95b9933f8b87a638e36821849e2c6b814789bbddbeccb7f98ca3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|
Release files / Perimetr-0.0.3-py3-none-any.whl
| Download URL | Perimetr-0.0.3-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b884bbf28af191b9ccbc6f8f29049ace472216f86f1030c6efa7f12ea4798c66
|
|
BLAKE2b-256 checksum How to use checksums |
85c7c295fafb389c5629831e2488f0dce3f641077049af6e927b8d931e26f1fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|