Skip to content

Commit 99d8f23

Browse files
committed
Merge branch 'develop'
2 parents 86f23ae + a39c5e5 commit 99d8f23

File tree

15 files changed

+435
-93
lines changed

15 files changed

+435
-93
lines changed

.github/workflows/publish.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Publish to TestPyPI and PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
10+
jobs:
11+
build:
12+
name: Build distribution
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.x"
20+
- name: Install poetry
21+
run: >-
22+
pip install poetry --user
23+
- name: Build
24+
run: poetry build
25+
- name: Store distribution packages
26+
uses: actions/upload-artifact@v3
27+
with:
28+
name: python-package-distributions
29+
path: dist/
30+
31+
publish-to-pypi:
32+
name: Publish Python distribution to PyPI
33+
if: startsWith(github.ref, 'refs/tags/')
34+
needs:
35+
- build
36+
runs-on: ubuntu-latest
37+
environment:
38+
name: pypi
39+
url: https://pypi.org/p/simplemonitor
40+
permissions:
41+
id-token: write
42+
steps:
43+
- name: Download dists
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: python-package-distributions
47+
path: dist/
48+
- name: Publish to PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
51+
github-release:
52+
name: Sign distribution and upload to GitHub Release
53+
needs:
54+
- publish-to-pypi
55+
runs-on: ubuntu-latest
56+
permissions:
57+
contents: write
58+
id-token: write
59+
steps:
60+
- name: Download dists
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: python-package-distributions
64+
path: dist/
65+
- name: Sign the dists with Sigstore
66+
uses: sigstore/[email protected]
67+
with:
68+
inputs: >-
69+
./dist/*.tar.gz
70+
./dist/*.whl
71+
- name: Create GitHub release
72+
env:
73+
GITHUB_TOKEN: ${{ github.token }}
74+
run: >-
75+
gh release create
76+
'${{ github.ref_name }}'
77+
--repo '${{ github.repository }}'
78+
--notes ""
79+
- name: Upload artifact signatures to GitHub Release
80+
env:
81+
GITHUB_TOKEN: ${{ github.token }}
82+
run: >-
83+
gh release upload
84+
'${{ github.ref_name }}' dist/**
85+
--repo '${{ github.repository }}'
86+
87+
publish-to-testpypi:
88+
name: Publish Python distribution to TestPyPI
89+
needs:
90+
- build
91+
runs-on: ubuntu-latest
92+
environment:
93+
name: pypi
94+
url: https://test.pypi.org/p/simplemonitor
95+
permissions:
96+
id-token: write
97+
steps:
98+
- name: Download dists
99+
uses: actions/download-artifact@v4
100+
with:
101+
name: python-package-distributions
102+
path: dist/
103+
- name: Publish to TestPyPI
104+
uses: pypa/gh-action-pypi-publish@release/v1
105+
with:
106+
repository-url: https://test.pypi.org/legacy/

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
)$
1717
- id: flake8
1818
- repo: https://github.com/psf/black
19-
rev: 23.3.0
19+
rev: 24.4.2
2020
hooks:
2121
- id: black
2222
- repo: https://github.com/asottile/seed-isort-config

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.13.0:
2+
* Add ntfy alerter
3+
14
1.12.1:
25
* Adjust no-alerters message to warn not critical
36
* Include output on "command" monitor failure

CONTRIBUTORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ andronkyr
3636
dan
3737
danieldh206
3838
error454
39+
fabian
3940
graham
4041
kz159
4142
nvnwater
@@ -46,4 +47,5 @@ shakreiner
4647
snyk-bot
4748
tlegras
4849
wojtek
50+
wsw70
4951
wxcafé

docs/alerters/ntfy.rst

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
ntfy - ntfy notifications
2+
^^^^^^^^^^^^^^^^^^^^^^^^^
3+
4+
.. include:: ../creds-warning.rst
5+
6+
Send alerts using the ntfy_ service.
7+
8+
.. _ntfy: https://ntfy.sh
9+
10+
.. confval:: topic
11+
12+
:type: string
13+
:required: true
14+
15+
the ntfy topic to send to
16+
17+
.. confval:: priority
18+
19+
:type: str or int
20+
:required: false
21+
:default: ``default``
22+
23+
the priority to use for notifications. an int 1 to 5 (1 is lowest, 5 is highest), or one of ``max``, ``high``, ``default``, ``low``, ``min``
24+
25+
.. confval:: tags
26+
27+
:type: string
28+
:required: false
29+
30+
the tags to add to the notification. A comma-separated list of strings
31+
32+
.. confval:: token
33+
34+
:type: string
35+
:required: false
36+
37+
your token for ntfy, if required
38+
39+
.. confval:: server
40+
41+
:type: string
42+
:required: false
43+
:default: ``https://ntfy.sh``
44+
45+
the server to send to
46+
47+
.. confval:: timeout
48+
49+
:type: int
50+
:required: false
51+
:default: ``5``
52+
53+
Timeout for HTTP request
54+
55+
.. confval:: icon_prefix
56+
57+
:type: bool
58+
:required: false
59+
:default: ``false``
60+
61+
Prefix the subject line with an icon dependent on the result (failed/succeeded)
62+
63+
.. confval:: icon_failed
64+
65+
:type: str
66+
:required: false
67+
:default: ``274C``
68+
69+
Unicode code for the "failed" icon. The code is often provided as "U+<code>" (e.g. ``U+274C``). The default icon for the failed status is ❌.
70+
71+
.. confval:: icon_succeeded
72+
73+
:type: str
74+
:required: false
75+
:default: ``2705``
76+
77+
Unicode code for the "succeeded" icon. The code is often provided as "U+<code>" (e.g. ``U+2705``). The default icon for the failed status is ✅.
78+
79+

docs/creating-monitors.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,27 @@ To create your own Monitor, you need to:
6363
def describe(self) -> str:
6464
return f"checking that thing f{my_setting} does foo"
6565
66-
7. In :file:`simplemonitor/Monitors/__init__.py`, add your Monitor to the list of imports.
66+
7. You should also provide a ``get_params()`` method that sends back a tuple of the configuration entries of your Monitor. It will be used by Loggers as an input of which information to log.
67+
68+
.. code-block:: python
69+
70+
@register
71+
class MonitorMyThing(Monitor):
72+
73+
def __init__(self, name: str, config_options: dict) -> None:
74+
super().__init__(name, config_options)
75+
self.some_configuration = cast(str, self.get_config_option("some_configuration"))
76+
self.some_other_configuration = cast(str, self.get_config_option("some_other_configuration"))
77+
78+
# ...
79+
80+
def get_params(self) -> Tuple:
81+
return (
82+
self.some_configuration,
83+
self.some_other_configuration,
84+
)
85+
86+
8. In :file:`simplemonitor/Monitors/__init__.py`, add your Monitor to the list of imports.
6787

6888
That's it! You should now be able to use ``type=my_thing`` in your Monitors configuration to use your monitor.
6989

docs/loggers/seq.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
seq - seq log server
22
^^^^^^^^^^^^^^^^^^^^
33

4-
Sends the status of monitors to a **seq** log server. See https://datalust.co for more information on Seq.
4+
Sends the status of monitors to a **Seq** log server. See https://datalust.co/seq for more information on Seq.
55

66
.. confval:: endpoint
77

88
:type: string
99
:required: true
1010

11-
the full URI for the endpoint on the seq server, for example ``http:://localhost:5341/api/events/seq``.
11+
Full URI for the endpoint on the seq server, for example ``http:://localhost:5341/api/events/raw``.
12+
See the raw `API ingestion documentation <https://docs.datalust.co/docs/server-http-api#api>` for the curent endpoint URI.
1213

1314
.. confval:: timeout
1415

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
sphinx==7.2.6
22
sphinx_rtd_theme==2.0.0
33
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
4+
urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability

old_docs/Gemfile.lock

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ GEM
216216
rb-fsevent (~> 0.10, >= 0.10.3)
217217
rb-inotify (~> 0.9, >= 0.9.10)
218218
mercenary (0.3.6)
219-
mini_portile2 (2.8.5)
219+
mini_portile2 (2.8.6)
220220
minima (2.5.1)
221221
jekyll (>= 3.5, < 5.0)
222222
jekyll-feed (~> 0.9)
223223
jekyll-seo-tag (~> 2.1)
224224
minitest (5.20.0)
225225
mutex_m (0.2.0)
226-
nokogiri (1.15.4)
226+
nokogiri (1.16.5)
227227
mini_portile2 (~> 2.8.2)
228228
racc (~> 1.4)
229229
octokit (4.25.1)
@@ -236,7 +236,8 @@ GEM
236236
rb-fsevent (0.11.2)
237237
rb-inotify (0.10.1)
238238
ffi (~> 1.0)
239-
rexml (3.2.6)
239+
rexml (3.2.8)
240+
strscan (>= 3.0.9)
240241
rouge (3.26.0)
241242
ruby2_keywords (0.0.5)
242243
rubyzip (2.3.2)
@@ -251,6 +252,7 @@ GEM
251252
faraday (>= 0.17.3, < 3)
252253
simpleidn (0.2.1)
253254
unf (~> 0.1.4)
255+
strscan (3.1.0)
254256
terminal-table (1.8.0)
255257
unicode-display_width (~> 1.1, >= 1.1.1)
256258
typhoeus (1.4.0)

0 commit comments

Comments
 (0)