Skip to main content

Manage Fleet configurations with MCP

Use an AI assistant connected to Coralogix through the Model Context Protocol (MCP) to create and update a Fleet Management configuration group. This walkthrough connects a Docker Supervisor, collects host CPU and memory metrics, then adds CPU load metrics through a configuration update.

What you need​

Set CORALOGIX_DOMAIN to your account's Coralogix domain. The MCP-created Collector configuration must use the same domain.

The agent selector uses the OpenTelemetry resource attribute deployment.environment.name with the standard value staging. This is useful across real deployments, unlike a test-only selector. See the OpenTelemetry deployment environment convention.

This selector matches every Docker Supervisor reporting deployment.environment.name=staging in the account. Use it when the configuration should apply to that staging fleet; add another stable agent attribute if you need to target a smaller set.

1. Set the required environment variables​

export CORALOGIX_DOMAIN="<your-coralogix-domain>"
export CORALOGIX_PRIVATE_KEY="<send-your-data-api-key>"

Supply the Send-Your-Data key through your secret-management workflow.

2. Create collector.yaml​

This configuration collects CPU and memory metrics every 30 seconds, sets service.name to fleet-mcp-hostmetrics, and exports the metrics to Coralogix:

receivers:
host_metrics:
collection_interval: 30s
scrapers:
cpu: {}
memory: {}
processors:
resource/demo:
attributes:
- key: service.name
value: fleet-mcp-hostmetrics
action: upsert
batch:
timeout: 1s
exporters:
coralogix:
domain: "<your-coralogix-domain>"
private_key: ${env:CORALOGIX_PRIVATE_KEY}
application_name: fleet-mcp-demo
subsystem_name: hostmetrics
extensions:
health_check:
endpoint: 0.0.0.0:13133
service:
extensions: [health_check]
pipelines:
metrics:
receivers: [host_metrics]
processors: [resource/demo, batch]
exporters: [coralogix]

Replace <your-coralogix-domain> with the same value you exported as CORALOGIX_DOMAIN. Keep the private-key environment reference as shown.

3. Connect a Docker Supervisor​

Download the latest Docker installer:

curl -fsSL \
https://github.com/coralogix/telemetry-shippers/releases/latest/download/docker-install.sh \
-o docker-install.sh

Install the Supervisor on this host. The installer uses the exported CORALOGIX_DOMAIN to connect it to your region and uses its default ports. Set the deployment environment attribute:

bash docker-install.sh --supervisor \
--opamp-attribute "deployment.environment.name=staging"

This identifies the Supervisor as part of the staging environment so the group can target it. Use these commands to verify the Supervisor is running and inspect recent logs for startup or connection issues:

docker ps --filter name=coralogix-otel-collector
docker logs --since 5m coralogix-otel-collector

4. Create a configuration group with MCP​

In your AI assistant, ask it to create a Fleet configuration group with these settings:

  • Name: fleet-mcp-staging-hostmetrics-demo.
  • Description: Host metrics managed through MCP.
  • Tag: mcp-demo.
  • Start with the group inactive.
  • Add one remote configuration named host-metrics.
  • Use the complete collector.yaml as the remote configuration.
  • Select agents with cx.agent.type=docker and deployment.environment.name=staging.

Attach collector.yaml when you send the prompt. If your AI assistant cannot accept file attachments, paste the file contents into the request.

Copy and send this prompt:

Create an inactive Fleet configuration group named fleet-mcp-staging-hostmetrics-demo with description "Host metrics managed through MCP." and tag "mcp-demo". Add one remote configuration named host-metrics using the attached collector.yaml exactly as provided. Select only agents with cx.agent.type=docker and deployment.environment.name=staging.

Before activating the group, copy and send this prompt to your AI assistant:

List Fleet configuration groups with a name filter of fleet-mcp-staging-hostmetrics-demo and confirm that a matching group exists. Show its name and ID.

5. Activate the group and check metrics​

Ask your AI assistant to activate the configuration group:

Copy and send this prompt:

Activate the Fleet configuration group named fleet-mcp-staging-hostmetrics-demo. Preserve its existing configuration and do not change any other group.

In the Coralogix portal, open Fleet Management > Configurations, find your group by name, and confirm that it is active with a healthy matching agent. Allow up to 5 minutes for the Supervisor to receive the configuration and for the first metrics to arrive.

In Explore, open Metric Explorer, switch to Query, and run:

{__name__=~"system_cpu_time.*|system_memory_usage.*", service_name="fleet-mcp-hostmetrics"}

Select the last 15 minutes and confirm that new samples arrive. Exported metric names use underscores in place of dots and can include unit suffixes.

6. Add CPU load metrics​

Update collector.yaml to include the load scraper alongside the CPU and memory scrapers:

scrapers:
cpu: {}
memory: {}
load: {}

Attach the updated file to your AI assistant. If attachments aren't supported, paste the full updated file into the request.

Copy and send this prompt:

Replace the remote configuration for Fleet group fleet-mcp-staging-hostmetrics-demo with the attached updated collector.yaml. Keep the group active.

Use the matching ID returned by list to retrieve the group through your AI assistant and confirm its family version has advanced. The Supervisor applies the new configuration automatically; no container restart is needed. In Metric Explorer, query for the new series:

{__name__=~"system_cpu_load_average.*", service_name="fleet-mcp-hostmetrics"}

Confirm that the 1 minute, 5 minute, and 15 minute load averages appear. CPU and memory metrics should continue to arrive.

Troubleshooting​

Use these commands to check the Supervisor's status and inspect recent logs:

docker ps --filter name=coralogix-otel-collector
docker logs --since 5m coralogix-otel-collector
  • No matching agent: Check that the Supervisor reports cx.agent.type=docker and deployment.environment.name=staging, matching the selector.
  • Group does not become active: Check the MCP server's management API key and FleetManagement permission.
  • No metrics arrive: Check the Send-Your-Data key, Coralogix domain, and Collector logs. Confirm the group is active and the service name in Metric Explorer matches the YAML.

Cleanup​

Stop and remove the Supervisor:

docker stop coralogix-otel-collector
docker rm coralogix-otel-collector

Before archiving the group, deactivate its configuration family through your AI assistant. Send this prompt and wait for confirmation that the group is inactive:

Deactivate the configuration family for Fleet group fleet-mcp-staging-hostmetrics-demo. Keep the group configuration intact and confirm the family is inactive.

Then archive the group:

Archive Fleet configuration group fleet-mcp-staging-hostmetrics-demo.

The group is archived and no longer delivers configuration.

Learn more​

Last updated on