What is my Instance ID?
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
Thomas
Posted 8 years ago·Last reply 8 years ago
6 comments
Jeffrey_McGover
·8 years agoHey 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/
Thomas
OP8 years agoThat's what I was looking for!
Thanks Sarah!!!
Sarah_Terry
·8 years agoHi 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:
Thanks,
Sarah
Thomas
OP8 years agoHi 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.
Matthew_Dunham
·8 years agoHi 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
Thomas
OP8 years agoI 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?