No instances on API response
Hello everyone,
Sorry if this is a repeat topic here, but I'm having some trouble polling data from our new LogicMonitor setup via API.
As I understand it, I'll need device ID, device datasource ID, instance ID, all together to get graph data over a specific time period. I can successfully pull the first two (device id and datasource id), but when I pull the instances resource, I'm not getting any response.
Example resource path:
/device/devices/{device id}/devicedatasources/{datasourceid}/instances
The response I get is:
{
"total": 0,
"items": [],
"searchId": null,
"isMin": false
}
indicating that there's no instances. This is where I seem to get stuck, I don't seem to be able to move on any further. Has anybody run into this, and can give me a direction for next steps? Anything is appreciated!
Lewis_Beard
I dont usually get my instances that way, so apologies if I'm about to be confusing. :) But I think you are using this call: "/device/devices/{deviceId}/devicedatasources/{hdsId}/instances". I dont think that hdsId is the global template datasource id. In your post you mention "device datasource ID" in your text but then make a reference to {datasourceid} and they arent the same.
If you already knew that, apologies. Anyway, what I usually do is slightly different. I do:
So TL;DR I just wanted to be sure you know that for some of these calls, the "datasource id" isnt necessarily the number you'd see when editing the datasource. Apologies if I just focused in on the wrong thing in your post.
Maybe I'll just focus on something where I have some target devices in a Map and I'm snagging the actual instances of a specific logicmodule to roll up into something else I'm doing. Its a different way to get to the data, and I have some function calls here that I dont show but hopefully are clear.
If this muddies the water, I apologize. I'm just hoping it will help, since so many people here have helped me.
Feel free to ignore me and just open a support ticket. :)
juramir
OPThanks a bunch for your reply! I checked it out today and it looks like I haven't been running into any issues. I think I got stuck in the "hierarchical" structure that I expected (Device -> Datasource -> instance) and it looks like I completely missed over that endpoint.
I've now tested on several devices and ports (instances) and not seeing any issues so far.
jake_nahm
Thanks juramir. Definitely worth raising a support ticket for this case. Based on the information provided it seems like you should be getting a response.
jake_nahm
Hi juramir as long as you have instances associated with the datasource, you should be seeing instance details in the response. Would you be able to share the device type and datasource you are referencing? Also, have you tried reaching out to LM Support for help with this issue?
juramir
OPHi jake_nahm thanks for checking in. No support case yet, as I wasn't sure this was my issue or not. The devices I'm trying to poll are simply just Cisco routers and switches, which are having their SNMP data collected.
sn.device_role = L3 Switch
sn.device_type = Switch
juramir
OPAnd just to add more detail, the GUI itself has several instances per datasource, it's just the API response that's not showing anything. I cycled through every instance and got the same response as above.