Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos-caddy
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
Guillaume Hervier
slapos-caddy
Commits
dbbf14a9
Commit
dbbf14a9
authored
Mar 04, 2015
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: monitor.py.in naming conventions
parent
44cc3774
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 @
dbbf14a9
...
...
@@ -129,12 +129,12 @@ def runScripts(directory):
return result
def writeFile
s(monitors
):
def writeFile
(monitor_dict
):
timestamp = int(time.time())
db = sqlite3.connect(db_path)
init_db(db)
status = SUCCESS
for key, value in monitor
s
.iteritems():
for key, value in monitor
_dict
.iteritems():
if value:
element_status = status = FAILURE
else:
...
...
@@ -143,12 +143,12 @@ def writeFiles(monitors):
db.execute("insert into status(timestamp, status) values (?, ?)", (timestamp, status))
db.commit()
db.close()
monitor
s
['datetime'] = time.ctime(timestamp)
json.dump(monitor
s
, open(monitoring_file_json, "w+"))
monitor
_dict
['datetime'] = time.ctime(timestamp)
json.dump(monitor
_dict
, open(monitoring_file_json, "w+"))
def main():
parser = OptionParser(option_list=option_list)
monitor
s
= {}
monitor
_dict
= {}
(options, args) = parser.parse_args()
if not (options.monitor or options.promise
...
...
@@ -156,16 +156,16 @@ def main():
exit("Please provide at list one arg in : -a, -m, -p, -s")
if options.monitor or options.all:
monitor
s
.update(runScripts(monitor_dir))
monitor
_dict
.update(runScripts(monitor_dir))
if options.promise or options.all:
monitor
s
.update(runScripts(promise_dir))
monitor
_dict
.update(runScripts(promise_dir))
if options.service or options.all:
monitor
s
.update(runServices(pid_dir))
monitor
_dict
.update(runServices(pid_dir))
if options.only_stdout:
print json.dumps(monitor
s
)
print json.dumps(monitor
_dict
)
else:
writeFile
s(monitors
)
writeFile
(monitor_dict
)
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