Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
slapos
Commits
2f3c88f8
Commit
2f3c88f8
authored
Mar 04, 2015
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: monitor.py.in naming conventions
parent
40048ccc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
stack/monitor/monitor.py.in
stack/monitor/monitor.py.in
+10
-10
No files found.
stack/monitor/monitor.py.in
View file @
2f3c88f8
...
@@ -129,12 +129,12 @@ def runScripts(directory):
...
@@ -129,12 +129,12 @@ def runScripts(directory):
return result
return result
def writeFile
s(monitors
):
def writeFile
(monitor_dict
):
timestamp = int(time.time())
timestamp = int(time.time())
db = sqlite3.connect(db_path)
db = sqlite3.connect(db_path)
init_db(db)
init_db(db)
status = SUCCESS
status = SUCCESS
for key, value in monitor
s
.iteritems():
for key, value in monitor
_dict
.iteritems():
if value:
if value:
element_status = status = FAILURE
element_status = status = FAILURE
else:
else:
...
@@ -143,12 +143,12 @@ def writeFiles(monitors):
...
@@ -143,12 +143,12 @@ def writeFiles(monitors):
db.execute("insert into status(timestamp, status) values (?, ?)", (timestamp, status))
db.execute("insert into status(timestamp, status) values (?, ?)", (timestamp, status))
db.commit()
db.commit()
db.close()
db.close()
monitor
s
['datetime'] = time.ctime(timestamp)
monitor
_dict
['datetime'] = time.ctime(timestamp)
json.dump(monitor
s
, open(monitoring_file_json, "w+"))
json.dump(monitor
_dict
, open(monitoring_file_json, "w+"))
def main():
def main():
parser = OptionParser(option_list=option_list)
parser = OptionParser(option_list=option_list)
monitor
s
= {}
monitor
_dict
= {}
(options, args) = parser.parse_args()
(options, args) = parser.parse_args()
if not (options.monitor or options.promise
if not (options.monitor or options.promise
...
@@ -156,16 +156,16 @@ def main():
...
@@ -156,16 +156,16 @@ def main():
exit("Please provide at list one arg in : -a, -m, -p, -s")
exit("Please provide at list one arg in : -a, -m, -p, -s")
if options.monitor or options.all:
if options.monitor or options.all:
monitor
s
.update(runScripts(monitor_dir))
monitor
_dict
.update(runScripts(monitor_dir))
if options.promise or options.all:
if options.promise or options.all:
monitor
s
.update(runScripts(promise_dir))
monitor
_dict
.update(runScripts(promise_dir))
if options.service or options.all:
if options.service or options.all:
monitor
s
.update(runServices(pid_dir))
monitor
_dict
.update(runServices(pid_dir))
if options.only_stdout:
if options.only_stdout:
print json.dumps(monitor
s
)
print json.dumps(monitor
_dict
)
else:
else:
writeFile
s(monitors
)
writeFile
(monitor_dict
)
if __name__ == "__main__":
if __name__ == "__main__":
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment