Datasource SDT and REST API
I’d like to write a script to accomplish what we can do in the GUI when creating a new SDT, which is to find a datasource and create a global SDT applied to it.
The REST API v3 shows me that we can only create a DeviceDatasourceSDT, which seems to require the device Id of every resource where the datasource has been applied.
This doesn’t make sense. It seems in order to SDT a datasource in the same way the GUI allows us to do, we must iterate through every single resource and their respective device datasources, locate ones that match the datasource I’d ilke to SDT, then SDT each of the corresponding device datasources.
This is madness. Has anyone accomplished anything useful with a datasource SDT using the REST API?
jwoerner
Posted 3 years ago·Last reply 3 years ago
3 comments
LM User
·3 years agoApplying it to the root is the way to simply SDT specific datasources globally. Group SDT is the only way to do it without setting SDT on each device.
jwoerner
OP3 years agoThank you for your response. My goal is to add an SDT to every datasource matching a text pattern, as we’ve named them appropriately (they’re all custom datasources).
The devices/resources aren’t relevant, as I want the SDT to apply globally, just to the specific datasources I identify. So I can’t start with a device group, unless I start with the root device group, which seems like a huge overhead. Is there a more direct way to simply SDT specific datasources globally?
Michael Baker
·3 years agoYou can first find the group id (Folder) https://www.logicmonitor.com/swagger-ui-master/dist/#/Device%20Groups/getDeviceGroupList
Then once you have the group id use this to list all the data sources in the group https://www.logicmonitor.com/swagger-ui-master/dist/#/Device%20Groups/getDeviceGroupDatasourceList
Once you have that list you then POST to https://www.logicmonitor.com/swagger-ui-master/dist/#/SDTs/addSDT
Example payload:
That will set SDT on every resource in the group