• 0

What is my Instance ID?


Thomas
Go to solution Solved by Sarah Terry,

Question

6 answers to this question

Recommended Posts

  • 2
  • LogicMonitor Staff
  • Solution

Hi Thomas - You can get instance Ids for use with the REST API two ways:

1. via a GET request to the REST API instances resource for the desired datasource: https://www.logicmonitor.com/support/rest-api-developers-guide/datasource-instances/get-datasource-instances/

2. via the Info tab for the instance in the UI:

5a0f49d1aeb95_ScreenShot2017-11-17at12_42_28PM.thumb.png.0b555ce5c39a4b8b273036ec3d91d775.png

Thanks,

Sarah

Link to post
Share on other sites
  • 0
11 minutes ago, Thomas said:

Hi all,

I am new to Logic Monitor and I am working on my Python script to gather datapoints but I don't know what the Instance ID is of the data I want. How do I find this out?

Thank you,

Thomas

I should clarify:
I am doing something like this: https://companyname.logicmonitor.com/santaba/rest/device/devices/1234/devicedatasources/123456/data?start=1510918823&end=1510947623&datapoints=PercentUsed

which gives me data for many different instances like this:
"status" : 200,
  "errmsg" : "OK",
  "data" : {
    "dataSourceName" : "Data Source Name ABC",
    "dataPoints" : [ "PercentUsed" ],
    "instances" : {
      "Instance Name ABC" : {
        "values" : [ [ 46.0 ],
        "time" : [ 1510947392000 ]
      },
      "Instance Name DEF" : {
        "values" : [ [ 18.0 ] ],
        "time" : [ 1510947500000 ]
      },


 But I only want 1 of those instances, say, Instance DEF. But I need to know the instance ID. How do I find this?

Edited by Thomas
Link to post
Share on other sites
  • 0
  • LogicMonitor Staff

Hi Thomas - 

I'd suggest having a look at https://www.logicmonitor.com/support/devices/device-datasources-instances/device-datasources-instances-overview/ to solidify the concept of "singleton" vs "multi-instance" datasources. Note that a singleton won't have an instance id, since there's only a single instance to monitor in that type of datasource.

Once you have that under your belt, have a look at https://www.logicmonitor.com/support/datasources/data-collection-methods/scripted-data-collection-overview/ to understand scripted datasource modes of operation. 

Then follow with https://www.logicmonitor.com/support/terminology-syntax/scripting-support/external-scripting/ which provides a simple example of putting together a scripted datasource.

Hope this helps.

-m

Link to post
Share on other sites
  • 0
8 minutes ago, Matthew Dunham said:

Hi Thomas - 

I'd suggest having a look at https://www.logicmonitor.com/support/devices/device-datasources-instances/device-datasources-instances-overview/ to solidify the concept of "singleton" vs "multi-instance" datasources. Note that a singleton won't have an instance id, since there's only a single instance to monitor in that type of datasource.

Once you have that under your belt, have a look at https://www.logicmonitor.com/support/datasources/data-collection-methods/scripted-data-collection-overview/ to understand scripted datasource modes of operation. 

Then follow with https://www.logicmonitor.com/support/terminology-syntax/scripting-support/external-scripting/ which provides a simple example of putting together a scripted datasource.

Hope this helps.

-m

 

Hi Matthew,

Thank you for your prompt reply. If it makes a difference, I should mention that I am trying to do this using a REST API call with a Python Script. Is there a way I can find out the specific instance ID through the API?

Specifically this call: 
https://companyname.logicmonitor.com/santaba/rest/device/devices/1234/devicedatasources/123456/instances/????/data?start=1510921472&end=1510950272&datapoints=PercentUsed

How can I find out what I need to put in place of ???? to make this work?

Thanks again.

Edited by Thomas
Link to post
Share on other sites
  • 0
15 minutes ago, Sarah Terry said:

Hi Thomas - You can get instance Ids for use with the REST API two ways:

1. via a GET request to the REST API instances resource for the desired datasource: https://www.logicmonitor.com/support/rest-api-developers-guide/datasource-instances/get-datasource-instances/

2. via the Info tab for the instance in the UI:

5a0f49d1aeb95_ScreenShot2017-11-17at12_42_28PM.thumb.png.0b555ce5c39a4b8b273036ec3d91d775.png

Thanks,

Sarah

 

That's what I was looking for!

Thanks Sarah!!!

Link to post
Share on other sites
  • 0

Hey Thomas,

You need to call GET: /device/devices/{deviceId}/devicedatasources/{deviceDatasourceId}/instances and retrieve the instanceId from there and then pass the output into your call above.

I think what you are trying to do is the last example at the bottom of: https://www.logicmonitor.com/support/rest-api-developers-guide/data/get-data/

Link to post
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
Answer this question...

×   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.