2018-02-22 12:19:40 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Nico Schottelius, 2018-02-22
|
|
|
|
# Copyright ungleich glarus ag
|
|
|
|
|
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
echo "$0: to monitor"
|
|
|
|
echo "f.i. osd.17 or mon.server4"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
to_monitor=$1
|
|
|
|
|
2018-02-22 12:22:02 +00:00
|
|
|
set -e
|
|
|
|
set -x
|
2018-02-22 12:19:40 +00:00
|
|
|
|
|
|
|
cat > "/etc/monit/conf-enabled/$to_monitor" <<EOF
|
|
|
|
# Auto generated by $0
|
|
|
|
check process $to_monitor with pidfile /var/run/ceph/${to_monitor}.pid
|
|
|
|
start program = "/etc/init.d/ceph start ${to_monitor}" with timeout 60 seconds
|
|
|
|
stop program = "/etc/init.d/ceph stop ${to_monitor}"
|
|
|
|
group server
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
monit reload
|
2018-02-22 12:22:02 +00:00
|
|
|
sleep 1
|
2018-02-22 12:19:40 +00:00
|
|
|
monit start "$to_monitor"
|