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
Thomas Leymonerie
slapos.toolbox
Commits
eabfaa8c
Commit
eabfaa8c
authored
Jun 19, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup monitor.py
parent
bb51f5da
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
56 deletions
+52
-56
slapos/monitor.py
slapos/monitor.py
+52
-56
No files found.
slapos/monitor.py
View file @
eabfaa8c
...
@@ -28,15 +28,12 @@
...
@@ -28,15 +28,12 @@
import
datetime
import
datetime
import
os
import
os
import
time
import
time
import
resource
from
time
import
strftime
from
time
import
strftime
import
logging
import
logging
import
sys
import
sys
from
lxml
import
etree
as
ElementTree
from
lxml
import
etree
as
ElementTree
import
platform
import
psutil
import
psutil
from
optparse
import
OptionParser
from
optparse
import
OptionParser
import
tempfile
import
sqlite3.dbapi2
as
sqlite3
import
sqlite3.dbapi2
as
sqlite3
#define global variable for log file
#define global variable for log file
...
@@ -59,7 +56,6 @@ class GenerateXML(object):
...
@@ -59,7 +56,6 @@ class GenerateXML(object):
self
.
element_tree
=
element_tree
self
.
element_tree
=
element_tree
self
.
path_database
=
path_database
self
.
path_database
=
path_database
self
.
path_xml
=
path_xml
self
.
path_xml
=
path_xml
#self.log_file = log_file
def
dump_xml
(
self
):
def
dump_xml
(
self
):
"""This func read data from database and through
"""This func read data from database and through
...
@@ -286,7 +282,7 @@ class SlapReport(object):
...
@@ -286,7 +282,7 @@ class SlapReport(object):
cursor
.
execute
(
"UPDATE data set reported='1' WHERE time=?"
,
(
row
[
5
],))
cursor
.
execute
(
"UPDATE data set reported='1' WHERE time=?"
,
(
row
[
5
],))
conn
.
commit
()
conn
.
commit
()
except
Exception
,
e
:
except
Exception
:
if
log_file
:
if
log_file
:
logging
.
info
(
"ERROR : Unable to connect to % at %s"
logging
.
info
(
"ERROR : Unable to connect to % at %s"
%
(
self
.
ssh_parameters
[
'ip'
],
strftime
(
"%Y-%m-%d at %H:%m"
)))
%
(
self
.
ssh_parameters
[
'ip'
],
strftime
(
"%Y-%m-%d at %H:%m"
)))
...
@@ -383,7 +379,7 @@ def run_slapreport():
...
@@ -383,7 +379,7 @@ def run_slapreport():
except
IOError
:
except
IOError
:
if
log_file
:
if
log_file
:
logging
.
info
(
"ERROR : process with pid : %s watched by slap monitor exited too quickly at %s"
logging
.
info
(
"ERROR : process with pid : %s watched by slap monitor exited too quickly at %s"
%
(
self
.
proc
.
pid
,
strftime
(
"%Y-%m-%d at %H:%m"
)))
%
(
proc
.
pid
,
strftime
(
"%Y-%m-%d at %H:%m"
)))
sys
.
exit
(
1
)
sys
.
exit
(
1
)
if
log_file
:
if
log_file
:
...
...
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