Skip to content
Snippets Groups Projects
Commit 558e0154 authored by Claudio Scafuri's avatar Claudio Scafuri :speech_balloon:
Browse files

initial import from CVS repo fermi/servers/alarmmail release_04

parent 40c76640
No related branches found
No related tags found
No related merge requests found
.pydevproject
.project
.cproject
.settings
obj
bin
core*
*~
*.pyc
*.so
*.so*
.pylintrc
.metadata
.idea
.cvsignore
.nse_depinfo
software
oldsrc
CVS
*-srv
LICENSE 0 → 100644
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
Makefile 0 → 100644
NAME_SRV=alarm-mail
PY_FILES += $(wildcard src/*.py)
default: bin/${NAME_SRV} ${PY_FILES}
@cp ${PY_FILES} bin/${NAME_SRV}
bin/${NAME_SRV}:
@test -d $@ || mkdirhier $@
clean:
@rm -fr bin/ src/*~
.PHONY: clean
# alarm-mail
# Project Name
alarm-mail
## Description
tango server for dispatching alarm notifcations vie e-mail
## Dependencies
The device is written in python 2.7 and needs the tango python bindings
## Installation & deployment
follow the standard of python tango servers
## History
2020-05-13: creation of project
## Credits
Graziano Scalamera
Elettra-Sincrotrone Trieste S.C.p.A. di interesse nazionale
Strada Statale 14 - km 163,5 in AREA Science Park
34149 Basovizza, Trieste ITALY
## License
GPL 3
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# "$Name: $";
# "$Header: /home/cvsadm/cvsroot/fermi/servers/alarmmail/AlarmMail.py,v 1.6 2019-06-20 11:52:19 graziano Exp $";
# ############################################################################
# license :
# ============================================================================
#
# File : AlarmMail.py
#
# Project : Alarm Mail Notification
#
# This file is part of Tango device class.
#
# Tango is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tango is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Tango. If not, see <http://www.gnu.org/licenses/>.
#
#
# $Author : graziano.scalamera$
#
# $Revision : $
#
# $Date : $
#
# $HeadUrl : $
# ============================================================================
# This file is generated by POGO
# (Program Obviously used to Generate tango Object)
# ############################################################################
__all__ = ["AlarmMail", "AlarmMailClass", "main"]
__docformat__ = 'restructuredtext'
import PyTango
import sys
# Add additional import
#----- PROTECTED REGION ID(AlarmMail.additionnal_import) ENABLED START -----#
import smtplib
from email.mime.text import MIMEText
import mysql.connector
from mysql.connector import errorcode
from datetime import datetime, timedelta
import re
#----- PROTECTED REGION END -----# // AlarmMail.additionnal_import
# Device States Description
# No states for this device
class AlarmMail (PyTango.Device_4Impl):
""""""
# -------- Add you global variables here --------------------------
#----- PROTECTED REGION ID(AlarmMail.global_variables) ENABLED START -----#
addressBook= {
}
att_conf_Map= {
}
att_conf_fqdn_Map= {
}
#----- PROTECTED REGION END -----# // AlarmMail.global_variables
def __init__(self, cl, name):
PyTango.Device_4Impl.__init__(self,cl,name)
self.debug_stream("In __init__()")
AlarmMail.init_device(self)
#----- PROTECTED REGION ID(AlarmMail.__init__) ENABLED START -----#
#----- PROTECTED REGION END -----# // AlarmMail.__init__
def delete_device(self):
self.debug_stream("In delete_device()")
#----- PROTECTED REGION ID(AlarmMail.delete_device) ENABLED START -----#
#----- PROTECTED REGION END -----# // AlarmMail.delete_device
def init_device(self):
self.debug_stream("In init_device()")
self.get_device_properties(self.get_device_class())
#----- PROTECTED REGION ID(AlarmMail.init_device) ENABLED START -----#
for dest in self.receivers:
self.addressBook[dest.split('=')[0]] = dest.split('=')[1]
hdbpp=mysql.connector.MySQLConnection()
try:
hdbpp = mysql.connector.connect(user=self.hdbpp_user, password=self.hdbpp_password, host=self.hdbpp_host, database=self.hdbpp_dbname)
hdbppcursor = hdbpp.cursor(named_tuple=True)
hdbppcursor.execute("SELECT att_name, att_conf_id FROM att_conf")
word = '([a-zA-Z0-9\+\._\*\#\-\:]+)'
for row in hdbppcursor:
self.att_conf_fqdn_Map[row.att_name] = row.att_conf_id
m = re.compile("tango://"+word+"/"+word+"/"+word+"/"+word+"/"+word).match(row.att_name)
if m is not None:
att=m.groups()[1]+"/"+m.groups()[2]+"/"+m.groups()[3]+"/"+m.groups()[4]
#print("* TANGO_HOST:{tango_host} -> {att_name}: {att_conf_id}".format(
# tango_host=m.groups()[0],
# att_name=att,
# att_conf_id=row.att_conf_id
#))
else:
att=row.att_name
#print("* TANGO_HOST:default -> {att_name}: {att_conf_id}".format(
# att_name=att,
# att_conf_id=row.att_conf_id
#))
self.att_conf_Map[att] = row.att_conf_id
except mysql.connector.Error as err:
if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
self.set_status("HDB++: wrong username or password")
elif err.errno == errorcode.ER_BAD_DB_ERROR:
self.set_status("HDB++: database not existing")
else:
self.set_status("HDB++: " + err)
hdbpp.close()
#----- PROTECTED REGION END -----# // AlarmMail.init_device
def always_executed_hook(self):
self.debug_stream("In always_excuted_hook()")
#----- PROTECTED REGION ID(AlarmMail.always_executed_hook) ENABLED START -----#
#----- PROTECTED REGION END -----# // AlarmMail.always_executed_hook
# -------------------------------------------------------------------------
# AlarmMail read/write attribute methods
# -------------------------------------------------------------------------
def read_attr_hardware(self, data):
self.debug_stream("In read_attr_hardware()")
#----- PROTECTED REGION ID(AlarmMail.read_attr_hardware) ENABLED START -----#
#----- PROTECTED REGION END -----# // AlarmMail.read_attr_hardware
# -------------------------------------------------------------------------
# AlarmMail command methods
# -------------------------------------------------------------------------
def SendAlarm(self, argin):
"""
:param argin:
:type argin: PyTango.DevString
"""
self.debug_stream("In SendAlarm()")
#----- PROTECTED REGION ID(AlarmMail.SendAlarm) ENABLED START -----#
params= {
}
for param in argin.split(';'):
params[param.split('=',1)[0]] = param.split('=',1)[1]
#print('looping param=' + param)
#print(params)
dtnow = datetime.now()
dtstart = dtnow - timedelta(hours=24)
dtnow = dtnow + timedelta(hours=1)
stop_date = dtnow.strftime("%Y-%m-%d %H:%M:%S")
start_date = dtstart.strftime("%Y-%m-%d %H:%M:%S")
#values= {
#}
msg_link = ''
att_conf_str = ''
for value in params['values'].split(','):
#values[value.split('=',1)[0]] = value.split('=',1)[1]
att = value.split('=',1)[0]
if len(att) == 0:
continue
print('looping value=' + value + 'len(value.split(''='',1)[0])=')
print(len(att))
print(' -> ' + value.split('=',1)[0])
word = '([a-zA-Z0-9\+\._\*\#\-\:]+)'
#ind = r'\[[0-9]+\]);'
ind = r'\[(.*?)\]'
try:
m = re.compile("tango://"+word+"/"+word+"/"+word+"/"+word+"/"+word+ind).match(att) #match fqdn with ind
if m is not None:
att="tango://"+m.groups()[0]+"/"+m.groups()[1]+"/"+m.groups()[2]+"/"+m.groups()[3]+"/"+m.groups()[4]
att_conf_id=self.att_conf_fqdn_Map[att]
else:
m1 = re.compile(word+"/"+word+"/"+word+"/"+word+ind).match(value.split('=',1)[0]) #match NOT fqdn with ind
if m1 is not None:
att=m1.groups()[0]+"/"+m1.groups()[1]+"/"+m1.groups()[2]+"/"+m1.groups()[3]
att_conf_id=self.att_conf_Map[att]
else:
m2 = re.compile("tango://"+word+"/"+word+"/"+word+"/"+word+"/"+word).match(att) #match fqdn without ind
if m2 is not None:
att="tango://"+m2.groups()[0]+"/"+m2.groups()[1]+"/"+m2.groups()[2]+"/"+m2.groups()[3]+"/"+m2.groups()[4]
att_conf_id=self.att_conf_fqdn_Map[att]
else: #try NOT fqdn without ind
att=value.split('=',1)[0]
att_conf_id=self.att_conf_Map[att]
if len(att_conf_str) == 0:
att_conf_str = str(att_conf_id)+',1,1'
else:
att_conf_str += ';' + str(att_conf_id)+',1,1'
except Exception, e:
print 'Cannot find att_conf_id for ', value
print e
if len(att_conf_str) > 0:
link = 'http://fcsproxy.elettra.trieste.it/docs/egiga2m/egiga2m.html?conf=fermi_hdbpp&start='+start_date+'&stop='+stop_date+'&ts='+att_conf_str+'&show_error='
msg_link = '<a href="'+link+'">'+link+'</a><br>'
if len(msg_link) == 0:
msg = MIMEText('NEW ALARM DETECTED: \nName: ' +params['name'] + '\nMessage: ' + params['msg'] + '\nValues: ' + params['values'] + '\nFormula: ' + params['formula'])
else:
msg = MIMEText('<html><head></head><body><p>NEW ALARM DETECTED: <br>Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' +params['name'] + '<br>Message: &nbsp;&nbsp;' + params['msg'] + '<br>Values: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + params['values'] + '<br>Formula: &nbsp;&nbsp;' + params['formula']+'<br><br>HDB++ eGiga link:<br><br>'+msg_link+'</p></body></html>','html')
msg['Subject'] = 'ALARMED ' + params['name'] + ' - ' + params['msg']
msg['From'] = '"'+ self.email_name +'"<'+self.email_user+'>'
groups = params['groups']
receive = ''
first = True
for gr in groups.split('|'):
#print('looping gr=' + gr)
#print(' -> address=' + self.addressBook[gr])
if first:
receive = receive + self.addressBook[gr]
first = False
else:
receive = receive + ',' + self.addressBook[gr]
#print('msg to=' + receive)
msg['To'] = receive
#msg['To'] = self.addressBook[groups] + ','
s = smtplib.SMTP(self.email_smtp)
s.sendmail(self.email_user,msg["To"].split(","), msg.as_string())
s.quit()
#----- PROTECTED REGION END -----# // AlarmMail.SendAlarm
def SendNormal(self, argin):
"""
:param argin:
:type argin: PyTango.DevString
"""
self.debug_stream("In SendNormal()")
#----- PROTECTED REGION ID(AlarmMail.SendNormal) ENABLED START -----#
params= {
}
for param in argin.split(';'):
params[param.split('=',1)[0]] = param.split('=',1)[1]
#print('looping param=' + param)
#print(params)
msg = MIMEText('RESTORED TO NORMAL CONDITION: \nName: ' +params['name'] + '\nMessage: ' + params['msg'] + '\nValues: ' + params['values'] + '\nFormula: ' + params['formula'])
msg['Subject'] = 'RESTORED ' + params['name'] + ' - ' + params['msg']
msg['From'] = '"'+ self.email_name +'"<'+self.email_user+'>'
groups = params['groups']
receive = ''
first = True
for gr in groups.split('|'):
#print('looping gr=' + gr)
print(' -> address=' + self.addressBook[gr])
if first:
receive = receive + self.addressBook[gr]
first = False
else:
receive = receive + ',' + self.addressBook[gr]
#print('groups split=' + groups.split('|'))
#print('msg to=' + receive)
msg['To'] = receive
#msg['To'] = self.addressBook[groups] + ','
s = smtplib.SMTP(self.email_smtp)
s.sendmail(self.email_user,msg["To"].split(","), msg.as_string())
s.quit()
#----- PROTECTED REGION END -----# // AlarmMail.SendNormal
def SendAlarmHDB(self, argin):
"""
:param argin:
:type argin: PyTango.DevString
"""
self.debug_stream("In SendAlarmHDB()")
#----- PROTECTED REGION ID(AlarmMail.SendAlarmHDB) ENABLED START -----#
params= {
}
for param in argin.split(';'):
params[param.split('=',1)[0]] = param.split('=',1)[1]
#print('looping param=' + param)
print(params)
word = '([a-zA-Z0-9\+\._\*\#\-]+)'
m = re.compile(word+"/"+word+"/"+word+"/"+word).match(params['name'])
if m is not None:
hdbppes = m.groups()[0]+"/"+m.groups()[1]+"/"+m.groups()[2]
dev = PyTango.DeviceProxy(hdbppes)
try:
#tmp_nok = dev.read_attribute("AttributeNokList")
tmp_errs = dev.read_attribute("AttributeErrorList")
tmp_list = dev.read_attribute("AttributeList")
#nok_list = tmp_nok.value
err_list = tmp_errs.value
att_list = tmp_list.value
comb_list = map(lambda x,y:(x,y),att_list,err_list)
except (DevFailed,ConnectionFailed,EventSystemFailed),e:
print 'Error read_attribute: %s' % (e[0]['desc'])
msg_hdb = ''
for iii in comb_list:
if len(iii[1]) > 0:
msg_hdb += iii[0]+'\n'+iii[1]+'\n\n'
msg = MIMEText('NEW ALARM DETECTED: \nName: ' +params['name'] + '\nMessage: ' + params['msg'] + '\nValues: ' + params['values'] + '\nFormula: ' + params['formula']+'\n\nHDB++ Errors:\n\n'+msg_hdb)
msg['Subject'] = 'ALARMED ' + params['name'] + ' - ' + params['msg']
msg['From'] = '"'+ self.email_name +'"<'+self.email_user+'>'
groups = params['groups']
receive = ''
first = True
for gr in groups.split('|'):
#print('looping gr=' + gr)
#print(' -> address=' + self.addressBook[gr])
if first:
receive = receive + self.addressBook[gr]
first = False
else:
receive = receive + ',' + self.addressBook[gr]
#print('groups split=' + groups.split('|'))
#print('msg to=' + receive)
msg['To'] = receive
#msg['To'] = self.addressBook[groups] + ','
s = smtplib.SMTP(self.email_smtp)
s.sendmail(self.email_user,msg["To"].split(","), msg.as_string())
s.quit()
#----- PROTECTED REGION END -----# // AlarmMail.SendAlarmHDB
def SendAlarmPROCFS(self, argin):
"""
:param argin:
:type argin: PyTango.DevString
"""
self.debug_stream("In SendAlarmPROCFS()")
#----- PROTECTED REGION ID(AlarmMail.SendAlarmPROCFS) ENABLED START -----#
params= {
}
for param in argin.split(';'):
params[param.split('=',1)[0]] = param.split('=',1)[1]
#print('looping param=' + param)
#print(params)
try:
att_conf_id=self.att_conf_Map[params['name']]
dtnow = datetime.now()
dtstart = dtnow - timedelta(hours=24)
dtnow = dtnow + timedelta(hours=1)
stop_date = dtnow.strftime("%Y-%m-%d %H:%M:%S")
start_date = dtstart.strftime("%Y-%m-%d %H:%M:%S")
msg_procfs = 'http://fcsproxy.elettra.trieste.it/docs/egiga2m/egiga2m.html?conf=fermi_hdbpp&start='+start_date+'&stop='+stop_date+'&ts='+str(att_conf_id)+',1,1&show_error='
except Exception, e:
print 'Cannot find att_conf_id for', params['name']
msg_procfs = 'http://fcsproxy.elettra.trieste.it/docs/egiga2m/egiga2m.html?conf=fermi_hdbpp'
msg = MIMEText('<html><head></head><body><p>NEW ALARM DETECTED: <br>Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' +params['name'] + '<br>Message: &nbsp;&nbsp;' + params['msg'] + '<br>Values: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + params['values'] + '<br>Formula: &nbsp;&nbsp;' + params['formula']+'<br><br>HDB++ eGiga link:<br><br><a href="'+msg_procfs+'">'+msg_procfs+'</a></p></body></html>','html')
msg['Subject'] = 'ALARMED ' + params['name'] + ' - ' + params['msg']
msg['From'] = '"'+ self.email_name +'"<'+self.email_user+'>'
groups = params['groups']
receive = ''
first = True
for gr in groups.split('|'):
#print('looping gr=' + gr)
#print(' -> address=' + self.addressBook[gr])
if first:
receive = receive + self.addressBook[gr]
first = False
else:
receive = receive + ',' + self.addressBook[gr]
#print('groups split=' + groups.split('|'))
#print('msg to=' + receive)
msg['To'] = receive
#msg['To'] = self.addressBook[groups] + ','
s = smtplib.SMTP(self.email_smtp)
s.sendmail(self.email_user,msg["To"].split(","), msg.as_string())
s.quit()
#----- PROTECTED REGION END -----# // AlarmMail.SendAlarmPROCFS
#----- PROTECTED REGION ID(AlarmMail.programmer_methods) ENABLED START -----#
#----- PROTECTED REGION END -----# // AlarmMail.programmer_methods
class AlarmMailClass(PyTango.DeviceClass):
# -------- Add you global class variables here --------------------------
#----- PROTECTED REGION ID(AlarmMail.global_class_variables) ENABLED START -----#
#----- PROTECTED REGION END -----# // AlarmMail.global_class_variables
# Class Properties
class_property_list = {
}
# Device Properties
device_property_list = {
'receivers':
[PyTango.DevVarStringArray,
"groupname=email",
[] ],
'email_name':
[PyTango.DevString,
"email name",
["Control Alarms"] ],
'email_smtp':
[PyTango.DevString,
"SMTP server",
["smtp"] ],
'email_user':
[PyTango.DevString,
"email user",
[] ],
'hdbpp_user':
[PyTango.DevString,
'',
[] ],
'hdbpp_password':
[PyTango.DevString,
'',
[] ],
'hdbpp_host':
[PyTango.DevString,
'',
[] ],
'hdbpp_dbname':
[PyTango.DevString,
'',
[] ],
}
# Command definitions
cmd_list = {
'SendAlarm':
[[PyTango.DevString, "none"],
[PyTango.DevVoid, "none"]],
'SendNormal':
[[PyTango.DevString, "none"],
[PyTango.DevVoid, "none"]],
'SendAlarmHDB':
[[PyTango.DevString, "none"],
[PyTango.DevVoid, "none"]],
'SendAlarmPROCFS':
[[PyTango.DevString, "none"],
[PyTango.DevVoid, "none"]],
}
# Attribute definitions
attr_list = {
}
def main():
try:
py = PyTango.Util(sys.argv)
py.add_class(AlarmMailClass, AlarmMail, 'AlarmMail')
#----- PROTECTED REGION ID(AlarmMail.add_classes) ENABLED START -----#
#----- PROTECTED REGION END -----# // AlarmMail.add_classes
U = PyTango.Util.instance()
U.server_init()
U.server_run()
except PyTango.DevFailed as e:
print ('-------> Received a DevFailed exception:', e)
except Exception as e:
print ('-------> An unforeseen exception occured....', e)
if __name__ == '__main__':
main()
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="AlarmMail" pogoRevision="9.4">
<description description="" title="Alarm Mail Notification" sourcePath="/home/graziano/workspace/fermi/servers/alarmmail" language="Python" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at elettra.eu - graziano.scalamera" author="graziano.scalamera" emailDomain="elettra.eu" classFamily="Miscellaneous" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="none" reference=""/>
</description>
<deviceProperties name="receivers" description="groupname=email">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="email_name" description="email name">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>Control Alarms</DefaultPropValue>
</deviceProperties>
<deviceProperties name="email_smtp" description="SMTP server">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>smtp</DefaultPropValue>
</deviceProperties>
<deviceProperties name="email_user" description="email user">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="hdbpp_user" description="">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="hdbpp_password" description="">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="hdbpp_host" description="">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="hdbpp_dbname" description="">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device state">
<type xsi:type="pogoDsl:StateType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device status">
<type xsi:type="pogoDsl:ConstStringType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="SendAlarm" description="" execMethod="send_alarm" displayLevel="OPERATOR" polledPeriod="0">
<argin description="">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="SendNormal" description="" execMethod="send_normal" displayLevel="OPERATOR" polledPeriod="0">
<argin description="">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="SendAlarmHDB" description="" execMethod="send_alarm_hdb" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="SendAlarmPROCFS" description="" execMethod="send_alarm_procfs" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.2.5a/share/pogo/preferences"/>
</classes>
</pogoDsl:PogoSystem>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment