A.1 Predefined Objects

These objects are predefined in the Experience Manager scripting environment.

A.1.1 The “bem” object

The bem object provides access to various services common to all Experience Manager monitor script-based applications. This object is predefined and always available in all contexts.

bem.load()

Loads a script source file into the current context.

Valid Signatures
  • void bem.load(String fileName): Load the specified script file.

Returns

None

Description

Loads a script source file into the current context. The fileName argument can be the name of a script file in the Monitor’s scripts directory, the path to the script file relative to the scripts directory, or an absolute file path. If the file cannot be found, or cannot be parsed by the script interpreter, an exception is thrown.

bem.logDebug

Generate a log message at DEBUG level.

Valid Signatures
  • void bem.logDebug(String message): Generate a log message in the default category.

  • void bem.logDebug(String category,String message): Generate a log message in the specified category.

Returns

None

Description

Generate a log message at DEBUG level. All scripting logs are recorded in the "Scripting" log category. Messages can be allocated to a subcategory of "Scripting" using the optional category argument. For example bem.logDebug('testCategory', 'test message') writes test message to the logger at DEBUG level, with the category Scripting.testCategory.

bem.logError

Generate a log message at ERROR level.

Valid Signatures
  • void bem.logError(String message): Generate a log message in the default category.

  • void bem.logError(String category,String message): Generate a log message in the specified category.

Returns

None

Description

Generate a log message at ERROR level. All scripting logs are recorded in the "Scripting" log category. Messages can be allocated to a subcategory of "Scripting" using the optional category argument. For example bem.logError('testCategory', 'test message') writes test message to the logger at ERROR level, with the category Scripting.testCategory.

bem.logInfo

Generate a log message at INFO level.

Valid Signatures
  • void bem.logInfo(String message): Generate a log message in the default category.

  • void bem.logInfo(String category,String message): Generate a log message in the specified category.

Returns

None

Description

Generate a log message at INFO level. All scripting logs are recorded in the "Scripting" log category. Messages can be allocated to a subcategory of "Scripting" using the optional category argument. For example bem.logInfo('testCategory', 'test message') writes test message to the logger at INFO level, with the category Scripting.testCategory.

bem.logWaring

Generate a log message at WARN level.

Valid Signatures
  • void bem.logWarning(String message): Generate a log message in the default category.

  • void bem.logWarning(String category,String message): Generate a log message in the specified category.

Returns

None

Description

Generate a log message at WARN level. All scripting logs are recorded in the "Scripting" log category. Messages can be allocated to a subcategory of "Scripting" using the optional category argument. For example bem.logWarning('testCategory', 'test message') writes test message to the logger at WARN level, with the category Scripting.testCategory.

bem.nodeId

The bem.nodeId property identifies the local monitor to the scripting layer in the format:

monitor_name:monitor_listener_port

For example:

qasun2.mosol.com:6789

This property is read-only.

A.1.2 The “metrics” object

The “metrics” object provides access to various services specific to the High-Volume-Metrics application. This object is predefined and always available in the HVMetrics.script context.

metrics.constants

metrics.constants is a collection of global read-only values used by HVM scripts when interacting with various parts of the API. The collection as a whole is normally not referenced. Members of this collection fall into the categories described in the following sections:

metrics.constants Case Rules

Case rule constants are assigned to the caseRule property of a FieldXform

Values

  • metrics.constants.CASE_TO_LOWER

    Convert field content to lower case.

  • metrics.constants.CASE_TO_UPPER

    Convert field content to upper case.

Description

Case rule constants are assigned to the caseRule property of a FieldXform. These rules are typically used for data normalization, especially for data collector grouping fields.

Example

var xform = metrics.createXform('Normalize URL');
xform.fieldName=metrics.constants.FN_URL;
xform.caseRule=metrics.constants.CASE_TO_LOWER;
metrics.constants Field Names

Field name constants are used to identify standard fields in an HVEvent object.

Values

  • metrics.constants.FN_APPLICATION_NAME

    Identifies the field containing the application name value sent by the instrumentation script that sent the event.

  • metrics.constants.FN_CLIENT_IP

    Identifies the field containing the IP address of the system that delivered the event to the monitor.

  • metrics.contstants.FN_DOWN_LOAD_TIME

    Identifies the field containing the time between Page initialization and load complete.

  • metrics.constants.FN_EVENT_TS

    Identifies the field containing the time the event was received by the monitor.

  • metrics.constants.FN_PAGE_TITLE

    Identifies the field containing the page title of the page that generated the event.

  • metrics.constants.FN_RESPONSE_TIME

    Identifies the field containing the response time for this event.

  • metrics.constants.FN_UPLOAD_TIME

    Identifies the field containing the time before-unload and page initialization for the event.

  • metrics.constants.FN_URL

    Identifies the field containing the URL of the page that generated the event.

  • metrics.constants.FN_USER_AGENT

    Identifies the field containing the navigator.userAgent value as reported by the browser that reported this event.

Description

Field names are used to identify standard fields in an HVEvent object. They are used in a variety of objects, including FieldFilters, FieldXForms, and DataCollectors to specify the event fields on which they operate.

Example

var ipFilter = metrics.createFieldFilter('ipFilter', 
               metrics.constants.FN_CLIENT_IP, '192.168.1.*');
var appsCollector = metrics.createSummaryCollector();
appsCollector.exclusionFilters=[ipFilter]; //exclude the local subnet
metrics.constants Severities

Severity constants are used when specifying the condition of an alarm or element.

Values

  • metrics.constants.SEV_CRITICAL

  • metrics.constants.SEV_INFO

  • metrics.constants.SEV_MAJOR

  • metrics.constants.SEV_MINOR

  • metrics.constants.SEV_OK

  • metrics.constants.SEV_UNKNOWN

Description

Severity constants are used when specifying the condition of an alarm or element.

Example

var alarm = metrics.createTecAlarm();
alarm.severity= metrics.constants.SEV_CRITICAL;
var elem = metrics.createMetricsElement() ;
elem.condition=metrics.constants.SEV_MINOR;
metrics.constants Stale-Report Handling Options

Stale-report handling option constants are used to specify how to process stale report data from distributed data collectors during aggregation.

Values

  • metrics.constants.SRO_FILTER

    Specifies that stale reports should be filtered out of aggregate reports.

  • metrics.constants.SRO_INCLUDE

    Specifies that stale reports should be rolled into the current interval of aggregate reports.

  • metrics.constants.SRO_PASS

    Specifies that stale reports should be passed through to the report handler for processing.

Description

Stale-report handling option constants are used to specify how to process stale report data from distributed data collectors during aggregation. These values are assigned to a data collector’s staleReportOption property in a distributed collection environment. Refer to SummaryDataCollector.staleReportOption or SamplingDataCollector.staleReportOption for more information.

Example

var appsCollector = metrics.createSummaryCollector();
appsCollector.staleReportOption= metrics.constants.SRO_PASS;

metrics.createFieldFilter()

Creates a new FieldFilter object.

Valid Signatures
  • FieldFilter metrics.createFieldFilter()

  • FieldFilter metrics.createFieldFilter(String filterName, String fieldName, String expression)

Returns

A FieldFilter object.

Description

Creates a new FieldFilter object. FieldFilter objects are included in Preprocessor objects to exclude an HVEvent from processing. They are also used with DataCollectors to determine what HVEvents should be reported on.

Example
var ipFilter = metrics.createFieldFilter('ipFilter', 
               metrics.constants.FN_CLIENT_IP, '192.168.1.*');

var appsCollector = metrics.createSummaryCollector();
appsCollector.exclusionFilters=[ipFilter]; //exclude the local subnet

metrics.createFieldXform()

Creates a new FieldXform object.

Valid Signatures
  • FieldXform metrics.createFieldXform()

  • FieldXform metrics.createFieldXform(String name)

  • FieldXform metrics.createFieldXform (String name, String fieldName, String matchExression, String replaceExpression)

  • FieldXform metrics.createFieldXform (String name, String fieldName, String matchExression, String replaceExpression, String destFieldName, CaseRule rule)

Returns

A FieldXform object.

Description

Creates a new FieldXform object. FieldXform objects are included in Preprocessor objects to normalize data in HVEvent objects. Refer to the FieldXForm description for more information.

Example

Refer to the FieldXform object description.

metrics.createMetricsElement()

Creates a new MetricsElement object.

Valid Signatures
  • MetricsElement metrics.createMetricsElement()

  • MetricsElement metrics.createMetricsElement(String elementKeys)

  • MetricsElement metrics.createMetricsElement(SummaryReport report, Boolean mapValues)

  • MetricsElement metrics.createMetricsElement(SamplingReport report, Boolean mapValues)

Returns

A MetricsElement object.

Description

Creates a new MetricsElement object. These objects are used to create and update Operations Center elements that capture data about your metrics data. The createMetricsElement method supports two specialized forms, one that takes a SummaryReport, and the other a SamplingReport. These prepopulate MetricsElement.elementKeys with the collector name, followed by the grouping values. If the mapValues argument is set to True, this method also populates the seriesData arrays. In the case of SummaryReports, each of the SummaryStats value in SummaryReport.overall, as well as any populated SummaryReport.rangeStats values. (The example for MetricsElement shows this mapping done in JavaScript.). For SummaryReports, each of the captured hits produces a SeriesData entry, with any duplicate time stamps being scrubbed out.

Example

Refer to the MetricsElement object description.

metrics.createPreprocessor()

Creates a new Preprocessor object.

Valid Signatures
  • Preprocessor metrics.createPreprocessor()

  • Preprocessor metrics.createPreprocessor(integer uploadTimeLimit)

  • Preprocessor metrics.createPreprocessor(integer uploadTimeLimit, FieldXform[] xforms, FieldFilters[] filters)

Returns

A Preprocessor object.

Description

Creates a new Preprocessor object. Preprocessor objects are responsible for normalizing and filtering HVEvent objects before they are processed by data collectors. Refer to the Preprocessor description for more information.

Example

Refer to the Preprocessor object description.

metrics.createResponseTimeRange()

Creates a new ResponsetimeRange object.

Valid Signatures
  • ResponsetimeRange metrics.createResponsetimeRange()

  • ResponsetimeRange metrics.createResponsetimeRange(String name, integer lowTime, integer highTime)

Returns

A ResponsetimeRange object.

Description

Creates a new ResponsetimeRange object. These objects are used to refine data collectors to track hits where the response time falls within the specified range values.

Example

Refer to the ResponsetimeRange object description.

metrics.createSeriesData()

Creates a new SeriesData object.

Valid Signatures
  • SeriesData metrics.createSeriesData()

  • SeriesData metrics.createSeriesData(String name, java.util.Date, Number value)

  • SeriesData metrics.createSeriesData(String name, java.util.Date, Number value, integer expiryDays)

Returns

A SeriesData object.

Description

Creates a new SeriesData object. These objects are used to track statistical information over time. Refer to the SeriesData object for more information.

Example

Refer to the SeriesData object description.

metrics.createSummaryCollector()

Creates a new SummaryDataCollector object.

Valid Signatures
  • SummaryDataCollector metrics.createSummaryCollector()

  • SummaryDataCollector metrics.createSummaryCollector(String name, integer intervalDuration, Function reportHandler)

  • SummaryDataCollector metrics.createSummaryCollector(String name, integer intervalDuration, Function reportHandler, String[] groupingFieldNames, FieldFilter[] inclusionFilters, FieldFilter[] exclusionFilters, ResponseTimeRange[] ranges, String staleReportOption)

Returns

A SummaryDataCollector object.

Description

Creates a new SummaryDataCollector object. These objects are used to analyze the HVEvent stream and periodically produce summary reports describing the content of the event stream. The various configuration options on the data collector determine precisely what information to extract and the frequency it is reported. Refer to the SummaryDataCollector object description for more information.

Example

Refer to the SummaryDataCollector object description.

metrics.createTecAlarm()

Creates a new MetricAlarm object for delivery to a TEC subscriber.

Valid Signatures
  • MetricAlarm metrics.creatTecAlarm()

  • MetricAlarm metrics.creatTecAlarm(SamplingReport report, String severity, String description)

  • MetricAlarm metrics.creatTecAlarm(SummaryReport report, String severity, String description)

Returns

A MetricAlarm object.

Description

Creates a new MetricAlarm object for delivery to a TEC subscriber. The content of these alarms is largely driven be the TEC receiver. There are two convience versions that automatically mines relevant information from the provided report object as follows:

metricAlarm.timestamp = report.stopTime;
metricAlarm.id = report.key.hashCode();
metricAlarm.collectorName = xiReport.collector.name;

In addition, the appName property is populated from an HVEvent in the event stream.

Example

Refer to the MetricAlarm object description.

metrics.getAllMembers()

Retrieve the list of members defined in the current group.

Valid Signatures
  • MetricsMember[] metrics.getAllMembers()

Returns

The list of members defined in the current group as MetricsMembers objects.

Description

Retrieve the list of members defined in the current group. The list includes the local instance. All return data is read-only.

Example
var members = metrics.getAllMembers();
for(var i=0; i < members.length; i++)
{
   var elem = metrics.createMetricsElement();
   elem.elementKeys = ['groupStatus', members[i].id];
   elem.properties.put('Is Controller', !members[i].isRemote);
   elem.properties.put('Is Connected', members[i].isConnected());
   elem.condition=metrics.constants.SEV_MINOR;
   elem.isPropertySetComplete=false;
   metrics.sendMetricsElement(elem);   
}

metrics.getLocalMember()

Retrieve information about the local metrics group member.

Valid Signatures
  • MetricsMember metrics.getLocalMembers()

Returns

The MetricsMembers object representing the local Monitor.

Description

Retrieve information about the local metrics group member. All return data is read-only.

Example
var statusElem = metrics.createMetricsElement();
statusElem.elementKeys = ['groupStatus'];
statusElem.properties.put('currentController', metrics.getLocalMember().id);
statusElem.condition=metrics.constants.SEV_OK;
statusElem.isPropertySetComplete=false;
metrics.sendMetricsElement(statusElem);

metrics.onload

The metrics.onload property is used to specify the event handler to be called when HVM is starting up.

Handler Signature:
  • void onload()

Description

The metrics.onload property is used to specify the event handler to be called when HVM is starting up. The specified handler function is responsible for deploying the HVM configuration. In a single-monitor environment, this handler is normally only called during monitor startup. In a grouped-monitor environment, it can be called several times in the life of a monitor instance as the controller changes.

Example
metrics.onload=doStart;

function doStart()
{
   var preproc metrics.createPreprocessor(
                    metrics.properties.get('Cust.uploadThreshold',2500));
   var apps = metrics.createSummaryCollector('Applications',60000,handleReports);
   apps.groupingFieldNames=[metrics.constants.FN_APPLICATION_NAME];
   
   metrics.start(preproc, apps);
}
function handleReports(reports)
{
   // process reports here
}

metrics.onMemberConnect

The metrics.onMemberConnect property is used to specify the event handler to be called when a connectivity is established with another monitor in the group.

Handler Signature:
  • void onMemberConnect(GroupMember memberData)

Description

The metrics.onMemberConnect property is used to specify the event handler to be called when a connectivity is established with another member in the group. The handler function can be used to track report status of an HVM group configuration. In a single monitor environment, this handler is not called. In a group monitor environment, it is called when the initial connection is established and each time it is re‑established after a connectivity failure.

Example
metrics.onMemberConnect=handleConnect;

function handleConnect(memberData)
{
   var statusElem = metrics.createMetricsElement();
   statusElem.elementKeys = ['groupStatus', memberData.id];
   statusElem.condition=metrics.constants.SEV_OK;
   statusElem.message='Member is active';
   statusElem.isPropertySetComplete=false;
   metrics.sendMetricsElement(statusElem);
}

metrics.onMemberDisconnect

The metrics.onMemberDisconnect property is used to specify the event handler to be called when connectivity to another member in the group is lost.

Handler Signature:
  • void onMemberDisconnect(GroupMember memberData)

Description

The metrics. onMemberDisconnect property is used to specify the event handler to be called when connectivity to another monitor in the group is lost. The handler function can be used to track report status of an HVM group configuration. In a single monitor environment, this handler is not called. In a group monitor environment, it is called when the connectivity is lost and cannot be immediately re‑established.

Example
metrics.onMemberDisconnect=handleDisconnect;

function handleDisconnect(memberData)
{
   var statusElem = metrics.createMetricsElement();
   statusElem.elementKeys = ['groupStatus', memberData.id];
   statusElem.condition=metrics.constants.SEV_UNKNOWN;
   statusElem.message='Member unreachable';
   statusElem.isPropertySetComplete=false;
   metrics.sendMetricsElement(statusElem);
}

metrics.onMemberRefused

The metrics.onMemberRefused property is used to specify the event handler to be called when another member in the group refused control by the local instance.

Handler Signature:
  • void onMemberRefused(GroupMember memberData)

Description

The metrics.onMemberRefused property is used to specify the event handler to be called when another member in the group refused control by the local instance. The handler function can be used to track report status of an HVM group configuration. In a single monitor environment, this handler is not called. In a group monitor environment, it is called when a member refuses to be controlled by this instance. This indicates that the remote instance either does not recognize the local instance as valid controller, or it is already controlled by a higher precedence controller.

Example
metrics.onMemberRefused=handleRefused;

function handleRefused(memberData)
{
   var statusElem = metrics.createMetricsElement();
   statusElem.elementKeys = ['groupStatus', memberData.id];
   statusElem.condition=metrics.constants.SEV_CRITICAL;
   statusElem.message='Member denied connection. Check configuration';
   statusElem.isPropertySetComplete=false;
   metrics.sendMetricsElement(statusElem);
   // might want to send an alarm here too...
}

metrics.onunload

The metrics.onunload property is used to specify the event handler to be called when HVM is shutting down.

Handler Signature:
  • void onunload()

Description

The metrics.onunload property is used to specify the event handler to be called when HVM is shutting down. The handler function can be used to track report status of an HVM configuration. In a single monitor environment, this handler is only called when the monitor is shutting down. In a grouped-monitor environment, it can be called several times in the life of a monitor instance as the controller changes.

Example
metrics.onunload=stopping;

function stopping()
{
   var statusElem = metrics.createMetricsElement();
   statusElem.elementKeys = ['groupStatus',
                             metrics.properties.getMyID().toString()];
   statusElem.condition=metrics.constants.SEV_UNKNOWN;
   statusElem.message='Discontinued group control';
   statusElem.isPropertySetComplete=false;
   metrics.sendMetricsElement(statusElem);
}

metrics.properties

The metrics.properties object provides read access to values set in the metrics properties files. The current metrics properties file is specified in the "metrics.properties" property of the monitor.properties file. While this file does contain certain properties that are interpreted by the monitor (such as HVMetrics.script), the primary purpose of the metrics properties file is to configure the scripts that drive the HVM implementation. As such, the content of a particular metrics properties file is specific to the implementation. The examples used here are based on the DemoMetrics.properies file that ships with the product.

metrics.properties.get()

Retrieve the value of a specified property.

Valid Signatures
  • String metrics.properties.get(String propName, String defaultValue)

  • Integer metrics.properties.get(String propName, integer defaultValue)

  • Float metrics.properties.get(String propName, float defaultValue)

  • Boolean metrics.properties.get(String propName, Boolean defaultValue)

Returns

The value of the specified property from the current metrics properties file. The returned type always matches the type of the provided defaultValue argument. If the specified property is not defined or cannot be interpreted as the specified type, the default value is returned.

Description

Retrieve the value of a specified property. The various forms of the get method allows the script to quickly access a property value in the same form as the provided default value. When the value is retrieved from the properties file, it is coerced to the target type in the java layer, not the JavaScript layer. This means that if your properties file contains "myProp.count=14", then metrics.properties.get("myProp.count", 5) returns 14, but if "myProp.count=", then 5 is returned. (A JavaScript interpretation of "myProp.count=" returns 0.)

Example
var elementName=metrics.properties.get('Cust.topElementName','demo');
var uploadThreshod=metrics.properties.get('Cust.uploadThreshold',2000);
var errorPercent=metrics.properties.get('Cust.errorPercentThreshold', 0.10);
var sendDisconnectAlerts=metrics.properties.get(
   'Cust.group.sendMonitorConnAlerts',true);

metrics.sendMetricAlarm()

Send MetricAlarm objects to designated recipients.

Valid Signatures
  • metrics.sendMetricAlarm (MetricAlarm alarm)

  • metrics. sendMetricAlarm (MetricAlarm[] alarms)

Returns

N/A.

Description

Send MetricAlarm objects to designated recipients. The recipients of the alarm are designated at alarm creation. Currently only TEC recipients are support using the metrics.createTecAlarm() functions. If any included elements are invalid (MetricAlarm.isValid()), then an exception is thrown. Otherwise, alarms are delivered to the publishing component.

Errors in delivery are handled like other event data sent to the recipients (retries, caching, and so on). No notification is sent back to the script.

Example

Refer to the MetricAlarm object description.

metrics.sendMetricsElement()

Send MetricElement objects to Operations Center.

Valid Signatures
  • metrics.sendMetricsElement (MetricsElement element)

  • metrics.sendMetricsElement (MetricsElement[] elements)

Returns

N/A.

Description

Send MetricElement objects to Operations Center. If any included elements are invalid (MetricsElement.isValid()), then an exception is thrown. Otherwise, elements are delivered to the publishing component.

Errors in delivery are handled like other event data sent to Operations Center (retries, caching, and so on). No notification is sent back to the script.

Example

Refer to the MetricsElement object description.

metrics.start()

Deploys a new HVM configuration and initiates collection.

Valid Signatures
  • void metrics.start(Preprocessor preprocessor, DataCollector collector)

  • void metrics.start(Preprocessor preprocessor, DataCollector[] collectors)

Description

Deploys a new HVM configuration and initiates collection. A successful start requires a valid Preprocessor object and a list of valid SummmaryCollector and/or SamplingCollector objects. At least one collector must be in the list. If any arguments are invalid, this method throws a ScriptingException. Otherwise, the objects are deployed to the local system and, if necessary, the Web server is started (If Monitor.properties/Metrics.manageWebServer=true). If in a distributed configuration, the monitor also connects to the group members and starts them, as well. (Remote deployment occurs on a separate thread of execution so distribution might not have been completed when this method returns. You can track progress using the metrics.onMemberConnected and related event handlers.)

Example
metrics.onload=doStart;

function doStart()
{
   var preproc = metrics.createPreprocessor(metrics.properties.get('Cust.uploadThreshold',2500));
   var apps = metrics.createSummaryCollector('Applications',60000,handleReports);
   apps.groupingFieldNames=[metrics.constants.FN_APPLICATION_NAME];
   var pages = metrics.createSummaryCollector('Pages',60000,handleReports);
   pages.groupingFieldNames=[metrics.constants.FN_PAGE_TITLE];
   
   metrics.start(preproc, [apps,pages]);
}
function handleReports(reports)
{
   // process reports here
}

A.1.3 The “testEngine” object

The “testEngine” object provides limited access to the Experience Manager Monitor’s synthetic test engine, allowing scripts to track changes to the deployment, and start and stop tests and/or scenarios. This object is predefined and always available in all scripting contexts.

testEngine.activateScenario()

Activates a test scenario in the Experience Manager Monitor test engine.

Valid Signatures
  • String testEngine.activateScenario(String testName, Number sequenceNumber)

Returns

OK if the operation is successful; otherwise, a string describing the error.

Description

Activates a test scenario in the Experience Manager Monitor test engine. The test scenario must be part of the SyntheticDeployment and must currently be deactivated. This method is functionally equivalent to the "Activate Scenario" operation available under Monitor Administration in the Operations Center client.

This operation has no impact on the status of the SyntheticTest object.

Example
/*
 * Simple web-invocable operation to activate a specified test scenario. 
 * Activate the first scenario in test 'foo',with:
 * http[s]://<BemWebServer>/Plugins/invoke.pl?testName=foo&seq=1&op=activateScenario
 */
function activateScenario(parmMap)
{
   var testName=parmMap.get('testName');
   var seqNum=parmMap.get('seq');
   return testEngine.activateScenario(testName,seqNum);
}

testEngine.activateTest()

Activates a test in the Experience Manager Monitor test engine.

Valid Signatures
  • String testEngine.activateTest(String testName)

Returns

OK if the operation is successful; otherwise, a string describing the error.

Description

Activates a test in the Experience Manager Monitor test engine. The test must be part of the SyntheticDeployment and must currently be deactivated. If successful, the test is scheduled to run immediately and continues to run on its scheduled interval until deactivated or removed. This method is functionally equivalent to the "Activate Test" operation available under Monitor Administration in the Operations Center console.

Example
/*
 * Simple web-invocable operation to activate a specified test. 
 * Activate test 'foo' with:
 * http[s]://<BemWebServer>/Plugins/invoke.pl?testName=foo&op=activateTest
 */
function activateTest(parmMap)
{
   var testName=parmMap.get('testName');
   return testEngine.activateTest(testName);
}

testEngine.deactivateScenario()

Deactivates a test scenario in the Experience Manager Monitor test engine.

Valid Signatures
  • String testEngine.deactivateScenario(String testName, Number sequenceNumber)

Returns

OK if the operation is successful; otherwise, a string describing the error.

Description

Deactivates a test scenario in the Experience Manager Monitor test engine. The test scenario must be part of the SyntheticDeployment and must currently be activated. This method is functionally equivalent to the "Deactivate Scenario" operation available under Monitor Administration in the Operations Center console.

This operation has no impact on the status of the SyntheticTest object.

Example
/*
 * Simple web-invocable operation to deactivate a specified test scenario. 
 * Deactivate the first scenario in test 'foo',with:
 * http[s]://<BemWebServer>/Plugins/invoke.pl?testName=foo&seq=1&op=deactivateScenario
 */
function deactivateScenario(parmMap)
{
   var testName=parmMap.get('testName');
   var seqNum=parmMap.get('seq');
   return testEngine.deactivateScenario(testName,seqNum);
}

testEngine.deactivateTest()

Deactivates a test in the Experience Manager Monitor test engine.

Valid Signatures
  • String testEngine.deactivateTest(String testName)

Returns

OK if the operation is successful; otherwise, a string describing the error.

Description

Deactivates a test in the Experience Manager Monitor test engine. The test must be part of the SyntheticDeployment and must currently be activated. If successful, the test is no longer scheduled to run. If it is currently running, it is allowed to complete, but is not rescheduled. This method is functionally equivalent to the "Deactivate Test" operation available under Monitor Administration in the Operations Center console.

Example
/*
 * Simple web-invocable operation to deactivate a specified test. 
 * Deactivate test 'foo' with:
 * http[s]://<BemWebServer>/Plugins/invoke.pl?testName=foo&op=deactivateTest
 */
function deactivateTest(parmMap)
{
   var testName=parmMap.get('testName');
   return testEngine.deactivateTest(testName);
}

testEngine.constants

testEngine.constants is a collection of global read-only values used by Test Management and WebOps scripts. The collection as a whole is normally not referenced. Members of this collection fall into the categories described in the following sections:

testEngine.constants Scenario Types

Scenario type constants are used to distinguish different types of SyntheticScenario objects.

Values
  • testEngine.constants.SCENARIO_TYPE_HTTP

  • testEngine.constants.SCENARIO_TYPE_HTTPS

  • testEngine.constants.SCENARIO_TYPE_SQL

  • testEngine.constants.SCENARIO_TYPE_THIRD_PARTY

  • testEngine.constants.SCENARIO_TYPE_NATIVE_WINDOWS

  • testEngine.constants.SCENARIO_TYPE_MAIL

  • testEngine.constants.SCENARIO_TYPE_FTP

  • testEngine.constants.SCENARIO_TYPE_PING

  • testEngine.constants.SCENARIO_TYPE_TRACERT

  • testEngine.constants.SCENARIO_TYPE_DHCP

  • testEngine.constants.SCENARIO_TYPE_LDAP

Description Scenario type constants are used to distinguish different types of SyntheticScenario objects. The provided values correspond to the types of scenarios that can be created in Experience Manager adapter test administration.

testEngine.constants Severities

Test engine severity constants are used to identify the severity of a SyntheticAlarm produced by the testEngine.

Values
  • testEngine.constants.SEV_CRITICAL

  • testEngine.constants.SEV_INFO

  • testEngine.constants.SEV_MAJOR

  • testEngine.constants.SEV_MINOR

  • testEngine.constants.SEV_OK

  • testEngine.constants.SEV_UNKNOWN

Description

Test engine severity constants are used to identify the severity of a SyntheticAlarm produced by the testEngine.

Example

Refer to the SyntheticTestResults object description.

testEngine.getDeployment()

Retrieve the current deployment of synthetic tests.

Valid Signatures
  • SyntheticDeployment testEngine.getDeployment()

Returns

A SyntheticDeployment object representing the current monitor deployment.

Description

Retrieve the current deployment of synthetic tests. The returned object is a snapshot of the monitor’s deployment. It does not change if the deployment changes.

Example

Refer to the SytheticDeployment object description.

testEngine.onDeploymentChanged

The testEngine.onDeploymentChanged property is used to specify the event handler to be called when the tests deployed to the test engine change in any way.

Handler Signature:
  • void onDeploymentChanged(String originator, SyntheticDeployment deployment)

Description

The testEngine.onDeploymentChanged property is used to specify the event handler to be called when the tests deployed to the test engine change in any way. The handler function can be used to reinitialize rules that handle fail-over conditions, audit changes to deployment, and so on.

The following example is really just a skeleton to show how to capture this event. Implementations of fail-over tracking and other synthetic test management functions can be fairly complex and distracts from the purpose of this example.

Example
testEngine.onDeploymentChanged = handleNewDeployment;

function handleNewDeployment(originator,deployment)
{
   // filter out changes that originate locally...
   if(!(originator == bem.nodeId))
   {
      bem.logDebug('Processing deployment change from: ' + originator);
      var tests = deployment.getTests();
      // ... update rules/states based on changes in deployment
   }
}

testEngine.onScenarioComplete

The testEngine.onScenarioComplete property is used to specify the event handler to be called when the test engine completes execution of a test scenario.

Handler Signature:
  • void onScenarioComplete(SyntheticAlarm alarm)

Description

The testEngine.onScenarioComplete property is used to specify the event handler to be called when the test engine completes execution of a test scenario. The handler function is typically used as part of a Synthetic Test Management implementation involving some form of conditional execution logic.

Example

Refer to the SynthetTestResults object description.

testEngine.onTestComplete

The testEngine.onTestComplete property is used to specify the event handler to be called when the test engine completes execution of a test.

Handler Signature:
  • void onTestComplete(SyntheticTestResults testResults)

Description

The testEngine.onTestComplete property is used to specify the event handler to be called when the test engine completes execution of a test. The handler function is typically used as part of a Synthetic Test Management implementation involving some form of conditional execution logic.

Example

Refer to the SynthetTestResults object description.

testEngine.properties

The testEngine.properties object provides read access to values set in the test management properties files. The current test management properties file is specified in the tests.management.properties property of the monitor.properties file. While this file does contain certain properties that are interpreted by the monitor (for example, tests.management.script), the primary purpose of the properties file is to configure test management scripts. As such, the content of a particular properties file is specific to the implementation.

testEngine.properties.get()

Retrieve the value of a specified property.

Valid Signatures
  • String testEngine.properties.get(String propName, String defaultValue)

  • Integer testEngine.properties.get(String propName, integer defaultValue)

  • Float testEngine.properties.get(String propName, float defaultValue)

  • Boolean testEngine.properties.get(String propName, Boolean defaultValue)

Returns

The value of the specified property from the current properties file. The returned type always matches the type of the provided defaultValue argument. If the specified property is not defined or cannot be interpreted as the specified type, the default value is returned.

Description

Retrieve the value of a specified property. The various forms of the get method allows the script to quickly access a property value in the same form as the provided default value. When the value is retrieved from the properties file, it is coerced to the target type in the java layer, not the JavaScript layer. This means that if your properties file contains "myProp.count=14", then metrics.properties.get("myProp.count", 5) returns 14, but if "myProp.count=", then 5 is returned. (A JavaScript interpretation of "myProp.count=" returns 0.)