forked from talsonthomas/nagios-nconf-new
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_local.sh
30 lines (26 loc) · 867 Bytes
/
deploy_local.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
OUTPUT_DIR="/var/www/nconf/output/"
NAGIOS_DIR="/usr/local/nagios/etc/"
TEMP_DIR=${NAGIOS_DIR}"import/"
CONF_ARCHIVE="NagiosConfig.tgz"
if [ ! -e ${TEMP_DIR} ] ; then
mkdir -p ${TEMP_DIR}
fi
md5=$(md5sum /usr/local/nagios/etc/nagios.cfg |awk '{print $1}');
if [[ $md5 != "68bd78c0b1786a6600b747b584b96871" ]];then
cp -rfp /nagios.cfg /usr/local/nagios/etc/
fi;
#if [ ${OUTPUT_DIR}${CONF_ARCHIVE} -nt ${TEMP_DIR}${CONF_ARCHIVE} ] ; then
cp -p ${OUTPUT_DIR}${CONF_ARCHIVE} ${TEMP_DIR}${CONF_ARCHIVE}
tar -xf ${TEMP_DIR}${CONF_ARCHIVE} -C ${NAGIOS_DIR}
#/etc/init.d/nagios reload
supervisorctl restart nagios4
#fi
#exit
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
status=$(echo $?);
if [ $status == 0 ]
then
mysqldump -u root -pNag123 nconf >nconf_dump.sql
s3cmd -c /.s3cfg put nconf_dump.sql "s3://inmobi-noc/${stack}/"
fi;