SDT Dashboard Widget
I would like to see a dashboard widget that can display upcoming SDTs. We have multiple sites and being able to show upcoming maintenance windows for things like circuits would be useful for onsite IT personnel.
martin_sims
Posted 4 years ago·Last reply 4 years ago
12 comments
LM User
·4 years agoGlad you got it working. Still, I would recommend tokenizing the api credentials and passing those in so that the keys to the kingdom aren't hard coded in a script.
Rakzskull
·4 years ago@Stuart Weenig Solved ! Script is working, it was a matter of powershell permission. Thanks :)/emoticons/smile@2x.png 2x" title=":)" width="20" />
Rakzskull
·4 years ago@Stuart Weenig Actually, we already have put these values directly into the script instead of tokens.
We are wondering what else could be wrong.
Rakzskull
·4 years agoActually, we already have put these values directly into the script instead of tokens.
We are wondering what else could be wrong.
LM User
·4 years agoYou could easily make the appliesto for your datasource something like this:
lm.access.id && lm.access.key && lm.company && dashboard.id && widget.id
That would ensure that if the properties are missing, your applies to would error out, clearly indicating the problem you need to fix.
I would also recommend a best practice of specifying a unique API token/key for this datasource. Using lm.access.id and lm.access.key for every API based DataSource makes it difficult to tell which one might be causing issues when/if you run into issues like reaching your query limit. I prepend the datasource name in front of the credential properties so that each one of my datasources has a unique set of API credentials. When/if there is a failure, only that one datasource goes down and it's clear which api id is the offender.
LM User
·4 years agoYou need to populate the following properties on the device the DataSource is applied to:
Once those are set as properties, the script will actually run with proper values. The fact that your get request still has "##companyname##" indicates that the task doesn't have a value for that property. system.hostname is the only one you don't need to populate manually, that one is added by the system.
Rakzskull
·4 years ago@mmatec01 @Stuart Weenig I'm struggling to implement this custom datasource in our environment, it would be helpful for me if you could elaborate the steps to implement this data-source. :)/emoticons/smile@2x.png 2x" title=":)" width="20" />
Could you share the details how the API call is structured? the output is just showing the below.
GET https://##companyname##.logicmonitor.com/santaba/rest/sdt/sdts?offset=0&size=5000 with 0-byte payload
We have added all the parameters including "accessid" and key but still getting the error getting connected.
martin_sims
OP4 years agoWow, thanks a bunch. I'll test this out in my environment and see how it does.
LM User
·4 years agoNice, and i like how you have a couple datapoints that you can alert on if anything goes wrong (exit code, html length, rows returned). Really good code.
mmatec01
·4 years agoSure. Here's the code. PowerShell script. Should be self-explanatory.
LM User
·4 years agoI've seen this done in several other situations and works well.
@mmatec01 would you mind sharing some sanitized code?
mmatec01
·4 years agoSo what I do today I have a dashboard with bunch of widgets and one of them is generic Text widget. Then I created a custom DataSource which runs every 5 minutes and basically makes 2 API calls to your company's API endpoints. One is to fetch all SDTs, then massage the data, in fact turn it into the HTML table and then the second API call is to post the data to the dashboard based on dashboard id and text widget id. Yeah, perhaps little bit kludgy but it works great.