Defining tags rules
A tags rule copies the value of another field to the tags field so that it becomes searchable in the UI.
About this task
A resource's tags can be searched via the UI, and matching resources can be displayed. Resources with common tags can optionally be grouped using a tag-based template definition.
A tags rule populates the tags of resources matched by the rule. See the following sample tags rules for more information.
You can create custom tags on IBM Tivoli Network Manager, which the ITNM Observer can integrate into Agile Service Manager tags. For information on creating custom tags in Network Manager, see the Adding name-value pairs to entities using the File finder topic in the IBM Tivoli Network Manager IP Edition documentation.
customTags=~/[\\{]Country=(.+?)[,\\}]/
Procedure
Details
On the Details section of the New tags rule (or Edit tags rule) page, you define the name, status and tokens for the rule.
Conditions
Example
The tags rule allows the value of another field to be copied to the tags field so that it becomes searchable in the UI. It populates the tags of resources matched by the rule.
- name: tagRuleCustomProp
ruleType: tagsRule
ruleStatus: enabled
tokens: [ name ]
entityTypes: null
observers: null
providers: null
curl -k -s -X POST --user $PROXY_USER:$PROXY_PASSWORD --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-TenantID: cfd95b7e-3bc7-4006-a4a8-a73a79c71255' -w "Response code: %{http_code}\n" -d '{
"tokens": [
"com.docker.compose.service",
"com.docker.compose.project"
],
"name": "tag-docker-container-service-project",
"ruleStatus": "enabled",
"ruleType": "tagsRule",
"observers": [
"docker_observer"
],
"entityTypes": [
"container"
]
}
' "https://${PROXY_HOST}/1.0/merge/rules"
To verify:{
"_createdAt": "2019-09-10T02:24:03.652Z",
"_executionTime": 10,
"_id": "YEaGjuCJT5-wCH-SAfCssA",
"_modifiedAt": "2019-09-10T15:29:33.829Z",
"_observedAt": "2019-09-10T15:29:33.829Z",
"_startedAt": "2019-09-10T15:29:33.829Z",
"architecture": "x86_64",
"changeTime": 1568129373829,
"com.docker.compose.config-hash": "6afc3ec12fd17d2b815df61e4ab276af6a27324a1487567f1bbba29a4a4bca1e",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "asm",
"com.docker.compose.service": "search",
"com.docker.compose.version": "1.11.2",
"createTime": 1568082243652,
"dockerId": "dc39b5ea19cb79755e48a525bfbd2d479777464b1e80c708cb851da1b22fa952",
"entityTypes": [
"container"
],
"matchTokens": [
"asm_search_1",
"dc39b5ea19cb79755e48a525bfbd2d479777464b1e80c708cb851da1b22fa952"
],
"mergeTokens": [
"dc39b5ea19cb79755e48a525bfbd2d479777464b1e80c708cb851da1b22fa952"
],
"name": "asm_search_1",
"observedTime": 1568129373829,
"tags": [
"asm_search_1",
"asm",
"search"
],
"uniqueId": "dc39b5ea19cb79755e48a525bfbd2d479777464b1e80c708cb851da1b22fa952",
"vcs-type": "git",
"vendor": "IBM",
"version": "1.0.10-SNAPSHOT"
}
- Resource with variable substitutions and exclude list
-
{ "name": "sysNameMatching", "tokens": [ "sysName", "${name}/${customField}"], "ruleStatus": "enabled", "entityTypes": [ "host", "server" ], "observers": [ "ITNM", "TADDM" ], "providers": [ "*" ], "customField": "string", "excludeTokens": [ "^asm-default.*"] }