26 lines
495 B
Bash
Executable file
26 lines
495 B
Bash
Executable file
#!/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 >= 20" | bc`
|
|
if [ $result == 1 ]
|
|
then
|
|
echo "OK: score=$score|score=$score;;;;"
|
|
exit 0
|
|
fi
|
|
result=`echo "$score > 10" | bc`
|
|
if [ $result == 1 ]
|
|
then
|
|
echo "WARNING: score=$score|score=$score;;;;"
|
|
exit 1
|
|
else
|
|
echo "CRITICAL: score=$score|score=$score;;;;"
|
|
exit 2
|
|
fi
|