# Basic Concepts

Avantra provides a powerful JavaScript environment to allow our customers to build custom monitoring custom checks, powerful automations and custom output channels.

The JavaScript version used is ECMAScript 2021 (ES 12) which provides advanced language features to simplify your scripts. Access to Avantra, and the the system for which the check or automation is available on is provided by global variables that we inject into the script runtime.

Depending on the type of system the Custom Check or Automation is running on, different global are available variables to allow access to the specific features of that system. Although some APIs are common across all system types.

Additionally, the type of extension being developed, e.g. custom check or automation etc., gives access to different context specific methods. For example, all check scripts have a mechanism for reporting their status and other information whereas a custom notification output channel will provide the access to the current message being sent.

## Enhancement Types

### Custom Checks

A JavaScript based custom check is a powerful way to extend the core monitoring capabilities of Avantra by providing check logic that alerts you if any functionality your business relies on behaves incorrectly or needs attention.

We provide a rich API to report the status of the check back to Avantra along with detailed information or tabular results. Within a check we have access to powerful APIs depending on the monitored system type the check is run on. In addition, we always have access to the following building blocks:

- Using (Monitoring) Parameters

  Access parameters set in Avantra for the monitored object this action is run on to control the logic.

- Saving State

  Save calculated values to a local storage for use in subsequent executions of this check on a specific system.

- Calling Web Services

  Access to a simple HTTP client to call web services to validate operations or perform actions.

### Automation Actions

A JavaScript based automation action step is a method to perform custom actions to automate complex tasks and perform custom logic within a larger automation workflow.

Automation actions can either be performed on the agent or on the Avantra server itself. The APIs that are available differ in these scenarios.

- Agent-based steps

  Provides powerful APIs to access the managed object and perform complex actions depending on the managed object type. For example can call SAP RFCs, perform database queries, and execute operating system commands.

- Server-based steps

  The server-side type steps have access to a rich information API from the data that Avantra has collected, system information and check statuses etc. This type of step also allows users to update some information in Avantra, for example create external check results.

In both cases, we also provide an API to report the status and details of the step that has been executed. We always have access to the following building blocks:

- Using (Monitoring) Parameters

  Access parameters set in Avantra for the managed object the step is run on to control the logic. (Only applies to agent-based steps)

- Calling Web Services

  Access to a simple HTTP client to call web services to validate operations or perform actions.

### Script Based Notification Channels

Introduced in Avantra 21.11, Script Based Notification Channels are a powerful method of extending the Notification System in Avantra with custom business logic. Customers can decide, based on the message to be sent, or information about the underlying check, system, or Avantra customer what information to send.

We provide a rich API API to access information about the message that is due to be sent, the system or action that is linked to the message to be sent and the trigger of that message (a critical check, alert etc.). In addition, with a custom notification channel script, we have access to the following building blocks:

- Saving State

  Save calculated values to a local storage for use in subsequent messages sent for this notification action/check/system combination.

- Calling Web Services

  Access to a simple HTTP client to call web services to validate operations or perform actions.

## System Types

For JavaScript based custom checks and automation steps, which system type the script is run on determines which extra functions, or building blocks we have access to:

### Server

- Operating System Access

  Access information about the underlying operating system and execute command line programs.

### SAP System / SAP Instance

- Calling SAP Function Modules

  We provide a simple API to easily call functions on SAP (remote function calls) to either validate correct operation (in monitoring checks) or perform actions (in automations).

- Using the SAP Control API

  Access the SAP Control SOAP web API using our wrapper object to simplify your scripts by easily calling commands or retrieving parameter values without using XML.

- Making Database Queries

  Access the underlying database of an SAP system to perform SQL queries to collect information for checks or change data in automations.

- Operating System Access

  Access information about the underlying operating system and execute command line programs.

### Database

- Making Database Queries

  Access the database to perform SQL queries to collect information for checks or change data in automations.

- Operating System Access

  Access information about the underlying operating system and execute command line programs.

### Cloud Service

- Operating System Access

  Access information about the underlying operating system and execute command line programs.