CC-2888: Create a monit file for each airtime component

This commit is contained in:
martin 2011-09-26 12:51:02 -04:00
parent 3f1ea46d3d
commit 974612badf
17 changed files with 100 additions and 16 deletions

View file

@ -61,8 +61,9 @@ python ${SCRIPTPATH}/../python_apps/show-recorder/install/recorder-install.py
echo -e "\n*** Media Monitor Installation ***" echo -e "\n*** Media Monitor Installation ***"
python ${SCRIPTPATH}/../python_apps/media-monitor/install/media-monitor-install.py python ${SCRIPTPATH}/../python_apps/media-monitor/install/media-monitor-install.py
monit monitor icecast2 set +e
monit monitor rabbitmq-server monit monitor rabbitmq-server
set -e
echo -e "\n*** Verifying your system environment ***" echo -e "\n*** Verifying your system environment ***"
sleep 10 sleep 10

View file

@ -25,8 +25,9 @@ SCRIPTPATH=`dirname $SCRIPT`
echo -e "\n******************************* Uninstall Begin ********************************" echo -e "\n******************************* Uninstall Begin ********************************"
monit unmonitor icecast2 >/dev/null 2>&1 set +e
monit unmonitor rabbitmq-server >/dev/null 2>&1 monit unmonitor rabbitmq-server >/dev/null 2>&1
set -e
echo -e "\n*** Uninstalling Pypo ***" echo -e "\n*** Uninstalling Pypo ***"
python ${SCRIPTPATH}/../python_apps/pypo/install/pypo-uninstall.py python ${SCRIPTPATH}/../python_apps/pypo/install/pypo-uninstall.py

View file

@ -120,13 +120,6 @@ class AirtimeIni
chmod($filename, 0640)); chmod($filename, 0640));
} }
public static function CreateMonitFile(){
if (!copy(__DIR__."/../../python_apps/monit/airtime-monit.cfg", AirtimeIni::CONF_FILE_MONIT)){
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
exit(1);
}
}
public static function RemoveMonitFile(){ public static function RemoveMonitFile(){
@unlink("/etc/monit/conf.d/airtime-monit.cfg"); @unlink("/etc/monit/conf.d/airtime-monit.cfg");
} }

View file

@ -110,8 +110,6 @@ if ($overwrite) {
echo "* Creating INI files".PHP_EOL; echo "* Creating INI files".PHP_EOL;
AirtimeIni::CreateIniFiles(); AirtimeIni::CreateIniFiles();
} }
AirtimeIni::CreateMonitFile();
AirtimeInstall::InstallPhpCode(); AirtimeInstall::InstallPhpCode();
AirtimeInstall::InstallBinaries(); AirtimeInstall::InstallBinaries();

View file

@ -39,6 +39,10 @@ def get_current_script_dir():
index = current_script_dir.rindex('/') index = current_script_dir.rindex('/')
return current_script_dir[0:index] return current_script_dir[0:index]
def copy_monit_file(current_script_dir):
shutil.copy("%s/../monit-airtime-media-monitor.cfg"%current_script_dir, "/etc/monit/conf.d/")
shutil.copy("%s/../../monit/monit-airtime-generic.cfg"%current_script_dir, "/etc/monit/conf.d/")
try: try:
# load config file # load config file
@ -50,6 +54,8 @@ try:
current_script_dir = get_current_script_dir() current_script_dir = get_current_script_dir()
copy_monit_file(current_script_dir)
p = Popen("/etc/init.d/airtime-media-monitor stop >/dev/null 2>&1", shell=True) p = Popen("/etc/init.d/airtime-media-monitor stop >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1] sts = os.waitpid(p.pid, 0)[1]

View file

@ -18,6 +18,9 @@ def get_current_script_dir():
index = current_script_dir.rindex('/') index = current_script_dir.rindex('/')
return current_script_dir[0:index] return current_script_dir[0:index]
def remove_monit_file():
os.system("rm -f /etc/monit/conf.d/monit-airtime-media-monitor.cfg")
try: try:
# load config file # load config file
try: try:
@ -30,6 +33,9 @@ try:
os.system("rm -f /etc/init.d/airtime-media-monitor") os.system("rm -f /etc/init.d/airtime-media-monitor")
os.system("update-rc.d -f airtime-media-monitor remove >/dev/null 2>&1") os.system("update-rc.d -f airtime-media-monitor remove >/dev/null 2>&1")
print "Removing monit file"
remove_monit_file()
print "Removing log directories" print "Removing log directories"
remove_path(config["log_dir"]) remove_path(config["log_dir"])

View file

@ -0,0 +1,9 @@
set daemon 10 # Poll at 5 second intervals
set logfile /var/log/monit.log
set httpd port 2812
check process airtime-media-monitor
with pidfile "/var/run/airtime-media-monitor.pid"
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-media-monitor stop"

View file

@ -21,10 +21,6 @@
with pidfile "/var/run/airtime-show-recorder.pid" with pidfile "/var/run/airtime-show-recorder.pid"
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-show-recorder stop" stop program = "/etc/init.d/airtime-show-recorder stop"
check process icecast2
matching "/usr/bin/icecast2"
start program = "/etc/init.d/icecast2 start" with timeout 10 seconds
stop program = "/etc/init.d/icecast2 stop"
check process rabbitmq-server check process rabbitmq-server
with pidfile "/var/run/rabbitmq.pid" with pidfile "/var/run/rabbitmq.pid"
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'" start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'"

View file

@ -0,0 +1,10 @@
set daemon 10 # Poll at 5 second intervals
set logfile /var/log/monit.log
set httpd port 2812
allow admin:monit
check process rabbitmq-server
with pidfile "/var/run/rabbitmq.pid"
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'"
stop program = "/etc/init.d/rabbitmq-server stop"

View file

@ -0,0 +1,11 @@
set daemon 10 # Poll at 5 second intervals
#set logfile syslog facility log_daemon
set logfile /var/log/monit.log
set httpd port 2812
allow admin:monit
check process rabbitmq-server
with pidfile "/var/run/rabbitmq.pid"
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'"
stop program = "/etc/init.d/rabbitmq-server stop"

View file

@ -50,6 +50,10 @@ def is_natty():
return True return True
return False return False
def copy_monit_file(current_script_dir):
shutil.copy("%s/../monit-airtime-playout.cfg"%current_script_dir, "/etc/monit/conf.d/")
shutil.copy("%s/../monit-airtime-liquidsoap.cfg"%current_script_dir, "/etc/monit/conf.d/")
shutil.copy("%s/../../monit/monit-airtime-generic.cfg"%current_script_dir, "/etc/monit/conf.d/")
try: try:
# load config file # load config file
@ -61,6 +65,8 @@ try:
current_script_dir = get_current_script_dir() current_script_dir = get_current_script_dir()
copy_monit_file(current_script_dir)
p = Popen("/etc/init.d/airtime-playout stop >/dev/null 2>&1", shell=True) p = Popen("/etc/init.d/airtime-playout stop >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1] sts = os.waitpid(p.pid, 0)[1]

View file

@ -17,6 +17,10 @@ def get_current_script_dir():
current_script_dir = os.path.realpath(__file__) current_script_dir = os.path.realpath(__file__)
index = current_script_dir.rindex('/') index = current_script_dir.rindex('/')
return current_script_dir[0:index] return current_script_dir[0:index]
def remove_monit_file():
os.system("rm -f /etc/monit/conf.d/monit-airtime-playout.cfg")
os.system("rm -f /etc/monit/conf.d/monit-airtime-liquidsoap.cfg")
try: try:
# load config file # load config file
@ -30,8 +34,11 @@ try:
os.system("rm -f /etc/init.d/airtime-playout") os.system("rm -f /etc/init.d/airtime-playout")
os.system("update-rc.d -f airtime-playout remove >/dev/null 2>&1") os.system("update-rc.d -f airtime-playout remove >/dev/null 2>&1")
#copy logrotate script #remove logrotate script
os.system("rm -f /etc/logrotate.d/airtime-liquidsoap") os.system("rm -f /etc/logrotate.d/airtime-liquidsoap")
print "Removing monit file"
remove_monit_file()
print "Removing cache directories" print "Removing cache directories"
remove_path(config["cache_base_dir"]) remove_path(config["cache_base_dir"])

View file

@ -0,0 +1,9 @@
set daemon 10 # Poll at 5 second intervals
set logfile /var/log/monit.log
set httpd port 2812
check process airtime-liquidsoap
with pidfile "/var/run/airtime-liquidsoap.pid"
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"

View file

@ -0,0 +1,9 @@
set daemon 10 # Poll at 5 second intervals
set logfile /var/log/monit.log
set httpd port 2812
check process airtime-playout
with pidfile "/var/run/airtime-playout.pid"
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"

View file

@ -32,6 +32,10 @@ def get_current_script_dir():
index = current_script_dir.rindex('/') index = current_script_dir.rindex('/')
return current_script_dir[0:index] return current_script_dir[0:index]
def copy_monit_file(current_script_dir):
shutil.copy("%s/../monit-airtime-show-recorder.cfg"%current_script_dir, "/etc/monit/conf.d/")
shutil.copy("%s/../../monit/monit-airtime-generic.cfg"%current_script_dir, "/etc/monit/conf.d/")
try: try:
# load config file # load config file
@ -43,6 +47,8 @@ try:
current_script_dir = get_current_script_dir() current_script_dir = get_current_script_dir()
copy_monit_file(current_script_dir)
p = Popen("/etc/init.d/airtime-show-recorder stop >/dev/null 2>&1", shell=True) p = Popen("/etc/init.d/airtime-show-recorder stop >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1] sts = os.waitpid(p.pid, 0)[1]

View file

@ -17,6 +17,10 @@ def get_current_script_dir():
current_script_dir = os.path.realpath(__file__) current_script_dir = os.path.realpath(__file__)
index = current_script_dir.rindex('/') index = current_script_dir.rindex('/')
return current_script_dir[0:index] return current_script_dir[0:index]
def remove_monit_file():
os.system("rm -f /etc/monit/conf.d/monit-airtime-show-recorder.cfg")
try: try:
# load config file # load config file
@ -29,6 +33,9 @@ try:
os.system("/etc/init.d/airtime-show-recorder stop") os.system("/etc/init.d/airtime-show-recorder stop")
os.system("rm -f /etc/init.d/airtime-show-recorder") os.system("rm -f /etc/init.d/airtime-show-recorder")
os.system("update-rc.d -f airtime-show-recorder remove >/dev/null 2>&1") os.system("update-rc.d -f airtime-show-recorder remove >/dev/null 2>&1")
print "Removing monit file"
remove_monit_file()
print "Removing log directories" print "Removing log directories"
remove_path(config["log_dir"]) remove_path(config["log_dir"])

View file

@ -0,0 +1,9 @@
set daemon 10 # Poll at 5 second intervals
set logfile /var/log/monit.log
set httpd port 2812
check process airtime-show-recorder
with pidfile "/var/run/airtime-show-recorder.pid"
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-show-recorder stop"