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

Valid Signatures

void bem.load(String file_name)

Loads the specified script file.

Returns

None

bem.logDebug

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.

Valid Signatures

void bem.logDebug(String message_text)

Generates a log message in the default category.

void bem.logDebug(String category_name,String message_text)

Generates a log message in the specified category.

Returns

None

bem.logError

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.

Valid Signatures

void bem.logError(String message_text)

Generate a log message in the default category.

void bem.logError(String category_name,String message_text)

Generate a log message in the specified category.

Returns

None

bem.logInfo

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.

Valid Signatures

void bem.logInfo(String message_text)

Generate a log message in the default category.

void bem.logInfo(String category_name,String message_text)

Generate a log message in the specified category.

Returns

None

bem.logWarning

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.

Valid Signatures

void bem.logWarning(String message_text)

Generate a log message in the default category.

void bem.logWarning(String category_name,String message_text)

Generate a log message in the specified category.

Returns

None

bem.nodeId

The bem.nodeId property is read-only and identifies the local monitor to the scripting layer in the format, monitor_name:monitor_listener_port

For example, qasun2.mosol.com:6789

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. These rules are typically used for data normalization, especially for data collector grouping fields. For example,

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

Values

metrics.constants.CASE_TO_LOWER

Convert field content to lower case.

metrics.constants.CASE_TO_UPPER

Convert field content to upper case.

metrics.constants Field Names

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

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

metrics.constants Severities

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

var alarm = metrics.createTecAlarm();
alarm.severity= metrics.constants.SEV_CRITICAL;
var elem = metrics.createMetricsElement() ;
elem.condition=metrics.constants.SEV_MINOR;

Values

metrics.constants.SEV_CRITICALmetrics.constants.SEV_INFOmetrics.constants.SEV_MAJORmetrics.constants.SEV_MINORmetrics.constants.SEV_OKmetrics.constants.SEV_UNKNOWN

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

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

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.

metrics.createFieldFilter()

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

Valid Signatures

FieldFilter metrics.createFieldFilter()

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

Returns

A FieldFilter object.

metrics.createFieldXform()

Creates a new FieldXform object. FieldXform objects are included in Preprocessor objects to normalize data in HVEvent objects. For more information and an example, see Section A.2.2, FieldXform.

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.

metrics.createMetricsElement()

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. For an example, see Section A.2.5, MetricsElement.

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.

metrics.createPreprocessor()

Creates a new Preprocessor object. Preprocessor objects are responsible for normalizing and filtering HVEvent objects before they are processed by data collectors. For more information, see Section A.2.7, Preprocessor.

Valid Signatures

Preprocessor metrics.createPreprocessor()

Preprocessor metrics.createPreprocessor(integer uploadTimeLimit)

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

Returns

A Preprocessor object.

metrics.createResponseTimeRange()

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. For an example, see Section A.2.9, ResponseTimeRange.

Valid Signatures

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

Returns

A ResponsetimeRange object.

metrics.createSeriesData()

Creates a new SeriesData object. These objects are used to track statistical information over time. For more information and an example, see Section A.2.10, SeriesData.

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.

metrics.createSummaryCollector()

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. For more information and an example, see Section A.2.11, SummaryDataCollector.

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.

metrics.createTecAlarm()

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

For more information and an example, see Section A.2.4, MetricAlarm.

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.

metrics.getAllMembers()

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

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);   
}

Valid Signatures

MetricsMember[] metrics.getAllMembers()

Returns

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

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.getLocalMember()

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

Valid Signatures

MetricsMember metrics.getLocalMembers()

Returns

The MetricsMembers object representing the local Monitor.

metrics.onload

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.

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
}

Handler Signature

void onload()

metrics.onMemberConnect

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.

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);
}

Handler Signature

void onMemberConnect(GroupMember memberData)

metrics.onMemberDisconnect

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.

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);
}

Handler Signature

void onMemberDisconnect(GroupMember memberData)

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

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

Handler Signature

void onMemberRefused(GroupMember memberData)

metrics.onunload

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.

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);
}

Handler Signature:

void onunload()

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

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);

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.

metrics.sendMetricAlarm()

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.

For more information and an example, see Section A.2.4, MetricAlarm.

Valid Signatures

metrics.sendMetricAlarm (MetricAlarm alarm)

metrics. sendMetricAlarm (MetricAlarm[] alarms)

Returns

N/A

metrics.sendMetricsElement()

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.

For an example, see Section A.2.5, MetricsElement.

Valid Signatures

metrics.sendMetricsElement (MetricsElement element)

metrics.sendMetricsElement (MetricsElement[] elements)

Returns

N/A

metrics.start()

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

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
}

Valid Signatures

void metrics.start(Preprocessor preprocessor, DataCollector collector)

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

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

/*
 * 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);
}

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

Valid Signatures

String testEngine.activateScenario(String testName, Number sequenceNumber)

Returns

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

testEngine.activateTest()

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.

/*
 * 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);
}

Valid Signatures

String testEngine.activateTest(String testName)

Returns

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

testEngine.deactivateScenario()

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.

/*
 * 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);
}

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

Valid Signatures

String testEngine.deactivateScenario(String testName, Number sequenceNumber)

Returns

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

testEngine.deactivateTest()

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.

/*
 * 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);
}

Valid Signatures

String testEngine.deactivateTest(String testName)

Returns

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

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. The provided values correspond to the types of scenarios that can be created in Experience Manager adapter test administration.

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

testEngine.constants Severities

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

For instructions, see Section A.2.18, SyntheticTestResults.

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

testEngine.getDeployment()

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

For instructions, see Section A.2.15, SyntheticDeployment.

Valid Signatures

SyntheticDeployment testEngine.getDeployment()

Returns

A SyntheticDeployment object representing the current monitor deployment.

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

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
   }
}

Handler Signature

void onDeploymentChanged(String originator, SyntheticDeployment 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. The handler function is typically used as part of a Synthetic Test Management implementation involving some form of conditional execution logic.

For an examples, see Section A.2.18, SyntheticTestResults.

Handler Signature

void onScenarioComplete(SyntheticAlarm alarm)

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. The handler function is typically used as part of a Synthetic Test Management implementation involving some form of conditional execution logic.

For an example, see Section A.2.18, SyntheticTestResults.

Handler Signature

void onTestComplete(SyntheticTestResults testResults)

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

Valid Signatures

String testEngine.properties.get(String property_name, String property_value)

Integer testEngine.properties.get(String property_name, integer property_value)

Float testEngine.properties.get(String property_name, Float property_value

Boolean testEngine.properties.get(String property_name, Boolean property_value

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.