#!/bin/bash MGMT_IP=$(ifconfig br-mgmt | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}') HOST=$(hostname -s) ADMIN_IP=$(hiera management_vip) PUB_IP=$(hiera public_vip) USER='masakari' PASS='masakari' DIR="$(dirname `readlink -f $0`)" apt-get install pacemaker-remote iptables -A INPUT -p tcp -m multiport --ports 3121 -m comment --comment "pacemaker-remore" -j ACCEPT apt-get install -y --force-yes git python-pip python-dev pkg-config libvirt-dev pip install --upgrade pip pip install virtualenv virtualenv v-masakari source v-masakari/bin/activate git clone https://github.com/openstack/python-masakariclient cd python-masakariclient pip install -r requirements.txt python setup.py install cd $DIR git clone https://github.com/openstack/masakari-monitors cat > masakari-monitors/fix-req.txt <<- EOM libvirt-python>=1.2.5 # LGPLv2+ oslo.config>=3.10.0 # Apache-2.0 oslo.i18n>=2.1.0 # Apache-2.0 oslo.log>=1.14.0 # Apache-2.0 oslo.middleware>=3.0.0 # Apache-2.0 oslo.service>=1.10.0 # Apache-2.0 oslo.utils>=3.11.0 # Apache-2.0 pbr>=1.6 # Apache-2.0 python-openstackclient>=3.3.0 # Apache-2.0 EOM cd masakari-monitors pip install -r fix-req.txt python setup.py install mkdir -p /etc/masakari cat > /etc/masakari/hostmonitor.conf <<- EOM # Monitoring interval(in seconds) of node status # Default : 60 MONITOR_INTERVAL=60 # Timeout value(in seconds) when cannot send the notice to resource management. # Default : 10 NOTICE_TIMEOUT=10 # Retry numbers when failed to notify the resource management. # Default : 12 NOTICE_RETRY_COUNT=12 # Retry interval(in seconds) when cannot send the notice to resource management. # Default : 10 NOTICE_RETRY_INTERVAL=10 # Standby time(in seconds) until activate STONITH # Default : 30 STONITH_WAIT=30 # Stonith type ( ipmi(default) / ssh(for test) ) STONITH_TYPE=ssh # Maximum number of child process to start # Default : 3 MAX_CHILD_PROCESS=3 # Timeout value(in seconds) of the tcpdump command when monitor the HB line # Default : 10 TCPDUMP_TIMEOUT=10 # Timeout value(in seconds) of the ipmitool command # Default : 5 IPMI_TIMEOUT=5 # Number of ipmitool command retries # Default : 3 IPMI_RETRY_MAX=3 # Retry interval(in seconds) of the ipmitool command # Default : 10 IPMI_RETRY_INTERVAL=10 # Configuration file path of corosync # Default : /etc/corosync/corosync.conf HA_CONF="/etc/corosync/corosync.conf" # Log level ( info / debug ) # Otherwise, info is set # Default : info LOG_LEVEL="debug" # These value of the order to get the token from the key stone # DOMAIN,ADMIN_USER,ADMIN_PASS,AUTH_URL # Domain name which the project belongs DOMAIN="Default" # The name of a user with administrative privileges ADMIN_USER="admin" # Administrator user's password ADMIN_PASS="admin" # Administrator user's project name PROJECT="admin" # Name of Region REGION="RegionOne" IGNORE_RESOURCE_GROUP_NAME_PATTERN="stonith" # Address of Keystone AUTH_URL="http://${ADMIN_IP}:5000/" EOM cat > /etc/init/masakari-hostmonitor.conf <<- EOM description "Masakari Hostmonitor" start on runlevel [2345] stop on runlevel [!2345] chdir /root/ script . /root/v-masakari/bin/activate exec /root/masakari-monitors/masakarimonitors/hostmonitor/hostmonitor.sh /etc/masakari/hostmonitor.conf end script EOM initctl reload-configuration service masakari-hostmonitor start echo "Activate masakari virtual env: source /root/v-masakari/bin/activate" echo "Make sure that all pacemaker nodes (cluster and remote) use the same /etc/pacemaker/authkey"