Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
temperature-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stustanet
temperature-daemon
Commits
c214e814
Commit
c214e814
authored
7 years ago
by
root
Browse files
Options
Downloads
Patches
Plain Diff
updated to running version
parent
f077ee46
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
temperdaemon.py
+18
-4
18 additions, 4 deletions
temperdaemon.py
with
18 additions
and
4 deletions
temperdaemon.py
+
18
−
4
View file @
c214e814
...
...
@@ -31,6 +31,8 @@ HOSTNAME = "hugin.stusta.mhn.de"
FLOOR_LIMIT
=
25
CEILING_LIMIT
=
30
CEILING_LIMIT_EMR
=
42
FLOOR_LIMIT_EMR
=
38
MAX_OUTDOOR_DIFF
=
15
MAILINTERVAL
=
3600
...
...
@@ -88,16 +90,19 @@ oo $ $ "$ o$$$$$$$$$ $$$$$$$$$$$$$ $$$$$$$$$o $$$o$$o$
msg
=
MIMEText
(
body
.
format
(
floor
,
ceiling
,
outdoor
),
_charset
=
"
UTF-8
"
)
src
=
"
Temperator <root@hugin.stusta.mhn.de>
"
msg
[
'
Subject
'
]
=
u
"
Temperaturalarm Serverraum
"
if
(
ceiling
>
CEILING_LIMIT_EMR
)
or
(
floor
>
FLOOR_LIMIT_EMR
):
msg
[
'
Subject
'
]
=
u
"
TEMPERATURNOTFALL Serverraum!
"
else
:
msg
[
'
Subject
'
]
=
u
"
Temperaturalarm Serverraum
"
msg
[
'
From
'
]
=
src
if
SPAM
:
dst
=
[
"
jn@stusta.de
"
,
"
maxi@stusta.de
"
,
"
markus.hefele@stusta.net
"
]
dst
=
[
"
markus.hefele@stusta.net
"
]
else
:
dst
=
[
"
admins@stustanet.de
"
]
msg
[
'
To
'
]
=
"
,
"
.
join
(
dst
)
msg
[
'
Date
'
]
=
formatdate
(
localtime
=
True
)
self
.
mail_queue
.
put
((
src
,
dst
,
msg
.
as_string
()))
#
self.mail_queue.put((src, dst, msg.as_string()))
def
run
(
self
):
while
True
:
...
...
@@ -182,6 +187,12 @@ oo $ $ "$ o$$$$$$$$$ $$$$$$$$$$$$$ $$$$$$$$$o $$$o$$o$
self
.
last_mail
=
now
self
.
queue_mail
(
floor
,
ceiling
,
outdoor
)
if
(
self
.
iteration
>
1
and
self
.
last_mail
+
300
<
now
and
(
ceiling
>
CEILING_LIMIT_EMR
or
floor
>
FLOOR_LIMIT_EMR
)):
self
.
last_mail
=
now
self
.
queue_mail
(
floor
,
ceiling
,
outdoor
)
logger
.
debug
(
"
--------------EMERGENCY------------
"
)
sys
.
stdout
.
flush
()
wait
=
start
+
READINGINTERVAL
-
time
.
time
()
...
...
@@ -203,10 +214,13 @@ class Mail0r(threading.Thread):
continue
try
:
s
=
smtplib
.
SMTP
(
"
localhost
"
)
#s = smtplib.SMTP("localhost")
#we don't have a local mta anymore
s
=
smtplib
.
SMTP
(
"
mail.stusta.mhn.de
"
)
s
.
sendmail
(
sender
,
recipient
,
msg
)
s
.
quit
()
except
Exception
as
e
:
logger
.
debug
(
"
----ERROR---MAIL----
"
)
logger
.
debug
(
e
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment