Using G2 custom monitors, building and managing independent monitoring solutions is easy without relying on the platform. Agent-based monitors and templates can be created using the following:

  • Application type: Script Executor (Also called as “Remote Script Executor”)
  • Supported Programming languages: Shell, Powershell, and Python
  • Supported Operating systems: Windows & Linux

Set up agent G2 monitors using Remote Script Executor

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

Key highlights

  • 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.
  • The monitoring of Windows workstations through Linux Gateway is not supported.

Step 1: Create metrics

Metrics provide the metadata to correlate the script output and must match the metric names added to the Monitor.

To create Metrics:

  1. Select a client from the All Clients list.
  2. Go to Setup > Monitoring > Metrics.
  3. From METRICS, click + Add.
  4. From Create Metric, provide details for the following parameters:
    • 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.
      OpsRamp recommends <vendorname>.<application name>.<component>.<metric> as naming convention for the 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
      • None
      • Graph and Notification.
      • To configure values for Graph and Notification, provide the following parameters:
        • Warning if value: Warning alert sent when the metric reaches the Warning Threshold.
        • Critical if value: Critical alert sent when the metric reaches the Critical Threshold.
        • Subject: Subject for the metric.
        • Description: Description for the metric.
  5. Click Save.

Use the following tokens in subject and description fields:

${severity}Alert state. For example,  Critical, Warning, and  OK.
${}Metric name.
${} Component name.
${metric.value}  Value of the metric or component.
${}Device hostname.
${resource.ip} IP address of the device.
${threshold}  Threshold value configured for the alert state.
${repeat.count}  Configured repeat count for the respective alert state.
${resource.ipaddress}IP address of the device.
${resource.mac}MAC address of the device.
${resource.serialno}  Serial Number of the device.
${resource.make} Make of the device.
${resource.model}  Device model.
${resource.hostname}Device hostname.
${resource.uniqueid}  Unique ID/UUID of the device.
${resource.os}   Operating system of the device

Step 2: Create monitors

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

Prerequisites: Add the required custom parameters.

Macros in Remote Script Executor

Macros are implemented to address the passing of dynamic arguments to scripts.

Use the Static or Dynamic macros to make available native attributes and custom attribute defined on the resource, in the script.

Static macros

Using the static macros, the values that you provide in the script are overridden.

${resource.ipaddress}The IP address of the device
${resource.mac}Mac address of the device
${resource.serialno}Serial Number of  the device
${resource.make}Make of the device
${resource.model}Model of the device.
${resource.hostname}The hostname of the device
${resource.uniqueid}UniqueId of the device
${resource.os}Operating System of the device

Dynamic macros

Using Dynamic Macros, do the following actions:

  • Get custom attributes of the device: If you want to use an argument in any script, apply the custom attributes to the device.
    Syntax: ${customattributes.customAttributekey}.

    For 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.

  • Get the credentials added to the device: You can use (macros) credentials in the script to avoid keeping the original username and password in plain text. The macros replace the original credentials when you execute the script.
    Syntax: ${credentials.CredentialName.credentialField}.

    For example, you define a Credential set of Name JMXCred and added to a device. You can use the macro ${credentials.JMXCred.username} in your script. The macro replaces the original credentials in your script at runtime.

Script execution path for configuration parameters in Linux and Windows

Target Platform
BashbashNot Applicable
ShellshNot Applicable
PowershellNot Applicablepowershell.exe
PerlPerlNot Applicable

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, provide the absolute path of Python such as /usr/lib/python.

Create monitors

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

      Configuration Parameters

  5. Click Save.
    The MONITORS screen displays the new monitor.
  • Using available configuration parameters, you can specify the scripting language type and the platform to execute the script.
  • If you select the Custom value in configuration parameters, add the parameter: custom.script.execution.path.

Step 3: Create templates

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

  1. Select a client from the All Clients list.
  2. Go to Setup > Monitoring >Templates.
  3. From Templates, click + Add.
  4. From MONITOR TEMPLATE, provide details for the following parameters and click Save.
    • Select Template Scope: Template type.

    • Collector Type: Select Agent.

    • Monitor Type: Select G2 Monitors.

    • 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.

    • 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
        After providing the template details, MONITOR TEMPLATE displays the Monitors section.
        The console 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.
        The monitor screen appears.
      2. Provide 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.
        Select the Availability and Alert checkbox to initiate monitoring.
      1. Provide details for the following parameters:
      • Warning Operator
      • Warning Threshold
      • Warning Repeat Count
      • Critical Operator
      • Critical threshold
      • Critical Repeat Count
      1. Click Add.
        The TEMPLATES section displays the configured details.

After adding the monitor, add component thresholds and component filters by editing the metric values. For more details, view Add Filter and Define Threshold

Step 4: Assign templates

  1. From the left pane, click Infrastructure.
    The Infrastructure screen of the selected client appears.
  2. From the Resources tab, select the required resource from the list of resources.
    Alternatively, use the search option to locate the resource.
  3. Click the resource name to view details.
  4. From the left pane, click Monitors.
  5. From the 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.

Step 4: View graphs

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

  1. From the left pane, click Infrastructure.
  2. From the Resources tab, select the required resource from the list of resources.
    Alternatively, use the search option to locate 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.

Sample: Remote script executor script


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"

Next steps