mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-02-28 16:50:19 +00:00
24 lines
503 B
Bash
Executable File
24 lines
503 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# NOTE: THIS NTP SERVICE CHECK SCRIPT ASSUME THAT NTP SERVICE IS RUNNING UNDER SYSTEMD.
|
|
# THIS IS JUST AN EXAMPLE. YOU CAN WRITE YOUR OWN NODE PROBLEM PLUGIN ON DEMAND.
|
|
|
|
OK=0
|
|
NONOK=1
|
|
UNKNOWN=2
|
|
|
|
which systemctl >/dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo "Systemd is not supported"
|
|
exit $UNKNOWN
|
|
fi
|
|
|
|
systemctl status ntp.service | grep 'Active:' | grep -q running
|
|
if [ $? -ne 0 ]; then
|
|
echo "NTP service is not running"
|
|
exit $NONOK
|
|
fi
|
|
|
|
echo "NTP service is running"
|
|
exit $OK
|