Off the top of my head I can't think of an easy way to do this in Nagios, possibly something to do with dependencies?
What I'd do though is write a custom check script that takes two hosts as parameters, the first being the main host to check and the second being its slave.
Run your check and if the main host fails but the second host is up then return the warning alert.
So the pseudocode (I'm too lazy to write the whole script here!) would be something like
Code:
twincheck.sh hosta hostb
Code:
#!/bin/bash
HOSTA=$1
HOSTB=$2
check_host_ping -h ${HOSTA} [plus whatever other parameters for timeout, etc.]
AUP=$?
if ${AUP} = 0; then
# A is up, so we're fine here, even if B is down.
# We don't need to check B because if it's down
# then our check of B A will catch it.
echo "OK"
exit 0
fi
if ${AUP} != 0; then
# A Isn't up, let's check our twin
check_host_ping -h ${HOSTB} [plus whatever other parameters for timeout, etc.]
BUP=$?
fi
if ${BUP} = 0; then
# A is down, but B is up, so we exit with a warning
echo "Down but twin up"
exit 1
fi
if ${BUP} != 0; then
# A is down and B isn't in an "OK" state
# So we exit with a CRITICAL
echo "Down and twin down"
exit 2
fi