bash script to retrieve list of Rest api services from various datapower boxes and display the content to a browser or excel sheet

0

I have a rest mgmt uri. using that I have to pull the list of services from various datapower boxes. For every environment I have one datapower box and one rest mgmt uri. So I have to pull the details from every datapower box for every environment and display all the content in an organized readable format either to browser or excel sheet.

I need to use only bash scripting. as no other type of scripts will work in my system.

I have used curl to pull the details but I was able to pull only for one rest mgmt api.

curl -k -u 'username:password' https://dpbox001:5554/mgmt/status/DEV/ObjectStatus

I was able to get the details but was not able to display in readable form and that to in the similar way for all the dpboxes for all environments.

Output I got after running the above curl command :

"Class" : "ExampleProtocolHandler",
"OpState" : "up",
"AdminState" : "enabled",
"Name" : "Example_service",
"EventCode" : "0x00000000",
"ErrorCode" : "",
"ConfigState" : "saved"}, {

the below was the restmgmt uri

https://dpbox001:5554/mgmt/status/DEV/ObjectStatus
  1. I need to get the details using the rest mgmt uri (https://dpbox001:5554/mgmt/status/DEV/ObjectStatus) for all the dpboxes(total they are 20) for all environments. (I have TST, STG, PRD).

  2. After gathering the above details I need to display the complete information in structured form either to browser or excel sheet like below

    Output in one single line like below to be displayed either to console or browser

    class : Exampleprotocohandler Opstate : up Adminstate: enabled Name: Exampleservice Eventcode: 0x0000000 Errorcode : configstate: saved

    or else output to excel sheet like below columns and rows format

    class opstate Adminstate Name Eventcode ErrorCode configstate Example up Enabled service 0xx000 if any saved

bash
shell
scripting
asked on Stack Overflow May 9, 2019 by venkata12 • edited May 9, 2019 by James Z

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0