Failover looking much better with proper rsync

2021
Eric Loyd 6 years ago
parent 5dc028eeda
commit faf9fdd312

@ -1,5 +1,8 @@
primary: primary:
./failover.sh -p 192.168.56.113 -s 192.168.56.114 -H 192.168.56.113 ./failover.sh -P 192.168.56.113 -S 192.168.56.114 -H 192.168.56.113
secondary: secondary:
./failover.sh -p 192.168.56.113 -s 192.168.56.114 -H 192.168.56.114 ./failover.sh -P 192.168.56.113 -S 192.168.56.114 -H 192.168.56.114
sync:
rsync -avu --stats . clone:/root/princeton/failover

@ -10,14 +10,16 @@ PATH=/usr/sbin:/sbin:/usr/bin:/bin
primary="nagiosxi-p.princeton.edu" primary="nagiosxi-p.princeton.edu"
secondary="nagiosxi-f.princeton.edu" secondary="nagiosxi-f.princeton.edu"
synconly="false"
hostname=`/bin/hostname` hostname=`/bin/hostname`
while [ -n "$1" ]; do while [ -n "$1" ]; do
case "$1" in case "$1" in
-H | --hostname) hostname="$2"; shift 2;; -H | --hostname) hostname="$2"; shift 2;;
-s | --secondary) secondary="$2"; shift 2;; -S | --secondary) secondary="$2"; shift 2;;
-p | --primary) primary="$2"; shift 2;; -P | --primary) primary="$2"; shift 2;;
-s | --sync-only) synconly="true"; shift 1;;
*) shift 1;; *) shift 1;;
esac esac
done done
@ -39,6 +41,9 @@ do_secondary() {
mysqlfile=`ls -tr1 /store/backups/nagiosxi/ | tail -1` mysqlfile=`ls -tr1 /store/backups/nagiosxi/ | tail -1`
[ -z "$mysqlfile" ] && echo "No MySQL Backup file." && exit 2 [ -z "$mysqlfile" ] && echo "No MySQL Backup file." && exit 2
./restore_xi.sh /store/backups/nagiosxi/$mysqlfile ./restore_xi.sh /store/backups/nagiosxi/$mysqlfile
./nagios_startstop.sh stop
cp /usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css.secondary /usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css
cd /usr/local/nagiosxi/scripts && ./reconfigure_nagios.sh
} }
case "$hostname" in case "$hostname" in

@ -0,0 +1,7 @@
#header {
background: rgb(59,234,2);
background: -moz-linear-gradient(90deg, rgba(59,234,2,1) 0%, rgba(8,124,8,1) 35%);
background: -webkit-linear-gradient(90deg, rgba(59,234,2,1) 0%, rgba(8,124,8,1) 35%);
background: linear-gradient(90deg, rgba(59,234,2,1) 0%, rgba(8,124,8,1) 35%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#3bea02",endColorstr="#087c08",GradientType=1);
}

@ -0,0 +1,7 @@
#header {
background: rgb(59,234,2);
background: -moz-linear-gradient(90deg, rgba(59,234,2,1) 0%, rgba(8,124,8,1) 35%);
background: -webkit-linear-gradient(90deg, rgba(59,234,2,1) 0%, rgba(8,124,8,1) 35%);
background: linear-gradient(90deg, rgba(59,234,2,1) 0%, rgba(8,124,8,1) 35%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#3bea02",endColorstr="#087c08",GradientType=1);
}

@ -0,0 +1,7 @@
#header {
background: rgb(234,59,2);
background: -moz-linear-gradient(90deg, rgba(234,59,2,1) 0%, rgba(121,51,11,1) 35%);
background: -webkit-linear-gradient(90deg, rgba(234,59,2,1) 0%, rgba(121,51,11,1) 35%);
background: linear-gradient(90deg, rgba(234,59,2,1) 0%, rgba(121,51,11,1) 35%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#ea3b02",endColorstr="#79330b",GradientType=1);
}

@ -0,0 +1,8 @@
;#header {
; background: #3cb371;
;}
#header {
background: #c71585;
}

@ -100,6 +100,7 @@ mysqlpass="$themysqlpass"
############################## ##############################
# RESTORE DATABASES # RESTORE DATABASES
############################## ##############################
restore_databases() {
echo "Restoring MySQL databases..." echo "Restoring MySQL databases..."
if [[ "$cfg__db_info__ndoutils__dbserver" == *":"* ]]; then if [[ "$cfg__db_info__ndoutils__dbserver" == *":"* ]]; then
ndoutils_dbport=`echo "$cfg__db_info__ndoutils__dbserver" | cut -f2 -d":"` ndoutils_dbport=`echo "$cfg__db_info__ndoutils__dbserver" | cut -f2 -d":"`
@ -204,6 +205,7 @@ fi
echo "Restarting database servers..." echo "Restarting database servers..."
$BASEDIR/manage_services.sh restart mysqld $BASEDIR/manage_services.sh restart mysqld
}
############################## ##############################
# RESTART SERVICES # RESTART SERVICES
@ -230,6 +232,6 @@ echo "==============="
echo "Restarting Nagios XI" echo "Restarting Nagios XI"
cd /usr/local/nagiosxi/scripts cd /usr/local/nagiosxi/scripts
./resconfigure_nagios ./reconfigure_nagios.sh
exit 0 exit 0

@ -96,14 +96,14 @@ mkdir -p $mydir
do_rsync() { do_rsync() {
rsync -avun --delete --delete-after $1 ${secondary}:${1} rsync -avu --delete --delete-after $1 ${secondary}:${1}
} }
# Only backup NagiosQL if it exists # Only backup NagiosQL if it exists
if [ -d "/var/www/html/nagiosql" ]; then if [ -d "/var/www/html/nagiosql" ]; then
echo "Backing up NagiosQL..." echo "Backing up NagiosQL..."
do_rsync /var/www/html/nagiosql do_rsync /var/www/html/nagiosql/
do_rsync /etc/nagiosql do_rsync /etc/nagiosql/
fi fi
echo "Backing up Nagios Core..." echo "Backing up Nagios Core..."
@ -116,26 +116,26 @@ if [ -f "/etc/sysconfig/nagios" ]; then
fi fi
echo "Backing up Nagios XI..." echo "Backing up Nagios XI..."
do_rsync /usr/local/nagiosxi do_rsync /usr/local/nagiosxi/
echo "Backing up MRTG..." echo "Backing up MRTG..."
do_rsync /var/lib/mrtg do_rsync /var/lib/mrtg/
do_rsync /etc/mrtg/mrtg.cfg do_rsync /etc/mrtg/mrtg.cfg
do_rsync /etc/mrtg/conf.d do_rsync /etc/mrtg/conf.d/
# SNMP configs and MIBS # SNMP configs and MIBS
echo "Backing up the SNMP directories" echo "Backing up the SNMP directories"
do_rsync /etc/snmp do_rsync /etc/snmp/
do_rsync /usr/share/snmp do_rsync /usr/share/snmp/
echo "Backing up NRDP..." echo "Backing up NRDP..."
do_rsync /usr/local/nrdp do_rsync /usr/local/nrdp/
echo "Backing up Nagvis..." echo "Backing up Nagvis..."
do_rsync /usr/local/nagvis do_rsync /usr/local/nagvis/
echo "Backing up nagios user home dir..." echo "Backing up nagios user home dir..."
do_rsync /home/nagios do_rsync /home/nagios/
############################## ##############################
# BACKUP DATABASES # BACKUP DATABASES

Loading…
Cancel
Save