Splunk AppDynamics

How to export the list of all Custom Dashboards in the controller into a format like JSON or XML?

Amartya_Jha
New Member

Is there a way you can export Dashboards in any format like JSON or XML?

^ Edited by @Ryan.Paredez to include the location of the original comment.

Note: This comment was split off into its own post from this original post: How to export the list of all Custom Dashboards in the controller into a file?

Labels (1)
Tags (3)
0 Karma
1 Solution

Morelz
Builder

Hi Vishwanath

My Apologies, I gave you the incorrect details, please find below method to query it:)

1) Get the JESSIONID and X-CSRF-TOKEN with user having permissions

curl -i --user <USERNAME>@<Account>:<PASSWORD> https://<Controller-URL>/controller/auth?action=login

2) Run the following CURL call with JESSIONID and X-CSRF-TOKEN from step 1?

curl -i -H "X-CSRF-TOKEN:<TOKEN FROM ABOVE>" -H "Cookie: JSESSIONID=<JSESSION ID FROM ABOVE>; X-CSRF-TOKEN=<TOKEN>;" -H "Content-Type: application/json" -H "Accept: application/json" https://<Controller URL>/controller/restui/dashboards/getAllDashboardsByType/false


Example below
curl -i -H "Cookie:JSESSIONID=9b81672143e228e4eb73fdea89a9;" -H "X-CSRF-TOKEN:6fece457az197155a8f68320cfa781eaeb88991b" -H "Content-Type: application/json" -H "Accept: application/json" https://<controller url>/controller/restui/dashboards/getAllDashboardsByType/false"

This will output all dashboards, with one of the attributes being the Dashboard ID, which you can then use in the last query

https://<controller url>/controller/CustomDashboardImportExportServlet?dashboardId=<dashboard ID>

Ciao

View solution in original post

iamryan
Community Manager
Community Manager

Hi @Mario.Morelli,

Are you able to jump back in here and help out @Maximiliano.Salibe?

0 Karma

iamryan
Community Manager
Community Manager

Hi @Maximiliano.Salibe,

It looks like since this was an older thread, the other members did not chime in. Since it has been a few days, did you happen to find a solution or anything you can share?

If you still need help with this, you can contact Cisco AppDynamics Support. https://www.appdynamics.com/support

Nawaz_Ali_Moha1
Contributor

Hello Amartya,

If you export the custom dashboards from "Dashboards & Reports", I see that the dashboard by default is being exported as .json file. I have attached a gif recording of the same.

image.gif

Vishwanath_Nair
Explorer

Is there a way to export all the dashboards at once via command line ?

We would like to set up an automated way of exporting all custom dashboards at regular intervals.

Tags (1)
0 Karma

Morelz
Builder

Hi There

You can create a simple script to query all the dashboard ID's

https://<controller URL>/controller/restui/dashboards/getPermissionsForDashboards

Then just loop through the dashboard id's, example below GET Query

https://<controller URL>/controller/CustomDashboardImportExportServlet?dashboardId=1234

We used a Python script to do this task, for regular backups of teh dashboards into JSON backups format

Ciao

Vishwanath_Nair
Explorer

Thanks for the tip @Mario.Morelli .

I tried a simple curl test to the url https://<controller URL>/controller/restui/dashboards/getPermissionsForDashboards and I got an error.

curl --user xxxxxx@xxxxx:xxxx https://appdynamics_controller:8181/controller/restui/dashboards/getPermissionsForDashboards

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Unauthorized</title>
</head>
<body>
HTTP Error 401 Unauthorized
<p/>
This request requires HTTP authentication
</body>
</html>

Is this expected ? HTTP is blocked in our environment, so cant test that. Also, we are going through a LB.

0 Karma

Morelz
Builder

Hi Vishwanath

My Apologies, I gave you the incorrect details, please find below method to query it:)

1) Get the JESSIONID and X-CSRF-TOKEN with user having permissions

curl -i --user <USERNAME>@<Account>:<PASSWORD> https://<Controller-URL>/controller/auth?action=login

2) Run the following CURL call with JESSIONID and X-CSRF-TOKEN from step 1?

curl -i -H "X-CSRF-TOKEN:<TOKEN FROM ABOVE>" -H "Cookie: JSESSIONID=<JSESSION ID FROM ABOVE>; X-CSRF-TOKEN=<TOKEN>;" -H "Content-Type: application/json" -H "Accept: application/json" https://<Controller URL>/controller/restui/dashboards/getAllDashboardsByType/false


Example below
curl -i -H "Cookie:JSESSIONID=9b81672143e228e4eb73fdea89a9;" -H "X-CSRF-TOKEN:6fece457az197155a8f68320cfa781eaeb88991b" -H "Content-Type: application/json" -H "Accept: application/json" https://<controller url>/controller/restui/dashboards/getAllDashboardsByType/false"

This will output all dashboards, with one of the attributes being the Dashboard ID, which you can then use in the last query

https://<controller url>/controller/CustomDashboardImportExportServlet?dashboardId=<dashboard ID>

Ciao

Maximiliano_Sal
Explorer

Hi! Now that global logon has been implemented, how can you take the value of the cookie needed? I only can get it manually, but need to programmatically obtain it; however, cannot do it requesting login with basic auth anymore.

0 Karma

Morelz
Builder

Hi Maximiliano

What issue are you having with basic auth? We are still able to use it without any issues.

But either way, bets practice is to rather create an API Key and use that to do what you need to do, that is the suggested and best practice way.

If you are not sure on how to use the API Key method, just DM me, I can share a sample python script for you to get started

Ciao

0 Karma

Maximiliano_Sal
Explorer

Hi Mario, thanks for your response.

This is what I get when requesting login.

image.png

0 Karma

Vishwanath_Nair
Explorer

Thanks a lot! Much appreciated.

0 Karma
Get Updates on the Splunk Community!

What's New in Splunk Cloud Platform 9.3.2411?

Hey Splunky People! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2411. This release ...

Buttercup Games: Further Dashboarding Techniques (Part 6)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...