}
public void sendAlert(String name, String json) {
broker.alert(name, json);
}
public void sendEvent(StratconMessage m) {
Event e = null;
NoitMetricNumeric nmn = null;
NoitMetricText nmt = null;
NoitStatus ns = null;
if (m instanceof NoitMetric) {
NoitMetric nm = (NoitMetric)m;
if(nm.isNumeric()) nmn = nm.getNumeric();
if(nm.isText()) nmt = nm.getText();
}
else if (m instanceof NoitMetricNumeric) {
nmn = (NoitMetricNumeric)m;
}
else if (m instanceof NoitMetricText) {
nmt = (NoitMetricText)m;
}
else if (m instanceof NoitStatus) {
ns = (NoitStatus)m;
}
if(nmn != null) {
PersistentVector tags = PersistentVector.create(new java.lang.String[] {
"reconnoiter",
"check:" + nmn.getUuid(),
"name:" + nmn.getCheck_name(),
"module:" + nmn.getCheck_module(),
"noit:" + nmn.getNoit(),
"type:numeric" });
e = new Event(nmn.getCheck_target(), // host
nmn.getName(), // service
null, // state
null, // description
nmn.getValue(), // value
tags, // tags
nmn.getTime()/1000, //time
10); //ttl
}
else if(nmt != null) {
PersistentVector tags = PersistentVector.create(new java.lang.String[] {
"reconnoiter",
"check:" + nmt.getUuid(),
"name:" + nmt.getCheck_name(),
"module:" + nmt.getCheck_module(),
"noit:" + nmt.getNoit(),
"type:text" });
e = new Event(nmt.getCheck_target(), // host
nmt.getName(), // service
null, // state
nmt.getMessage(), // description
null, // value
tags, // tags
nmt.getTime()/1000, //time
10); //ttl
}
if (ns != null) {
PersistentVector tags = PersistentVector.create(new java.lang.String[] {
"reconnoiter",
"check:" + ns.getUuid(),
"name:" + ns.getCheck_name(),
"module:" + ns.getCheck_module(),
"noit:" + ns.getNoit(),
"availability:" + ns.getAvailability(),
"type:status" });
e = new Event(ns.getCheck_target(), // host
"status", // service
ns.getState(), // state
ns.getStatus(), // description
ns.getDuration(), // value
tags, // tags