Forum Discussion
Ok, cool. What you need to do is adjust your script so that it talks to only one server and outputs only one datapoint. Instead of manually specifying server1, server2, and server3 in your script, you would bring the server name in as a variable.
How you do this depends on a few things. Is this a multi-instance datasource? If so, are you in script or batchscript mode?
If it's a single instance datasource, you'll be using script mode, so the collector will run your script once for each server. To get the hostname into a variable in your powershell script like this:
$hostname = '##SYSTEM.HOSTNAME##';
Then your invoke command would only happen once and would look like this:
Invoke command - computername $hostname - scriptblock { Logic to Size of folder = x }
So, each execution of the script would output metrics for that one server. The number of metrics for one server would be the same number of datapoints defined.
Related Content
- 3 months ago
- 7 months ago
- 8 months ago