# Azure Storage

# Introduction

The Azure Storage Discovery plugin automatically discovers storage accounts in a Microsoft Azure subscription, retrieves account, Blob, File, Queue, and Table capacity, operation, traffic, latency, and availability metrics through Azure Monitor, and creates the corresponding Pandora FMS agents and modules.

# Prerequisites

- A Pandora FMS server with Discovery enabled.
- A Microsoft Azure subscription containing storage accounts.
- A Microsoft Entra Service Principal with the **Reader** and **Monitoring Reader** roles over the subscription or Resource Group to be discovered.
- An Azure credential in the Pandora FMS credential store containing the **Client ID**, **Application secret**, **Tenant or domain name**, and **Subscription id**.
- A valid agent group for the task. The `All` group is not valid because its ID is `0`.
- To use **Advanced container metrics**, the `ContainerLevelCapacityMetrics` rule must already be enabled in Azure.

# Parameters

<table id="bkmrk-option-description--"><thead><tr><th>Option</th><th>Description</th></tr></thead><tbody><tr><td>`--conf`, `-c`</td><td>Required path to the configuration file used for manual execution.</td></tr><tr><td>`--pretty`</td><td>Pretty-prints the JSON output.</td></tr><tr><td>`--version`</td><td>Prints the plugin version, which remains `1.0`.</td></tr><tr><td>`--help`, `-h`</td><td>Displays command help.</td></tr></tbody></table>

# Manual execution

The plugin can be run manually with a minimal configuration file such as:

```ini
[CONF]
tenant_id=11111111-1111-1111-1111-111111111111
client_id=22222222-2222-2222-2222-222222222222
client_secret=my_client_secret
subscription_id=00000000-0000-0000-0000-000000000000
group_id=2

```

Run the plugin with:

```bash
./pandora_azure_storage --conf /etc/pandora/pandora_azure.conf

```

To pretty-print the JSON output:

```bash
./pandora_azure_storage --conf /etc/pandora/pandora_azure.conf --pretty

```

# Discovery

**Step 1. Task definition**

- Select the group where agents will be created. The group ID must be greater than `0`; `All` cannot be used.

**Step 2. Azure base**

- **Azure credentials:** selects an Azure credential from the Pandora FMS credential store.
- **Custom Resource Group:** limits discovery to one Resource Group when enabled. It is disabled by default.
- **Resource group:** exact Resource Group name. It is shown when **Custom Resource Group** is enabled and does not accept regular expressions.

**Step 3. Advanced options**

- **Storage account regexp:** optional regular expression applied locally to storage account names.
- **Create one agent per Storage Account:** enabled creates one agent per account; disabled sends all modules to **Target agent**.
- **Target agent:** agent used when per-account creation is disabled. The default value is `Azure Storage`.
- **Agent name prefix:** prefix used for per-account agents. The default value is `Azure Storage `.
- **Agent autodisable mode:** enabled creates agents with `agent_mode=2`; disabled uses `agent_mode=1`.
- **Agent interval:** interval assigned to generated agents. The default is 5 minutes.
- **Enable entities file re-scan interval:** retains the account cache until the selected re-scan interval is reached.
- **Entities re-scan interval:** interval before rebuilding the cache. It is shown only when the previous token is enabled and defaults to 1 day.
- **Request timeout:** timeout for each Azure request. The default is 30 seconds.
- **Azure management endpoint:** optional endpoint for sovereign or custom clouds. Empty uses `https://management.azure.com`.
- **Microsoft login endpoint:** optional endpoint for sovereign or custom clouds. Empty uses `https://login.microsoftonline.com`.

**Step 4. Metrics and module filters**

- **Storage account metrics:** enables general storage-account metrics.
- **Blob service metrics:** enables Blob service metrics.
- **File service metrics:** enables File service metrics.
- **File share metrics:** enables per-file-share metrics. It is shown only when **File service metrics** is enabled.
- **Queue service metrics:** enables Queue service metrics.
- **Table service metrics:** enables Table service metrics.
- **Advanced container metrics:** enables advanced container checks and metrics. It is disabled by default.
- **Container regexp:** regular expression applied only to containers. It is shown only when **Advanced container metrics** is enabled.
- **Modules allow regexp:** one regular expression per line. Only modules that match at least one expression are allowed.
- **Modules deny regexp:** one regular expression per line. Matching modules are excluded.

# Generated agents and modules

With **Create one agent per Storage Account** enabled, the plugin creates one agent per account named `<Agent name prefix><storage account name>`. If the prefix does not end in a space, hyphen, period, or underscore, a space is added automatically. When the token is disabled, the plugin uses one **Target agent**and adds the account name to the beginning of each module name.

Generated agents use `Azure` as their operating system, inherit the task group and interval, and use mode `2` when **Agent autodisable mode** is enabled or mode `1` when it is disabled.

`Azure Storage Connection` is always created as `generic_proc`, with value `1`for discovered accounts. When a cached account disappears, its agent is retained and the module reports `0` until the entity is removed during a cache rebuild.

**Storage account metrics**

- `Account Used Capacity`: `generic_data`, GiB.
- `Account Capacity Quota`: `generic_data`, GiB; Standard accounts only.
- `Account Used Capacity Percentage`: `generic_data`, percent; Standard accounts only.
- `Account Transactions_Current`: `generic_data`, requests.
- `Account Ingress_Current`: `generic_data`, bytes.
- `Account Egress_Current`: `generic_data`, bytes.
- `Account SuccessServerLatency_Current`: `generic_data`, ms.
- `Account SuccessE2ELatency_Current`: `generic_data`, ms.
- `Account Availability_Current`: `generic_data`, percent.

When hierarchical namespace is enabled, the plugin also creates `Data Lake Storage Gen2 Enabled` as `generic_proc`.

**Blob service metrics**

- `Blob Used Capacity`: `generic_data`, GiB.
- `Blob Object Count`: `generic_data`.
- `Blob Container Count`: `generic_data`.
- `Blob Index Capacity`: `generic_data`, GiB.
- `Blob Transactions_Current`: `generic_data`, requests.
- `Blob Ingress_Current`: `generic_data`, bytes.
- `Blob Egress_Current`: `generic_data`, bytes.
- `Blob SuccessServerLatency_Current`: `generic_data`, ms.
- `Blob SuccessE2ELatency_Current`: `generic_data`, ms.
- `Blob Availability_Current`: `generic_data`, percent.

**File service metrics**

- `File Used Capacity`: `generic_data`, GiB.
- `File Object Count`: `generic_data`.
- `File Share Count`: `generic_data`.
- `File Snapshot Count`: `generic_data`.
- `File Snapshot Size`: `generic_data`, GiB.
- `File Capacity Quota`: `generic_data`, GiB.
- `File Transactions_Current`: `generic_data`, requests.
- `File Ingress_Current`: `generic_data`, bytes.
- `File Egress_Current`: `generic_data`, bytes.
- `File SuccessServerLatency_Current`: `generic_data`, ms.
- `File SuccessE2ELatency_Current`: `generic_data`, ms.
- `File Availability_Current`: `generic_data`, percent.

**File share metrics**

- `File Share <name> Used Capacity`: `generic_data`, GiB.
- `File Share <name> Capacity Quota`: `generic_data`, GiB.
- `File Share <name> Used Capacity Percentage`: `generic_data`, percent.

**Queue service metrics**

- `Queue Used Capacity`: `generic_data`, GiB.
- `Queue Count`: `generic_data`.
- `Queue Message Count`: `generic_data`.
- `Queue Transactions_Current`: `generic_data`, requests.
- `Queue Ingress_Current`: `generic_data`, bytes.
- `Queue Egress_Current`: `generic_data`, bytes.
- `Queue SuccessServerLatency_Current`: `generic_data`, ms.
- `Queue SuccessE2ELatency_Current`: `generic_data`, ms.
- `Queue Availability_Current`: `generic_data`, percent.

**Table service metrics**

- `Table Used Capacity`: `generic_data`, GiB.
- `Table Count`: `generic_data`.
- `Table Entity Count`: `generic_data`.
- `Table Transactions_Current`: `generic_data`, requests.
- `Table Ingress_Current`: `generic_data`, bytes.
- `Table Egress_Current`: `generic_data`, bytes.
- `Table SuccessServerLatency_Current`: `generic_data`, ms.
- `Table SuccessE2ELatency_Current`: `generic_data`, ms.
- `Table Availability_Current`: `generic_data`, percent.

**Advanced container metrics**

- `Blob Container Metrics Enabled`: `generic_proc`, with value `1` when the Azure rule is enabled and `0` when it is disabled.
- `Container <name> Used Capacity`: `generic_data`, GiB.
- `Container <name> Blob Count`: `generic_data`.
- `Container <name> Blob Capacity Percentage`: `generic_data`, percent; created when **Blob service metrics** is also enabled and Azure returns `BlobCapacity`.

**Modules allow regexp** and **Modules deny regexp** are evaluated against the final name of every module. In consolidated mode, the final name includes the storage account prefix.