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

Problems export script

gurugogi
Guide

Hi all,

Please let me know anyone has written python script to export Problems data from API V2.
API V2-> Problems -> List problems observed within the specified time frame.

 Challenge I faced : with evidenceDetails field we can export only 10 problems once, suppose I have 1000 problems in last 1 month then I have to run this API 100 times manually with nextPage key.

Please help.

Thanks.

13 REPLIES 13

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

You can use Bash, Perl, Python, Go, Ruby, Powershell... Almost all languages have libraries do make HTTP requests and parse JSON answer.

Something to explore would be using DQL to get Davis AI information. You do not need programming skills for that.

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

Yosi_Neuman
DynaMight Guru
DynaMight Guru

Hi @gurugogi 

Try to use the code from the attached file 

HTH

Yos 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

gurugogi
Guide

Hi @Yosi_Neuman 
Thanks for providing script.

Iam getting certificate error "urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1007).

Please check attach output.


"

gurugogi
Guide

I used verify=true in "requests.get" and certificate error is fixed now but script is not getting completed just its keep on running in loop.

PFA snapshot.

 

Hi @gurugogi 

My bad, gave you a not complete code ..... try the attached one see if its works for you 

Just tried that with 10 days and its look like its working 

Yosi_Neuman_0-1700143380073.png

Yos 

 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

Gogi
Helper

@Yosi_Neuman Script is working now, thanks.

Does it include problems with "evidenceDetails" field

You are welcome @Gogi 

In order to include evidenceDetails please add , "fields" : 'evidenceDetails' to request_params

Yosi_Neuman_0-1700153940955.png

HTH

Yos 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

gurugogi
Guide

I have added fields" : 'evidenceDetails' to request_params, still I see same columns is csv, please refer attached snapshot.

whether its possible to add one more column to print ProblemID?

Thanks.

Here it goes 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

steven_v
Organizer

Awesome script @Yosi_Neuman

We have python scripts to export Problem data as well but haven't found a efficient way to parse nextKeyPages. Will definitely be taking a look at what you've set up and improve ours.

 

Cheers,

Steven

Happy to assist @steven_v :fist_bump:

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

gurugogi
Guide

@Yosi_Neuman 

Thanks its working.

please is it possible to add Problem selector filed also , I want to export problems data based on MZ names so that we will have problems count for each application in last 1 mont.

Management zone ID: managementZoneIds("mZId-1", "mzId-2").
Management zone name: managementZones("value-1","value-2") 

Thanks

Hi @gurugogi 

With the attached py you can add MZ as 3ed parameter (only one at a time)

HTH

Yos 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

Featured Posts