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
59fb191b
Commit
59fb191b
authored
Aug 31, 2014
by
Jonathan Michalon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give information about failure duration in recovery notification
parent
78fcca71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
picomon/mails.py
picomon/mails.py
+11
-4
No files found.
picomon/mails.py
View file @
59fb191b
...
...
@@ -5,6 +5,7 @@ from email.utils import make_msgid
from
collections
import
defaultdict
from
sys
import
stderr
from
time
import
strftime
from
datetime
import
datetime
,
timedelta
import
email.charset
from
threading
import
Thread
import
queue
...
...
@@ -99,10 +100,16 @@ def send_email_for_check(check):
check
=
check
.
__class__
.
__name__
,
dest
=
check
.
target_name
))
msg_text
=
''
if
not
check
.
ok
:
msg_text
+=
(
"Check %s failed:
\n
%s"
%
(
str
(
check
),
check
.
errmsg
.
strip
()))
msg_text
=
"Check %s:
\n
"
%
str
(
check
)
if
check
.
ok
:
delta
=
datetime
.
now
()
-
check
.
failure_date
# remove microsec
delta
=
delta
-
timedelta
(
microseconds
=
delta
.
microseconds
)
n
=
delta
//
timedelta
(
seconds
=
check
.
error_every
*
config
.
base_tick
)
msg_text
+=
(
"recovered after %s (%d %s)."
%
(
delta
,
n
,
"retry"
if
n
==
1
else
"retries"
))
else
:
msg_text
+=
(
"failure:
\n
%s"
%
check
.
errmsg
.
strip
())
extra_headers
=
{}
extra_headers
[
'Message-ID'
]
=
make_msgid
(
type
(
check
).
__name__
)
...
...
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