Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tristan Cavelier
slapos.toolbox
Commits
811581b1
Commit
811581b1
authored
Jun 11, 2012
by
Mohamadou Mbengue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename report column
parent
18c82ba2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
slapos/monitor.py
slapos/monitor.py
+4
-4
No files found.
slapos/monitor.py
View file @
811581b1
...
...
@@ -224,7 +224,7 @@ class SlapMonitor(object):
conn
=
sqlite3
.
connect
(
self
.
path_database
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
"create table if not exists data (cpu real, cpu_time real, memory real, rss real,"
\
"date text, time text, report integer NULL DEFAULT 0)"
)
"date text, time text, report
ed
integer NULL DEFAULT 0)"
)
try
:
res_list
=
temporary_monitoring
.
get_cpu_and_memory_usage
(
self
.
proc
)
date_catched
=
"-"
.
join
([
str
(
res_list
[
4
].
year
),
str
(
res_list
[
4
].
month
),
str
(
res_list
[
4
].
day
)])
...
...
@@ -266,7 +266,7 @@ class SlapReport(object):
fd
=
open
(
self
.
consumption_log_path
,
'a'
)
conn
=
sqlite3
.
connect
(
self
.
path_database
)
cursor
=
conn
.
cursor
()
log_list
=
cursor
.
execute
(
"SELECT * FROM data WHERE report=0 ORDER BY rowid ASC"
)
log_list
=
cursor
.
execute
(
"SELECT * FROM data WHERE report
ed
=0 ORDER BY rowid ASC"
)
last_report_time
=
""
for
row
in
log_list
:
cpu_consumption_info
=
"%s %s Instance %s CPU Consumption: CPU:%s CPU_TIME:%s
\
n
"
\
...
...
@@ -283,7 +283,7 @@ class SlapReport(object):
if
last_report_time
!=
row
[
5
]:
fd
.
write
(
"%s%s"
%
(
cpu_consumption_info
,
memory_consumption_info
))
last_report_time
=
"%s"
%
row
[
5
]
cursor
.
execute
(
"UPDATE data set report='1' WHERE time=?"
,
(
row
[
5
],))
cursor
.
execute
(
"UPDATE data set report
ed
='1' WHERE time=?"
,
(
row
[
5
],))
conn
.
commit
()
except
Exception
,
e
:
...
...
@@ -307,7 +307,7 @@ class SlapReport(object):
try
:
# send log to logbox
self
.
write_log
()
time
.
sleep
(
self
.
update_time
)
time
.
sleep
(
self
.
update_time
)
except
IOError
:
if
log_file
:
logging
.
info
(
"ERROR : process with pid : %s watched by slap monitor exited too quickly at %s"
...
...
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