Using LogicMonitor's REST API as a Power BI Source


Kevin Ford
 Share

Recommended Posts

  • LogicMonitor Staff

Overview

LogicMonitor has a number of built-in report types that can be customized and sent out on a scheduled basis, including the powerful ability to turn any dashboard into a dynamic report. A common question for cloud-based services like LogicMonitor, however, is how to incorporate hosted data with information from other sources. An example may be a report that combines inventory data & monitoring metrics from LogicMonitor with incident data from systems such as ServiceNow.

With Microsoft Power BI’s ability to easily parse and ingest JSON data directly from web services, it’s possible to create reports directly from LogicMonitor’s REST-based APIs without the need for intermediary automation or databases.

Below are some basic steps to start pulling data directly from your LogicMonitor portal into a Power BI report. This isn’t meant to be a comprehensive reference though the concepts introduced here can be used for other report types generated directly from LogicMonitor data.
 

Prerequisites

Adding a LogicMonitor REST API as a Power BI Source

For this example we will use LogicMonitor's "Get Devices" API method to build a simple inventory report. Documentation for the "Get Devices" method and its options are available at:
https://www.logicmonitor.com/support/rest-api-developers-guide/v1/devices/get-devices

1. Launch Microsoft Power BI Desktop.

2. Click the Get Data button, either on the intro dialog or on the toolbar ribbon.
image.thumb.png.fff5be33de85d5e636f50efd3f0f65dc.png
 

3. On the Get Data dialog, search for the “Web” data type that’s located under the “Other” section. Once “Web” is selected click the Connect button.
  image.thumb.png.b018469bfd02780b1abdd9c97caa1d93.png
 

4. Enter the URL of the REST method, including optional query parameters. For the example using the "Get Devices" method, the URL used was the following (replace "[portalname]" to match your own LogicMonitor portal's URL) :

https://[portalname].logicmonitor.com/santaba/rest/device/devices?size=1000&fields=alertStatus,autoProperties,displayName,description,id,link,hostStatus,name,systemProperties,upTimeInSeconds

This example URL calls the "Get Devices" method (/device/devices) and passes optional parameters specifying to return up to 1,000 records and lists some properties/fields we want for each device.
Please refer to the “Get Devices” method’s documentation for more information about the available parameters and options. For instance, if your query has more than 1,000 results available (the maximum results available in a single REST call) then you may have to code a loop in Power BI to make multiple calls that paginate through the available results.
 

5. Power BI will then try to access that URL. After a moment it will ask how to authenticate with the REST service. For this example we’ll use the Basic authentication method. Enter a valid LogicMonitor username and password that Power BI will use to access your portal’s web services and click the Connect button.
(NOTE: as mentioned in LogicMonitor’s REST documentation, the option for “Basic” authentication may be removed at some point in the future.)
image.thumb.png.52508936b48674e30e11ceb74e0657b0.png
 

6. Power BI will then authenticate with LogicMonitor's REST service. After a moment you'll see the initial results from your REST query.
Click the "Record" link on the result's 'data' row.
image.thumb.png.0e3bcf0715276131a078fe3d41f36bb0.png
 

7. Next, click the "List" link on the 'items' row to expand the list of records.
image.thumb.png.4ea9494b8165ec551997d512d298115c.png
 

8. Click the To Table button.
image.thumb.png.133291ac3303e904323eece700b7473e.png
 

9. Keep the default conversion options and click OK.
image.thumb.png.1ec8ddd14a42d183f17c85f262b95dc1.png
 

10. Click the small icon in the column header to expand the results.
image.thumb.png.7b0937fd261f3d3cddb4336395119514.png
 

11. Click OK on the column selection dialog.
image.thumb.png.b9bde8949b772dc44cc9251502de580f.png
 

12. Click the Close & Apply button to apply the changes from the query builder.
image.thumb.png.11b351da0dbf43175be5e1fef315ddde.png

 

You've now added the REST method as a dynamic data source in Power BI. At this point you can design the report to suit your specific needs.

If you want to browse and manipulate the data that was brought into the model, click the Data button (looks like a small grid) on the left-hand toolbar.

image.png.e80dc47291301e3a3d604dd8c0ee5add.png

 

Edited by Kevin Ford
Link to comment
Share on other sites

  • 1 year later...
  • 4 months later...

What if 2FA is enabled? Basic authentication is not possible and the PQ Web API authentication only prompts for the Access Key, however, LM requires the Access ID and Access Key. Can I enter something to the URL as a query parameter or is there another mechanism?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share