dbWatch contains a lot of data about database instances and status. It is
sometimes useful to be able to export this data to be used by other tools.

In this tutorial I will show how to export the list of instances with host and status
as json on a web page.

Create a dbwql query

The data we want is available to dbwql.

Open the “Dbwql Console” and type in the folowing query:

instance{}->i/host{}/$i/status{}

On my setup this yealds.

instance host status
Millennium Falcon 10.0.0.21 ALARM
Moldy Crow localhost NO STATUS

Exporting the query as a web page.

The next step is to export the result of this query as a web page. The
resulting web page will run the query every time it is accessed and display the result.

Still in the “Dbwql Console” select the menu “web”->“Make available as web page”.

This brings up the web configuration dialog.

Change the url to the desired url and press save.

The result.

We look at the result in a web browser.

Navigate to the desired url. On my system, since I entred “instancelist” as the place to mount the web page, my url is http://localhost:8080/instancelist/anyFile.json. This web page returns the same data for any url starting with http://localhost:8080/instancelist/ and ending with .json

Content of the file http://localhost:8080/instancelist/anyFile.json

{
    "query":"instance{}->i\/host{}\/$i\/status",
    "tags":[[], [], []],
    "columns":["instance", "host", "status"],
    "data":[
        ["Millennium Falcon", "10.0.0.21", "ALARM"],
        ["Moldy Crow", "localhost", "NO STATUS"]
    ]
}

If you change the file type of the url to html or csv you will get a html or csv representation of the same data.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment