A simple prometheus exporter for OpenContrail/TungstenFabric.
$ tungsten-prometheus-exporter --config /path/to/config.yml
or
$ TUNGSTEN_PROMETHEUS_EXPORTER=/path/to/config.yml tungsten-prometheus-exporter
Metrics are available on port 8080
by default.
If authentication is enabled on the analytics API you need to provide Openstack credentials.
By default no authentication is made. Use the --os-auth-type
to choose the
desired authentication plugin (v2password
, v3password
).
Depending on the selected auth plugin multiple options needs to be set on the
command line or exported in environment variables (use --help
to see them
all). For example to use v2password
:
$ tungsten-prometheus-exporter --config config.yaml --os-auth-type v2password --os-username admin --os-password development --os-auth-url http://localhost:35357/v2.0/ --os-tenant-name openstack
Configuration is provided as a yaml file.
You should at least configure analytics.host
and metrics
.
Analytics host can be configured with the --host
option or
TUNGSTEN_PROMETHEUS_EXPORTER_ANALYTICS_HOST
env variable.
Configuration file location can be configured with the --config
option or
TUNGSTEN_PROMETHEUS_EXPORTER_CONFIG
env variable.
Other configuration options are described below with default values for reference.
analytics:
host: http://ANALYTICS_API:8081
base_url: /analytics/uves
Define port of metrics endpoint and prefix for all metric names.
Default settings:
prometheus:
port: 8080
metric_name_prefix: "tungsten"
Defines the pyhon logging level of tungsten-prometheus-exporter
.
Default settings:
logging:
level: INFO
Settings for scraper workers that will fetch data from analytics API.
Default settings:
scraper:
max_retry: 3 # number of retries when an http call fails
timeout: 1 # http timeout in seconds
pool_size: 10 # maximum number of concurrent http calls
interval: 60 # wait time in seconds between scrapes
Describes the list of metrics to export.
A metric is described with the following attributes:
- name: base name of the metric
- type: prometheus metric type (eg: Gauge, Enum)
- uve_type: uve type to fetch (eg: vrouter, bgp-peer...)
- uve_module: uve module data to fetch (eg: NodeStatus...)
- uve_instances: list of instances (default:
*
) - json_path: a JSON path expression to target the metric in the json
- labels_from_path: add metric labels based on the attribute path
- append_field_name: append the target attribute to the metric name (default:
true
) - make_label: extract string attributes as labels (default:
false
)
Look at ./examples
directory for metrics examples.
metrics:
- name: vrouter_drop_stats
type: Gauge
uve_type: vrouter
uve_module: VrouterStatsAgent
json_path: drop_stats.*
This will scrape the url http://ANALYTICS_IP:8081/analytics/uves/vrouter/*?flat&cfilt=VrouterStatsAgent
.
The returned json will contain:
{
"VrouterStatsAgent": {
"drop_stats": {
"ds_rewrite_fail": 0,
"ds_mcast_df_bit": 0,
"ds_flow_no_memory": 0,
"ds_push": 0,
...
}
}
}
Because of json_path
for every attribute in the drop_stats
object a
prometheus gauge will be created:
- vrouter_drop_stats_ds_rewrite_fail
- vrouter_drop_stats_ds_mcast_df_bit
- ...