[monit/ceph] always use monit -> same for all OS
This commit is contained in:
parent
dd27b12052
commit
6bcb2b6734
4 changed files with 26 additions and 47 deletions
|
@ -3,7 +3,7 @@
|
|||
name=$(hostname)
|
||||
|
||||
CEPH_PATH=/var/lib/ceph
|
||||
MGR_PATH=$CEPH_PATH/mgr/ceph-$name
|
||||
MGR_PATH=$CEPH_PATH/mgr/ceph-${name}
|
||||
|
||||
if [ -e "$MGR_PATH" ]; then
|
||||
echo "$MGR_PATH exists - aborting"
|
||||
|
@ -14,14 +14,10 @@ mkdir "$MGR_PATH"
|
|||
chown ceph:ceph "$MGR_PATH"
|
||||
touch "$MGR_PATH/sysvinit"
|
||||
|
||||
ceph auth get-or-create mgr.$name \
|
||||
ceph auth get-or-create mgr.${name} \
|
||||
mon 'allow profile mgr' \
|
||||
osd 'allow *' \
|
||||
mds 'allow *' > "$MGR_PATH/keyring"
|
||||
|
||||
# Starting with monit, if available
|
||||
if [ -e /etc/monit ]; then
|
||||
/opt/ungleich-tools/monit-ceph-create-start mgr.${name}
|
||||
else
|
||||
/etc/init.d/ceph start mgr.${name}
|
||||
fi
|
||||
# Starting with monit - same on every os
|
||||
/opt/ungleich-tools/monit-ceph-create-start mgr.${name}
|
||||
|
|
|
@ -13,9 +13,5 @@ chown -R ceph:ceph /var/lib/ceph/mon/ceph-$(hostname)
|
|||
# Fix broken permissions on Debian
|
||||
chown ceph:ceph /var/run/ceph/
|
||||
|
||||
# Starting with monit, if available
|
||||
if [ -e /etc/monit ]; then
|
||||
/opt/ungleich-tools/monit-ceph-create-start mon.$(hostname)
|
||||
else
|
||||
/etc/init.d/ceph start mon.$(hostname)
|
||||
fi
|
||||
# Starting with monit
|
||||
/opt/ungleich-tools/monit-ceph-create-start mon.$(hostname)
|
||||
|
|
|
@ -100,9 +100,5 @@ ceph osd crush set-device-class $CLASS osd.${osd_id}
|
|||
|
||||
echo "$metadata_dev /var/lib/ceph/osd/ceph-${osd_id} xfs noatime 0 0" >> /etc/fstab
|
||||
|
||||
# Starting with monit, if available
|
||||
if [ -e /etc/monit ]; then
|
||||
/opt/ungleich-tools/monit-ceph-create-start osd.${osd_id}
|
||||
else
|
||||
/etc/init.d/ceph start osd.${osd_id}
|
||||
fi
|
||||
# Start it
|
||||
/opt/ungleich-tools/monit-ceph-create-start osd.${osd_id}
|
||||
|
|
|
@ -13,44 +13,35 @@ to_monitor=$1
|
|||
set -e
|
||||
|
||||
depends="cephrundir"
|
||||
osd=""
|
||||
conf="/etc/monit/conf.d/$to_monitor"
|
||||
|
||||
if echo $to_monitor | grep ^osd; then
|
||||
depends="${depends}, ${to_monitor}-whoami"
|
||||
osd="yes"
|
||||
osdid=$(echo $to_monitor | cut -d. -f2)
|
||||
cat > "$conf" <<EOF
|
||||
# Generated by $0
|
||||
check process ${to_monitor} with pidfile /var/run/ceph/${to_monitor}.pid
|
||||
start program = "/usr/bin/ceph-osd -i ${osdid} --pid-file /var/run/ceph/osd.${osdid}.pid -c /etc/ceph/ceph.conf --cluster ceph --setuser ceph --setgroup ceph" with timeout 3600 seconds
|
||||
stop program = "/usr/bin/pkill -f '/usr/bin/ceph-osd -i ${osdid}'"
|
||||
daemon=$(echo $to_monitor | awk -F . '{ print $1 }')
|
||||
id=$(echo $to_monitor | awk -F . '{ print $2 }')
|
||||
|
||||
|
||||
case "$daemon" in
|
||||
osd)
|
||||
depends="${depends}, ${to_monitor}-whoami"
|
||||
cat >> "$conf" <<EOF
|
||||
check file ${to_monitor}-whoami with path /var/lib/ceph/osd/ceph-${id}/whoami
|
||||
if content != "${id}" then alert
|
||||
EOF
|
||||
|
||||
else
|
||||
# monitor, mgr
|
||||
cat > "$conf" <<EOF
|
||||
# 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}"
|
||||
|
||||
;;
|
||||
mon|mgr)
|
||||
:
|
||||
;;
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
# final clause same for both
|
||||
cat >> "$conf" <<EOF
|
||||
# Generated by $0
|
||||
check process ${to_monitor} with pidfile /var/run/ceph/${to_monitor}.pid
|
||||
start program = "/usr/bin/ceph-${daemon} -i ${id} --pid-file /var/run/ceph/osd.${id}.pid -c /etc/ceph/ceph.conf --cluster ceph --setuser ceph --setgroup ceph" with timeout 3600 seconds
|
||||
stop program = "/usr/bin/pkill -f '/usr/bin/ceph-${daemon} -i ${id}'"
|
||||
|
||||
group ceph
|
||||
depends on $depends
|
||||
EOF
|
||||
|
||||
if [ "$osd" ]; then
|
||||
cat >> "$conf" <<EOF
|
||||
check file ${to_monitor}-whoami with path /var/lib/ceph/osd/ceph-${osdid}/whoami
|
||||
if content != "${osdid}" then alert
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue