Skip to content

Check the clock skew of a web server by comparing the HTTP Date header with the local time

License

Notifications You must be signed in to change notification settings

dnmvisser/nagios_check_time_by_http_date

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

check_time_http

A Nagios check to monitor the time offset between a web server (by examining its HTTP Date response header) and the local system (i.e. where the plugin is executed).

Requirements

Nagios or Ininga, Python3 with the argparse, sys, requests, and pytz modules. The latter is python2-tz on Debian based systems.

Usage

usage: check_time_http [-h] --url URL [--useragent USERAGENT] [--warn WARN]
                       [--crit CRIT] [--timeout TIMEOUT] [--verbose]
                       [--verify | --no-verify]

Check time offset of the HTTP "Date" response header against the local time

optional arguments:
  -h, --help            show this help message and exit
  --url URL, -u URL     the URL to check
  --useragent USERAGENT, -a USERAGENT
                        the User-Agent string to use
  --warn WARN, -w WARN  Offset to result in warning (seconds, default 180)
  --crit CRIT, -c CRIT  Offset to result in critical (seconds, default 300)
  --timeout TIMEOUT, -t TIMEOUT
                        Timeout of the HTTP request (seconds)
  --verbose, -v         Return verbose output
  --verify              Verify SSL certificate (default)
  --no-verify           Do not verify SSL certificate

Notes

  1. This plugin only looks at the HTTP Date header. Anything else is considered irrelevant and is not taken into account. So whether the actual service works fine (200), requires authentication (403), or even is failing (503) is not taken into account.

  2. Since this plugin uses the difference between a remote system and the local system, it is recommended to make sure the local system time is accurately synced to an NTP source, and also monitor this, for instance with check_ntp_date.

  3. The format of the HTTP Date header limits the resolution to 1 second, so this plugin is only useful to pick up substantially larger offsets. The plugin was designed to give an early warning in case a web server that is performing a SAML role has its clock drifting away outside the recommended limits (3-5 minutes - which are the defaults for the plugin).

  4. If there is no Date header detected in the response, the plugin returns UNKNOWN.

About

Check the clock skew of a web server by comparing the HTTP Date header with the local time

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages