How to build your own agent?

yCrash APIs provide a great option to create an agent. Anyone can create their own agent by making HTTP post requests to receiver API, receiver heap API, and fin API.  

Here is the one way to build an agent by using Jquery AJAX technology:

Make synchronous AJAX HTTP post request to below APIs:

APIDescription
Receiver APIReceiver API is used to transmit various artifacts such as garbage collection logs, thread dumps, top , disk usage, network stats, … from the target device to yCrash server.
Receiver Heap APIReceiver Heap API is used to transmit the  Heap dump file from the target device to the yCrash server.
Fin APIFin API is the last API call one should invoke after all yc-receiver API calls and yc-receiver-heap calls. This API will return back the RCA report URL that corresponds to the data that has been uploaded. The response will also contain detailed GC log, thread dump, heap dump metrics analysis report URLs.

API 1

Let’s create AJAX function to make an HTTP post request to Receiver API to transmit various artifacts(GC, thread dumps, top, disk usage……)

$.ajax({
url:"./yc-receiver?apiKey={ Your API Key }&de=172.31.22.190&ts=2020-07-01T08-19-09&dt=gc&app=soa&filename=gcLog.zip",        
type: 'POST'
data: log\dump file,
 });

AJAX Properties

URL/yc-receiver?apiKey={API Key }&dt={datatype}&ts={timestamp}&app={Appname}&de={device/host name}&fileName={filename}”,
TypePOST
datalog/dump file which is needs to uploaded

URL parameters

KeyValue
apiKeyYour API Key which we sent
deHost/Device name
tsTimestamp in “yyyy-mm-ddThh-mm-ss” this format 
dtThe type of data is uploaded. Below are the datatypes which need to be set as value:GC log: “gc”, Thread dump: “dt”, Top: “top”, VMstat: “vmstat”, Top-h: “toph”, DF: “df”, CPU: “cpu”, PS: “ps”, NETSTAT: “ns”.
appApplication name

API 2 

Let’s create one more AJAX function to make an HTTP post request to Receiver Heap API to transmit heap dumps:

$.ajax({
url:"./yc-receiver-heap?apiKey={ Your API Key }&de=172.31.22.190&ts=2020-07-01T08-19-09&app=soa&filename=heap.zip",        
type: 'POST'
data: heapDump file,
 });

AJAX Properties

URL/yc-receiver-heap?apiKey={API Key }&dt={datatype}&ts={timestamp}&app={Appname}&de={device/host name}&fileName={filename}”,
TypePOST
dataheapdump file which is needs to uploaded

URL parameters

KeyValue
apiKeyYour API Key which we sent
deHost/Device name
tsTimestamp in “yyyy-mm-ddThh-mm-ss” this format 
appApplication name

API 3 

Now let’s create one more AJAX function to make a last API call for Fin API which will send HTTP response which contains the RCA report URL.

$.ajax({
url:"./yc-fin?apiKey={ Your API Key }&de=172.31.22.190&uApp=t&ts=2020-07-01T08-19-09&app=soa",        
type:’POST’,
success: function (data) {
        	data.RCAReportURL; -----------> URL for the RCA report page
        },
 });

AJAX Properties

URL/yc-fin?apiKey={API Key }&dt={datatype}&ts={timestamp}&app={Appname}&de={device/host name}”,
TypePOST

URL Parameters

KeyValue
apiKeyYour API Key which we sent
deHost/Device name
tsTimestamp in “yyyy-mm-ddThh-mm-ss” this format 
appApplication name
uApp“t”  

HTTP Response

KEYDescription
RCAReportURLRCA report page URL which contains all the root causes for the problems.
http://192.168.43.92:8080/tier1app/yc-report.jsp?ou=metlife&de=xcvxcvxc&app=yc&ts=2020-07-02T15-33-29
tier1appteam

One thought on “How to build your own agent?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s