# Configure Exporter Targets

## Overview

`lmc_exporter` exposes LMC shared-memory managed object data as Prometheus-compatible metrics. Target configuration controls which LMC root the exporter discovers, subscribes to, and renders during a scrape.

This article explains how to configure:

-   single-target scraping
-   preloaded multi-target scraping
-   HTTP query routing with `server_key`, `app`, and `instance`

Use TOML configuration with `--config` for most deployments. A legacy flat target file is also supported for minimal multi-target setups.

NoteRecommended configuration format

Use TOML unless you specifically need the legacy `--targets-config` format. TOML can define runtime defaults, HTTP settings, metric scopes, and preloaded scrape targets in one file.

## Prerequisites

Before configuring targets, ensure that:

-   The tar archive is installed as described in [Installation](https://portal.cjcit.io/knowledge-base/lmc_exporter/0.19/getting-started/installation/). Commands use the EL8 binary; use `lmc_exporter-el9` on EL9.
-   The target LMC shared-memory roots are visible from the host running the exporter.
-   You know the shared-memory `server_key` values for the targets you want to scrape.
-   You know the application metric mapping to use, such as `ads`, `adh`, `ats`, `rtc`, or `rrcp_trans`.
-   A valid local license or [Gateway configuration](https://portal.cjcit.io/knowledge-base/lmc_exporter/0.19/configuration/gateway-licensing/) is available. Partial TOML examples must be combined with those licensing settings.
-   HTTP scraping is enabled if Prometheus or `curl` will scrape the exporter.

A minimal HTTP-enabled configuration requires:

```
metrics_http_enabled = true
metrics_bind_address = "0.0.0.0"
metrics_port = 9464
metrics_path = "/metrics"
```

## How It Works

At startup, `lmc_exporter` creates a shared-memory server pool, discovers visible root handles, selects a matching root, subscribes to the target subtree, and renders metrics after the tracked objects and variables are ready.

The selected target is determined from:

<table><caption class="sr-only">How It Works</caption><thead><tr><th scope="col">Configuration value</th><th scope="col">Purpose</th></tr></thead><tbody><tr><td><code>server_key</code> or <code>server_keys</code></td><td>Identifies the shared-memory server key used to discover a target root.</td></tr><tr><td><code>app</code></td><td>Selects the application-specific metric mapping set, such as <code>ads</code>, <code>adh</code>, <code>ats</code>, <code>rtc</code>, or <code>rrcp_trans</code>.</td></tr><tr><td><code>instance</code></td><td>Optional root-selection hint. It can be a full resolved root id or the <code>instance_no</code> segment when roots follow <code>hostname.instance_no.application</code> naming.</td></tr><tr><td><code>variable</code></td><td>Optional descendant variable path to highlight.</td></tr><tr><td><code>classes</code></td><td>Optional app-specific class aliases that limit subscribed and rendered metrics.</td></tr><tr><td><code>seed_path_groups</code></td><td>Optional named app-specific filter groups that limit subscription and rendered metrics.</td></tr><tr><td><code>seed_paths</code></td><td>Optional raw seed-path prefixes that limit subscription and rendered metrics.</td></tr></tbody></table>

When `instance` is omitted, the exporter resolves the selected root instance from the configured `server_key` at runtime.

NoteTarget readiness

The HTTP endpoint returns `503` until the requested target subtree has completed its initial sync. After a target is ready, the exporter serves the rendered snapshot for that target.

## Configuration Modes

Use one entry in the top-level `server_keys` list and no `[[targets]]` tables for a single target.

Without target tables, multiple `server_keys` entries still create one target per key using the shared top-level app, instance hint, and filters. Route scrapes explicitly when more than one target is configured.

```
context_id = "shmApp"
pool_name = "pool"

app = "ads"
server_keys = ["82"]

metrics_http_enabled = true
metrics_bind_address = "0.0.0.0"
metrics_port = 9464
metrics_path = "/metrics"

license_file = "/opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic"
```

Run the exporter:

```
/opt/particle_horizon/lmc_exporter/bin/lmc_exporter-el8 --config ./lmcExporterConfig.toml
```

Scrape the target:

```
curl "http://127.0.0.1:9464/metrics?server_key=82"
```

Use preloaded multi-target mode when one exporter process should serve multiple scrape targets.

Multi-target mode is active when the TOML file contains one or more `[[targets]]` tables.

```
context_id = "shmApp"
pool_name = "pool"

metrics_http_enabled = true
metrics_bind_address = "0.0.0.0"
metrics_port = 9464
metrics_path = "/metrics"

license_file = "/opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic"

[[targets]]
app = "ads"
server_key = "82"

[[targets]]
app = "ads"
server_key = "456"

[[targets]]
app = "adh"
server_key = "999"
```

Run the exporter:

```
/opt/particle_horizon/lmc_exporter/bin/lmc_exporter-el8 --config ./lmcExporterConfig.toml
```

Scrape a specific target by `server_key`:

```
curl "http://127.0.0.1:9464/metrics?server_key=82"
```

Use the legacy flat target format only when you need a minimal target-only registry.

Create `targets.conf`:

```
target app=ads server_key=82
target app=ads server_key=456
```

Run the exporter with HTTP scraping enabled:

```
/opt/particle_horizon/lmc_exporter/bin/lmc_exporter-el8 --targets-config ./targets.conf --enable-metrics-http --metrics-port 9464 --license-file /opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic
```

Scrape a target:

```
curl "http://127.0.0.1:9464/metrics?server_key=82"
```

## Single-Target Scraping

For a single target, use top-level target settings with exactly one server key.

Use this mode when:

-   one exporter process maps to one primary application target
-   `server_keys` contains the one key to monitor
-   you do not need preloaded `[[targets]]` entries

### Minimal Single-Target Configuration

```
context_id = "shmApp"
pool_name = "pool"

app = "ads"
server_keys = ["82"]

metrics_interval_seconds = 10
metrics_http_enabled = true
metrics_bind_address = "0.0.0.0"
metrics_port = 9464
metrics_path = "/metrics"

license_file = "/opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic"
```

### Add an Instance Hint

Use `instance` when multiple roots may be visible and you want to guide root selection.

```
app = "ads"
instance = "1"
server_keys = ["82"]
```

You can also use the full resolved root id:

```
app = "ads"
instance = "phoads01.1.ads"
server_keys = ["82"]
```

### Limit the Target Scope

Use `classes`, `seed_path_groups`, or `seed_paths` to reduce the subscribed subtree and rendered metrics.

```
app = "ads"
server_keys = ["82"]

classes = ["ManagedProcess.SinkDist", "WSOCKServer"]
seed_path_groups = ["core", "sink_ripc"]
seed_paths = ["serviceGenerator.srcPrdServicePool"]
```

For ADS, the `core` group includes root-scoped variables.

### Run Single-Target Mode from CLI

You can also configure a single target with CLI flags:

```
/opt/particle_horizon/lmc_exporter/bin/lmc_exporter-el8 --app ads --server-key 82 --enable-metrics-http --metrics-port 9464 --license-file /opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic
```

With an instance hint:

```
/opt/particle_horizon/lmc_exporter/bin/lmc_exporter-el8 --app ads --instance phoads01.1.ads --server-key 82 --enable-metrics-http --metrics-port 9464 --license-file /opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic
```

## Multi-Target Scraping

Preloaded multi-target mode uses repeated `[[targets]]` tables. Each table defines one scrape target.

Each `[[targets]]` table supports:

<table><caption class="sr-only">Multi-Target Scraping</caption><thead><tr><th scope="col">Key</th><th scope="col">Required</th><th scope="col">Description</th></tr></thead><tbody><tr><td><code>app</code></td><td>Yes</td><td>Application metric mapping set for the target.</td></tr><tr><td><code>server_key</code></td><td>Yes</td><td>Shared-memory server key for the target.</td></tr><tr><td><code>instance</code></td><td>No</td><td>Optional root-selection hint.</td></tr><tr><td><code>variable</code></td><td>No</td><td>Optional descendant variable path to highlight.</td></tr><tr><td><code>component_instance_id</code></td><td>In Gateway mode</td><td>Stable licensed component identity.</td></tr><tr><td><code>classes</code></td><td>No</td><td>Optional app-specific class aliases.</td></tr><tr><td><code>seed_path_groups</code></td><td>No</td><td>Optional app-specific filter groups.</td></tr><tr><td><code>seed_paths</code></td><td>No</td><td>Optional raw seed-path prefixes.</td></tr></tbody></table>

### Multi-Target TOML Example

```
context_id = "shmApp"
pool_name = "pool"

metrics_http_enabled = true
metrics_bind_address = "0.0.0.0"
metrics_port = 9464
metrics_path = "/metrics"

license_file = "/opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic"

[[targets]]
app = "ads"
instance = "1"
server_key = "82"
classes = ["ManagedProcess.SinkDist", "ConsumerDataStream"]
seed_path_groups = ["core", "users"]

[[targets]]
app = "ads"
instance = "1"
server_key = "456"
classes = ["SSLDispatcher", "ManagedSSLChannel"]
seed_paths = ["sourceApplicationPool"]

[[targets]]
app = "adh"
server_key = "999"
seed_path_groups = [
  "consumer_mqos_service_service",
  "mqos_service_attributes",
  "mqos_service_datastreams"
]
```

NoteDuplicate app and instance values

Duplicate `app` + `instance` targets are allowed when the `server_key` differs. In that case, include `server_key` in scrape queries to disambiguate the target.

## Query Routing

When multiple targets are configured, the HTTP endpoint uses query parameters to select which target to render.

The default metrics path is `/metrics`.

### Route by server\_key

Use `server_key` when you know the shared-memory server key for the target.

```
/metrics?server_key=82
```

Example:

```
curl "http://127.0.0.1:9464/metrics?server_key=82"
```

This is the clearest routing method for multi-target deployments.

### Route by app and instance

Use `app` and `instance` when you want to route by the resolved root identity after discovery.

```
/metrics?app=ads&instance=phoads01.1.ads
```

Example:

```
curl "http://127.0.0.1:9464/metrics?app=ads&instance=phoads01.1.ads"
```

### Disambiguate duplicate app and instance targets

If more than one target shares the same `app` and `instance`, add `server_key`.

```
/metrics?app=ads&instance=phoads01.1.ads&server_key=82
```

Example:

```
curl "http://127.0.0.1:9464/metrics?app=ads&instance=phoads01.1.ads&server_key=82"
```

## Metric Scopes with Target Routing

Metric scopes expose named subsets of the rendered Prometheus output. They are configured with repeated `[[metric_scopes]]` tables.

```
[[metric_scopes]]
name = "client_threads"
metrics = [
  "ads_client_session_thread_*"
]

[[metric_scopes]]
name = "process_health"
metrics = [
  "ads_managed_process_sink_dist_state",
  "ads_managed_process_sink_dist_process_id",
  "ads_shmem_mo_server_stats_num_clients"
]
```

A scope can be selected as a path segment:

```
/metrics/client_threads?server_key=82
```

Or as a query parameter:

```
/metrics?scope=client_threads&server_key=82
```

When multiple targets are configured, target routing is still required with scoped endpoints.

```
curl "http://127.0.0.1:9464/metrics/process_health?server_key=82"
```

If a scoped endpoint is requested without enough target routing information in multi-target mode, the request fails with:

```
scope selected, but target routing still required when multiple targets are configured.
```

## CLI Override Behavior

TOML values are loaded first. CLI flags override TOML values afterwards.

Common overrides include:

<table><caption class="sr-only">CLI Override Behavior</caption><thead><tr><th scope="col">CLI flag</th><th scope="col">Effect</th></tr></thead><tbody><tr><td><code>--metrics-port 9564</code></td><td>Overrides <code>metrics_port</code>.</td></tr><tr><td><code>--debug</code></td><td>Enables debug logging even if <code>debug = false</code> in TOML.</td></tr><tr><td><code>--instance ...</code></td><td>Clears TOML <code>[[targets]]</code> and uses global target settings.</td></tr><tr><td><code>--server-key ...</code></td><td>Clears TOML <code>[[targets]]</code> and uses global target settings.</td></tr><tr><td><code>--targets-config ...</code></td><td>Uses the legacy flat target file instead of TOML targets.</td></tr></tbody></table>

NoteAvoid accidental mode changes

Passing `--instance` or `--server-key` clears TOML target tables. The first `--server-key` replaces the global key list; repeated flags add keys. `--instance` alone retains the global key list. Multiple global keys create multiple targets and still require scrape routing.

## Examples

### Single ADS Target

```
context_id = "shmApp"
pool_name = "pool"

app = "ads"
server_keys = ["82"]

metrics_http_enabled = true
metrics_port = 9464
metrics_path = "/metrics"

license_file = "/opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic"
```

Run:

```
/opt/particle_horizon/lmc_exporter/bin/lmc_exporter-el8 --config ./lmcExporterConfig.toml
```

Scrape:

```
curl "http://127.0.0.1:9464/metrics?server_key=82"
```

### Multiple ADS Targets

```
metrics_http_enabled = true
metrics_port = 9464
metrics_path = "/metrics"

license_file = "/opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic"

[[targets]]
app = "ads"
server_key = "82"

[[targets]]
app = "ads"
server_key = "456"
```

Scrape each target separately:

```
curl "http://127.0.0.1:9464/metrics?server_key=82"
curl "http://127.0.0.1:9464/metrics?server_key=456"
```

### Multiple Applications

```
metrics_http_enabled = true
metrics_port = 9464
metrics_path = "/metrics"

license_file = "/opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic"

[[targets]]
app = "ads"
server_key = "82"

[[targets]]
app = "adh"
server_key = "999"
```

Scrape by `server_key`:

```
curl "http://127.0.0.1:9464/metrics?server_key=82"
curl "http://127.0.0.1:9464/metrics?server_key=999"
```

### RRCP Trans Target

Add this target to your existing HTTP and licensing configuration, replacing the illustrative shared-memory key:

```
[[targets]]
app = "rrcp_trans"
server_key = "123"
seed_path_groups = ["core", "sink", "source"]
# Required in Gateway mode:
# component_instance_id = "rrcp-trans-primary"
```

```
curl "http://127.0.0.1:9464/metrics?app=rrcp_trans&server_key=123"
```

Gateway mode for RRCP Trans requires **Keystone Gateway v0.2.1**. Provision the `rrcp_trans` entitlement before restarting the exporter. See [Metric Configuration](https://portal.cjcit.io/knowledge-base/lmc_exporter/0.19/configuration/metric-configuration/#rrcp-trans) for role filters, metric semantics, and deployment validation.

### Scoped Multi-Target Scrape

```
metrics_http_enabled = true
metrics_port = 9464
metrics_path = "/metrics"

license_file = "/opt/particle_horizon/local_data/lmc_exporter/lmc_exporter.lic"

[[metric_scopes]]
name = "process_health"
metrics = [
  "ads_managed_process_sink_dist_state",
  "ads_managed_process_sink_dist_process_id",
  "ads_shmem_mo_server_stats_num_clients"
]

[[targets]]
app = "ads"
server_key = "82"

[[targets]]
app = "ads"
server_key = "456"
```

Scrape the scoped output for one target:

```
curl "http://127.0.0.1:9464/metrics/process_health?server_key=82"
```

Equivalent query-parameter form:

```
curl "http://127.0.0.1:9464/metrics?scope=process_health&server_key=82"
```
