• 0
Savad Mottammel

Run Script only if the Device/Instance is not under SDT

Question

I've created a Datasource to Monitor Windows Service on machine and try to restart it using Powershell.

But, i want it to run only if the Machine/Instance is not under SDT.

How can i write it the code?

How can i get the SDT status from LM via powershell.

Edited by Savad Mottammel

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

You'd have to write a bit of powershell code to fetch the current SDT status from the LM API. Generate an API token and set the ID and key as a properties on the group containing your servers. I recommend calling these properties after your datasource since that is how it will be used. Once you have that setup, you can pull those values into your posh script and call the Devices endpoint: https://www.logicmonitor.com/swagger-ui-master/dist/#/Devices/getAllSDTListByDeviceId. I believe the "isEffective" attribute should do it. You can pull in the system.deviceId property to construct the API call url.

I know this is a bit bare bones. Let me know if you want more detail on what the script strategy would be.

Share this post


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.