Commit 76f2188a authored by Alain Takoudjou's avatar Alain Takoudjou

monitor bootstrap: write pid too file while processing

parent 238b167d
...@@ -91,6 +91,7 @@ class Monitoring(object): ...@@ -91,6 +91,7 @@ class Monitoring(object):
self.parameter_list = [param.strip() for param in config.get("monitor", "parameter-list").split('\n') if param] self.parameter_list = [param.strip() for param in config.get("monitor", "parameter-list").split('\n') if param]
# Use this file to write knowledge0_cfg required by webrunner # Use this file to write knowledge0_cfg required by webrunner
self.parameter_cfg_file = config.get("monitor", "parameter-file-path").strip() self.parameter_cfg_file = config.get("monitor", "parameter-file-path").strip()
self.pid_file = config.get("monitor", "pid-file")
self.config_folder = os.path.join(self.private_folder, 'config') self.config_folder = os.path.join(self.private_folder, 'config')
self.report_folder = self.private_folder self.report_folder = self.private_folder
...@@ -208,6 +209,7 @@ class Monitoring(object): ...@@ -208,6 +209,7 @@ class Monitoring(object):
response = urllib2.urlopen(url) response = urllib2.urlopen(url)
except urllib2.HTTPError: except urllib2.HTTPError:
self.bootstrap_is_ok = False self.bootstrap_is_ok = False
print "Error: Failed to get Monitor configuration at %s " % monitor_url
return 'Unknown Instance' return 'Unknown Instance'
else: else:
try: try:
...@@ -442,6 +444,10 @@ class Monitoring(object): ...@@ -442,6 +444,10 @@ class Monitoring(object):
if os.path.exists(self.promise_output_file): if os.path.exists(self.promise_output_file):
os.unlink(self.promise_output_file) os.unlink(self.promise_output_file)
# save pid of current process into file
with open(self.pid_file, 'w') as pid_file:
pid_file.write(str(os.getpid()))
# create symlinks from monitor.conf # create symlinks from monitor.conf
self.createSymlinksFromConfig(self.public_folder, self.public_path_list) self.createSymlinksFromConfig(self.public_folder, self.public_path_list)
self.createSymlinksFromConfig(self.private_folder, self.private_path_list) self.createSymlinksFromConfig(self.private_folder, self.private_path_list)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment