Exemplo n.º 1
0
 def __init__(self):
     self.ems_mysql=insertDBdata._MySQL(host='localhost',port=3306,user='******',passwd='emsadmin',db='emsdb')
Exemplo n.º 2
0
import insertDBdata
import json
import time

host = '10.178.250.33'
port = 3306
user = '******'
passwd = 'emsadmin'
db = 'emsdb'

alert_count = 0

#global VAR
ISOTIMEFORMAT = '%Y-%m-%d %X'

mysql = insertDBdata._MySQL(host, port, user, passwd, db)

""" ------- Send SMS/Email for heartbeat alert -------"""     
def heartbeatAlert():
    sql = 'select phone from v_subscription where alert_subscription="yes"'
    datalist = insertDBdata.get_data(mysql, sql)
    smslist = []
    for row in datalist:
        smslist.append(row[0]+'@sms.ericsson.com')
    sql = 'select email from v_subscription where alert_subscription="yes"'
    datalist = insertDBdata.get_data(mysql, sql)
    emaillist = []
    for row in datalist:
        emaillist.append(row[0])
    subjectSMS = '[EMS Communication Loss Alert]'
    subjectMail = 'EMS Communication Loss Alert'