Routing metrics from 1 location
To route metrics that are generated in 1 IBM Cloud® Metrics Routing supported location to a destination target, you must create a route in your IBM Cloud account that specifies the target and the location as an inclusion filter.
Prereqs
-
Ensure you have the correct IAM permissions to configure IBM Cloud Metrics Routing routes.
-
Log in to IBM Cloud. Run the following command: ibmcloud login.
Get the target details
Complete the following steps:
-
Run the following command to list all targets. Copy the target ID of the one where you want to route the metrics.
ibmcloud metrics-router target ls
-
Run the following command to get the target details:
ibmcloud metrics-router target get --target <TARGET_ID>
Define the inclusion filter
Inclusion filters determine which metrics are routed to the targets.
Inclusion filters are comprised of an operand
, operator
, and values
:
operand
-
Operand is the name of the property on which the
operator
test is run. The following operands are supported:location
,service_name
,service_instance
,resource_type
, andresource
. operator
-
Two operators are supported:
in
andis
.in
-
The value of the operand property is compared to a list of values.
You can define up to 20 values.
is
-
The value of the operand property is compared to a single value.
When using
is
, only 1 value can be specified.
value
-
A string, or an array of strings, to be compared with the
operand
property to determine whether the metric is routed or not. When theis
operator
is used,value
must include a single string. When thein
operator
is used,value
can include multiple strings in an array.Valid values depend on the
operand
.location
- Any location where IBM Cloud Metrics Routing is available.
service_name
- The CRN service name of an [IBM Cloud service that generates metrics managed through IBM Cloud Metrics Routing
service_instance
,resource_type
, andresource
- Values appropriate to an [IBM Cloud service that generates metrics managed through IBM Cloud Metrics Routing
For example, to define an inclusion filter that defines the condition where only metrics that are generated in the us-south region are routed, looks as follows:
{"operand": "location","operator": "is","values": "us-south"}
Configure the route
Run the following command to route metrics from us-south to the target identified in previous steps.
ibmcloud metrics-router route create --name new-route --rules '[{"action": "send", "targets":[{"id":"11111111-1111-1111-1111-1111111111111"}], "inclusion_filters":[{"operand": "location","operator": "is","values": "us-south"}]}]'
Where targets
represents the list of target IDs and inclusion_filters
specifies the filters.