CmkRedisTools
Installation
To install the CmkRedisTools package, you can use pip:
pip install cmk-tools
or
poetry add cmk-tools
Testing
To run tests for CmkRedisTools, use the following command:
pytest
Example
All connector must provide unique stage_id for testing purrpose
Using redis semaphore
Here is a simple example of how to use CmkRedisTools:
from cmk_tools import RedisSemaphore, run_with_semaphore
semaphore = RedisSemaphore(
'redis://localhost:6379/0',
name="my_semaphore",
limit=3, # limit concurrent running task
timeout=10 # accquire timeout
)
run_with_semaphore(
your_func,
func_args,
func_kwargs,
execute_when_timeout=True # execute function if accquired timeout
)
For more detailed documentation, email me.
Using make_request_v2
Here is an example of how to use the make_request_v2 function:
from cmk_tools import make_request_v2
response = make_request_v2(
url='https://api.example.com/data',
method='GET',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
params={'key': 'value'},
data={'key': 'value'},
stage_id='unique-id',
)
print(response.json())
Using es_client
Here is an example of how to use the es_client function:
from cmk_tools import new_elk_client, elk_search
es_client = new_elk_client('host', 'port', 'username', 'password')
body = {"query": {}, "sort": []}
search_res = elk_search(
es_client,
'index', body,
with_scroll=False,
stage_id='unique-id'
)
# search_res should be an arrays of inner hits
print(search_res)
Here is an example of how to use the es_client search with scroll for get many data:
from cmk_tools import new_elk_client, elk_search
es_client = new_elk_client('host', 'port', 'username', 'password')
body = {"query": {}, "sort": []}
search_res = elk_search(
es_client,
'index', body,
with_scroll=True,
stage_id='unique-id'
)
# search_res should be an arrays of inner hits
print(search_res)
Using snmp_get
Here is an example of how to use the snmp_get function:
from cmk_tools.snmp_client import snmp_get
data = netsnmp.VarList(
'....',
)
result = snmp_get(
host='192.168.1.1',
community='public',
data=data,
stage_id='unique-id'
)
print(result)
Metadata
Release files for cmk-tools 2.1.2
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 |
|---|---|---|---|---|
| cmk_tools-2.1.2.tar.gz | 11.6 kB | Without provenance | Details for cmk_tools-2.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cmk_tools-2.1.2-py3-none-any.whl | Python 3 | none | any | Details for cmk_tools-2.1.2-py3-none-any.whl |
Total release size: 27.4 kB
Release files / cmk_tools-2.1.2.tar.gz
| Download URL | cmk_tools-2.1.2.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96f74659c7bf149b3fd7ac8dc8ed1b7b4cef48007e9133bafb20e514a8ac7f9a
|
|
BLAKE2b-256 checksum How to use checksums |
47a4cde6489d735fb2fea14f788e91f8e040ec87a5c786dc88591497ae8da2e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.5 Linux/6.11.0-1015-azure
|
Release files / cmk_tools-2.1.2-py3-none-any.whl
| Download URL | cmk_tools-2.1.2-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc43d0dd920be50705f05c66e50473d27b61022916af8adb012d0074adcd82c1
|
|
BLAKE2b-256 checksum How to use checksums |
22596ef1c86b73fae37dfe43b11fd8d1b46f009fd3a021d1aff8b7e951879bac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.5 Linux/6.11.0-1015-azure
|
Security for cmk-tools 2.1.2
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.