- Print
- PDF
How to Provision Sensor Collector to Support SNMP
Overview
In this article, we'll be discussing how to provision Sensor Collector (formerly Roadrunner) to support Simple Network Management Protocol (SNMP). Cisco Provider Connectivity Assurance (formerly Skylight performance analytics) currently supports SNMPv2 as a mechanism for delivering alert notifications to northbound systems.
Prerequisites:
Read the following topics before setting up the SNMP trap receiver:
SNMP Connector Configuration
The connector config REST API can generate a MQTT token and provide a MQTT to SNMP client. The following example uses Postman to execute the API requests.
- Authenticate with Cisco Provider Connectivity Assurance using your username and password. Record the cookie in the response; this will be used in subsequent requests.
{{protocol}}://{{host}}/api/v1/auth/login
- POST a payload to {{protocol}}://{{host}}/api/v2/connector-configs
{
"data": {
"type": "connectorConfigs",
"attributes": {
"name": "<CONNECTOR NAME>",
"tenantId": "<Tenant Name>",
"datatype": "connectorConfig",
"pollingFrequency": 60,
"type": "FileWatcher",
"zone": "<ZONE NAME>",
"username": "<USER NAME>",
"url": "/var/lib/data/snmp",
"SNMPTrapSenderConfig": {
"trapTargetHost": "<SNMP Trap Target HOST/IP>",
"trapTargetPort": "162",
"community": "public"
}
}
}
}
- You may see the below error while sending the above post call.
{
"code": 415,
"message": "unsupported media type \"application/json\", only [application/vnd.api+json] are allowed"
}
- To fix this error, add a header called Content-Type application/vnd.api+json, as seen below
- After fixing the error code, execute Step 2. You will see that snmp connector will be created with response code 201.
Note: Ensure that you get 201 response code while creating the snmp Sensor Collector.
Replace
with your tenant ID (this is not the tenant name). To get your Tenant ID, you can CURL the following URL or go to this page in your web browser.
curl 'https://<your tenant URL>/api/v1/onboarding/tenant-info'
{
"data": {
"attributes": {
"tenantId": "<< TENANT ID >>",
"tenantName": "<< TENANT NAME >>" }, "id": "<< TENANT NAME >>",
"type": "tenant-info"
}
}
Replace < ZONE NAME > with a unique zone identifier (anything unique, such as 1234).
Replace < USER NAME > with the Cisco Provider Connectivity Assurance tenant admin user that is creating the connector configuration (the same username that an admin would log in to Cisco Provider Connectivity Assurance as (e.g. admin@tenant.com).
Optional: If you will be using this connector for ingesting CSV files, replace < Data Ingestion URI > with the path to your ingestion files (e.g. /var/lib/data/pocs/jyu/cybetron/rr/ ).
Configure the SNMPTrapSenderConfig with your SNMP Trap Receiver. All alerts from Cisco Provider Connectivity Assurance will be sent to the trap receiver configured here.
- Replace <SNMP Trap Target HOST/IP> with the Hostname/IP of the SNMP Trap Receiver
- Replace trapTargetPort with the SNMP Trap Receiver's port (usually 162)
- Replace community with the SNMP Trap Receiver's community string
CAUTION: It is assumed that the Sensor Collector configured here is able to connect to the SNMP Trap Receiver on the customer network. Sensor Collector runs in a docker container so you may need to configure routing to accommodate. In most likely scenarios do not use 127.0.0.1 for trapTargetHost.
- Log in to Cisco Provider Connectivity Assurance and find your Connector Configuration in the Settings.
- Download the connector.
- Follow the guide below to run your connector.
Deploying Sensor Collector in Docker
- Once the Sensor Collector has successfully connected and has been configured, you will see SNMP Sensor Collector logs as below:
$ sudo docker logs -tf <'container id or container name'>
- You can download your connector config using the API call below:
GET {{protocol}}://{{host}}/api/v2/connector-configs
Setting up the SNMP Trap Receiver to See Alerts
You can create an SNMP trap receiver with a docker-snmp tool to see whether or not snmp trap is being triggered.
To create an SNMP trap receiver with a docker container**
- Download the SNMP trap receiver from docker hub repository
https://hub.docker.com/r/lidaheemc/docker-snmp
- Install the SNMP trap receiver.
sudo docker pull lidaheemc/docker-snmp
- Run and Test the SNMP trap receiver.
sudo docker run -d -p 162:162/udp --name snmptrap-receiver -v $PWD/snmp:/var/log/snmp lidaheemc/docker-snmp
- Check docker SNMP trap container status.
- Once the server is running you can view the log by using the below command:
docker logs -tf --tail 100 <container id or container name>
You can see the trap logs as below:
- Check the snmp-trap receiver log i.e. below:
Note: This is only for testing purpose, client would have their own snmp trap receiver to see the alerts.
- Now your connector will forward alerts from MQTT to the configured SNMP trap receiver.
For quick reference, the following mapping are used:
SNMPID: ".1.3.6.1.4.1.22420.3.1",
ObjectIDOID: ".1.3.6.1.4.1.22420.3.2",
ObjectNameOID: ".1.3.6.1.4.1.22420.3.3",
ObjectTypeOID: ".1.3.6.1.4.1.22420.3.4",
DirectionOID: ".1.3.6.1.4.1.22420.3.5",
PolicyIDOID: ".1.3.6.1.4.1.22420.3.6",
MetricOID: ".1.3.6.1.4.1.22420.3.7",
AlertTypeOID: ".1.3.6.1.4.1.22420.3.8",
SourceOID: ".1.3.6.1.4.1.22420.3.9",
ProcessedTimestampOID: ".1.3.6.1.4.1.22420.3.10",
StartTimestampOID: ".1.3.6.1.4.1.22420.3.11",
TimestampOID: ".1.3.6.1.4.1.22420.3.12",
PolicyNameOID: ".1.3.6.1.4.1.22420.3.13",
AlertStateOID: ".1.3.6.1.4.1.22420.3.14",
SNMP Trap MIB for alerts on capture based metrics
The trap definition is in the file PERFORMANCEVISION-MIB.txt
For quick reference, the following mapping are used:
SNMPID: ".1.3.6.1.4.1.36773.3.1",
CaptureMetaNameOID: ".1.3.6.1.4.1.36773.3.1.1",
CaptureMetaFiringOID: ".1.3.6.1.4.1.36773.3.1.2",
CaptureMetaCertaintyPercentOID: ".1.3.6.1.4.1.36773.3.1.3",
CaptureMetaDescOID: ".1.3.6.1.4.1.36773.3.1.4",
Sending Alert Metadata in SNMP Trap
SNMP Traps can retrieve metadata defined on the object. The maximum configuration is set to five for defining the alertMetaDataKey(x) to be returned. When this feature is enabled in the Sensor Collector configuration it will search for the specified metadata key and retrieve the value if found. A blank string will be returned if the key is not located or if the key was not defined in one of the alertMetaDataKey attributes.
To configure the connector
Create the new connector configuration in the UI by going to Settings → Connectors → New
Select FileWatcher type and fill in the rest of the fields.
Once the connector is created, retrieve the current configuration via the connector-configs API.
Note: The connector config ID will be required to do the update, you can retrieve this in one of the following two ways:- Searching for it in the UI once it is created and select it. Once selected the URL in the browser will display the UID for this connector as shown below selection=c22f0050-7070-45cd-a830-d6e1cdacb2d7
Or:
- Using a tool such as postman all of the connector configs can be retrieved by using the following api: {{serverAddress}}/api/v2/connector-configs (replace {{serverAddress}} with the address of the system). This will return all of the connector configs which can be searched for the one in question.
Once the connector configuration UID has been obtained, the configuration must be changed to allow for the connection to the MQTT service.
To change the configuration to allow connection to MQTT service:
- Retrieve the connector configuration using the following GET:{{serverAddress}}/api/v2/connector-configs/{{connectorConfigId}}
(replace {{connectorConfigId}} with the value retrieved above) - Modify the body of the connector config to include both the SNMPTrapSenderConfig and the MQTTConfig.
Both of these sections need the variable keys replaced represented by the double curly brace:
{
"data": {
"attributes": {
"SNMPTrapSenderConfig": {
"trapTargetHost": "192.168.1.6",
"trapTargetPort": "162",
"community": "public",
"alertMetaDataEnabled": {{true/false}},
"alertMetaDataKey1": "{{metaDataKey1}}",
"alertMetaDataKey2": "{{metaDataKey2}}",
"alertMetaDataKey3": "{{metaDataKey3}}",
"alertMetaDataKey4": "{{metaDataKey4}}",
"alertMetaDataKey5": "{{metaDataKey5}}"
},
"MQTTConfig": {
"brokerURI": "wss://{{serverAddress}}:443/mqtt",
"clientID": "{{connectorConfigName}}",
"notificationTopic": "{{tenantName}}/v1/notifications/alert/public/#",
"user": "{{userName}}"
}
.... additional information returned when the configuration was retrieved ....
}
}
Once the payload has been modified perform a PATCH to send the required updates to the system: {{serverAddress}}/api/v2/connector-configs/{{connectorConfigId}} (replace {{connectorConfigId}} with the value retrieved above)
Download and install the new connector.
SNMP Trap Reference
SNMPID: ".1.3.6.1.4.1.22420.3.50.1",
ObjectIDOID: ".1.3.6.1.4.1.22420.3.2",
ObjectNameOID: ".1.3.6.1.4.1.22420.3.3",
ObjectTypeOID: ".1.3.6.1.4.1.22420.3.4",
DirectionOID: ".1.3.6.1.4.1.22420.3.5",
PolicyIDOID: ".1.3.6.1.4.1.22420.3.6",
MetricOID: ".1.3.6.1.4.1.22420.3.7",
AlertTypeOID: ".1.3.6.1.4.1.22420.3.8",
SourceOID: ".1.3.6.1.4.1.22420.3.9",
ProcessedTimestampOID: ".1.3.6.1.4.1.22420.3.10",
StartTimestampOID: ".1.3.6.1.4.1.22420.3.11",
TimestampOID: ".1.3.6.1.4.1.22420.3.12",
PolicyNameOID: ".1.3.6.1.4.1.22420.3.13",
AlertStateOID: ".1.3.6.1.4.1.22420.3.14",
ThresholdValueOID: ".1.3.6.1.4.1.22420.3.15",
MetaDataKey1OID: ".1.3.6.1.4.1.22420.3.16",
MetaDataKey2OID: ".1.3.6.1.4.1.22420.3.17",
MetaDataKey3OID: ".1.3.6.1.4.1.22420.3.18",
MetaDataKey4OID: ".1.3.6.1.4.1.22420.3.19",
MetaDataKey5OID: ".1.3.6.1.4.1.22420.3.20",
MetaDataVal1OID: ".1.3.6.1.4.1.22420.3.21",
MetaDataVal2OID: ".1.3.6.1.4.1.22420.3.22",
MetaDataVal3OID: ".1.3.6.1.4.1.22420.3.23",
MetaDataVal4OID: ".1.3.6.1.4.1.22420.3.24",
MetaDataVal5OID: ".1.3.6.1.4.1.22420.3.25",
TriggeredValueOID: ".1.3.6.1.4.1.22420.3.26",
SNMP Trap Example Payload
If alertMetaDataEnabled in the connectorConfig is set to true, the following values will be returned:
[{Name:.1.3.6.1.6.3.1.1.4.1.0 Type:ObjectIdentifier Value:.1.3.6.1.4.1.22420.3.50.1 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.2 Type:OctetString Value:33761-F648E24B-AB01-4B95-8CC6-1AB6611FCCC0 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.3 Type:OctetString Value:E21600_ABC_2_ENB_AF22 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.4 Type:OctetString Value:twamp-sf Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.5 Type:OctetString Value:0 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.6 Type:OctetString Value:c79123a7-27d4-472e-a541-789a334f0a94 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.7 Type:OctetString Value:delayP95 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.8 Type:OctetString Value:twamp-sf Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.9 Type:OctetString Value:skylight-spark Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.10 Type:OctetString Value:1688834954653 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.11 Type:OctetString Value:1688834954653 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.12 Type:OctetString Value:1688834954653 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.13 Type:OctetString Value:Test Name SQA_TWAMP_1686775324645909 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.14 Type:OctetString Value:raised Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.15 Type:OctetString Value:15000.0 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.16 Type:OctetString Value:region Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.17 Type:OctetString Value:target_city Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.18 Type:OctetString Value:source_city Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.19 Type:OctetString Value:service_class Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.20 Type:OctetString Value:uplink_route Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.21 Type:OctetString Value:north east Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.22 Type:OctetString Value:ottawa Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.23 Type:OctetString Value:montreal Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.24 Type:OctetString Value:af22 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.25 Type:OctetString Value:rtr0121-rtr1447-rtr1847-rtr1848-rtr1849-rtr1851 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.26 Type:OctetString Value:16000.0 Logger:<nil>}]
If alertMetaDataEnabled is not set or set to false the following values will be returned, you will notice that 16 to 25 are no longer present in the returned payload. This is due to a new parameter being added after the metaData and to ensure backwards compatibility and the numbering was not reordered.
[{Name:.1.3.6.1.6.3.1.1.4.1.0 Type:ObjectIdentifier Value:.1.3.6.1.4.1.22420.3.50.1 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.2 Type:OctetString Value:33761-F648E24B-AB01-4B95-8CC6-1AB6611FCCC0 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.3 Type:OctetString Value:E21600_ABC_2_ENB_AF22 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.4 Type:OctetString Value:twamp-sf Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.5 Type:OctetString Value:0 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.6 Type:OctetString Value:c79123a7-27d4-472e-a541-789a334f0a94 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.7 Type:OctetString Value:delayP95 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.8 Type:OctetString Value:twamp-sf Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.9 Type:OctetString Value:skylight-spark Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.10 Type:OctetString Value:1688834954653 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.11 Type:OctetString Value:1688834954653 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.12 Type:OctetString Value:1688834954653 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.13 Type:OctetString Value:Test Name SQA_TWAMP_1686775324645909 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.14 Type:OctetString Value:raised Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.15 Type:OctetString Value:15000.0 Logger:<nil>}
{Name:.1.3.6.1.4.1.22420.3.26 Type:OctetString Value:16000.0 Logger:<nil>}]
© 2024 Cisco and/or its affiliates. All rights reserved.
For more information about trademarks, please visit: Cisco trademarks
For more information about legal terms, please visit: Cisco legal terms
For legal information about Accedian Skylight products, please visit: Accedian legal terms and tradmarks