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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
arn
picomon
Commits
0ceb4ff5
Commit
0ceb4ff5
authored
Jul 20, 2014
by
Jonathan Michalon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add report feature
parent
50fcd4eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
lib/mails.py
lib/mails.py
+3
-0
picomon.py
picomon.py
+9
-0
No files found.
lib/mails.py
View file @
0ceb4ff5
...
@@ -113,3 +113,6 @@ def send_email_for_check(check):
...
@@ -113,3 +113,6 @@ def send_email_for_check(check):
_send_email
(
subject
,
msg_text
,
extra_headers
)
_send_email
(
subject
,
msg_text
,
extra_headers
)
def
send_email_report
(
text
):
from
.
import
config
_send_email
(
config
.
emails
.
report
.
subject
,
text
)
picomon.py
View file @
0ceb4ff5
...
@@ -30,11 +30,20 @@ def usr1_handler(signum, frame):
...
@@ -30,11 +30,20 @@ def usr1_handler(signum, frame):
print
(
"Signal SIGUSR1 caught, printing state of checks."
)
print
(
"Signal SIGUSR1 caught, printing state of checks."
)
print
(
report
)
print
(
report
)
def
alarm_handler
(
signum
,
frame
):
(
report
,
err
)
=
create_report
()
if
err
:
mails
.
send_email_report
(
report
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
# register signal handling
# register signal handling
signal
.
signal
(
signal
.
SIGUSR1
,
usr1_handler
)
signal
.
signal
(
signal
.
SIGUSR1
,
usr1_handler
)
signal
.
signal
(
signal
.
SIGALRM
,
alarm_handler
)
# register report signal interval
if
config
.
emails
.
report
.
every
>
0
:
signal
.
setitimer
(
signal
.
ITIMER_REAL
,
60
,
config
.
emails
.
report
.
every
)
# Parse command line
# Parse command line
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
...
...
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