Ejemplo n.º 1
0
 def notify(self):
     NagiosNotification.notify(self)
     msg = []
     for line in (self.template % self.vars).split("\n"):
         if not line == "" and not line.strip().endswith(":"):
             msg.append(line)
     self.bot.inchan(self.channel, "say %s" % ", ".join(msg))
Ejemplo n.º 2
0
 def parseArgs(self):
     opts, args = NagiosNotification.parseArgs(self)
     if not opts.socket:
         print "Socket not defined."
         self.usage()
     if not opts.channel:
         print "Channel not defined."
         self.usage()
     self.bot = Kibot(opts.socket)
     self.channel = opts.channel
     self.errorEmail = opts.errorEmail
     return opts, args
Ejemplo n.º 3
0
 def setupParser(self):
     p = NagiosNotification.setupParser(self)
     p.add_option('-d', '--dest-email', dest='emailAddr', 
                  help='email address to send to')
     p.add_option('-f', '--from-email', dest='fromEmail',
                  help='email address to send from')
     p.add_option('-n', '--from-name', dest='fromName',
                  help='name to send email from')
     p.add_option('-e', '--error-email', dest='errorEmail', 
                  default='root@localhost', 
                  help='email address to send errors to')
     return p
Ejemplo n.º 4
0
 def parseArgs(self):
     opts, args = NagiosNotification.parseArgs(self)
     if not opts.fromEmail:
         print "Source email address not defined."
         self.usage()
     if not opts.fromName:
         print "Name to send email from not defined."
         self.usage()
     if opts.emailAddr:
         self.emailAddr = opts.emailAddr
     elif self.vars['contactemail'] != '':
         self.emailAddr = self.vars['contactemail']
     else:
         print "Contact email not defined."
         self.usage()
     self.fromEmail = opts.fromEmail
     self.fromName = opts.fromName
     self.errorEmail = opts.errorEmail
     return opts, args
Ejemplo n.º 5
0
 def setupParser(self):
     p = NagiosNotification.setupParser(self)
     p.add_option("-s", "--socket", dest="socket", help="path to kibot socket")
     p.add_option("-c", "--channel", dest="channel", help="channel to send notification on")
     p.add_option("-e", "--error", dest="errorEmail", help="email to send tracebacks to")
     return p
Ejemplo n.º 6
0
 def notify(self):
     NagiosNotification.notify(self)
     subject = self.subject_template % self.vars
     body = self.template % self.vars
     self.send(subject, body)