End of support notice: On October 7th, 2026, Amazon will discontinue support for Amazon IoT Greengrass Version 1. After October 7th, 2026, you will no longer be able to access the Amazon IoT Greengrass V1 resources. For more information, please visit Migrate from Amazon IoT Greengrass Version 1.
ServiceNow MetricBase Integration connector
Warning
This connector has moved into the extended life phase, and Amazon IoT Greengrass won't release updates that provide features, enhancements to existing features, security patches, or bug fixes. For more information, see Amazon IoT Greengrass Version 1 maintenance policy.
The ServiceNow MetricBase Integration connector publishes time series metrics from Greengrass devices to ServiceNow MetricBase. This allows you to store, analyze, and visualize time series data from the Greengrass core environment, and act on local events.
This connector receives time series data on an MQTT topic, and publishes the data to the ServiceNow API at regular intervals.
You can use this connector to support scenarios such as:
Create threshold-based alerts and alarms based on time series data collected from Greengrass devices.
Use time services data from Greengrass devices with custom applications built on the ServiceNow platform.
This connector has the following versions.
Version |
ARN |
|---|---|
4 |
|
3 |
|
2 |
|
1 |
|
For information about version changes, see the Changelog.
Requirements
This connector has the following requirements:
Connector Parameters
This connector provides the following parameters:
Create Connector Example (Amazon CLI)
The following CLI command creates a ConnectorDefinition with an initial version that contains the ServiceNow MetricBase Integration connector.
aws greengrass create-connector-definition --name MyGreengrassConnectors --initial-version '{ "Connectors": [ { "Id": "MyServiceNowMetricBaseIntegrationConnector", "ConnectorArn": "arn:aws:greengrass:region::/connectors/ServiceNowMetricBaseIntegration/versions/4", "Parameters": { "PublishInterval" : "10", "PublishBatchSize" : "50", "InstanceName" : "myinstance", "DefaultTableName" : "u_greengrass_app", "MaxMetricsToRetain" : "20000", "AuthSecretArn" : "arn:aws-cn:secretsmanager:region:account-id:secret:greengrass-secret-hash", "AuthSecretArn-ResourceId" : "MySecretResource", "IsolationMode" : "GreengrassContainer" } } ] }'
Note
The Lambda function in this connector has a long-lived lifecycle.
In the Amazon IoT Greengrass console, you can add a connector from the group's Connectors page. For more information, see Getting started with Greengrass connectors (console).
Input data
This connector accepts time series metrics on an MQTT topic and publishes the metrics to ServiceNow. Input messages must be in JSON format.
- Topic filter in subscription
-
servicenow/metricbase/metric - Message properties
-
request-
Information about the table, record, and metric. This request represents the
seriesRefobject in a time series POST request. For more information, see Clotho Time Series API - POST. Required:
trueType:
objectthat includes the following properties:subject-
The
sys_idof the specific record in the table.Required:
trueType:
string metric_name-
The metric field name.
Required:
trueType:
string table-
The name of the table to store the record in. Specify this value to override the
DefaultTableNameparameter.Required:
falseType:
string value-
The value of the individual data point.
Required:
trueType:
float timestamp-
The timestamp of the individual data point. The default value is the current time.
Required:
falseType:
string
- Example input
-
{ "request": { "subject":"ef43c6d40a0a0b5700c77f9bf387afe3", "metric_name":"u_count", "table": "u_greengrass_app" "value": 1.0, "timestamp": "2018-10-14T10:30:00" } }
Output data
This connector publishes status information as output data on an MQTT topic.
- Topic filter in subscription
-
servicenow/metricbase/metric/status - Example output: Success
-
{ "response": { "metric_name": "Errors", "table_name": "GliderProd", "processed_on": "2018-10-14T10:35:00", "response_id": "khjKSkj132qwr23fcba", "status": "success", "values": [ { "timestamp": "2016-10-14T10:30:00", "value": 1.0 }, { "timestamp": "2016-10-14T10:31:00", "value": 1.1 } ] } } - Example output: Failure
-
{ "response": { "error": "InvalidInputException", "error_message": "metric value is invalid", "status": "fail" } }Note
If the connector detects a retryable error (for example, connection errors), it retries the publish in the next batch.
Usage Example
Use the following high-level steps to set up an example Python 3.7 Lambda function that you can use to try out the connector.
Note
-
If you use other Python runtimes, you can create a symlink from Python3.x to Python 3.7.
-
The Get started with connectors (console) and Get started with connectors (CLI) topics contain detailed steps that show you how to configure and deploy an example Twilio Notifications connector.
Make sure you meet the requirements for the connector.
-
Create and publish a Lambda function that sends input data to the connector.
Save the example code as a PY file. Download and unzip the Amazon IoT Greengrass Core SDK for Python. Then, create a zip package that contains the PY file and the
greengrasssdkfolder at the root level. This zip package is the deployment package that you upload to Amazon Lambda.After you create the Python 3.7 Lambda function, publish a function version and create an alias.
-
Configure your Greengrass group.
-
Add the Lambda function by its alias (recommended). Configure the Lambda lifecycle as long-lived (or
"Pinned": truein the CLI). -
Add the required secret resource and grant read access to the Lambda function.
-
Add the connector and configure its parameters.
-
Add subscriptions that allow the connector to receive input data and send output data on supported topic filters.
Set the Lambda function as the source, the connector as the target, and use a supported input topic filter.
Set the connector as the source, Amazon IoT Core as the target, and use a supported output topic filter. You use this subscription to view status messages in the Amazon IoT console.
-
-
Deploy the group.
-
In the Amazon IoT console, on the Test page, subscribe to the output data topic to view status messages from the connector. The example Lambda function is long-lived and starts sending messages immediately after the group is deployed.
When you're finished testing, you can set the Lambda lifecycle to on-demand (or
"Pinned": falsein the CLI) and deploy the group. This stops the function from sending messages.
Example
The following example Lambda function sends an input message to the connector.
import greengrasssdk import json iot_client = greengrasssdk.client('iot-data') SEND_TOPIC = 'servicenow/metricbase/metric' def create_request_with_all_fields(): return { "request": { "subject": '2efdf6badbd523803acfae441b961961', "metric_name": 'u_count', "value": 1234, "timestamp": '2018-10-20T20:22:20', "table": 'u_greengrass_metricbase_test' } } def publish_basic_message(): messageToPublish = create_request_with_all_fields() print("Message To Publish: ", messageToPublish) iot_client.publish(topic=SEND_TOPIC, payload=json.dumps(messageToPublish)) publish_basic_message() def lambda_handler(event, context): return
Licenses
The ServiceNow MetricBase Integration connector includes the following third-party software/licensing:
pysnow
/MIT
This connector is released under the
Greengrass Core Software License Agreement
Changelog
The following table describes the changes in each version of the connector.
Version |
Changes |
|---|---|
4 |
Added the |
3 |
Upgraded the Lambda runtime to Python 3.7, which changes the runtime requirement. |
2 |
Fix to reduce excessive logging. |
1 |
Initial release. |
A Greengrass group can contain only one version of the connector at a time. For information about upgrading a connector version, see Upgrading connector versions.