Skip to main content

Overview

Monitoring agents collect telemetry data from virtual machines and send it to centralized monitoring services. Multi-Cloud Manager supports:
  • Azure Monitor Agent (AMA): Modern agent for Azure VMs
  • GCP Ops Agent: Unified agent for Compute Engine VMs
Both agents collect metrics and logs without requiring manual configuration on the VM.

Azure Monitor Agent (AMA)

About AMA

Azure Monitor Agent is the next-generation monitoring agent that replaces:
  • Log Analytics Agent (MMA/OMS)
  • Azure Diagnostics Extension
  • Telegraf agent
Advantages:
  • Data Collection Rules (DCR) for centralized configuration
  • Security through managed identity
  • Multi-homing to multiple workspaces
  • Support for both Windows and Linux
  • Enhanced security and performance

Check Agent Status

Verify if AMA is installed on a VM:
GET /api/azure/vm/{vm_name}/agent/status
Response:
{
  "vm": "webserver-01",
  "subscriptionId": "12345678-1234-1234-1234-123456789abc",
  "resourceGroup": "production-rg",
  "extensions": [
    "AzureMonitorWindowsAgent",
    "BGInfo"
  ],
  "hasMMA": false,
  "hasAMA_Linux": false,
  "hasAMA_Windows": true
}
Implementation:
# From vmmonitor.py:106-142
compute_client, rg, vm_info = _get_vm_client_and_rg(vm_id, credential)

vm = compute_client.virtual_machines.get(rg, vm_id)
ext_list_result = compute_client.virtual_machine_extensions.list(rg, vm_id)
exts = ext_list_result.value

has_ama_linux = any(
    "AzureMonitorLinuxAgent" in (e.name + e.type) for e in exts
)
has_ama_windows = any(
    "AzureMonitorWindowsAgent" in (e.name + e.type) for e in exts
)
has_mma = any(
    "MicrosoftMonitoringAgent" in (e.name + e.type) for e in exts
)
Extension detection:
  • Checks VM extensions for agent presence
  • Distinguishes between Windows and Linux agents
  • Identifies legacy MMA installations

Install Azure Monitor Agent

Automatically install AMA on a VM:
POST /api/azure/vm/{vm_name}/agent/install
The system:
  1. Detects the VM’s operating system (Windows/Linux)
  2. Installs the appropriate AMA extension
  3. Configures the agent with default settings
Implementation:
# From vmmonitor.py:148-207
# Detect OS type
vm = compute_client.virtual_machines.get(rg, vm_id)
os_type = vm.storage_profile.os_disk.os_type

if os_type == "Windows":
    ext_name = "AzureMonitorWindowsAgent"
    publisher = "Microsoft.Azure.Monitor"
else:
    ext_name = "AzureMonitorLinuxAgent"
    publisher = "Microsoft.Azure.Monitor"

ext_props = {
    "location": vm.location,
    "publisher": publisher,
    "virtual_machine_extension_type": ext_name,
    "type_handler_version": "1.0",
    "auto_upgrade_minor_version": True,
    "settings": {}
}

poller = compute_client.virtual_machine_extensions.begin_create_or_update(
    rg, vm_id, ext_name, ext_props
)
result = poller.result()
Response:
{
  "message": "AMA installed",
  "extension": "AzureMonitorWindowsAgent"
}

Windows Agent Details

Extension properties:
  • Name: AzureMonitorWindowsAgent
  • Publisher: Microsoft.Azure.Monitor
  • Type: AzureMonitorWindowsAgent
  • Version: 1.0 (auto-upgrade enabled)
System requirements:
  • Windows Server 2012 R2 or later
  • Windows 10 or later (for client OS)
  • .NET Framework 4.5 or later
  • TLS 1.2 enabled
Collected data:
  • Performance counters (CPU, memory, disk, network)
  • Windows Event Logs (System, Application, Security)
  • IIS logs (if IIS installed)
  • Custom logs and metrics

Linux Agent Details

Extension properties:
  • Name: AzureMonitorLinuxAgent
  • Publisher: Microsoft.Azure.Monitor
  • Type: AzureMonitorLinuxAgent
  • Version: 1.0 (auto-upgrade enabled)
System requirements:
  • Supported distributions: Ubuntu 16.04+, RHEL 7+, CentOS 7+, Debian 9+, SLES 12+
  • systemd required
  • Python 2.6+ or Python 3.5+
Collected data:
  • Performance counters (CPU, memory, disk, network)
  • Syslog messages
  • Custom logs and metrics

Agent Configuration

AMA is configured via Data Collection Rules (DCR), not on the VM itself.
After installing AMA, create and associate a DCR to start collecting data. See Log Analytics for DCR configuration.
Configuration flow:
  1. Install AMA on VM
  2. Create Data Collection Rule specifying what to collect
  3. Associate DCR with VM
  4. Data flows to Log Analytics workspace

Upgrade from MMA

If the VM has legacy MMA installed:
1

Install AMA

Install Azure Monitor Agent (both can coexist temporarily).
2

Migrate DCRs

Create Data Collection Rules equivalent to existing MMA configuration.
3

Verify Data Flow

Confirm data is flowing to Log Analytics via AMA.
4

Remove MMA

Uninstall the MicrosoftMonitoringAgent extension.

GCP Ops Agent

About Ops Agent

The Ops Agent is Google Cloud’s unified agent that combines:
  • Monitoring agent: Collects system and application metrics
  • Logging agent: Collects and forwards logs
Previously, these were separate agents (Stackdriver Monitoring and Logging agents). Benefits:
  • Single agent installation
  • Automatic updates
  • Improved performance
  • Better integration with Cloud Monitoring and Cloud Logging

Check Agent Status

Verify if Ops Agent is installed and reporting:
GET /api/gcp/vm/{project_id}/{instance_id}/agent/status
Implementation:
# From vmmonitor.py:174-224
credentials = SessionCredentials(gcp_account)
client = monitoring_v3.MetricServiceClient(credentials=credentials)

now = datetime.utcnow().replace(tzinfo=pytz.UTC)
interval = monitoring_v3.TimeInterval(
    end_time=now,
    start_time=now - timedelta(minutes=10)
)

# Check for agent uptime metric
filter_query = (
    f'metric.type = "agent.googleapis.com/agent/uptime" AND '
    f'resource.labels.instance_id = "{instance_id}"'
)

results = client.list_time_series(request=request)
has_data = any(True for _ in results)
Response:
{
  "hasOpsAgent": true,
  "message": "Ops Agent jest aktywny."
}
Detection method:
  • Queries the agent.googleapis.com/agent/uptime metric
  • Checks for data in the last 10 minutes
  • Reports active only if agent is currently reporting

Install Ops Agent

Install Ops Agent on a Compute Engine VM:
POST /api/gcp/vm/{project_id}/{instance_id}/agent/install
The system:
  1. Detects the VM’s operating system
  2. Generates the appropriate installation script
  3. Executes the script via OS Config API
Implementation:
# From vmmonitor.py:226-303
# Detect OS type
req = compute_client.instances().aggregatedList(
    project=project_id,
    filter=f"id = {instance_id}"
)

for inst in instances:
    if 'guestOsFeatures' in inst:
        for feature in inst['guestOsFeatures']:
            if 'WINDOWS' in feature['type']:
                os_type = 'WINDOWS'

if os_type == 'WINDOWS':
    install_script = "Start-Process -FilePath \"https://dl.google.com/cloudagents/windows/google-cloud-ops-agent-msi.exe\" -ArgumentList \"/allusers /quiet\" -Wait"
    command_type = types.RunGuestCommandRequest.CommandType.POWERSHELL
else:
    install_script = "curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh && sudo bash add-google-cloud-ops-agent-repo.sh --also-install"
    command_type = types.RunGuestCommandRequest.CommandType.SHELL

osconfig_client = osconfig_v1.OsConfigServiceClient(credentials=credentials)
request_body = types.RunGuestCommandRequest(
    name=f"projects/{project_id}/locations/{zone}/instances/{instance_id}",
    command=types.RunGuestCommandRequest.Command(
        type_=command_type,
        script=install_script
    )
)

response = osconfig_client.run_guest_command(request=request_body)
Response:
{
  "message": "Zainicjowano instalację Ops Agent (LINUX) na VM 'instance-1'.",
  "operation_name": "projects/my-project/locations/us-central1-a/instances/1234567890/operations/..."
}

Linux Installation Script

# From vmmonitor.py:278
curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
sudo bash add-google-cloud-ops-agent-repo.sh --also-install
What it does:
  1. Downloads the Ops Agent repository configuration
  2. Adds the repository to package manager
  3. Installs google-cloud-ops-agent package
  4. Starts the agent services
Supported distributions:
  • Ubuntu 18.04, 20.04, 22.04
  • Debian 10, 11
  • CentOS 7, 8
  • RHEL 7, 8, 9
  • Rocky Linux 8, 9

Windows Installation Script

# From vmmonitor.py:275
Start-Process -FilePath "https://dl.google.com/cloudagents/windows/google-cloud-ops-agent-msi.exe" -ArgumentList "/allusers /quiet" -Wait
What it does:
  1. Downloads the Ops Agent MSI installer
  2. Runs silent installation for all users
  3. Configures Windows services
  4. Starts the agent
Supported versions:
  • Windows Server 2016, 2019, 2022
  • Windows 10, 11 (for client OS)

Agent Configuration

Ops Agent uses a YAML configuration file: Location:
  • Linux: /etc/google-cloud-ops-agent/config.yaml
  • Windows: C:\Program Files\Google\Cloud Operations\Ops Agent\config\config.yaml
Default configuration:
logging:
  receivers:
    syslog:
      type: syslog
  service:
    pipelines:
      default_pipeline:
        receivers: [syslog]

metrics:
  receivers:
    hostmetrics:
      type: hostmetrics
      collection_interval: 60s
  service:
    pipelines:
      default_pipeline:
        receivers: [hostmetrics]
Customization:
  • Edit the config file on the VM
  • Restart the agent: sudo service google-cloud-ops-agent restart
  • Or deploy via OS Config policies for fleet-wide configuration

Collected Metrics

Ops Agent automatically collects:
MetricDescription
agent.googleapis.com/agent/uptimeAgent uptime in seconds
agent.googleapis.com/cpu/utilizationCPU usage percentage
agent.googleapis.com/memory/percent_usedMemory usage percentage
agent.googleapis.com/disk/percent_usedDisk usage percentage
agent.googleapis.com/network/trafficNetwork bytes sent/received
agent.googleapis.com/processes/countNumber of running processes

Collected Logs

Ops Agent automatically collects: Linux:
  • Syslog messages (/var/log/syslog or /var/log/messages)
  • Auth logs (/var/log/auth.log)
  • Custom application logs (configurable)
Windows:
  • Windows Event Logs (System, Application, Security)
  • IIS logs (if IIS installed)
  • Custom application logs (configurable)

Permissions

Azure AMA Permissions

Required roles:
  • Virtual Machine Contributor or Owner on the VM
  • Monitoring Contributor on the resource group
Service principal permissions:
{
  "actions": [
    "Microsoft.Compute/virtualMachines/extensions/write",
    "Microsoft.Compute/virtualMachines/extensions/read",
    "Microsoft.Compute/virtualMachines/extensions/delete"
  ]
}

GCP Ops Agent Permissions

Required IAM roles:
  • compute.instanceAdmin.v1 (to use OS Config API)
  • osconfig.guestPolicyAdmin (for fleet-wide deployment)
Service account permissions: The VM’s service account needs:
  • logging.logEntries.create
  • monitoring.timeSeries.create
Use the default Compute Engine service account or create a dedicated service account with monitoring permissions.

Troubleshooting

Common causes:
  • VM not running
  • Insufficient permissions
  • VM Agent (Azure Guest Agent) not running
  • Network connectivity issues
Solution:
  1. Verify VM is running
  2. Check VM Agent status in Azure Portal
  3. Verify network allows outbound HTTPS to Azure endpoints
  4. Review extension error logs in Azure Portal
Common causes:
  • OS Config API not enabled
  • VM doesn’t have Guest Environment installed
  • Insufficient IAM permissions
  • Unsupported OS version
Solution:
  1. Enable OS Config API: gcloud services enable osconfig.googleapis.com
  2. Verify Guest Environment: sudo systemctl status google-guest-agent
  3. Check IAM permissions on the VM
  4. Confirm OS is supported
Azure:
  • Wait 5-10 minutes for initial data
  • Ensure DCR is associated with the VM
  • Verify DCR is configured correctly
  • Check Log Analytics workspace permissions
GCP:
  • Wait 3-5 minutes for initial data
  • Verify agent status with /agent/status endpoint
  • Check Cloud Monitoring permissions
  • Review agent logs: journalctl -u google-cloud-ops-agent
Azure:
  • Check if VM was restarted or reimaged
  • Verify extension is still installed
  • Review Windows Event Viewer or Linux syslog for errors
GCP:
  • Check agent service status: sudo systemctl status google-cloud-ops-agent
  • Review agent logs: sudo journalctl -u google-cloud-ops-agent -n 100
  • Restart agent: sudo systemctl restart google-cloud-ops-agent

Agent Comparison

FeatureAzure Monitor AgentGCP Ops Agent
ConfigurationData Collection Rules (centralized)YAML file on VM
InstallationVM ExtensionPackage manager
UpdatesAutomatic (minor versions)Automatic via package updates
Multi-workspaceYes (via DCRs)No (single project)
Custom metricsYes (via DCR)Yes (via config)
CostNo agent cost (data ingestion charged)No agent cost (data ingestion charged)
Legacy agentsReplaces MMA/OMSReplaces separate monitoring/logging agents

Best Practices

Deploy During Provisioning

Install monitoring agents during VM creation to ensure complete telemetry from the start.

Use Automation

Use VM extensions (Azure) or startup scripts (GCP) to install agents automatically.

Monitor Agent Health

Set up alerts for agent failures or missing heartbeats.

Keep Agents Updated

Enable auto-upgrade for minor versions to get latest features and fixes.

Next Steps

Log Analytics

Configure Data Collection Rules for Azure VMs

Metrics Collection

View metrics collected by agents

Build docs developers (and LLMs) love