cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

App agent and Machine agent list export python code

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)

2 REPLIES 2

Ryan.Paredez
Community Manager

Hi @Haluk Yaşar.Erol,

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


Thanks,

Ryan, Cisco AppDynamics Community Manager




Found something helpful? Click the Accept as Solution button to help others find answers faster.

Liked something? Click the Thumbs Up button.



Check out Observabiity in Action

new deep dive videos weekly in the Knowledge Base.

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.

all versions.jpg

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

kind regards
Sunil