log("EmailAlarming", $recipient, LOG_INFO); $logger->log("EmailAlarming", $subject, LOG_INFO); $logger->log("EmailAlarming", $message, LOG_INFO); return true; } public function processAlarm ( InstAddr $inst_addr, // instance address $evt_time, // event time EventSpec $evt_spec, // event specification ServInfl $serv_infl = null, // service influence AlarmSevty $perc_sev = null, // perceived severity $src_host_name = null, // source host name (local if null) HostAddr $src_host_addr = null, // source host address HostAddr $tgt_host_addr = null // target host address ) { // check input if ($tgt_host_addr == null) throw new Exception("no email target given"); if (! $tgt_host_addr->getSelector()->equals(new HostAddrSel("host_name"))) throw new Exception("no email address given"); $logger = Logger::getInstance(); try { $email = $tgt_host_addr->getValue(); $logger->log(__FILE__, "Sending email to $email"); $logger->log(__FILE__, " instance address : $inst_addr"); $logger->log(__FILE__, " event time : $evt_time"); $logger->log(__FILE__, " event specification: $evt_spec"); $logger->log(__FILE__, " service influence : $serv_infl"); $logger->log(__FILE__, " perceived severity : $perc_sev"); $logger->log(__FILE__, " source host name : $src_host_name"); $logger->log(__FILE__, " source host address: $src_host_addr"); // send e-mail $message = <<send_mail($email, "System Alarming", $message); if (! $rc) throw new Exception("EmailAlarming failed: $rc"); } catch(Exception $e) { // alarm processing must not die du to problems with remote host $logger->logException(__CLASS__, $e); } } }