Using Remote Script Executor, you can execute scripts on both Linux and Windows workstations with different script types.

  • User-defined external arguments support the script through custom attributes.
  • Monitor Level script execution – Ability to pull more metrics in a single script execution.
  • Ability to execute different types of scripts through custom script options apart from default options.
  • Able to use Credentials attached to the device in the script using the dynamic macro support.

Prerequisite: Gateway version 7.0.0.

Create metrics

Metrics enter the metadata to correlate the script output and must match the metrics names added to the Monitor.

  1. Select a client from the All Clients list.

  2. Go to Setup > Monitoring > Metrics.

  3. From METRICS, click + Add and enter:

    • Metric Scope: Select Partner Metric or Client Specific Metric.

    • Adaptor Type: Select Application.

    • Application Type: Select Remote Script Executor.

    • Name: Unique Name for the metric. The recommended metric naming convention is <vendorname>_<application name>_<component>_<metric> . For example, apache_tomcat_webapps_count_

    • Tag Name: User-defined tags for better filtering.

    • Display Name: Enter Display Name. For example, System Drive Free Space.

    • Description: Enter the reason for the metric.

    • Data Point type: Value chosen to plot data in the graph.

    • Units: Required values for Units. You can choose Units depending on the chosen Data Point Type.

    • Unit Multiplication Factor: Value chosen to multiply a value based on the chosen unit.

    • Data Point Conversion: One of the following options:

      • Value: To populate data using values.
      • Enumerated Map: To populate alert and graph details after adding the states such as Up or Down. The screen displays an more section where you can add the state descriptions and select Alerts and Graphs to populate data.
    • Metric Processing: One of the following values for processing the Metric:

      • Notification

      • Graph

      • Graph and Notification

      • To configure values for Graph and Notification:

        • Warning if value: Warning threshold value.
        • Critical if value: Critical threshold value.
        • Subject: Subject for the metric.
        • Description: Description for the metric.
  4. Click Save.

Remote Script Executor Create Metric

Create monitor

Custom Remote Script Executor Monitor is a collection of Remote Script Executor metrics. You can create a template using the Remote Script Executor monitor.

Prerequisite: Add the required custom parameters.

  1. From All Clients, select a client.
  2. Go to Setup > Monitoring > Monitors.
  3. From Monitors, click + Add.
  4. From CREATE A MONITOR, enter the details for the following parameters and click Save.
    • Monitor Scope: Select Partner Monitor or Client Specific Monitor.
    • Type: Select Application.
    • Application Type: Select Remote Script Executor.
    • Name: Enter a unique name for the monitor.
    • Description: Enter the reason for creating the monitor.
    • Script: Custom script in the Script text box. You can refer to Script and JSON output formats-example to view the example script.
    • Metrics: To add Metrics:
      1. From Metrics, click Add Metrics.
      2. Search the metric and click Add Metrics. The Metrics section displays the selected metric.
      3. After adding the metrics, navigate to Configuration Parameters.
    • Configuration Parameters: To add configuration Parameters:
    1. Enter Default Value for all the configuration parameters.
    2. Select the Configurable checkbox.
    3. Click +Add.
    4. Enter Configuration Parameters depending on the selected script type.
      You can view the default value for the respective Name selected.
      If you select the Custom value in Configuration Parameters, add the configuration parameter: custom.script.execution.path.
      MONITORS screen displays the new monitor.
Remote Script Executor Monitor

Macros in Remote Script Executor

Macros are implemented to address the passing of dynamic arguments to scripts. Use the following macros to make available native attributes and custom attribute defined on the resource, in the script:

Static macros

Use static macros to override the resource values. See the Static macro reference for a list of static macros.

Dynamic macros

MacroDescription
${customattributes.serviceName}Get custom attributes of the device - If you want to use an argument in any script, apply the custom attributes on the device.

For an example, you have a custom attribute on the device with `Key: serviceName` and `Value: oracledb`. During runtime, the Value: oracledb replaces the macro: `${customattributes.serviceName}` in the script.
${credentials.CredentialName.credentialField}Get the credentials added to the device - You can use (macros) credentials in the script to avoid storing the original username and password in plain text. When you run the script, the macros replace the original credentials.

For an example, if you define a credential set with a name JMXCred and added it to a device. You can use the macro ${credentials.JMXCred.username} in your script and macro will replace the original credentials in your script at runtime.
${credential.type.all}Use this macro to get all credential sets (assigned on the device) into the script.
${credential.type.name}Use this MACRO( ${credential.type.name}) to get specific credentials in the script.

For an example, If the device has SSH, WMI and Database credentials and if user want to get only database credentails inside the script then need to use ${credential.type.database} inside the script. Similarly user can get any type of credentails into the script by replacing .name with the credentails type.
Example: ${credential.type.SSH}, ${credential.type.SNMP}, ${credential.type.VMWARE} etc.

Below are the supported credential types:

Credential TypesMarcosSample Output
VMWARE${credential.type.VMWARE}
[{
"uuid":"xB35mBgN354UGM3zQFZBQSaJ",
"type":"VMWARE",
"name":"sample-vmware",
"timeoutMs":10000,
"transportType":"HTTPS",
"appName":null,
"domain":null,
"username":"testuser",
"password":"xxxxxx",
"port":443
}]
SSH${credential.type.SSH}
[{
"uuid": "NwKGzg6qqSF29Sdy5hRJrAyH",
"type": "SSH",
"name": "sample-ssh",
"timeoutMs": 10000,
"transportType": "HTTP",
"appName": null,
"userName": "testuser",
"password": "xxxxxx",
"port": 22,
"privkey": null,
"passPhrasePasswd": null,
"privKeyFileName": null,
"sshAuthType": "PASSWORD"
    }]

The following are the remaining credential types:
SNMP, XEN, WINDOWS, JMX, HTTP, Database, CIM, NETAPP, NETAPPCLUSTER, HYPERFLEX, PURESTORAGE, FTP, CISCOUCS, EMCCLARIION, EMCVNX, EMCVNXE, EMCVMAX, IBM, HPEVA, REMOTE_CLI, TELNET, XTREMIO, VIPTELA, EMCVPLEX, EMCRPA, NUTANIX, HITACHIVSP, AZURESTACK, APPLICATION, and CITRIX_CVDA.

Script execution path for configuration parameters in Linux and Windows

GatewayTarget Platform
Script TypeLinux/SSHWindows
Linux GatewayBashbash -sNot Applicable
PowershellNot ApplicableNot Applicable
Pythonpython -Not Applicable
PerlPerl - -Not Applicable
Windows GatewayBashbash -s
PowershellNot Applicablepowershell.exe
Pythonpython -python.exe
PerlPerl - -perl.exe

If your runtime is not set as an environment variable, mention the absolute path of your runtime. For example, if Python is not set as an environment variable, enter the absolute path of Python such as /usr/lib/python.

Create template

A template is an instance of a monitor and is applied to devices.

  1. From All Clients, select a client.

  2. Go to Setup > Monitoring >Templates.

  3. Click + Add.

  4. From MONITOR TEMPLATE, enter the details for the following parameters and click Save:

    • Select Template Scope: Template type.

    • Collector Type: Select Gateway.

    • Monitor Type: Select Monitors for G2 Templates.

    • Applicable for: Select Device.

    • Template Name: Name of the template.

    • Description: Summary of the template.

    • Generation: Generation that the template belongs to.

    • Tags: User-defined tags for better filtering.

    • Prerequisites: Essential things that you must consider while monitoring using the template. For example, check the SQL services while monitoring the SQL Parameters using the Windows templates.

    • Status: Active or End-of-life templates.

    • Notes: Information that you want to add to the template.

    • Template Family Name: Category that applies to the application. For example, Windows Server, Storage Server, and Network Server.

    • Deployment Type: One of the following methods to apply the template to the resources:

      • Custom
      • Optional
      • Standard
  5. After providing the template details, MONITOR TEMPLATE displays the Monitors section.
    The user interface for the Monitors section varies with the option selected in the Collector Type.

    • Monitor: To add details in Monitors:
    1. From the Monitors section, click Add.

    2. Enter details for the following parameters:

      • Frequency: Refer to the frequency to execute the template.
      • Monitor Definition: Monitor type.
      • When to Alert: Select Breach of a Threshold.
    3. Select Availability and Alert checkbox to initiate monitoring. The TEMPLATES section displays the configured details.

Assign template to a device

You need to create credentials to assign a template to a device.

Create credentials

If the configuration parameter remote.server.operating system is:

  • Windows, you must consider Windows type credentials.
  • LINUX or UNIX, you must consider SSH type credentials.
  1. Select a client from the All Clients list.

  2. Go to Infrastructure > Resources.

  3. From the list of devices, select a device. Navigates to the device information page.

  4. From the center pane, click Credentials.

  5. Click +Add.

  6. From Create new credential, provide details for the following parameters and click Save:

    • Name: Name of the credential.
    • Description: Description of the new credential.
    • Type: Application type. Select Windows.
    • Username: Username for the credential set.
    • Password: Password that you set for the credential set.
    • Confirm Password: Enter the same password.
    • Port: Port used to connect to the application.
    • Connection Time-out (ms): Time taken for the resource to connect to the application. The Credentials screen displays the new credentials.

Assign template

  1. From the left pane, click Infrastructure. The Infrastructure screen of the selected client is displayed.
  2. From the Resources tab, select a required resource from the list of resources. Or, use the search option to find the resource.
  3. Click the resource name to view details.
  4. From the left pane, click Monitors. Templates tab is displayed.
  5. From Templates tab, click +Assign Templates.
  6. From Apply Templates, select the templates. The selected Templates section displays the chosen templates.
  7. Click Assign. The template gets assigned to the selected device.

After assigning the template to a resource for monitoring, click Get Latest Metric Values to view the latest metric information.

Use the following global templates to monitor your Linux resources:

  • Gateway - Linux OS Performance Remote Monitoring
  • Gateway - Linux OS Performance Remote Monitoring - V2
  • Gateway - Linux Network Remote Monitoring

View graphs

The gateway monitors the remote system using the assigned templates and displays the results in a graphical format.

  1. From the left pane, click Infrastructure. The Infrastructure screen of the selected client is displayed.
  2. From the Resources tab, select a required resource from the list of resources. Or, use the search option to find the resource.
  3. Click the resource name to view details.
  4. From the left pane, click Metrics. The Metrics page displays graphs generated by all monitoring templates assigned to a device.
  5. Search with the template name to filter the graphs.
Graphical Representation

Troubleshooting

  • The device is accessible to the gateway.
  • The appropriate port is available from the remote server.

Remote script executor example

#!/bin/bash

CPU=$(top -bn1 | grep load | awk ‘{printf "%.2f\t\t\n", $(NF-2)}’)
MEMORY=$(free -m | awk ‘NR==2{printf "%.2f\t\t", $3*100/$2 }’)
DISK=`df -h | awk ‘$NF=="/"{ print $5}’ | sed ‘s/%//g’`

printf "{\"disk.utilization\" : %s , \"memory.utilization\" : %s , \"cpu.usage\" : %s}" "$DISK" "$MEMORY" "$CPU"

Output :

{"disk.utilization" : 23 , "memory.utilization" : 24.28 , "cpu.usage" : 0.64 }

Standard JSON Output formats: Remote script executor script

Format 1
{
"Metric1": 98,
"Metric2": 70,
"Metric3": 80
}
Format 2
{
"Metric1": 98,
"Metric2": "STATE",
"Metric3": 80
}
}
Format 3
{
    "MetricName1": {
        "components": {
            "component1": 70,
            "component2": 98
        }
    },
    "MetricName2": {
        "components": {
            "component1": 77,
            "component2": 98
        }
    }
}
Format 4
alertTokens: Using alertTokens, you can add more information to the alert Subject and Description.

{
    "MetricName1": {
        "components": {
            "component1": "STATE",
            "component2": 98
        },
        "alertTokens": {
            "token1": "value",
            "token2": "value2"
        }
    },
    "MetricName2": {
        "components": {
            "component1": 77,
            "component2": 98
        },
        "alertTokens": {
            "token1": "value",
            "token2": "value2"
        }
    }
}
Format 5

{
    "MetricName1": 254,
    "MetricName2": {
        "components": {
            "comp1": 90,
            "comp2": 60
        }
    },
    "MetricName3": {
        "components": {
            "component1": "STATE",
            "component2": 98
        },
        "alertTokens": {
            "token1": "value",
            "token2": "value2"
        }
    }
}
Format 6
component level alertTokens: We can specify alertToken value for each component separately as mentioned for metricName4

{
    "MetricName1": 254,
    "MetricName2": {
        "components": {
            "comp1": 90,
            "comp2": 60
        }
    },
    "MetricName3": {
        "components": {
            "component1": "STATE",
            "component2": 98
        },
        "alertTokens": {
            "token1": "value",
            "token2": "value2"
        }
    },
     "MetricName4": {
        "components": {
            "component1": 10,
            "component2": 20
        },
        "alertTokens": {
            "token1": { 
        "component1": "comp1 token1 value", 
        "component2": "comp2 token1 value" 
        },
            "token2": { 
        "component1": "comp1 token2 value",
        "component2": "comp2 token2 value" 
        }
        }
    }
}