Skip to content

Commit

Permalink
ntp-w32tm (fix #629)
Browse files Browse the repository at this point in the history
  • Loading branch information
markuslf committed Sep 16, 2023
1 parent a62cd51 commit cb97e79
Show file tree
Hide file tree
Showing 19 changed files with 881 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and this project does NOT adhere to [Semantic Versioning](https://semver.org/spe

Monitoring Plugins:

* Notifications Plugins now generate URLs for Icinga DB Web instead of the old IcingaWeb2 Monitoring Module (fix #643)
* Notifications Plugins now generate URLs for Icinga DB Web instead of the old IcingaWeb2 Monitoring Module (fix [#643](https://github.com/Linuxfabrik/monitoring-plugins/issues/643))


### Added
Expand All @@ -33,10 +33,11 @@ Icinga Director:
Monitoring Plugins:

* deb-lastactivity ([PR #710](https://github.com/Linuxfabrik/monitoring-plugins/issues/710), thanks to [Yannic Schüpbach](https://github.com/Dissiyt))
* gitlab-health (fix #670)
* gitlab-liveness (fix #670)
* gitlab-readiness (fix #670)
* gitlab-health (fix [#670](https://github.com/Linuxfabrik/monitoring-plugins/issues/670))
* gitlab-liveness (fix [#670](https://github.com/Linuxfabrik/monitoring-plugins/issues/670))
* gitlab-readiness (fix [#670](https://github.com/Linuxfabrik/monitoring-plugins/issues/670))
* gitlab-version
* ntp-w32tm (fix [#629](https://github.com/Linuxfabrik/monitoring-plugins/issues/629))
* openstack-nova-list
* postgresql-version
* statuspal
Expand Down
43 changes: 43 additions & 0 deletions assets/icingaweb2-module-director/all-the-rest.json
Original file line number Diff line number Diff line change
Expand Up @@ -38030,6 +38030,49 @@
"volatile": null,
"zone": null
},
"NTP - w32tm": {
"action_url": null,
"apply_for": null,
"assign_filter": null,
"check_command": null,
"check_interval": null,
"check_period": null,
"check_timeout": null,
"command_endpoint": null,
"disabled": false,
"display_name": null,
"enable_active_checks": null,
"enable_event_handler": null,
"enable_flapping": null,
"enable_notifications": null,
"enable_passive_checks": null,
"enable_perfdata": null,
"event_command": null,
"fields": [],
"flapping_threshold_high": null,
"flapping_threshold_low": null,
"groups": [],
"host": null,
"icon_image": null,
"icon_image_alt": null,
"imports": [
"tpl-service-ntp-w32tm-windows"
],
"max_check_attempts": null,
"notes": null,
"notes_url": null,
"object_name": "NTP - w32tm",
"object_type": "object",
"retry_interval": null,
"service_set": null,
"template_choice": null,
"use_agent": null,
"use_var_overrides": null,
"uuid": "b04ff98e-64e2-4b89-a478-367ec24d94fa",
"vars": {},
"volatile": null,
"zone": null
},
"Procs": {
"action_url": null,
"apply_for": null,
Expand Down
Empty file.
109 changes: 109 additions & 0 deletions check-plugins/ntp-w32tm/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
Check ntp-w32tm
===============

Overview
--------

This monitoring plugin runs ``w32tm /query /status /verbose`` (Windows) to help diagnose problems with the time settings.


Fact Sheet
----------

.. csv-table::
:widths: 30, 70

"Check Plugin Download", "https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/ntp-w32tm"
"Check Interval Recommendation", "Once a minute"
"Can be called without parameters", "Yes"
"Compiled for", "Windows"


Help
----

.. code-block:: text
usage: ntp-w32tm [-h] [-V] [-c CRIT] [--test TEST] [-w WARN]
This monitoring plugin runs `w32tm /query /status /verbose` (Windows) to help
diagnose problems with the time settings.
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-c CRIT, --critical CRIT
Set the critical threshold for the time since "Last
Good Sync", in s. Default: 129600s
--test TEST For unit tests. Needs "path-to-stdout-file,path-to-
stderr-file,expected-retc".
-w WARN, --warning WARN
Set the warning threshold for the time since "Last
Good Sync", in s. Default: 28800s
Usage Examples
--------------

.. code-block:: bash
./ntp-w32tm --warning 28800 --critical 129600
Output:

.. code-block:: text
Leap Indicator: 3 (not synchronized), No NTP server used [WARNING], Last Sync Error: 1 (The computer did not resync because no time data was available.)
Leap Indicator: 3(not synchronized)
Stratum: 0 (unspecified)
Precision: -23 (119.209ns per tick)
Root Delay: 0.0267908s
Root Dispersion: 0.0402331s
ReferenceId: 0x00000000 (unspecified)
Last Successful Sync Time: 9/16/2023 12:52:13 PM
Source: time.windows.com,0x8
Poll Interval: 6 (64s)
Phase Offset: 0.7679486s
ClockRate: 0.0156250s
State Machine: 0 (Unset)
Time Source Flags: 0 (None)
Server Role: 0 (None)
Last Sync Error: 1 (The computer did not resync because no time data was available.)
Time since Last Good Sync Time: 19.2218793s
States
------

* WARN if no NTP server is used.
* WARN if stratum is >= 5.
* WARN if "Leap Indicator" is not "0(no warning)"
* WARN if "Last Sync Error" is not "0"
* WARN or CRIT if "Time since Last Good Sync Time" is above a given threshold.


Perfdata / Metrics
------------------

.. csv-table::
:widths: 25, 15, 60
:header-rows: 1

Name, Type, Description
clock_rate, Milliseconds,
leap_indicator, Number, "Indicates whether an impending leap second is to be inserted or deleted in the last minute of the current day."
phase_offset, Milliseconds,
precision, Number,
root_delay, Milliseconds, "This is the total of the network path delays to the stratum-1 computer from which the computer is ultimately synchronized. In certain extreme situations, this value can be negative. (This can arise in a symmetric peer arrangement where the computers’ frequencies are not tracking each other and the network delay is very short relative to the turn-around time at each computer.)"
root_dispersion, Milliseconds, "This is the total dispersion accumulated through all the computers back to the stratum-1 computer from which the computer is ultimately synchronized. Dispersion is due to system clock resolution, statistical measurement variations etc."
stratum, Number, "The stratum indicates how many hops away from a computer with an attached reference clock we are. Such a computer is a stratum-1 computer, so the computer in the example is two hops away (that is to say, a.b.c is a stratum-2 and is synchronized from a stratum-1)."
time_since_last_good_sync_time, Seconds


Credits, License
----------------

* Authors: `Linuxfabrik GmbH, Zurich <https://www.linuxfabrik.ch>`_
* License: The Unlicense, see `LICENSE file <https://unlicense.org/>`_.
127 changes: 127 additions & 0 deletions check-plugins/ntp-w32tm/icingaweb2-module-director/ntp-w32tm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"Command": {
"cmd-check-ntp-w32tm-windows": {
"arguments": {
"--critical": {
"value": "$ntp_w32tm_windows_critical$"
},
"--warning": {
"value": "$ntp_w32tm_windows_warning$"
}
},
"command": "C:\\ProgramData\\icinga2\\usr\\lib64\\nagios\\plugins\\ntp-w32tm.exe",
"disabled": false,
"fields": [
{
"datafield_id": 1,
"is_required": "n",
"var_filter": null
},
{
"datafield_id": 2,
"is_required": "n",
"var_filter": null
}
],
"imports": [],
"is_string": null,
"methods_execute": "PluginCheck",
"object_name": "cmd-check-ntp-w32tm-windows",
"object_type": "object",
"timeout": "10",
"vars": {},
"zone": null,
"uuid": "52bcb6ab-28d8-49aa-9daf-9a9f6f3c420a"
},
"cmd-check-ntp-w32tm-windows-python": {
"arguments": {},
"command": "C:\\Windows\\py C:\\ProgramData\\icinga2\\usr\\lib64\\nagios\\plugins\\ntp-w32tm.py",
"disabled": false,
"fields": [],
"imports": [
"cmd-check-ntp-w32tm-windows"
],
"is_string": null,
"methods_execute": null,
"object_name": "cmd-check-ntp-w32tm-windows-python",
"object_type": "object",
"timeout": null,
"vars": {},
"zone": null,
"uuid": "57927ffd-db3a-469a-bc56-c1b555cf76a5"
}
},
"ServiceTemplate": {
"tpl-service-ntp-w32tm-windows": {
"action_url": null,
"apply_for": null,
"assign_filter": null,
"check_command": "cmd-check-ntp-w32tm-windows",
"check_interval": 60,
"check_period": null,
"check_timeout": null,
"command_endpoint": null,
"disabled": false,
"display_name": null,
"enable_active_checks": null,
"enable_event_handler": null,
"enable_flapping": null,
"enable_notifications": true,
"enable_passive_checks": null,
"enable_perfdata": true,
"event_command": null,
"fields": [],
"flapping_threshold_high": null,
"flapping_threshold_low": null,
"groups": [],
"host": null,
"icon_image": "ntp-w32tm.png",
"icon_image_alt": null,
"imports": [
"tpl-service-generic"
],
"max_check_attempts": 5,
"notes": "This monitoring plugin runs `w32tm /query /status /verbose` (Windows) to help diagnose problems with the time settings.",
"notes_url": "https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/ntp-w32tm",
"object_name": "tpl-service-ntp-w32tm-windows",
"object_type": "template",
"retry_interval": 15,
"service_set": null,
"template_choice": null,
"use_agent": null,
"use_var_overrides": null,
"vars": {
"criticality": "B",
"ntp_w32tm_windows_critical": 129600,
"ntp_w32tm_windows_warning": 28800
},
"volatile": null,
"zone": null,
"uuid": "302f40db-9ad1-4d36-85d9-a4543ad98469"
}
},
"Datafield": {
"1": {
"varname": "ntp_w32tm_windows_critical",
"caption": "NTP W32Tm: Critical",
"description": "Set the critical threshold for the time since \"Last Good Sync\", in s.",
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString",
"format": null,
"settings": {
"visibility": "visible"
},
"uuid": "fa437e67-a3e6-430f-906c-ad6330db9ffa"
},
"2": {
"varname": "ntp_w32tm_windows_warning",
"caption": "NTP W32Tm: Warning",
"description": "Set the warning threshold for the time since \"Last Good Sync\", in s.",
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString",
"format": null,
"settings": {
"visibility": "visible"
},
"uuid": "308ec0c1-ec53-4f57-8f90-9078fa714248"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
variants:
- windows

overwrites:
'["ServiceTemplate"]["tpl-service-ntp-w32tm-windows"]["enable_perfdata"]': true
'["ServiceTemplate"]["tpl-service-ntp-w32tm-windows"]["vars"]["criticality"]': 'B'
1 change: 1 addition & 0 deletions check-plugins/ntp-w32tm/lib
Loading

0 comments on commit cb97e79

Please sign in to comment.