AppD Archive

Creating events via the rest api

CommunityUser
Splunk Employee
Splunk Employee

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

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

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() {

}

}

0 Karma

Matt_Jensen
Explorer

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. 

 
Thanks!
Matt
0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Is there anything I can do to "vote" for it to be prioritized?

JK

0 Karma

Matt_Jensen
Explorer
Yep! Please send me your company name (via PM if you like) and I'll add you to the list of customers requesting this update, which will give it more weight and we can contact you once its been added.

Thanks
Matt
0 Karma
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...