String type = notification.getType();
if (notification instanceof MonitorNotification) {
MonitorNotification notif = (MonitorNotification)notification;
String attribute = notif.getObservedAttribute();
ObjectName obsObj = notif.getObservedObject();
Object derivedGauge = notif.getDerivedGauge();
Object trigger = notif.getTrigger();
if (type.equals(MonitorNotification.THRESHOLD_VALUE_EXCEEDED)) {
trace("THRESHOLD EXCEEDED: Attribute: " + attribute + ", Object: "
+ obsObj + ", Derived Gauge: " + derivedGauge + ", Trigger: "
+ trigger);
}
else if (type.equals(MonitorNotification.STRING_TO_COMPARE_VALUE_DIFFERED)) {
trace("STRING DIFFERS: Attribute: " + attribute + ", Object: "
+ obsObj + ", Derived Gauge: " + derivedGauge + ", Trigger: "
+ trigger);
}
else if (type.equals(MonitorNotification.STRING_TO_COMPARE_VALUE_MATCHED)) {
trace("STRING MATCHES: Attribute: " + attribute + ", Object: "
+ obsObj + ", Derived Gauge: " + derivedGauge + ", Trigger: "
+ trigger);
}
else if (type.equals(MonitorNotification.OBSERVED_ATTRIBUTE_ERROR)) {
trace("ATTRIBUTE ERROR (" + attribute + "): " + notif.getMessage());
}
else if (type.equals(MonitorNotification.OBSERVED_ATTRIBUTE_TYPE_ERROR)) {
trace("ATTRIBUTE TYPE ERROR (" + attribute + "): " + notif.getMessage());
}
else if (type.equals(MonitorNotification.OBSERVED_OBJECT_ERROR)) {
trace("OBJECT ERROR (" + obsObj + "): " + notif.getMessage());
}
else if (type.equals(MonitorNotification.RUNTIME_ERROR)) {
trace("RUNTIME ERROR (" + obsObj + "): " + notif.getMessage());
}
else if (type.equals(MonitorNotification.THRESHOLD_ERROR)) {
trace("THRESHOLD ERROR (" + obsObj + "): " + notif.getMessage());
}
}