Shellscript - Nagios Plugins - UCARP
UCARP-Master
#!/bin/sh
virtuelle_ip=192.168.0.1
interface=eth1:1
/sbin/ifconfig $interface | grep $virtuelle_ip &> /dev/null
if [ $? = 1 ]; then
echo "CRITICAL – Virtual IP $ip on master"
exit 1
else
/sbin/ifconfig $interface | grep $virtuelle_ip | cut -f 2 -d ":" | while read output;
do
ip=$(echo $output | awk ‘{print $1}’ )
echo "OK – Virtual IP on master"
exit 0
done
fi
virtuelle_ip=192.168.0.1
interface=eth1:1
/sbin/ifconfig $interface | grep $virtuelle_ip &> /dev/null
if [ $? = 1 ]; then
echo "CRITICAL – Virtual IP $ip on master"
exit 1
else
/sbin/ifconfig $interface | grep $virtuelle_ip | cut -f 2 -d ":" | while read output;
do
ip=$(echo $output | awk ‘{print $1}’ )
echo "OK – Virtual IP on master"
exit 0
done
fi
UCARP-Slave
#!/bin/sh
virtuelle_ip=192.168.0.1
interface=eth1:1
/sbin/ifconfig $interface | grep $virtuelle_ip &> /dev/null
if [ $? = 1 ]; then
echo "OK – No Virtual IP on slave"
exit 0
else
/sbin/ifconfig $interface | grep $virtuelle_ip | cut -f 2 -d ":" | while read output;
do
ip=$(echo $output | awk ‘{print $1}’ )
echo "CRITICAL – Virtual IP $ip on slave"
exit 1
done
fi
virtuelle_ip=192.168.0.1
interface=eth1:1
/sbin/ifconfig $interface | grep $virtuelle_ip &> /dev/null
if [ $? = 1 ]; then
echo "OK – No Virtual IP on slave"
exit 0
else
/sbin/ifconfig $interface | grep $virtuelle_ip | cut -f 2 -d ":" | while read output;
do
ip=$(echo $output | awk ‘{print $1}’ )
echo "CRITICAL – Virtual IP $ip on slave"
exit 1
done
fi
Download: ucarp_master.sh ucarp_slave.sh