Forum Discussion

Idan's avatar
8 years ago

implement VBScript with parameters

Hi,

I'm looking how to implement VBScript that will get several parameters and will be generated alerts and performance charts in the tool.

The script need to run on selected servers (Not auto-discovery)

1.       I would like to see how we can run this script on a specific servers base on needs (Similar to “Add OtherMonitoring”)

2.       I would like to see how I can send different parameters to the script based on the server by provide the parameter in the LogicMonitor (Similar to “Add OtherMonitoring” under UNC monitor)

3.       I would like to see how I can define several parameters (Similar to “Add OtherMonitoring” under UNC monitor)

4.       I would like to see how I can generate a Graph from the output of the script

5.       I would like to see how I can trigger an Alerts from the script

 

I tried to understand from https://www.logicmonitor.com/support/terminology-syntax/scripting-support/external-scripting/ but this didn't help me.

 

1 Reply

Replies have been turned off for this 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.