Hello,
I've found the documentation on the REST API for creating events in AppDynamics but is no information on setting the tier or node the event applies to. Am I simply missing the magic parameter names to use?
http://docs.appdynamics.com/display/PRO14S/Use+the+AppDynamics+REST+API
JK
You can use the SDK to create an Event and pass it a Map with as many Name/Value pairs as you like. I used it with apache commons io and generated an Event every time a file was dropped in a Directory.
package com.appdynamics.logagent;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.monitor.FileAlterationListenerAdaptor;
import org.apache.commons.io.monitor.FileAlterationObserver;
import org.apache.log4j.Logger;
import com.appdynamics.apm.appagent.api.AgentDelegate;
import com.appdynamics.apm.appagent.api.IMetricAndEventReporter;
import com.appdynamics.apm.appagent.api.ITransactionDemarcator;
public class EventGenerator extends FileAlterationListenerAdaptor {
static final Logger logger = Logger.getLogger(EventGenerator.class);
public EventGenerator() {
super();
}
/**
* File created Event.
*
* @param file
* The file created (ignored)
*/
public void onFileCreate(final File file) {
logger.info(" onFileCreate :" + file.toString());
IMetricAndEventReporter metricEventSender = AgentDelegate
.getMetricAndEventPublisher();
Map<String, String> eventDetails = new HashMap<String, String>();
eventDetails.put("LogDirectoryMonitor", "INFO");
eventDetails.put("severity", "INFO");
eventDetails.put("fileName", file.getName());
eventDetails.put("Absolute File", file.getAbsolutePath());
eventDetails.put("FileSize", new Long(file.getTotalSpace()).toString() + " bytes");
metricEventSender.publishInfoEvent("New Universal Log File", eventDetails);
}
public void generateInformationEvent() {
}
}
Unfortunately events created via REST can only be associated at the Application level at this time. There's a use case already submitted to the team to make this feature available in the future however it hasn't been prioritized at this point.
Is there anything I can do to "vote" for it to be prioritized?
JK