This is a general description of an SNMP data source–based extension YAML file and ways to declare metrics and dimensions you would like to collect using your extension.
Create the definition of the data set to be pulled from your SNMP infrastructure and ingested into Dynatrace by the extension.
Create an inventory of the SNMP object identifiers (OIDs) that you want to reference in your extension (as values for your metrics and dimensions).
In our example, we use an extension that collects data from generic SNMP devices.
name: custom:snmp-exampleversion: 1.0.0minDynatraceVersion: '1.235'author:name: Dynatracemetrics:- key: snmp.generic.snmp.in.pkts- key: snmp.generic.silentdrops- key: snmp.generic.if.lastchange- key: snmp.generic.if.in.errorssnmp:- group: generic-deviceinterval:minutes: 5dimensions:- key: snmp.generic.device.addressvalue: this:device.address- key: snmp.generic.device.portvalue: this:device.portsubgroups:- subgroup: SNMP healthtable: falsemetrics:- key: snmp.generic.snmp.in.pktsvalue: oid:1.3.6.1.2.1.11.1.0type: count- key: snmp.generic.silentdropsvalue: oid:1.3.6.1.2.1.11.31.0type: count- subgroup: NIC statustable: truedimensions:- key: snmp.generic.if.descrvalue: oid:1.3.6.1.2.1.2.2.1.2- key: snmp.generic.if.typevalue: oid:1.3.6.1.2.1.2.2.1.3metrics:- key: snmp.generic.if.lastchangevalue: oid:1.3.6.1.2.1.2.2.1.9type: gauge- key: snmp.generic.if.in.errorsvalue: oid:1.3.6.1.2.1.2.2.1.14type: countdashboards:- path: 'generic-device-dashboard.json'
Your SNMP monitoring scope definition starts with the snmp
YAML node. All the settings under the node pertain to the declared data source type, which in this case is SNMP.
SNMP extensions rely on the OIDs that identify all the MIB objects, including values for metrics and device details.
For each level (extension, group, subgroup), you can define up to 25 dimensions.
For example:
dimensions:- key: cisco-catalyst-health.temperature.descvalue: oid:1.3.6.1.4.1.9.9.13.1.3.1.2
The dimension key string must conform to the metrics ingestion protocol.
Apart from simply instructing the extension to extract a dimension value from an OID, you can also use the following methods:
Plain text. Prefix with const:
- key: snmp.com.dt.generic.extension.ownervalue: const:Joe.Doe@somedomain.com
Monitoring configuration defined variable. Prefix with var:
. For details, see Variables.
- key: snmp.com.dt.generic.activation.tagvalue: var:ext.activationtag
Monitoring configuration–defined device details, such as device IP address or port. Prefix with this:
. Use device.address
and device.port
.
- key: snmp.com.dt.generic.device.addressvalue: this:device.address- key: snmp.com.dt.generic.device.portvalue: this:device.port
If you want to make your extension dimension customizable with the data from the monitoring configuration, you can use variables that will be replaced by values passed from the monitoring configuration. You can use variables directly as the dimension value or with filters. To use variables, you must first declare them in your extension YAML file:
vars:- id: ifNameFilterdisplayName: Pattern matching interfaces for which metrics should be queriedtype: pattern- id: ext.activationtagdisplayName: Extension activation tagtype: pattern
Then you can reference them in the dimension definition. Prefix the variable name with var
.
dimensions:- key: interface_descriptionvalue: oid:.1.3.6.1.2.1.2.2.1.2filter: var:ifNameFilter- key: snmp.com.dt.generic.activation.tagvalue: var:ext.activationtag
After you define the filter as a variable, you can add filtering logic that will result in reporting only the dimensions that match the filtering criteria.
filter: var:ifNameFilter
Define the filter based on a condition as follows:
Starts with – use a const:$prefix
qualifier. Example:
filter: const:$prefix(xyz)
Ends with – use a const:$suffix
qualifier. Example:
filter: const:$suffix(xyz)
Contains – use a const:$contains
qualifier. Example:
filter: const:$contains(xyz)
Equals – use a const:$eq
qualifier. Example:
filter: const:$eq(xyz)
For the expressions mentioned above, you can also use qualifiers:
const:$and
– to chain two or more expressions with AND operator. Example:
filter: const:$and(<expr1>,<expr2>)
const:$or
– to chain two or more expressions with OR operator. Example:
filter: const:$or(<expr1>,<expr2>)
const:$not
– to negate an expression. Example:
filter: const:$not(<expr>)
For each level (extension, group, subgroup), you can define up to 100 metrics.
For example:
snmp:- group: catalyst-healthfeatureSet: temperatureinterval:minutes: 5dimensions:- key: device_namevalue: oid:1.3.6.1.2.1.1.5- key: this.device.addressvalue: this:device.addressmetrics:- key: cisco-catalyst-health.temperature.valuevalue: oid:1.3.6.1.4.1.9.9.13.1.3.1.3type: gaugefeatureSet: basicinterval:minutes: 5
The metric key string must conform to the metrics ingestion protocol.
For Extension 2.0 schema versions 1.215, a metric node requires the id
parameter in place of key
. Starting with Extension 2.0 schema version 1.217, it is required to use the key
parameter.
The metrics you ingest into Dynatrace using your extension are just some of the thousands of metrics, built-in and custom, processed by Dynatrace. To make your metrics keys unique and easy to identify in Dynatrace, the best practice is to prefix the metric name with the extension name. This guarantees that the metric key is unique and you can easily appoint a metric to a particular extension in your environment.
The OID from which you want to extract metric value.
The Dynatrace Extensions 2.0 framework supports metric payloads in the gauge (gauge
) or count value (count
) formats. For details, see Metric payload. To indicate the metric type, use the type
attribute.
An Extension can define metadata for each metric available in Dynatrace. For example, you might want to add the metric display name and the unit, both of which can be used for filtering in the Metrics browser.
name: custom:example-extension-nameversion: 1.0.0minDynatraceVersion: "1.236"author:name: Dynatracemetrics:- key: your.metric.namemetadata:displayName: Display name of the metric visible in Metrics browserunit: Count
Feature sets are categories into which you organize the data collected by the extension. In this example, we create an SNMP extension monitoring your network devices and collecting metrics related to overall packet traffic and transport layer statistics. This is reflected by metrics organization into related feature sets, total traffic
and `transport layer statistics".
snmp:- group: healthinterval:minutes: 5dimensions:- key: device_namevalue: oid:1.3.6.1.2.1.1.5- key: this.device.addressvalue: this:device.addresssubgroups:- subgroup: TrafficfeatureSet: total trafficmetrics:- key: outgoing_packetsvalue: oid:.1.3.6.1.2.1.11.1type: count- key: incoming_packetsvalue: oid:.1.3.6.1.2.1.11.1type: count- subgroup: TCPfeatureSet: transport layer statisticsmetrics:- key: tcpActiveOpensvalue: oid:1.3.6.1.2.1.6.5.0type: count- key: tcpPassiveOpensvalue: oid:1.3.6.1.2.1.6.6.0type: count- subgroup: UDPfeatureSet: transport layer statisticsmetrics:- key: udpNoPortsvalue: oid:1.3.6.1.2.1.7.2.0type: count- key: udpInErrorsvalue: oid:1.3.6.1.2.1.7.3.0type: count
When activating your extension using monitoring configuration, you can limit monitoring to one of the feature sets. To work properly the extension has to collect at least one metric after the activation.
In highly segmented networks, feature sets can reflect the segments of your environment. Then, when you create a monitoring configuration, you can select a feature set and a corresponding ActiveGate group that can connect to this particular segment.
All metrics that aren't categorized into any feature set are considered to be the default and are always reported.
A metric inherits the feature set of a subgroup, which in turn inherits the feature set of a group. Also, the feature set defined on the metric level overrides the feature set defined on the subgroup level, which in turn overrides the feature set defined on the group level.
The interval at which the data measurement will be taken. You can define intervals at the group, subgroup, or individual metric level. You can define intervals with the granularity of one minute. The maximum interval is 2880 minutes (2 days, 48 hours).
Setting the interval is not possible for JMX data sources.
For example:
interval:minutes: 5
The above format is supported starting with schema version 1.217. For earlier schema versions, use the following format (supported up to schema version 1.251):
interval: 5m
For example
snmp:- group: snmp-genericinterval:minutes: 5dimensions:- key: device_namevalue: oid:1.3.6.1.2.1.1.5metrics:- key: incoming_packetsvalue: oid:.1.3.6.1.2.1.11.1
Management Information Base (MIB) is the database managing the entities in a network identified by OIDs. MIB provides a source of additional information related to OIDs declared in your extension.
ActiveGate comes with a default set of MIB files. You can also extend the default set with your own files.
If the MIB files accessible to the extension contain appropriate information, you can declare OIDs using their names instead of OID numeric values. For example:
subgroups:- subgroup: Device health (Temperature)table: truedimensions:- key: envmon.temperature.descvalue: oid:ciscoEnvMonTemperatureStatusDescrmetrics:- key: envmon.temperature.valuevalue: oid:ciscoEnvMonTemperatureStatusValuename: The current testpoint temperature (deg Celsius)type: gauge
An IP address returned from an OID can be automatically resolved to a string in the IPv4 or IPv6 format. A MIB file determines which format to use.
For example, the OID 1.3.6.1.4.1.3375.2.2.10.1.2.1.3
(ltmVirtualServAddr
), virtual server IP address, is returned as a binary (hex) value. With MIB, it's reported in IPv4 or IPv6 format, as determined by the information from ltmVitualServAddrType
.
subgroups:- subgroup: virtualServertable: truedimensions:- key: ltmvirtualserveraddrvaluevalue: oid:1.3.6.1.4.1.3375.2.2.10.1.2.1.3
$networkFormat
The $networkFormat
function allows data extraction from OIDs using formatter OIDs. Available types to extract are interfaceAlias
, interfaceName
, portComponent
, networkAddress
(ipv4, ipv6, mac, dns), local address
, macAddress
, and agentCircuitId
.
In your extension.yaml
file, use $networkFormat
under any dimension’s value (for example, network.translation
) to specify how OID values should be translated:
*$networkFormat
(oid:<formatter OID>,
oid:<data OID>
)$networkFormat
(const:<formatter type>
, oid:<OID>
)default
value in case the translation fails.
$networkFormat
(oid:<formatter OID>
, oid:<data OID>
, default:<default value>
)If translation errors occur (for example, unsupported ASCII characters or missing MIB information), Dynatrace retries the action. If the error continues to occur, the system falls back to rawString
, displaying untranslated data.
To avoid translation issues, ensure that necessary MIB files are available. Missing MIB files result in untranslated outputs.
When an OID is an enumerated type, the extension reports the OID value as a string with a name rather than just a number.
For example, the OID 1.3.6.1.2.1.2.2.1.7
(ifAdminStatus
) is an enumerated type with possible values (1-up, 2-down, 3-testing)
. With MIB, the extension will report the full string as its value (for example, 1-up
instead of 1
) for an interface with the up
state.
If some of the OIDs from your extension are not available in the default MIB files, you can add your own MIB file to the extension.
Create the snmp
directory next to your extension.yaml
and place the MIB file there. For example:
extension.zip│ extension.yaml│└───alerts│ | alert.json│└───dashboards| │ dashboard.json|└───snmp│ | IF-MIB.txt
Missing information is logged and the original value is reported. For example, if the data source is unable to determine the network address type based on available MIB files, the log throws the following message and the hex value is reported.
"inetAddress translation: Unable to find inetAddress type. X, dimension: Y"`.
Default MIB files are saved in:
/opt/dynatrace/remotepluginmodule/agent/res/mib-files
C:\%PROGRAMFILES%\dynatrace\remotepluginmodule\agent\res\mib-files
A MIB file added to the extension is saved in:
/var/lib/dynatrace/remotepluginmodule/agent/runtime/datasources/working_directories/[ID]/snmp
C:\%PROGRAMDATA%\dynatrace\remotepluginmodule\agent\runtime\datasources\working_directories\[ID]\snmp
where [ID]
is a string containing the monitoring configuration identifier and timestamp.
Alternatively, you can add your custom MIB files directly to your ActiveGate. These MIB files are then used by all the SNMP and SNMP Traps extensions running on this ActiveGate.
Place your custom MIB files in the mib-files-custom
directory:
/var/lib/dynatrace/remotepluginmodule/agent/conf/userdata/mib-files-custom/
C:\%PROGRAMDATA%\dynatrace\remotepluginmodule\agent\conf\userdata\mib-files-custom\
The files stored in the mib-files-custom
directory are preserved between updates.
After you define the scope of your configuration, you need to identify the network devices you'd like to collect data from and identify the ActiveGates that will execute the extension and connect to your devices.
Make sure that all the ActiveGates from the ActiveGate group you'll define as the scope can connect to a respective data source. You can assign an ActiveGate to a group during or after installation. For more information, see ActiveGate group.
The monitoring configuration is a JSON payload defining the connection details, credentials, and feature sets that you want to monitor. For details, see Start monitoring.
Example payload to activate an SNMP extension:
[{"scope": "ag_group-my-activegate-group","value": {"version": "1.0.0","description": "my monitoring configuration","enabled": true,"snmp": {"devices": [{"ip": "snmp.company.org","port": 161,"authentication": {"type": "SNMPv2c","community": "public"},"advanced": {"timeoutSecs": 5,"retries": 0,"maxRepetitions": 50,"maxOidsPerQuery": null,"enableUnconnectedUdp": true}}]},"featureSets": ["all"]}}]
When you have your initial extension YAML ready, package it, sign it, and upload it to your Dynatrace environment. For details, see Manage extension lifecyle.
The Dynatrace Hub-based extension activation wizard contains a dynamically updated JSON payload with your monitoring configuration
You can also use the Dynatrace API to download the schema for your extension that will help you create the JSON payload for your monitoring configuration.
Use GET an extension schema endpoint.
Issue the following request:
curl -X GET "{env-id}.live.dynatrace.com/api/v2/extensions/{extension-name}/{extension-version}/schema" \-H "accept: application/json; charset=utf-8" \-H "Authorization: Api-Token {api-token}"
Replace {extension-name}
and {extension-version}
with values from your extension YAML file. A successful call returns the JSON schema.
Note that each ActiveGate host running your extension needs the root certificate to verify the authenticity of your extension. For more information, see Sign extension.
The scope is an ActiveGate group that will execute the extension. Only one ActiveGate from the group will run this monitoring configuration. If you plan to use a single ActiveGate, assign it to a dedicated group. You can assign an ActiveGate to a group during or after installation. For more information, see ActiveGate group.
Use the following format when defining the ActiveGate group:
"scope": "ag_group-<ActiveGate-group-name>",
Replace <ActiveGate-group-name>
with the actual name.
Version of this monitoring configuration. Note that a single extension can run multiple monitoring configurations.
Human-readable description of the specifics of this monitoring configuration.
If set to true
, the configuration is active and Dynatrace starts monitoring immediately.
You can define up to 100 devices in a single monitoring configuration. To define a device, add the following details:
SNMPv2c
or SNMPv3
(note that SNMPv2c
by design uses the community authentication)Authentication details passed to Dynatrace API when activating monitoring configuration are obfuscated and it's impossible to retrieve them.
Depending on the security level, construct the authentication details using one of the examples below. See the list of supported protocols.
You can define the following additional properties for your connection:
timeoutSecs
retries
The maximum number of retries for a query if it fails (total time for a query is timeoutSecs
x retries
). 3 retries by default.maxRepetitions
maxOidsPerQuery
Can be used to limit the number of OIDs that can be queried in a single SNMP request. 60 by default.enableUnconnectedUdp
ActiveGate version 1.297+ When enabled, the UDP socket becomes unconnected. This allows it to accept responses from a different address than the one the request was sent to, or to ignore ICMP packets.Add a list of feature sets you want to monitor. To report all feature sets, add all
.
"featureSets": ["basic","advanced"]
If your extension declares variables, you can define values that will be passed as filters or plain strings to your extension. For more information, see Declare variable.
"vars":{"ifNameFilter": "$contains(1/1/1)","ifSpeedFilter": "$eq(4294967295)"}