From: Ruuska, R. <rr...@su...> - 2012-03-08 21:48:48
|
If anyone cares, I solved this issue with the following code: } else if (NotificationManager.PARAM_SUBJECT.equals(arg.getSwitch())) { log().debug("Found: PARAM_SUBJECT"); String strreplacertemp = arg.getValue(); if (strreplacertemp.contains("RESOLVED")){ String strreplacernew = strreplacertemp.replaceAll("RESOLVED: ", ""); String strreplacerfinal = strreplacernew.replaceAll("DOWN", "UP"); jm.setSubject(strreplacerfinal); } else { jm.setSubject(arg.getValue()); } } Thanks, Ryan From: Ruuska, Ryan Sent: Tuesday, March 06, 2012 1:26 PM To: OpenNMS Code Development and Bugs Subject: Re: [opennms-devel] Auto-notification change I found the following piece in JavaMailNotificationStrategy.java. I'm thinking it would be enough to take the arg.getValue statement within the PARAM_SUBJECT area, and do some sort of regex to check if "RESOLVED:" exists, and if so then remove it and replace "DOWN" with "UP". I'd like to get some thoughts on if this could possibly work before starting though. private JavaMailer buildMessage(List<Argument> arguments) throws JavaMailerException { JavaMailer jm = new JavaMailer(); for (int i = 0; i < arguments.size(); i++) { Argument arg = arguments.get(i); log().debug("Current arg switch: " + i + " of " + arguments.size() + " is: " + arg.getSwitch()); log().debug("Current arg value: " + i + " of " + arguments.size() + " is: " + arg.getValue()); /* * Note: The recipient gets set by whichever of the two switches: * (PARAM_EMAIL or PARAM_PAGER_EMAIL) are specified last in the * notificationCommands.xml file * * And the message body will get set to whichever is set last * (PARAM_NUM_MSG or PARAM_TEXT_MSG) */ if (NotificationManager.PARAM_EMAIL.equals(arg.getSwitch())) { log().debug("Found: PARAM_EMAIL"); jm.setTo(arg.getValue()); } else if (NotificationManager.PARAM_PAGER_EMAIL.equals(arg.getSwitch())) { log().debug("Found: PARAM_PAGER_EMAIL"); jm.setTo(arg.getValue()); } else if (NotificationManager.PARAM_SUBJECT.equals(arg.getSwitch())) { log().debug("Found: PARAM_SUBJECT"); jm.setSubject(arg.getValue()); } else if (NotificationManager.PARAM_NUM_MSG.equals(arg.getSwitch())) { log().debug("Found: PARAM_NUM_MSG"); jm.setMessageText(arg.getValue()); } else if (NotificationManager.PARAM_TEXT_MSG.equals(arg.getSwitch())) { log().debug("Found: PARAM_TEXT_MSG"); jm.setMessageText(arg.getValue()); } } return jm; } From: Ruuska, Ryan Sent: Monday, March 05, 2012 10:36 AM To: ope...@li...<mailto:ope...@li...> Subject: [opennms-devel] Auto-notification change Hi all, I want to change how the auto-notify feature works in our environment. I want to get rid of the resolution-prefix and make it act more like a nodeUp notification. For example, I want to to keep using auto-notify but the resolved notification should come across as "%nodelabel% is UP" instead of "RESOLVED: %nodelabel% is DOWN". I assume I need to be looking in \opennms-services\src\main\java\org\opennms\netmgt\notifd, but I'm lost from there. Can someone point me in the right direction? Thanks! Edit: I accidentally posted this to opennms-discuss. Sorry. Regards, Ryan Ruuska Systems Engineer Suburban Imaging 4801 West 81st Street Suite 119 Bloomington, MN 55437 (952) 837-9775 - Helpdesk (952) 837-9742 - Direct ---- Privacy Notice: The information transmitted in this e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material, including "protected health information". If you are not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please destroy and delete this message from any computer and contact us immediately by return e-mail. ---- Privacy Notice: The information transmitted in this e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material, including "protected health information". If you are not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please destroy and delete this message from any computer and contact us immediately by return e-mail. ---- Privacy Notice: The information transmitted in this e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material, including "protected health information". If you are not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please destroy and delete this message from any computer and contact us immediately by return e-mail. |