MetricsHub
MetricsHub Community Connectors 1.0.22
-
Home
- Connector Design Guide
Connector Object References
Documentation under construction...
This page shows how to reference connector objects such as sources, entries, columns and files, etc. inside the YAML document.
Source Reference
Format
A Source can be referenced either with its full path or its relative path. A relative path can be used only if the referenced source is in the same monitor and same job as the current source.
Example
mapping:
source: ${source::monitors.disk_controller.discovery.sources.source_discovery}
sourceDiscovery:
type: tableJoin
leftTable: ${source::monitors.enclosure.collect.sources.source_chassis} # full path for a source in another monitor
rightTable: ${source::source_enclosure} # relative path
leftKeyColumn: 1
rightKeyColumn: 1
Entry Reference
Format
$<columnNumber>
Example
source(3):
type: http
method: GET
executeForEachEntryOf:
source: ${source::monitors.enclosure.discovery.sources.source(2)}
concatMethod: list
path: /api/rest/StorageCenter/ScChassis/$2/PowerSupplyList
Column Reference
Format
$<columnNumber>
Example
mapping:
# PowerSupply
# tableID;ID;DisplayName;objectType;enclosure/controllerID;deviceType
source: ${source::monitors.power_supply.discovery.sources.source(4)}
attributes:
id: $2
__display_id: $3
hw.parent.type: $6
hw.parent.id: $5
name: $3
File Reference
Format
${file::<relativeFilePath>}
Example
criteria:
- type: commandLine
commandLine: /bin/sh ${file::storman-drives.sh}
expectedResult: Hard drive
errorMessage: No Adaptec Controller with Physical Disks attached or not enough rights to execute arcconf.
Mono-Instance Reference
Format
${attribute::<attribute-key>}
Example
collect:
# Collect type is multi-instance
type: monoInstance
sources:
source(1):
type: commandLine
commandLine: /bin/sh ${file::script.sh} ${attribute::id}
keep: ^MSHW;
separators: ;
selectColumns: "2,3,4,5,6,7,8,9"
Resource Attribute Reference
Format
${resource.attribute::<attribute-key>}
Example
collect:
type: monoInstance
sources:
httpSource:
type: http
path: /api/data
header: "Authorization: Bearer ${resource.attribute::api.token}"
Protocol Reference
Format
${protocol::<protocol-type>.<property>}
Example
collect:
type: monoInstance
sources:
customSource:
type: http
url: https://${protocol::http.hostname}:${protocol::http.port}/api/data
Translation Table Reference
Format
${translation::<translationTable>}
Example
collect:
# Collect type = multi-instance
type: multiInstance
sources:
source(1):
# Source(1) = connUnitSensorTable SNMP Table
# ID;Status;Value;
type: snmpTable
oid: 1.3.6.1.4.1.1588.2.1.1.1.1.22.1
selectColumns: "ID,3,4"
computes:
# Translate the first column status into a PATROLStatus
# ID;PatrolStatus;Value;
- type: translate
column: 2
translationTable: ${translation::SensorStatusTranslationTable}
Awk Script Reference
Format
${awk::<script>}
Example
monitors:
battery:
discovery:
mapping:
source: ${source::monitors.battery.discovery.sources.source(1)}
attributes:
name: ${awk::sprintf("%s (%s)", "Cisco", $1)}
References in Compute Attributes
Format
A compute attribute can reference:
A resource attribute
${resource.attribute::<attribute-key>}
A protocol property
${protocol::<protocol-type>.<property>}
A source content
${source::<source-name>}
Examples
Replace a value with a protocol property
The following example replaces the value PORT in column 1 with the HTTP port configured for the protocol:
sources:
source(1):
type: http
path: /api/device
computes:
- type: replace
column: 1
existingValue: "PORT"
newValue: ${protocol::http.port}
Append content from another source
The following example appends the content of another source to the value in column 1:
sources:
source(1):
type: http
path: /api/device
computes:
- type: append
column: 1
value: " - ${source::monitors.enclosure.simple.sources.source_discovery}"
Reference a resource attribute
The following example keeps only the lines whose value in column 3 matches the URL built from the host.name resource attribute:
sources:
source(1):
type: http
path: /api/hosts
computes:
- type: keepOnlyMatchingLines
column: 3
valueList: "https://${resource.attribute::host.name}"
Search Results for {{siteSearch | truncate:'50'}}
{{resultArray.length}}
No results.
