# Configuring Azure Monitor for Virtual Machines

#### **Key Differences from Other Azure Resources**

* **Platform metrics** are collected automatically for the VM host, but an **agent** is required for guest OS monitoring.
    
* **Resource logs** are not generated by default; an agent is needed to collect logs from the guest OS.
    
* **Diagnostic settings** for VMs cannot be configured in the Azure portal but can send data to storage or Event Hubs.
    

#### **Monitoring Data Sources**

1. **Virtual Machine Host:**
    
    * **Platform Metrics** (collected automatically) – Requires diagnostics extension for guest OS metrics.
        
    * **Activity Log** – Tracks VM lifecycle events like start/stop and configuration changes.
        
2. **Guest Operating System (Requires Agents):**
    
    * **Log Analytics Agent** – Collects logs from VMs (Azure, on-prem, and other clouds).
        
    * **Dependency Agent** – Tracks running processes and dependencies.
        
    * **Azure Diagnostic Extension** – Primarily for guest performance data in Azure Monitor Metrics.
        
    * **Telegraf Agent** – Collects Linux VM performance data.
        

#### **Recommended Configuration for Full Monitoring**

| **Step** | **Actions** | **Features Enabled** |
| --- | --- | --- |
| **No Configuration** | Host platform metrics & activity logs collected. | Metrics explorer & alerts for host, activity log alerts. |
| **Enable Azure Monitor for VMs** | Install Log Analytics & Dependency Agents. | Performance charts, log queries/alerts, dependency map. |
| **Install Diagnostics Extension & Telegraf Agent** | Collect guest performance data to Metrics. | Metrics explorer & alerts for guest OS. |

For **complete monitoring**, collect data from both the **host** and **guest OS** using **Azure Monitor Metrics** and **Azure Monitor Logs**.
