watchpost 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- watchpost-0.1.0/PKG-INFO +166 -0
- watchpost-0.1.0/README.md +132 -0
- watchpost-0.1.0/pyproject.toml +130 -0
- watchpost-0.1.0/src/watchpost/__init__.py +71 -0
- watchpost-0.1.0/src/watchpost/app.py +1126 -0
- watchpost-0.1.0/src/watchpost/cache.py +641 -0
- watchpost-0.1.0/src/watchpost/check.py +793 -0
- watchpost-0.1.0/src/watchpost/cli/__init__.py +26 -0
- watchpost-0.1.0/src/watchpost/cli/_cli.py +236 -0
- watchpost-0.1.0/src/watchpost/cli/loader.py +82 -0
- watchpost-0.1.0/src/watchpost/datasource.py +181 -0
- watchpost-0.1.0/src/watchpost/discover_checks.py +149 -0
- watchpost-0.1.0/src/watchpost/environment.py +221 -0
- watchpost-0.1.0/src/watchpost/executor.py +367 -0
- watchpost-0.1.0/src/watchpost/globals.py +59 -0
- watchpost-0.1.0/src/watchpost/hostname.py +558 -0
- watchpost-0.1.0/src/watchpost/http.py +61 -0
- watchpost-0.1.0/src/watchpost/py.typed +0 -0
- watchpost-0.1.0/src/watchpost/result.py +778 -0
- watchpost-0.1.0/src/watchpost/scheduling_strategy.py +397 -0
- watchpost-0.1.0/src/watchpost/utils.py +121 -0
- watchpost-0.1.0/src/watchpost/vendored/__init__.py +15 -0
- watchpost-0.1.0/src/watchpost/vendored/local_proxy.py +431 -0
watchpost-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: watchpost
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Code driven monitoring checks for Checkmk
|
|
5
|
+
Keywords: monitoring,checkmk,observability,infrastructure,devops
|
|
6
|
+
Author: Pit Kleyersburg
|
|
7
|
+
Author-email: Pit Kleyersburg <pitkley@googlemail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Framework :: AsyncIO
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: System Administrators
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: System :: Monitoring
|
|
18
|
+
Classifier: Topic :: System :: Systems Administration
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Dist: starlette>=0.47.3,<0.48.0
|
|
21
|
+
Requires-Dist: timelength>=3.0.2,<3.1.0
|
|
22
|
+
Requires-Dist: click>=8.2.1,<9.0.0 ; extra == 'cli'
|
|
23
|
+
Requires-Dist: rich>=14.1.0,<15.0.0 ; extra == 'cli'
|
|
24
|
+
Requires-Dist: redis>=6.4.0,<7.0.0 ; extra == 'redis'
|
|
25
|
+
Requires-Python: >=3.13
|
|
26
|
+
Project-URL: Changelog, https://github.com/pitkley/watchpost/releases
|
|
27
|
+
Project-URL: Documentation, https://pitkley.github.io/watchpost/
|
|
28
|
+
Project-URL: Homepage, https://github.com/pitkley/watchpost
|
|
29
|
+
Project-URL: Issues, https://github.com/pitkley/watchpost/issues
|
|
30
|
+
Project-URL: Repository, https://github.com/pitkley/watchpost.git
|
|
31
|
+
Provides-Extra: cli
|
|
32
|
+
Provides-Extra: redis
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Watchpost – code-driven monitoring checks for Checkmk
|
|
36
|
+
|
|
37
|
+
Watchpost is a small framework for writing monitoring checks as Python code and integrating them with [Checkmk](https://checkmk.com/).
|
|
38
|
+
It helps you configure checks through a simple function decorator, handles running checks across and against multiple environments, and supports you in gathering data from external systems.
|
|
39
|
+
|
|
40
|
+
## Example
|
|
41
|
+
|
|
42
|
+
Install Watchpost in your project:
|
|
43
|
+
|
|
44
|
+
```shell
|
|
45
|
+
pip install 'watchpost[cli]'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You can now write a basic Watchpost application like this:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import urllib.error
|
|
52
|
+
import urllib.request
|
|
53
|
+
|
|
54
|
+
from watchpost import EnvironmentRegistry, Watchpost, check, crit, ok
|
|
55
|
+
|
|
56
|
+
ENVIRONMENTS = EnvironmentRegistry()
|
|
57
|
+
PRODUCTION = ENVIRONMENTS.new("production")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@check( # (1)
|
|
61
|
+
name="example.com HTTP status",
|
|
62
|
+
service_labels={},
|
|
63
|
+
environments=[PRODUCTION],
|
|
64
|
+
cache_for="5m",
|
|
65
|
+
)
|
|
66
|
+
async def example_com_http_status():
|
|
67
|
+
try:
|
|
68
|
+
with urllib.request.urlopen("https://www.example.com") as response:
|
|
69
|
+
status_code = response.status
|
|
70
|
+
except urllib.error.HTTPError as e:
|
|
71
|
+
status_code = e.code
|
|
72
|
+
|
|
73
|
+
if status_code != 200:
|
|
74
|
+
return crit( # (2)
|
|
75
|
+
"example.com returned an error",
|
|
76
|
+
details=f"Expected status: 200\nActual status: {status_code}\n",
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
return ok("example.com is up") # (3)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
app = Watchpost(
|
|
83
|
+
checks=[
|
|
84
|
+
example_com_http_status, # (4)
|
|
85
|
+
],
|
|
86
|
+
execution_environment=PRODUCTION,
|
|
87
|
+
)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
1. Use the `@check` decorator to define your check:
|
|
91
|
+
|
|
92
|
+
* A human-friendly name that will appear as the service name in Checkmk.
|
|
93
|
+
* Optional service labels to attach to the Checkmk service.
|
|
94
|
+
* The environments this check targets.
|
|
95
|
+
* A cache duration that controls how long a result is kept before the check runs again.
|
|
96
|
+
|
|
97
|
+
2. If the check fails, return `crit(...)`. The details will be shown in the Checkmk service to help troubleshooting.
|
|
98
|
+
3. If everything is fine, return `ok(...)`.
|
|
99
|
+
4. Register the check with the application.
|
|
100
|
+
|
|
101
|
+
Assuming this is saved as `example.py`, you can run it locally as such using the `watchpost` CLI:
|
|
102
|
+
|
|
103
|
+
```console
|
|
104
|
+
$ watchpost --app example:app run-checks
|
|
105
|
+
Check Execution Results
|
|
106
|
+
┏━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
|
|
107
|
+
┃ State ┃ Environment ┃ Service Name ┃ Summary ┃
|
|
108
|
+
┡━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
|
|
109
|
+
│ OK │ production │ example.com HTTP status │ example.com is up │
|
|
110
|
+
└───────┴─────────────┴─────────────────────────┴───────────────────┘
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The Checkmk integration makes use of HTTP to retrieve the check results from the Watchpost application.
|
|
114
|
+
To support this, Watchpost is a valid ASGI web application which you can run with any ASGI server, for example [uvicorn](https://www.uvicorn.org/):
|
|
115
|
+
|
|
116
|
+
```console
|
|
117
|
+
$ pip install uvicorn
|
|
118
|
+
$ uvicorn example:app
|
|
119
|
+
INFO: Started server process [12345]
|
|
120
|
+
INFO: Waiting for application startup.
|
|
121
|
+
INFO: Application startup complete.
|
|
122
|
+
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Capabilities at a glance
|
|
126
|
+
|
|
127
|
+
* Checks and results
|
|
128
|
+
* `@check` decorator, multiple result modes (single, multiple, yielded, builder)
|
|
129
|
+
* Result helpers: `ok`, `warn`, `crit`, `unknown`, metrics, thresholds
|
|
130
|
+
* Environments and scheduling
|
|
131
|
+
* Target vs. execution environments, pluggable scheduling strategies with validation
|
|
132
|
+
* Datasources
|
|
133
|
+
* Simple base class (`Datasource`) and factory pattern to share configuration
|
|
134
|
+
* Execution and streaming
|
|
135
|
+
* Key‑aware executor, error aggregation, Checkmk output generation
|
|
136
|
+
* Caching
|
|
137
|
+
* In‑memory, disk, and optional Redis backends; memoization helper
|
|
138
|
+
* ASGI / HTTP
|
|
139
|
+
* Starlette app; routes: `/`, `/healthcheck`, `/executor/statistics`, `/executor/errored`
|
|
140
|
+
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
See [`./docs`](docs/) for more information.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
Watchpost is licensed under the Apache License, Version 2.0, (see [LICENSE](LICENSE) or <https://www.apache.org/licenses/LICENSE-2.0>).
|
|
148
|
+
|
|
149
|
+
Watchpost internally makes use of various open-source projects.
|
|
150
|
+
You can find a full list of these projects and their licenses in [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).
|
|
151
|
+
|
|
152
|
+
### Contribution
|
|
153
|
+
|
|
154
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Watchpost by you, as defined in the Apache-2.0 license, shall be licensed under the Apache License, Version 2.0, without any additional terms or conditions.
|
|
155
|
+
|
|
156
|
+
We make use of [Lefthook](https://lefthook.dev/) for pre-commit and pre-push hooks that verify your code is valid.
|
|
157
|
+
To set up the hooks, run `uv run lefthook install`.
|
|
158
|
+
|
|
159
|
+
## Affiliation
|
|
160
|
+
|
|
161
|
+
This project has no official affiliation with Checkmk GmbH or any of its affiliates.
|
|
162
|
+
"Checkmk" is a trademark of Checkmk GmbH.
|
|
163
|
+
|
|
164
|
+
## History
|
|
165
|
+
|
|
166
|
+
This project is a fork of [takkt-ag/watchpost](https://github.com/takkt-ag/watchpost).
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Watchpost – code-driven monitoring checks for Checkmk
|
|
2
|
+
|
|
3
|
+
Watchpost is a small framework for writing monitoring checks as Python code and integrating them with [Checkmk](https://checkmk.com/).
|
|
4
|
+
It helps you configure checks through a simple function decorator, handles running checks across and against multiple environments, and supports you in gathering data from external systems.
|
|
5
|
+
|
|
6
|
+
## Example
|
|
7
|
+
|
|
8
|
+
Install Watchpost in your project:
|
|
9
|
+
|
|
10
|
+
```shell
|
|
11
|
+
pip install 'watchpost[cli]'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
You can now write a basic Watchpost application like this:
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
import urllib.error
|
|
18
|
+
import urllib.request
|
|
19
|
+
|
|
20
|
+
from watchpost import EnvironmentRegistry, Watchpost, check, crit, ok
|
|
21
|
+
|
|
22
|
+
ENVIRONMENTS = EnvironmentRegistry()
|
|
23
|
+
PRODUCTION = ENVIRONMENTS.new("production")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@check( # (1)
|
|
27
|
+
name="example.com HTTP status",
|
|
28
|
+
service_labels={},
|
|
29
|
+
environments=[PRODUCTION],
|
|
30
|
+
cache_for="5m",
|
|
31
|
+
)
|
|
32
|
+
async def example_com_http_status():
|
|
33
|
+
try:
|
|
34
|
+
with urllib.request.urlopen("https://www.example.com") as response:
|
|
35
|
+
status_code = response.status
|
|
36
|
+
except urllib.error.HTTPError as e:
|
|
37
|
+
status_code = e.code
|
|
38
|
+
|
|
39
|
+
if status_code != 200:
|
|
40
|
+
return crit( # (2)
|
|
41
|
+
"example.com returned an error",
|
|
42
|
+
details=f"Expected status: 200\nActual status: {status_code}\n",
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
return ok("example.com is up") # (3)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
app = Watchpost(
|
|
49
|
+
checks=[
|
|
50
|
+
example_com_http_status, # (4)
|
|
51
|
+
],
|
|
52
|
+
execution_environment=PRODUCTION,
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
1. Use the `@check` decorator to define your check:
|
|
57
|
+
|
|
58
|
+
* A human-friendly name that will appear as the service name in Checkmk.
|
|
59
|
+
* Optional service labels to attach to the Checkmk service.
|
|
60
|
+
* The environments this check targets.
|
|
61
|
+
* A cache duration that controls how long a result is kept before the check runs again.
|
|
62
|
+
|
|
63
|
+
2. If the check fails, return `crit(...)`. The details will be shown in the Checkmk service to help troubleshooting.
|
|
64
|
+
3. If everything is fine, return `ok(...)`.
|
|
65
|
+
4. Register the check with the application.
|
|
66
|
+
|
|
67
|
+
Assuming this is saved as `example.py`, you can run it locally as such using the `watchpost` CLI:
|
|
68
|
+
|
|
69
|
+
```console
|
|
70
|
+
$ watchpost --app example:app run-checks
|
|
71
|
+
Check Execution Results
|
|
72
|
+
┏━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
|
|
73
|
+
┃ State ┃ Environment ┃ Service Name ┃ Summary ┃
|
|
74
|
+
┡━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
|
|
75
|
+
│ OK │ production │ example.com HTTP status │ example.com is up │
|
|
76
|
+
└───────┴─────────────┴─────────────────────────┴───────────────────┘
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The Checkmk integration makes use of HTTP to retrieve the check results from the Watchpost application.
|
|
80
|
+
To support this, Watchpost is a valid ASGI web application which you can run with any ASGI server, for example [uvicorn](https://www.uvicorn.org/):
|
|
81
|
+
|
|
82
|
+
```console
|
|
83
|
+
$ pip install uvicorn
|
|
84
|
+
$ uvicorn example:app
|
|
85
|
+
INFO: Started server process [12345]
|
|
86
|
+
INFO: Waiting for application startup.
|
|
87
|
+
INFO: Application startup complete.
|
|
88
|
+
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Capabilities at a glance
|
|
92
|
+
|
|
93
|
+
* Checks and results
|
|
94
|
+
* `@check` decorator, multiple result modes (single, multiple, yielded, builder)
|
|
95
|
+
* Result helpers: `ok`, `warn`, `crit`, `unknown`, metrics, thresholds
|
|
96
|
+
* Environments and scheduling
|
|
97
|
+
* Target vs. execution environments, pluggable scheduling strategies with validation
|
|
98
|
+
* Datasources
|
|
99
|
+
* Simple base class (`Datasource`) and factory pattern to share configuration
|
|
100
|
+
* Execution and streaming
|
|
101
|
+
* Key‑aware executor, error aggregation, Checkmk output generation
|
|
102
|
+
* Caching
|
|
103
|
+
* In‑memory, disk, and optional Redis backends; memoization helper
|
|
104
|
+
* ASGI / HTTP
|
|
105
|
+
* Starlette app; routes: `/`, `/healthcheck`, `/executor/statistics`, `/executor/errored`
|
|
106
|
+
|
|
107
|
+
## Documentation
|
|
108
|
+
|
|
109
|
+
See [`./docs`](docs/) for more information.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
Watchpost is licensed under the Apache License, Version 2.0, (see [LICENSE](LICENSE) or <https://www.apache.org/licenses/LICENSE-2.0>).
|
|
114
|
+
|
|
115
|
+
Watchpost internally makes use of various open-source projects.
|
|
116
|
+
You can find a full list of these projects and their licenses in [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).
|
|
117
|
+
|
|
118
|
+
### Contribution
|
|
119
|
+
|
|
120
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Watchpost by you, as defined in the Apache-2.0 license, shall be licensed under the Apache License, Version 2.0, without any additional terms or conditions.
|
|
121
|
+
|
|
122
|
+
We make use of [Lefthook](https://lefthook.dev/) for pre-commit and pre-push hooks that verify your code is valid.
|
|
123
|
+
To set up the hooks, run `uv run lefthook install`.
|
|
124
|
+
|
|
125
|
+
## Affiliation
|
|
126
|
+
|
|
127
|
+
This project has no official affiliation with Checkmk GmbH or any of its affiliates.
|
|
128
|
+
"Checkmk" is a trademark of Checkmk GmbH.
|
|
129
|
+
|
|
130
|
+
## History
|
|
131
|
+
|
|
132
|
+
This project is a fork of [takkt-ag/watchpost](https://github.com/takkt-ag/watchpost).
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "watchpost"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Code driven monitoring checks for Checkmk"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "Pit Kleyersburg", email = "pitkley@googlemail.com" },
|
|
9
|
+
]
|
|
10
|
+
requires-python = ">=3.13"
|
|
11
|
+
keywords = [
|
|
12
|
+
"monitoring",
|
|
13
|
+
"checkmk",
|
|
14
|
+
"observability",
|
|
15
|
+
"infrastructure",
|
|
16
|
+
"devops",
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Framework :: AsyncIO",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Intended Audience :: System Administrators",
|
|
23
|
+
"License :: OSI Approved :: Apache Software License",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Topic :: System :: Monitoring",
|
|
28
|
+
"Topic :: System :: Systems Administration",
|
|
29
|
+
"Typing :: Typed",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"starlette>=0.47.3,<0.48.0",
|
|
33
|
+
"timelength>=3.0.2,<3.1.0",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.optional-dependencies]
|
|
37
|
+
cli = [
|
|
38
|
+
"click>=8.2.1,<9.0.0",
|
|
39
|
+
"rich>=14.1.0,<15.0.0",
|
|
40
|
+
]
|
|
41
|
+
redis = [
|
|
42
|
+
"redis>=6.4.0,<7.0.0",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
watchpost = "watchpost.cli:main"
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
Homepage = "https://github.com/pitkley/watchpost"
|
|
50
|
+
Documentation = "https://pitkley.github.io/watchpost/"
|
|
51
|
+
Repository = "https://github.com/pitkley/watchpost.git"
|
|
52
|
+
Issues = "https://github.com/pitkley/watchpost/issues"
|
|
53
|
+
Changelog = "https://github.com/pitkley/watchpost/releases"
|
|
54
|
+
|
|
55
|
+
[build-system]
|
|
56
|
+
requires = ["uv_build>=0.8.2,<0.9.0"]
|
|
57
|
+
build-backend = "uv_build"
|
|
58
|
+
|
|
59
|
+
[dependency-groups]
|
|
60
|
+
dev = [
|
|
61
|
+
"httpx>=0.28.1,<0.29.0",
|
|
62
|
+
"lefthook>=1.12.4,<2.0.0",
|
|
63
|
+
"licensecheck>=2025.1.0,<2025.2.0",
|
|
64
|
+
"mypy>=1.17.1,<2.0.0",
|
|
65
|
+
"pytest>=8.4.2,<9.0.0",
|
|
66
|
+
"ruff>=0.13.0,<0.14.0",
|
|
67
|
+
"testcontainers[redis]>=4.13.0,<5.0.0",
|
|
68
|
+
"ty>=0.0.1a20",
|
|
69
|
+
]
|
|
70
|
+
docs = [
|
|
71
|
+
"mkdocs>=1.6.1",
|
|
72
|
+
"mkdocs-autorefs>=1.4.3",
|
|
73
|
+
"mkdocs-code-validator>=0.2.0",
|
|
74
|
+
"mkdocs-material>=9.6.19",
|
|
75
|
+
"mkdocs-section-index>=0.3.10",
|
|
76
|
+
"mkdocstrings[python]>=0.30.0",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.licensecheck]
|
|
80
|
+
only_licenses = [
|
|
81
|
+
"Apache-2.0",
|
|
82
|
+
"BSD-2-Clause",
|
|
83
|
+
"ISC",
|
|
84
|
+
"MIT",
|
|
85
|
+
"MPL-2.0",
|
|
86
|
+
"PSF-2.0",
|
|
87
|
+
]
|
|
88
|
+
ignore_packages = [
|
|
89
|
+
"mypy-extensions", # MIT licensed, information missing
|
|
90
|
+
]
|
|
91
|
+
groups = [
|
|
92
|
+
"dev",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[tool.mypy]
|
|
96
|
+
disallow_untyped_calls = true
|
|
97
|
+
disallow_untyped_defs = true
|
|
98
|
+
disallow_incomplete_defs = true
|
|
99
|
+
disallow_untyped_decorators = true
|
|
100
|
+
|
|
101
|
+
exclude = [
|
|
102
|
+
"tests/.*"
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
[tool.pytest.ini_options]
|
|
106
|
+
markers = [
|
|
107
|
+
"docker: marks tests that require Docker (deselect with '-m \"not docker\"')",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
[tool.ruff.lint]
|
|
111
|
+
extend-select = [
|
|
112
|
+
"ARG", # flake8-unused-arguments
|
|
113
|
+
"DTZ", # flake8-datetimez
|
|
114
|
+
"FAST", # FastAPI
|
|
115
|
+
"I", # isort
|
|
116
|
+
"RUF", # Ruff-specific rules
|
|
117
|
+
"T20", # flake8-print
|
|
118
|
+
"UP", # pyupgrade
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
[tool.ruff.lint.per-file-ignores]
|
|
122
|
+
"examples/**.py" = [
|
|
123
|
+
"T20", # flake8-print
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
[tool.ty.src]
|
|
127
|
+
exclude = [
|
|
128
|
+
"checkmk-integration/watchpost-plugin/",
|
|
129
|
+
"tests/",
|
|
130
|
+
]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Copyright 2025 TAKKT Industrial & Packaging GmbH
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
|
|
17
|
+
from .app import Watchpost
|
|
18
|
+
from .cache import Cache, ChainedStorage, DiskStorage, InMemoryStorage, RedisStorage
|
|
19
|
+
from .check import CheckFunctionResult, check
|
|
20
|
+
from .datasource import (
|
|
21
|
+
Datasource,
|
|
22
|
+
DatasourceFactory,
|
|
23
|
+
DatasourceUnavailable,
|
|
24
|
+
FromFactory,
|
|
25
|
+
)
|
|
26
|
+
from .environment import Environment, EnvironmentRegistry
|
|
27
|
+
from .globals import current_app
|
|
28
|
+
from .result import (
|
|
29
|
+
CheckResult,
|
|
30
|
+
Metric,
|
|
31
|
+
Thresholds,
|
|
32
|
+
build_result,
|
|
33
|
+
crit,
|
|
34
|
+
ok,
|
|
35
|
+
unknown,
|
|
36
|
+
warn,
|
|
37
|
+
)
|
|
38
|
+
from .scheduling_strategy import (
|
|
39
|
+
MustRunAgainstGivenTargetEnvironmentStrategy,
|
|
40
|
+
MustRunInGivenExecutionEnvironmentStrategy,
|
|
41
|
+
MustRunInTargetEnvironmentStrategy,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"Cache",
|
|
46
|
+
"ChainedStorage",
|
|
47
|
+
"CheckFunctionResult",
|
|
48
|
+
"CheckResult",
|
|
49
|
+
"Datasource",
|
|
50
|
+
"DatasourceFactory",
|
|
51
|
+
"DatasourceUnavailable",
|
|
52
|
+
"DiskStorage",
|
|
53
|
+
"Environment",
|
|
54
|
+
"EnvironmentRegistry",
|
|
55
|
+
"FromFactory",
|
|
56
|
+
"InMemoryStorage",
|
|
57
|
+
"Metric",
|
|
58
|
+
"MustRunAgainstGivenTargetEnvironmentStrategy",
|
|
59
|
+
"MustRunInGivenExecutionEnvironmentStrategy",
|
|
60
|
+
"MustRunInTargetEnvironmentStrategy",
|
|
61
|
+
"RedisStorage",
|
|
62
|
+
"Thresholds",
|
|
63
|
+
"Watchpost",
|
|
64
|
+
"build_result",
|
|
65
|
+
"check",
|
|
66
|
+
"crit",
|
|
67
|
+
"current_app",
|
|
68
|
+
"ok",
|
|
69
|
+
"unknown",
|
|
70
|
+
"warn",
|
|
71
|
+
]
|