Splunk AppDynamics

Delete application by API

CommunityUser
Splunk Employee
Splunk Employee

Hi folks,

We're using kubernets here and a wrong configuration created a lot of Applications, one for each pod. I used the AppDynamicsREST project in python to list all wrong application name but I can't find a way to delete them.

Do you know if it is possible?

Thanks

Labels (3)
Tags (3)
0 Karma

Naoto_Yamamoto
Path Finder
Hi Kadu,
 
Thanks for posting the question on the Community.
 
Application deletion API exists, and this needs authorization token retrieval first, so could you try these lines of execution? Caution to pass only your target application ID in <application_ID>.
 
  1. curl -s -c cookie.appd --user <username>@<customer name>:<password> -X GET "http://<url>:<port>/controller/auth?action=login"
  2. X_CSRF_TOKEN="$(grep X-CSRF-TOKEN cookie.appd|rev|cut -d$'\t' -f1|rev)" 
  3. X_CSRF_TOKEN_HEADER=$([ -n "$X_CSRF_TOKEN" ] && echo "X-CSRF-TOKEN:$X_CSRF_TOKEN" || echo '')
  4. curl -X POST <url>:<port>/controller/restui/allApplications/deleteApplication -H "Content-Type: application/json;charset=UTF-8" --data "<application_ID>" -b cookie.appd -H "$X_CSRF_TOKEN_HEADER"
Please run these queries by the user who has delete permissions on your applications.
 
Let me know if this helped you.
 
Many thanks,
Naoto

Venkat_Subraman
Engager

@Naoto.Yamamoto 

Curl command produces this cookie file for 20.4 version.

The next two commands fail to parse obviously.

Can you suggest?

Also, would this sequence of steps delete all artifacts of the app - BTs, Tiers, and Nodes?

# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

#HttpOnly_localhost FALSE /controller FALSE 0 JSESSIONID 48a75c23dca26c5a77232b48a687

^ Post edited by @Ryan.Paredez for formatting and clarity of post

0 Karma

Naoto_Yamamoto
Path Finder

Hi Venkat,

We're sorry for our late reply. 

From the cookie file you retrieved in the 1st step, could you try to pick up JSESSIONID and X-CSRF-TOKEN and replace the following place-holder values? 

curl -i -H "X-CSRF-TOKEN:<<TOKEN FROM STEP 1>>" -H "Cookie: JSESSIONID=<<JSESSIONID from Step 1>>; X-CSRF-TOKEN:<<TOKEN FROM STEP 1>>;" -H "Content-Type: application/json" -H "Accept: application/json" --data "<<application ID you want to delete>>" http://<<hostName>>:<<port>>/controller/restui/allApplications/deleteApplication
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Build the Future of Agentic AI: Join the Splunk Agentic Ops Hackathon

AI is changing how teams investigate incidents, detect threats, automate workflows, and build intelligent ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...