-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from paulgear/feature/debian-packaging
First cut at Debian package
- Loading branch information
Showing
11 changed files
with
224 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
tarballs | ||
*.pyc | ||
__pycache__ | ||
buildroot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Changelog | ||
|
||
Notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
|
||
## [2.0.0] - 2023-09-28 | ||
|
||
### Added | ||
|
||
- auto-detection of NTP implementation | ||
- chrony support | ||
- collectd support | ||
- detection of hours and days in "when" field | ||
- gnuplot-based scripts for loopstats and peerstats and intersection algorithm visualisation | ||
- juju charms reactive layer | ||
- ntpd system metrics (from "ntpq -nc readvar") | ||
- prometheus exporter | ||
- standalone parser for chrony statistics files | ||
- systemd service template | ||
- telegraf support | ||
- unit tests expanded and improved (still needs more work) | ||
- updated documentation | ||
|
||
### Fixed | ||
|
||
- correctly detect when no NTP server is running | ||
- fix incorrect reversal of WARNING & CRITICAL thresholds | ||
- various display quirks and inconsistencies | ||
- code reformatted for flake8 fixes | ||
- report metrics in seconds rather than milliseconds, to prevent confusion when graphing | ||
- report survivors-offset-mean instead of syncpeer-offset-mean; more closely corresponds with old behaviour | ||
|
||
### Removed | ||
|
||
- trace checks are now disabled by default, and marked as deprecated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,48 @@ | ||
# This file is part of ntpmon - see COPYING.txt for license. | ||
PYTHONPATH=$(PWD)/src | ||
|
||
BUILDROOT=buildroot | ||
DESTDIR=/ | ||
NAME=ntpmon | ||
PREFIX=/usr/local | ||
SHAREDIR=share/$(NAME) | ||
VERSION=2.0.0 | ||
|
||
test: pytest datatest | ||
|
||
pytest: | ||
python3 -m unittest -b unit_tests/test_classifier.py unit_tests/test_peers.py | ||
PYTHONPATH=./src python3 -m unittest -b unit_tests/test_classifier.py unit_tests/test_peers.py | ||
|
||
datatest: | ||
./testdata/testdata.sh | ||
PYTHONPATH=./src ./testdata/testdata.sh | ||
|
||
push: | ||
git push github | ||
|
||
clean: | ||
find . -type f -name '*.pyc' -print0 | xargs --null rm -f | ||
find . -type f -name '*.pyc' -delete | ||
find . -type d -name '__pycache__' -delete | ||
|
||
install: | ||
install -d $(DESTDIR)/$(PREFIX)/ $(DESTDIR)/$(PREFIX)/$(SHAREDIR)/ | ||
install -m 0644 src/*.py $(DESTDIR)/$(PREFIX)/$(SHAREDIR)/ | ||
chmod 0755 $(DESTDIR)/$(PREFIX)/$(SHAREDIR)/*ntpmon.py | ||
install -d -m 0755 $(DESTDIR)/$(PREFIX)/bin | ||
cd $(DESTDIR)/$(PREFIX)/bin; \ | ||
ln -s ../$(SHAREDIR)/ntpmon.py $(NAME); \ | ||
ln -s ../$(SHAREDIR)/check_ntpmon.py check_$(NAME) | ||
|
||
buildenv: | ||
mkdir -p $(BUILDROOT) | ||
git archive --format=tar.gz --prefix=$(NAME)-$(VERSION)/ HEAD > $(BUILDROOT)/$(NAME)_$(VERSION).orig.tar.gz | ||
|
||
package: buildenv | ||
cd $(BUILDROOT); \ | ||
tar -xf $(NAME)_$(VERSION).orig.tar.gz; \ | ||
cd $(NAME)-$(VERSION)/; \ | ||
debuild | ||
|
||
srcpackage: buildenv | ||
cd $(BUILDROOT); \ | ||
tar -xf $(NAME)_$(VERSION).orig.tar.gz; \ | ||
cd $(NAME)-$(VERSION)/; \ | ||
debuild -S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ntpmon (2.0.0-1) unstable; urgency=medium | ||
|
||
* Apparently I had previously tagged a version of ntpmon as v1.0.0, so I'm | ||
declaring this a breaking change, semver-wise, even though it probably is | ||
99% backwards compatible. The remaining changelog is lightly edited from | ||
an auto-generated changelog from git history. | ||
* Added: | ||
- auto-detection of NTP implementation | ||
- chrony support | ||
- collectd support | ||
- detection of hours and days in "when" field | ||
- gnuplot-based scripts for loopstats and peerstats and intersection | ||
algorithm visualisation | ||
- juju charms reactive layer | ||
- ntpd system metrics (from "ntpq -nc readvar") | ||
- prometheus exporter | ||
- standalone parser for chrony statistics files | ||
- systemd service template | ||
- telegraf support | ||
- unit tests expanded and improved (still needs more work) | ||
- updated documentation | ||
* Fixed: | ||
- correctly detect when no NTP server is running | ||
- fix incorrect reversal of WARNING & CRITICAL thresholds | ||
- various display quirks and inconsistencies | ||
- code reformatted for flake8 fixes | ||
- report metrics in seconds rather than milliseconds, to prevent confusion | ||
when graphing | ||
- report survivors-offset-mean instead of syncpeer-offset-mean; more | ||
closely corresponds with old behaviour | ||
* Removed: | ||
- trace checks are now disabled by default, and marked as deprecated | ||
|
||
-- Paul Gear <[email protected]> Thu, 28 Sep 2023 08:29:19 +1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Source: ntpmon | ||
Section: python | ||
Priority: optional | ||
Maintainer: Paul Gear <[email protected]> | ||
Build-Depends: | ||
debhelper-compat (= 13), | ||
dh-python, | ||
python3-all, | ||
python3-docutils | ||
Standards-Version: 4.6.0 | ||
Homepage: https://github.com/paulgear/ntpmon | ||
# X-Python3-Version: >= 3.7 | ||
Rules-Requires-Root: no | ||
|
||
Package: ntpmon | ||
Architecture: all | ||
Depends: ${misc:Depends}, ${python3:Depends}, chrony | ntp, python3-prometheus-client, python3-psutil | ||
Suggests: collectd, nagios-nrpe-server, telegraf | ||
Description: Monitor/check NTP metrics | ||
This application is a flexible monitor/checker for the health of an | ||
NTP daemon, supporting chronyd and ntpd. It supports reporting metrics | ||
to collectd, Nagios, prometheus, and telegraf. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: ntpmon | ||
Upstream-Author: Paul Gear <[email protected]> | ||
Source: https://github.com/paulgear/ntpmon | ||
|
||
Files: * | ||
Copyright: 2015-2023 Paul D. Gear. | ||
2017-2018 Canonical, Ltd. (juju layer) | ||
License: GPL-3.0+ | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
. | ||
This package is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
. | ||
On Debian systems, the complete text of the GNU General | ||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CHANGELOG.md | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
:Version: 2.0.0 | ||
:Date: 2023-09-28 | ||
:Copyright: 2015-2023 Paul Gear | ||
:Title: ntpmon | ||
:Subtitle: NTP metrics monitor | ||
:Manual group: NTP metrics monitor | ||
:Manual section: "8" | ||
|
||
Summary | ||
####### | ||
|
||
``ntpmon`` is a metrics collector for NTP which periodically queries data from | ||
the running NTP service and sends it to ``collectd``, ``prometheus``, or | ||
``telegraf`` for graphing or further processing. | ||
|
||
Usage | ||
##### | ||
|
||
ntpmon.py [-h] [--mode {collectd,prometheus,telegraf}] [--connect CONNECT] | ||
[--interval INTERVAL] [--port PORT] | ||
|
||
Common Options | ||
############## | ||
|
||
Options: | ||
|
||
-h, --help show this help message and exit | ||
|
||
--mode {collectd,prometheus,telegraf} | ||
Collectd is the default if collectd environment | ||
variables are detected | ||
|
||
--connect CONNECT Connect string (in host:port format) to use when sending | ||
data to telegraf (default: 127.0.0.1:8094) | ||
|
||
--interval INTERVAL How often to report statistics (default: the value of | ||
the COLLECTD_INTERVAL environment variable, or 60 | ||
seconds if COLLECTD_INTERVAL is not set) | ||
|
||
--port PORT TCP port on which to listen when acting as a prometheus | ||
exporter (default: 9648) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/make -f | ||
# -*- makefile -*- | ||
|
||
NAME=ntpmon | ||
|
||
%: | ||
dh $@ --with python3 | ||
|
||
override_dh_auto_install: | ||
$(MAKE) DESTDIR=$$(pwd)/debian/$(NAME) PREFIX=/usr install | ||
rst2man debian/manpage.rst > debian/$(NAME).8 | ||
dh_installman debian/$(NAME).8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0 (quilt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters