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

@ -32,6 +32,10 @@ def get_current_script_dir():
index = current_script_dir.rindex('/')
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:
# load config file
@ -43,6 +47,8 @@ try:
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)
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__)
index = current_script_dir.rindex('/')
return current_script_dir[0:index]
def remove_monit_file():
os.system("rm -f /etc/monit/conf.d/monit-airtime-show-recorder.cfg")
try:
# load config file
@ -29,6 +33,9 @@ try:
os.system("/etc/init.d/airtime-show-recorder stop")
os.system("rm -f /etc/init.d/airtime-show-recorder")
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"
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"