Nagios plugin to check SL delays for a given site
Project description
check_sl_delay
Introduction
check_sl_delay is a simple Nagios plugins to check the percentage of late departures for any given site operated by SL (Stockholms Länstrafik).
Installation
The easiest way to install check_sl_delay is via pip. Make sure to run this with python3, in some environments pip should be replaced with pip3 or similar.
For a specific user:
$ pip install --user check-sl-delay
This will put the executable check_sl_delay in ~/.local/bin/, so make sure that this is part of your $PATH variable.
System wide:
# pip install check-sl-delay
This will put the executable check_sl_delay in /usr/local/bin/, which is usually already part of the system wide $PATH. Check the documentation of your specific OS.
Wherever your executable file has been placed, you may symlink it to a place where plugins are generally available in your environment, for example /opt/plugins/
:
# ln -s /usr/local/bin/check_sl_delay /opt/plugins/check_sl_delay
Usage
Once you have made sure that check_sl_delay is on your $PATH, you can find some useful information with the --help
option:
$ check_sl_delay --help
Usage: check_sl_delay [OPTIONS]
check_sl_delay will connect to the SL API to determine the percentage of
delayed departures for any given site-id.
The site-id and the needed API key can be found using the API SL
Platsuppslag: https://www.trafiklab.se/api/sl-platsuppslag/dokumentation
The departure-api-key can be found using the API SL Realtidsinformation 4:
https://www.trafiklab.se/api/sl-realtidsdokumentation-4/dokumentation
Example: check_sl_delay -a <site-api-key> -A <departure-api-key> -p 10
-m 1 -i 1002 -T METRO -w 20 -c 30
The above example will check the site 1002 (T-Centralen) for all METRO
departures in the coming 10 minutes. It will warn if the percentage of
departures that are more than 1 minute late is 20% or more of the total
amount of departures for the time period. It will crit if the same
percentage is 30% or more.
Options:
-a, --site-api-key TEXT API key for 'SL Platsuppslag' (see
trafiklab.se) [required]
-A, --departure-api-key TEXT API key for 'SL Realtidsinformation 4' (see
trafiklab.se) [required]
-w, --warning INTEGER RANGE Warning threshold (0-100), warning if the
percentage of departures having delays above
--minutes is greater or equal than this
option. Must be less than --critical.
-c, --critical INTEGER RANGE Critical threshold (0-100), critical if the
percentage of departures having delays above
--minutes is greater or equal than this
option. Must be greater than --warning.
-i, --site-id INTEGER RANGE Site-id to check. [required]
-m, --minutes INTEGER RANGE Delay threshold, in minutes. [required]
-p, --period INTEGER Time period to check, in minutes.
[required]
-t, --timeout INTEGER RANGE Plugin timeout, in seconds.
-T, --traffic-type [BUS|METRO|TRAIN]
Traffic type to check. [required]
-v, --verbose Use 2 times for higher verbosity.
--version Show the version and exit.
-h, --help Show this message and exit.
Known Limitations
Due to a limitation in click the locale must be unicode and not ascii. For more information see this page.
History
0.1.3 (2020-03-27)
- Added options for API key and removed personal key from dev files.
0.1.2 (2020-03-24)
- Minor fixes.
0.1.1 (2020-03-23)
- Added short help option (-h).
0.1.0 (2020-03-23)
- First stable release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file check_sl_delay-0.1.3.tar.gz
.
File metadata
- Download URL: check_sl_delay-0.1.3.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edc93614107bd571a1819f934dddbb7cdbcabee4d1f79f34ba4f44f338d4786a |
|
MD5 | b310636beeb8f150334b799ccf5bf016 |
|
BLAKE2b-256 | 1d7eec4dad755ab670d5fa335be8e47c46aefd46cd6d87de1ddff2dc9feb0117 |
File details
Details for the file check_sl_delay-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: check_sl_delay-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66673306c43219b390aeb591304c556476558e018fdd744def9516d84a1328b8 |
|
MD5 | 5f56d771ab794f3513d7247ae86850ac |
|
BLAKE2b-256 | 32f7a9ece403b100597814b5e07560044a7dcc11be8602a2664208acf21a7556 |