How to create datasources from powershell script
- Anonymous2 years ago
Alright, assuming you’re not going to be running this code on your collector but on different systems, you’ll have to put your script into a scriptblock and run it as shown here.
Assuming your common names in production will actually be unique, just use for loop to make your discovery scriptblock write-host output look like this:
cert.domain.com##cert.domain.com
cert.domain.com##cert.domain.com
cert.domain.com##cert.domain.com
cert.domain.com##cert.domain.comAnd use pretty much the same code (but different for loop) to make your collection scriptblock write-host this
cert.domain.com.daysRemaining: 112
cert.domain.com.daysRemaining: 121
cert.domain.com.daysRemaining: 305
cert.domain.com.daysRemaining: 310Then just setup a datapoint using ‘multiline key-value pairs’ and make the interpreter “##WILDVALUE##.daysRemaining”.
Then just set whatever threshold you want on that datapoint.
Have you checked that this has not already been built by someone else?