patrolify
Do some checks every day, so that you can read the "news" in the morning while drinking coffee.
Install
How to write a check?
Define the "target" you want to check
from patrolify import Target
class IPTarget(Target):
def __init__(self, ip):
self.ip = ip
Define how to check that "target"
from patrolify import check
@check(IPTarget)
def check_ip(target):
return True, "it's ok"
A check function can:
- generates more targets: as long as the target can be checked by another checker;
- or return True/False to indicate the check was passed or not, plus a string indicate the extra information
Test Your Checker
In local environment, you can test your checker from __main__. But you need
to fire local_test_setup() first.
For example, you can write this in your checker.py:
if __name__ == '__main__':
from patrolify.utils import local_test_setup
local_test_setup()
print(check_ip(IPTarget("127.0.0.1")))
How to deploy?
Reporter was written in pure Python, requirements:
- Python 3.11+
- Redis 5.0+
Installation(The name patrolify was taken on Pypi):
pip install patrolify
Then you need to run 4 components after installation:
| Component Name | What for? | Dependencies | Command example | Can deploy instances? |
|---|---|---|---|---|
| admin | A portal so that you can see the results | filesystem, Redis | patrolify --redis-url redis://127.0.0.1:6379 admin --port 8084 |
Yes, as long as the result directory exist. |
| scheduler | Trigger the checker jobs | Redis | rqscheduler --host localhost --port 6379 --db 0 (it's redis' host and port) |
Yes, supports auto fail over |
| worker(for checker) | Get jobs from queue(Redis) and run it | Redis | patrolify --redis-url redis://127.0.0.1:6379 worker --queue=checker |
Yes, every worker will get jobs from queue and run it, more workers, more work load |
| worker(for patrolify) | Get jobs from queue(Redis) and run it, only works for collecting the results | Redis | patrolify --redis-url redis://127.0.0.1:6379 worker --queue=patrolify |
Yes, same above. But it must be deployed onto the same server with admin |
- scheduler
- worker (2 types, for running checker jobs and patrolify jobs)
- admin
Architecture:
Metadata
Release files for patrolify 0.1.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| patrolify-0.1.13.tar.gz | 1.2 MB | Without provenance | Details for patrolify-0.1.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| patrolify-0.1.13-py3-none-any.whl | Python 3 | none | any | Details for patrolify-0.1.13-py3-none-any.whl |
Total release size: 2.4 MB
Release files / patrolify-0.1.13.tar.gz
| Download URL | patrolify-0.1.13.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b4a7aa769efff2d54cea69deadc8f36a13725694556f25bb80790a492394edf
|
|
BLAKE2b-256 checksum How to use checksums |
0741227f38c1c09d87db63a20525e9461bfe036960e3f6f6ad1c7db14d309fdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1019-azure
|
Release files / patrolify-0.1.13-py3-none-any.whl
| Download URL | patrolify-0.1.13-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e51ed4abad2e3180e4960a6d5ff382bd44b8ff0c9a4abe4ca6be790a977c04f
|
|
BLAKE2b-256 checksum How to use checksums |
3c7a626fe5734673b55d6465af89566cd2c19a11da3f70fc9037fd3339836697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1019-azure
|
Security for patrolify 0.1.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.