From 2989cef8dbcfa24f588a67f6d270647b9d056f32 Mon Sep 17 00:00:00 2001 From: n Date: Sun, 10 Sep 2017 15:29:47 +0200 Subject: [PATCH] monitoring/check_ntppool_score --- README.md | 5 +++-- monitoring/check_ntppool_score | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 monitoring/check_ntppool_score diff --git a/README.md b/README.md index c605a42..8647a5f 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,10 @@ Patches * [alcasar_logo.patch](https://forge.tourmentine.com/n/scripts/src/master/alcasar_logo.patch) => small patch to add a background changer for ALCASAR webpages * [shaarli_OleG.0.9.0.patch](https://forge.tourmentine.com/n/scripts/src/master/shaarli_OleG.0.9.0.patch) => Open Graph support for Shaarli (patch against 0.9.0 version, also works against 0.9.1) Hi [Charly](https://fr.wikipedia.org/wiki/Charly_Oleg)! -Others ------- +Monitoring +------- + * [check_ntppool_score](https://forge.tourmentine.com/n/scripts/src/master/check_ntppool_score) => Simple shell script to check score on NTP Pool Project (score must be over 10 to server NTP). Requires Curl, fits for Nagios/Shinken/Icinga/etc. * [GonKyrellM](https://forge.tourmentine.com/n/scripts/src/master/GonKyrellM) => Conky, GKrellM style - with "invisible" theme (well, sort of) Attic diff --git a/monitoring/check_ntppool_score b/monitoring/check_ntppool_score new file mode 100755 index 0000000..4ce5777 --- /dev/null +++ b/monitoring/check_ntppool_score @@ -0,0 +1,20 @@ +#!/bin/sh + +score=`curl --silent "http://www.pool.ntp.org/scores/195.154.45.50/log?limit=1" 2>&1 | tail -1 | cut -f 5 -d ","` + + +if [ $score == "" ] +then + echo "UNKNOWN: unable to parse result" + exit 3 +fi + +result=`echo "$score > 10" | bc` +if [ $result == 1 ] +then + echo "OK: score=$score|score=$score;;;;" + exit 0 +else + echo "CRITICAL: score=$score|score=$score;;;;" + exit 2 +fi