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
- An AI assistant connected to the Coralogix MCP server. See the MCP setup guide.
- Docker running,
curl, and Bash 4.4 or later (brew install bashon macOS). - A Coralogix management API key with the
REMOTE-CONFIGURATION:MANAGEpermission, configured securely on the MCP server. See Fleet Management permissions and MCP server permissions. - A Send-Your-Data API key from the same account for the Supervisor and metric export.
- The
METRICS.DATA-API#HIGH:READDATApermission, to query metrics in Metric Explorer.
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:
hostmetrics:
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: [hostmetrics]
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 Management 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.yamlas the remote configuration. - Select agents with
cx.agent.type=dockeranddeployment.environment.name=staging.
Attach collector.yaml, with your domain already filled in, 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 Management 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 Management 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 Management configuration group named fleet-mcp-staging-hostmetrics-demo. Preserve its existing configuration and do not change any other group.
In the Coralogix UI, navigate to Fleet Management, then 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.
Navigate to Explore, then 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
In collector.yaml, add the load scraper under hostmetrics.scrapers, 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 Management configuration group fleet-mcp-staging-hostmetrics-demo with the attached updated collector.yaml. Keep the group active.
Ask your AI assistant to retrieve the group by name again and confirm that its configuration family version has advanced. The Supervisor applies the new configuration automatically, so no manual 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
| Symptom | Cause | What to do |
|---|---|---|
| No matching agent | The Supervisor's attributes don't match the agent selector. | Confirm the Supervisor reports cx.agent.type=docker and deployment.environment.name=staging. |
| Group does not become active | The MCP server's management API key is missing the required permission. | Confirm the key carries the FleetManagement preset (REMOTE-CONFIGURATION:MANAGE). See Fleet Management permissions. |
| No metrics arrive | The Collector can't export, or the group isn't applied. | Check the Send-Your-Data API key, the Coralogix domain, and the Collector logs. Confirm the group is active and that 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 Management configuration group fleet-mcp-staging-hostmetrics-demo. Keep the group configuration intact and confirm the family is inactive.
Confirm in Fleet Management, then Configurations, that the group shows as inactive, then archive it:
Archive Fleet Management configuration group fleet-mcp-staging-hostmetrics-demo.
The group is archived and no longer delivers configuration. The docker-install.sh and collector.yaml files remain on the host until you remove them.