Splunk AppDynamics

App agent and Machine agent list export python code

Haluk_Yaşar_Ero
Path Finder

Hello,

Appdynamics agents cannot be exported. There are many similar topics in the forum. However, there were no definitive answers in my opinion.

I'm not a programmer. That's why I'm sharing the script I prepared for those who need ready-made codes like me.

For non-programmers like me, I think it will be useful for most people if such sample codes are shared. It may be under a separate title, but I think it would be really good for everyone and appdynamics teams to share powershell, python, api query examples. (Life gets better when shared 🙂 )

sorry but moderator friends are just giving directions.

For those who don't know software like me please I ask developers and script writers to share more scripts and software code.

import pandas as pd
import requests
import urllib3
urllib3.disable_warnings()
from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth('yourusername@customer1', 'yourpasswd')

app_url='https://yourapmurl/controller/rest/applications?output=json'
app_resp=requests.get(app_url , verify=False, auth=auth).json()

dfs=list()
for item in app_resp:
name,node_id=item['name'],item['id']
node_url=f'https://yourappmurl/controller/rest/applications/{node_id}/nodes?output=json'
response=requests.get(node_url , verify=False, auth=auth).json()
df=pd.DataFrame(response)
if len(df)>0:
df=df[['machineName','tierName','appAgentVersion']]
df['name']=name
df['node_id']=node_id
else:
print(node_id)
dfs.append(df)
result=pd.concat(dfs).reset_index(drop=True)
save_dir=r'export_your_path'
result.to_excel(f'{save_dir}\\yourdata.xlsx',index=False)

Labels (3)
Tags (3)

open768
Path Finder

Hey @Haluk Yaşar.Erol , I applaud that you're sharing your code. great!!👍

Also you might want to look at my open source "rapport" tool which I also developed it like you, starting with simple scripts and going on to develop a complex web application.

I also use the api for extracting agent versions for each application. heres a screengrab of what it looks like.

image.jpeg

Rapport can be found at https://chickenkatsu.co.uk/apps/rapport

maybe we can collaborate, im happy to add features to Rapport that you or anyone in the community would find useful.

regards

Sunil

iamryan
Community Manager
Community Manager

Hi @Haluk Yaşar.Erol,

Thanks so much for sharing this! I'm sure the community will find this very valuable!

Get Updates on the Splunk Community!

Enhance Your Splunk App Development: New Tools & Support

UCC FrameworkAdd-on Builder has been around for quite some time. It helps build Splunk apps faster, but it ...

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...