Forum Discussion
Hi Idan,
This should be possible. Let me address your questions in order.
1. Normally a script is run on the Collector, not a target server. If you truly need to execute a script on a remote system, you will need to script a way to do this. With Windows servers, this is often Remote Powershell - aka invoke-command.
2. Applying a datasource and providing parameters can be accomplished using Device (or Group) Properties. For example, the presence of a Property can be used in the Applies-To field. See datasource "SolarisMemActivity" which requires ssh.user Property be present to apply the datasource. Similarly, parameters can be passed to the script on a per-host basis, by specifying those parameters as Properties. The Property values are referenced in the script using "Tokens" on a per-host basis. Most of the Hyper-V powershell datasources work this way. Note how each Hyper-V script looks for a local username and password from each machine: $hostname = '##SYSTEM.HOSTNAME##';$wmi_user = '##WMI.USER##';$wmi_pass = '##WMI.PASS##';
3. Using the method above, you can pass any number of parameters to a script. If Host1 needs 2 parameters, set a property like this: RequiredParameters="Parameter1,Parameter2", and parse this list in your script to isolate them.
4. Typically a script will execute some task and provide output. The output should be parsed as datapoints, where each datapoint is looking for some piece of the output. This is normally accomplished using RegEx on the output. Look at the Hyper-V datasources to see examples of this. Once the datapoint is isolated as a numerical value, it can easily be added to a graph in the datasource.
5. Datapoints also contain thresholds which define when an alert will be triggered. This is typically handled in the datapoint and not the script itself.
To sum up:
-Make a datasource apply and pass parameters to it using Properties. Try to keep your datasource script somewhat generic- the idea is to have the script "do" what you are asking, using the supplied parameters.
-The script will output something. Typically a return code, and some additional data. Use datapoints to parse the output to get the numerical values you want.
-Once you have numerical datapoints, set up graphs to display them, and thresholds per datapoint to trigger alerts for things that go above threshold.
Hope this helps! Definitely examine some of the Powershell datasources (like Hyper-V) that are already in your account. They should provide examples of how to accomplish some of your goals.
Related Content
- 3 days ago
- 7 years ago
- 3 years agoAnonymous