---
title: "Host Template: Cloud - Azure - Linux VMs"
description: ""
url: "https://docs.itrsgroup.com/docs/opsview/6.11.7/opspacks/cloud-azure-opspack/cloud-azure-linux-vms-host-template/index.html"
---## Overview

Azure Linux VMs allow you to monitor various performance metrics for Linux virtual machines, these include metrics for Logical Disk, Memory, Processor, System and Heartbeat.

The service checks in This Host Template are designed to complement the service checks in the [Azure - Virtual Machines Host Template](https://docs.itrsgroup.com/docs/opsview/6.11.7/opspacks/cloud-azure-opspack/cloud-azure-virtual-machines-host-template/index.html) (which works for both Linux and Windows VMs). If installed, This Host Template will provide a set of metrics for Linux VMs comparable to the [OS - Unix Base Opspack](https://docs.itrsgroup.com/docs/opsview/6.11.7/opspacks/os-unix-base-opspack/index.html). Configuring it requires administrator-level permissions for Azure, or the help of an administrator.

**How does This Host Template differ from OS - Unix Base?**

Using **OS - Unix Base** requires the installation of an Opsview Agent for Linux on the target VM - this may be computationally heavy and intrusive for use with small VMs or highly dynamic environments, or where Microsoft solutions are preferred.

However, **OS - Unix Base** does not require Azure administrator permissions, only the ability to launch and configure a VM with internet connectivity and adjust security groups to let the agent communicate with the Opsview Master.

**What does This Host Template offer above Azure - Virtual Machines?**

The **Azure - Virtual Machines Host Template** offers the ability to track VM read/write operations, network traffic in and out, and CPU load. These metrics are gathered via Azure API calls using an administrator defined "Application" or "Service Principal".

This Host Template complements **Azure - Virtual Machines** by offering extended metrics including memory utilization, memory swap space utilization, processor time, disk space, heartbeats, and restart/shutdown history. This requires the additional use of a Microsoft-approved, open source Azure Monitor Agent, which Azure can auto-install on your target VM when enabled (see Instructions: [Setup Azure Monitor Logs](#setup-azure-monitor-logs)).

This Host Template allows you to monitor the performance metrics for Linux virtual machines - in particular memory utilization, memory swap space utilization, processor time, disk space, heartbeats, and restart/shutdown history.

This Host Template includes the following Service Checks:

| Service&nbsp;Check&nbsp;Name | Description | Default&nbsp;Thresholds (Metric:&nbsp;Warning,&nbsp;Critical) | UOM |
|:-----------------------------|:------------|:------------------------------------------------:|:---:|
| Azure - Linux VM - Heartbeat | The time between the last two heartbeats
[Default Timespan = 5mins, Default Check Interval = 5mins] | N/A | NA |
| Azure - Linux VM - Logical Disk Space | The percentage of used logical disk space
[Default Timespan = 5mins, Default Check Interval = 5mins] | N/A | NA |
| Azure - Linux VM - Memory Swap Space | The percentage of swap space used
[Default Timespan = 5mins, Default Check Interval = 5mins] | N/A | NA |
| Azure - Linux VM - Memory | The percentage of used memory and the available memory in bytes
[Default Timespan = 5mins, Default Check Interval = 5mins] | N/A | NA |
| Azure - Linux VM - Processor Privileged Time | The percentage of processor privileged time
[Default Timespan = 5mins, Default Check Interval = 5mins] | N/A | NA |
| Azure - Linux VM - Processor Time | The percentage of processor time
[Default Timespan = 5mins, Default Check Interval = 5mins] | N/A | NA |
| Azure - Linux VM - Restarts | The number of restarts, and information on the user and command invoke history
[Default Timespan = 1440mins, Default Check Interval = 1440mins] | N/A | NA |
| Azure - Linux VM - Shutdowns | The number of shutdowns, and information on the user and command invoke history
[Default Timespan = 1440mins, Default Check Interval = 1440mins] | N/A | NA |
| Azure - Linux VM - System Uptime | The system uptime
[Default Timespan = 5mins, Default Check Interval = 5mins] | N/A | NA |


**Note**


The "Default Timespan" given for these Service Checks refers to the time period we use when retrieving metrics from Azure.




**Note**


See details about [Monitoring Plugin thresholds here](https://www.monitoring-plugins.org/doc/guidelines.html#THRESHOLDFORMAT).



## Prerequisites for monitoring

### Setup Azure Monitor Logs

This Opspack utilises Azure Monitor Logs to collect data directly from your Azure Virtual Machines. To enable Azure Monitor Logs follow the steps outlined below. If you already have an Azure Workspace, you can skip creating a workspace.

#### Create a Workspace

In the Azure portal, click **All Services** and filter for **Log Analytics workspaces**. Select **Log Analytics workspaces**.

![Show All Services](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-log_analytics_all_services.png)

![Filter Log Analytics workspaces](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-log_analytics_filter.png)

Click **Create**, and then fill in the fields as described:

- Select a **Subscription** from the drop-down list.
- Select an existing **Resource Group** or create a new one.
- Provide a **Name** such as DefaultWorkspace.
- Select the **Region** your VMs are deployed to.
- Optionally, you can click **Next : Pricing tier** to select the **Pricing Tier** you use.

![Create a Workspace](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-log_analytics_create_workspace.png)

After providing the required fields click **Review + Create** and then **Create**.

From the list of Log Analytics workspaces, select the workspace you just created.

From the left-hand menu, select **Overview**.

Make a note of the Workspace Id as this will be required when configuring the Opspack.

![Find Workspace Id](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-log_analytics_workspace_id.png)

#### Enable the Azure Monitor Agent and collect performance data

Log Analytics can be enabled on existing Azure Linux and Windows VMs using the Azure Monitor Agent.

In the Azure portal, click **All Services** and filter for **Data collection rules**. Select **Data collection rules**.

![Show All Services](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_all_services.png)

![Find Data Collection rules](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_data_collection_rules_filter.png)

Create a new Data Collection rule

![Create Data Collection Rule](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_create_data_collection_rule.png)

In **Basics**, select 'Linux' as the **Platform Type**. Don't forget to specify the name of your data collection rule.

![Basic Configuration of Linux VM Data Collection Rule](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_create_basics_linux.png)

In **Resources**, click on 'Add resources' and select the necessary virtual machine(s). Click 'Apply' to add the resources.

![Add Resources to Data Collection rule](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_add_resource.png)

![Apply Linux Resources to Data Collection rule](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_apply_resource_linux.png)

In **Collect and Deliver** tab, click on 'Add data source' and select Performance Counters as the Data Source type.

![Add Data Source](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_add_data_source.png)

Switch to **Custom**. We don't need to include all performance counters, so just make sure the following performance counters are ticked. You can use the search bar to filter the list:

- `Logical Disk(*)\Free Megabytes`
- `Logical Disk(*)\% Used Space`

![Linux Logical Disk Performance Counters](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_logicaldisk_linux.png)

- `Memory(*)\Available MBytes Memory`
- `Memory(*)\% Used Memory`
- `Memory(*)\% Used Swap Space`

![Linux Memory Performance Counters First Page](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_memory-1_linux.png)

![Linux Memory Performance Counters Second Page](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_memory-2_linux.png)

- `Processor(*)\% Processor Time`
- `Processor(*)\% Privileged Time`

![Linux Processor Performance Counters](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_processor_linux.png)

- `System(*)\Uptime`

![Linux System Performance Counters](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_system_linux.png)

In **Destination**, click 'Add destination' and specify destination type as "Azure Monitor Logs". Specify your Log Analytics workspace in **Destination Details**.

After that, click on 'Add data source'.

![Add Performance Counters Destination](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_destination.png)

After adding the performance counter data source, add a 'Linux Syslog' data source.

Under **Basic**, make sure the checkboxes for the following facilities are ticked as shown. Also, make sure the 'Minimum log level' is set to **LOG_DEBUG**:

- LOG_SYSLOG
- LOG_KERN
- LOG_AUTHPRIV
- LOG_DAEMON

![Add Linux Syslog Data Source First Part](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_linux_syslog-1.png)

![Add Linux Syslog Data Source Scrolled](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_linux_syslog-2.png)

In **Destination**, click 'Add destination' and specify destination type as "Azure Monitor Logs". Specify your Log Analytics workspace in **Destination Details**.

After that, click on 'Add data source'.

![Add Data Collection Destination](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_destination.png)

Once you have added the necessary data sources, click on 'Review + create' to review the configurations.

![Click Review and Create for Linux](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_click_review_create_linux.png)

The status should show **Validation passed**.
Finally, click 'Create' to deploy the resource for agent installation.
![Click Create for Linux](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_create_rule_linux.png)

The deployment should complete with no issues.
![Linux Data Collection rule Deployment Complete](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_deployment_complete_linux.png)

You can confirm that the provisioning has succeeded by clicking on 'Go to resource'. Then, the following page shows up.
![Linux Confirmed Data Collection rule Provision](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_provisioned_rule_linux.png)

Another way to verify the successful Azure Monitor Agent installation is by navigating to the respective virtual machine and then selecting 'Extensions + applications' under 'Settings' in the Left Panel.
Confirm the status is 'Provisioning succeeded' for AzureMonitorLinuxAgent.
![Confirmed Azure Monitor Linux Agent Provision](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_provisioned_extension_linux.png)

Finally, select the **Legacy storage account logs** option under your workspace, and add the storage account related to your virtual machine.

![Storage Account Logs](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-monitor_logs_storage_account_logs.png)

### Verify Azure Monitor Agent is running correctly (optional)

To verify the agent extension was successfully installed and provisioned, run the following command on your Azure VM.

```
az vm extension image list-versions --location <machine-region> --name AzureMonitorLinuxAgent --publisher Microsoft.Azure.Monitor
```

It should return an output similar to:

```
[
  {
    "name": "AzureMonitorLinuxAgent",
    "publisher": "Microsoft.Azure.Monitor",
    "type": "extension",
    "typeHandlerVersion": "1.10",
    "location": "westeurope",
    "provisioningState": "Succeeded"
  }
]
```

To check if the agent service is connected and operating correctly, run the following command.

```
systemctl status azuremonitoragent
```

It should return a status similar to:

```
● azuremonitoragent.service - Azure Monitor Agent
   Loaded: loaded (/etc/systemd/system/azuremonitoragent.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2024-10-29 14:32:00 UTC; 1 day 2h ago
     Docs: https://docs.microsoft.com/en-us/azure/azure-monitor/agents/azure-monitor-agent-overview
 Main PID: 1234 (azuremonitoragent)
    Tasks: 5 (limit: 4915)
   CGroup: /system.slice/azuremonitoragent.service
           └─1234 /opt/microsoft/azuremonitoragent/bin/azuremonitoragent
```

If the Agent is not connected to a workspace, connect your Data Collection rule to your chosen workspace using the following command.

```
az monitor data-collection rule association create \
  --association-name <association-name> \
  --resource <vm-resource-id> \
  --data-collection-rule-id <data-collection-rule-id>
```

If the agent is connected but not running, restart the agent using the following command.

```
systemctl restart azuremonitoragent
```

Finally, verify the agent is operating correctly by running the following command again.

```
systemctl status azuremonitoragent
```

### Provide Subscription Access

To use this Host Template you will need to provide access to the subscription you wish to monitor.
Navigate to the **Subscriptions** section and select your Subscription.

In the Subscription to be monitored, click **Access Control (IAM)**.

Then click the **Add** button, select the required role and select the application, once for each of the following roles:

- **Reader**

![Add Subscription to Application](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-add_subscription_1.png)

![Add Subscription to Application](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-add_subscription_2.png)

Repeat these steps for each subscription you wish to monitor.

## Usage Instructions

Please review the overall [Cloud - Azure Opspack](https://docs.itrsgroup.com/docs/opsview/6.11.7/opspacks/cloud-azure-opspack/cloud-azure-opspack/index.html) documentation for details on prerequisites, known issues, and other necessary configurations that apply to all Host Templates in the Opspack.

### Add this Host Template

Add the **Cloud - Azure - Linux VMs** Host Template to your Opsview Monitor host.
If the resource you're monitoring has no hostname or public IP, then open the **Advanced** settings pane and change **Host Check Command** to **Always assumed to be UP**.


**Note**


For more information, refer to the documentation on [Adding Host Templates to Hosts](https://docs.itrsgroup.com/docs/opsview/6.11.7/host/index.html#host-templates).



### Add and configure Variables

The Service Checks in this Host Template use the following variables, and they will be added to your Opsview Monitor instance alongside the Host Template:

- [**AZURE_CREDENTIALS**](#azure_credentials)
- [**AZURE_RESOURCE_DETAILS**](#azure_resource_details)
- [**AZURE_LOG_ANALYTICS_DETAILS**](#azure_log_analytics_details)
- [**AZURE_COMPUTER_NAME**](#azure_computer_name)


**Note**


For more information, refer to the documentation on [Adding Variables to Hosts](https://docs.itrsgroup.com/docs/opsview/6.11.7/adding-a-new-variable/index.html#adding-a-variable-to-a-host).



### Apply Changes

Apply Changes and the system will now be monitored:

![View Output](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-azure-output-cloud-azure-linux-vms.png)

## Available Variables

### AZURE_CREDENTIALS

The Value is not used and therefore can be set to anything. Override the arguments with your Azure Credentials.

| Plugin&nbsp;Parameter | Position&nbsp;in Variable | Name | Description |
|:---------------------:|:-------------------------:|:-----|:------------|
| N/A (Opsview UI Only) | Value | Credentials | The credentials for your Azure Subscription |
| `--subscription-id` | Arg1 | Subscription ID | The Subscription ID of your Azure Subscription |
| `--client-id` | Arg2 | Client ID | The Client ID of your Azure Subscription |
| `--secret-key` | Arg3 | Secret Key | The Secret Key of your Azure Subscription |
| `--tenant-id` | Arg4 | Tenant ID | The Tenant ID of your Azure Subscription |

### AZURE_RESOURCE_DETAILS

The Value is not used and therefore can be set to anything. Override the arguments with your Azure Resource Details.

| Plugin&nbsp;Parameter | Position&nbsp;in Variable | Name | Description |
|:---------------------:|:-------------------------:|:-----|:------------|
| N/A (Opsview UI Only) | Value | Resource Details | The details of your Azure Resource |
| `--resource-group` | Arg1 | Resource Group | Name of the Azure resource group of your resource |
| `--resource-name` | Arg2 | Resource Name | Name of the Azure resource to be monitored |

### AZURE_LOG_ANALYTICS_DETAILS

The Value is not used and therefore can be set to anything. Override the arguments with your Log Analytics Details.

| Plugin&nbsp;Parameter | Position&nbsp;in Variable | Name | Description |
|:---------------------:|:-------------------------:|:-----|:------------|
| N/A (Opsview UI Only) | Value | Log Analytics Details | The details for Azure Monitor Logs |
| `--workspace-id` | Arg1 | Workspace ID | The Workspace ID for Log Analytics |
| `--log-timespan` | Arg2 | Log Query Timespan (Minutes) | The Timespan for counting VM Restart and Shutdown events, in minutes |

### AZURE_COMPUTER_NAME

Set this value to the hostname of the Azure VM you want to monitor if it is different from the resource name. If your VM has been joined to a domain you will need to specify the FQDN.

| Plugin&nbsp;Parameter | Position&nbsp;in Variable | Name | Description |
|:---------------------:|:-------------------------:|:-----|:------------|
| `--host-name` | Value | Computer Name | Hostname of your Azure Computer (This will take precedence over the resource name variable) |

## Plugin help

Plugin: `check_azure`


**Secure Args**


This plugin uses the [Secure Args](https://docs.itrsgroup.com/docs/opsview/6.11.7/configuration/secure-arguments/index.html) feature for argument passing.



For mode-specific help, run the plugin with the `-h -m <mode>` flags. This will list the required and optional Variable Arguments for that mode.
The appropriate mode for each Service Check is listed here:

| Service&nbsp;Check&nbsp;Name | Mode |
|:-----------------------------|:-----|
| Azure - Linux VM - Heartbeat | `Az.Linux.VM.Heartbeat` |
| Azure - Linux VM - Logical Disk Space | `Az.Linux.VM.Logical.Disk.Space` |
| Azure - Linux VM - Memory Swap Space | `Az.Linux.VM.Memory.Swap.Space` |
| Azure - Linux VM - Memory | `Az.Linux.VM.Memory` |
| Azure - Linux VM - Processor Privileged Time | `Az.Linux.VM.Processor.Privileged.Time` |
| Azure - Linux VM - Processor Time | `Az.Linux.VM.Processor.Time` |
| Azure - Linux VM - Restarts | `Az.Linux.VM.Restarts` |
| Azure - Linux VM - Shutdowns | `Az.Linux.VM.Shutdowns` |
| Azure - Linux VM - System Uptime | `Az.Linux.VM.System.Uptime` |


