示例#1
0
#!/usr/bin/python

import parser

parser=parser.initparser("/etc/solomon/conf.d/global.conf")

pid=parser.get("global","pid")
log=parser.get("global","log")

check_interval=parser.get("global","check_interval")
retry_interval=parser.get("global","retry_interval")
retry_times=parser.get("global","retry_times")
event_handler=parser.get("global","event_handler")
示例#2
0
#!/usr/bin/python
#-*- coding:utf-8 -*-

import parser
import subprocess
import sys
import smtplib
from   email.mime.text import MIMEText
import time

parser=parser.initparser("/etc/solomon/conf.d/email.conf")

enabled=parser.get("email","enabled")
description=parser.get("email","description")
smtp_server=parser.get("email","smtp_server")
smtp_port=parser.get("email","smtp_port")
sender=parser.get("email","sender")
send_to=parser.get("email","to").split(':')
send_cc=parser.get("email","cc").split(':')
user=parser.get("email","user")
password=parser.get("email","password")
HOST=parser.get("email","host")

DATE=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))

def send_email(name):
	str="%s is down" % name
	RESON=str.upper()
	content='''<html>
            <hr/>
	    <font>%s因故障发生主备机切换,请通知运维人员检查并修复故障。</font><br><br>