Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
picomon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
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
glucas
picomon
Commits
7f38484d
Commit
7f38484d
authored
Jul 20, 2014
by
Jonathan Michalon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move usr1_handler's print code outside, in a new create_report helper
parent
d8598c06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
picomon.py
picomon.py
+19
-12
No files found.
picomon.py
View file @
7f38484d
...
...
@@ -7,22 +7,29 @@ from lib import config
from
lib
import
mails
def
usr1_handler
(
signum
,
frame
):
print
(
"""Signal SIGUSR1 caught, printing state of checks.
Checks in error:"""
)
def
create_report
(
):
has_error
=
False
report
=
''
report
+=
"
\n
Checks in error:
\n
"
for
check
in
config
.
checks
:
if
not
check
.
ok
:
print
(
'-+'
*
40
)
print
(
"Check %s is in error state:
\n\t
%s"
%
(
check
,
check
.
errmsg
.
strip
()))
print
(
'-+'
*
40
,
"""
Other checks (usually OK but may be in retry mode):"""
)
has_error
=
True
report
+=
'-+'
*
40
+
'
\n
'
report
+=
"%s: %s
\n\t
%s
\n
"
%
(
check
.
target_name
,
check
,
check
.
errmsg
.
strip
())
report
+=
'-+'
*
40
+
"
\n\n
Other checks (usually OK but may be in retry mode):
\n
"
for
check
in
config
.
checks
:
if
check
.
ok
:
print
(
"Check %s is %s"
%
(
check
,
"OK"
if
check
.
retry_count
==
0
else
"retrying"
))
report
+=
"Check %s is %s
\n
"
%
(
check
,
"OK"
if
check
.
retry_count
==
0
else
"retrying"
)
return
(
report
,
has_error
)
def
usr1_handler
(
signum
,
frame
):
(
report
,
err
)
=
create_report
()
print
(
"Signal SIGUSR1 caught, printing state of checks."
)
print
(
report
)
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