LMC Exporter

Quick Start: Export Your First Metrics

Overview

LMC Exporter is a C++ exporter that reads LSEG/LMC shared-memory managed objects and renders app-specific metrics in Prometheus text format.

This quick start shows how to:

  • Build the lmc_exporter executable.
  • Export your first metrics in snapshot mode.
  • Run the HTTP metrics endpoint for Prometheus-style scrapes.

The examples use the repository’s built-in ads app mapping and the example shared-memory server key 82. Replace those values with the app and server key used by your LMC environment.

Prerequisites

Before you start, make sure you have:

RequirementNotes
Linux build environmentUse one of the supported build targets: OL7_64_GCC482, RHEL8_64_GCC831, or RHEL9_64_GCC1141.
LMC install treeThe build expects LMC headers and platform libraries, such as include/ and lib/<platform>/....
C++ compilerThe repository configure script prompts for the compiler path.
OpenSSL development filesRequired for license verification builds.
make and shell toolsUsed to configure and build the executable.
Customer license JSON fileStartup requires a valid license file. The public key is embedded by default in the built binary.
Accessible LMC shared memoryThe exporter must be able to discover a root from the configured server_key.

How It Works

At startup, lmc_exporter creates a shared-memory server pool, discovers visible root handles, selects the best matching root, subscribes to child objects and variables under that root, and renders matched variables as Prometheus text.

The exporter can render metrics in two first-run modes:

Snapshot mode writes periodic Prometheus-style metric output to stdout. The interval is controlled by --metrics-interval or metrics_interval_seconds.

Use this mode when you want to inspect output directly from a terminal or capture snapshots with a process supervisor.

HTTP metrics mode starts a lightweight listener and serves the rendered Prometheus text on /metrics by default.

Use this mode when Prometheus or another scraper will collect metrics over HTTP.

Build LMC Exporter

From the repository root, configure the build environment:

./configure

The configuration step prompts for values such as:

  • LMC install directory
  • target platform
  • compiler path
  • optional NO_STL mode

Build the executable from src:

cd src
make

If OpenSSL is installed outside the compiler’s default search path, pass the prefix at build time:

make OPENSSL_PREFIX=/path/to/openssl

After a successful build, the executable is available as:

src/lmc_exporter

In NO_STL mode, the output executable is:

src/lmc_exporter_NO_STL

Check the built version:

./src/lmc_exporter --version

Configuration

You can configure the exporter with CLI flags or a TOML file. For quick-start usage, CLI flags are the fastest option.

Required first-run values

SettingCLI flagTOML keyDescription
App mapping--appappSelects the metric mapping set. Built-in app values include ads, adh, and ats.
Server key--server-keyserver_keysShared-memory server key used to discover the target root. Repeat the CLI flag for multiple keys.
License file--license-filelicense_filePath to the customer license JSON file required for startup.

Optional first-run values

SettingCLI flagTOML keyDescription
Instance hint--instanceinstanceOptional root-selection hint. Use a full root ID or a bare instance number when roots follow hostname.instance_no.application naming.
Snapshot interval--metrics-intervalmetrics_interval_secondsNumber of seconds between stdout snapshots.
Debug logging--debugdebugEnables verbose sync, update, and lookup diagnostics.
HTTP listener--enable-metrics-httpmetrics_http_enabledEnables HTTP metrics mode.
HTTP bind address--metrics-bind-addressmetrics_bind_addressIPv4 bind address, such as 127.0.0.1 or 0.0.0.0.
HTTP port--metrics-portmetrics_portHTTP listener port.
HTTP path--metrics-pathmetrics_pathScrape path, usually /metrics.

Optional TOML quick-start file

Copy the sample TOML file:

cp docs/lmcExporterConfig.toml.sample ./lmcExporterConfig.toml

For a minimal single-target HTTP quick start, use:

context_id = "shmApp"
pool_name = "pool"

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

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

license_file = "./scratch/example.lic"

Run with the config file:

./src/lmc_exporter --config ./lmcExporterConfig.toml

Usage

Quickstart: Export Your First Metrics

Use a known server key and app mapping. This example uses app ads, server key 82, and a license file at ./scratch/example.lic:

./src/lmc_exporter \
  --server-key 82 \
  --app ads \
  --license-file ./scratch/example.lic

By default, when HTTP mode is not enabled, the exporter writes Prometheus-style snapshots to stdout.

To make root discovery easier to diagnose during a first run, add --debug:

./src/lmc_exporter \
  --server-key 82 \
  --app ads \
  --license-file ./scratch/example.lic \
  --debug

If more than one visible root can match the server key, provide an instance hint:

./src/lmc_exporter \
  --server-key 82 \
  --app ads \
  --instance 1 \
  --license-file ./scratch/example.lic

The --instance value can be either the full root ID or the bare instance_no segment when roots use hostname.instance_no.application naming.

Running in Snapshot Mode

Snapshot mode is the default mode when the HTTP listener is disabled.

Run a snapshot exporter with a 10-second interval:

./src/lmc_exporter \
  --server-key 82 \
  --app ads \
  --metrics-interval 10 \
  --license-file ./scratch/example.lic

The exporter writes Prometheus-style metric snapshots to stdout. Lookup and event diagnostics are written to stderr.

Snapshot mode behavior

  • The exporter discovers the root for the configured server key.
  • It subscribes to the selected subtree.
  • It waits until the tracked subtree is fully subscribed and in sync.
  • It periodically writes rendered metrics to stdout.

Running in HTTP Metrics Mode

HTTP metrics mode serves the same rendered Prometheus output over an HTTP endpoint.

Start the exporter on port 9464:

./src/lmc_exporter \
  --server-key 82 \
  --app ads \
  --enable-metrics-http \
  --metrics-bind-address 127.0.0.1 \
  --metrics-port 9464 \
  --license-file ./scratch/example.lic

Scrape metrics from another shell:

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

When the HTTP listener is enabled, periodic Prometheus snapshots are no longer written to stdout.

Route by resolved instance

After discovery, you can route by app and resolved instance:

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

If more than one target shares the same app and instance, include server_key as well:

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

Use a custom metrics path

Set a custom HTTP path with --metrics-path:

./src/lmc_exporter \
  --server-key 82 \
  --app ads \
  --enable-metrics-http \
  --metrics-port 9464 \
  --metrics-path /metrics \
  --license-file ./scratch/example.lic

Scrape the configured path:

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

Examples

./src/lmc_exporter \
  --server-key 82 \
  --app ads \
  --metrics-interval 10 \
  --license-file ./scratch/example.lic
./src/lmc_exporter \
  --server-key 82 \
  --app ads \
  --enable-metrics-http \
  --metrics-bind-address 127.0.0.1 \
  --metrics-port 9464 \
  --license-file ./scratch/example.lic
curl "http://127.0.0.1:9464/metrics?server_key=82"
context_id = "shmApp"
pool_name = "pool"

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

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

license_file = "./scratch/example.lic"
./src/lmc_exporter --config ./lmcExporterConfig.toml