Stop a pacemaker node when local shell script returns an error?
1
vote
0
answers
143
views
Is it possible to make pacemaker stopping a node when a local test script fails, and start a node if the local test script returns true again?
This seems like a very simple problem, but as i can't find ANY way to do this within pacemaker, I'm about to run the following shell script on all my nodes:
while true; do
pcs status 2>/dev/null >/dev/null && node_running=true
/is_node_healthy.sh && node_healthy=true
[[ -v node_running ]] && ! [[ -v node_healthy ]] && pcs cluster stop
[[ -v node_healthy ]] && ! [[ -v node_running ]] && pcs cluster start
unset node_running node_healthy
sleep 10
done
This does exactly what i want, but looks like a very dirty hack in my eyes. Is there a more elegant way to get the same thing done by pacemaker itself?
BTW: The overall task i want to solve seems quite simple: create a ha cluster that has a public ip address assigned to a vital host, where vitality can be checked with /is_node_healthy.sh
Asked by psicolor
(11 rep)
Feb 22, 2021, 11:54 AM