次の方法で共有


Prometheus Rule Groups - Create Or Update

Prometheus ルール グループ定義を作成または更新します。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/prometheusRuleGroups/{ruleGroupName}?api-version=2023-03-01

URI パラメーター

名前 / 必須 説明
resourceGroupName
path True

string

リソース グループの名前。 名前の大文字と小文字は区別されます。

ruleGroupName
path True

string

ルール グループの名前。

Regex pattern: ^[^:@/#{}%&+*<>?]+$

subscriptionId
path True

string

ターゲット サブスクリプションの ID。

api-version
query True

string

この操作に使用する API バージョン。

要求本文

名前 必須 説明
location True

string

リソースが保存されている地理的な場所

properties.rules True

PrometheusRule[]

Prometheus ルール グループ内のルールを定義します。

properties.scopes True

string[]

Azure Monitor ワークスペースのリソース ID をターゲットとする。 この API バージョンは現在、1 つのスコープを使用した 作成に制限されています。 これは将来変更される可能性があります。

properties.clusterName

string

特定のクラスターのデータにルールを適用します。

properties.description

string

ルール グループの説明。

properties.enabled

boolean

ルール グループを有効または無効にします。

properties.interval

string

ISO 8601 期間形式で表される Prometheus ルール グループを実行する間隔。 1 から 15 分の間にする必要があります

tags

object

リソース タグ。

応答

名前 説明
200 OK

PrometheusRuleGroupResource

OK (更新済み)。

201 Created

PrometheusRuleGroupResource

作成済み (新しいアラート ルールが作成されました)。

Other Status Codes

ErrorResponse

操作に失敗した理由を説明するエラー応答。

Create or Update a cluster centric PrometheusRuleGroup
Create or Update a PrometheusRuleGroup

Create or Update a cluster centric PrometheusRuleGroup

Sample Request

PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup?api-version=2023-03-01

{
  "location": "East US",
  "properties": {
    "description": "This is a rule group with culster centric configuration",
    "interval": "PT10M",
    "clusterName": "myClusterName",
    "scopes": [
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace",
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myClusterName"
    ],
    "rules": [
      {
        "alert": "Billing_Processing_Very_Slow",
        "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30",
        "enabled": true,
        "severity": 2,
        "for": "PT5M",
        "labels": {
          "team": "prod"
        },
        "annotations": {
          "annotationName1": "annotationValue1"
        },
        "resolveConfiguration": {
          "autoResolved": true,
          "timeToResolve": "PT10M"
        },
        "actions": []
      }
    ]
  }
}

Sample Response

{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup",
  "type": "Microsoft.AlertsManagement/prometheusRuleGroups",
  "location": "East US",
  "properties": {
    "description": "This is a rule group with culster centric configuration",
    "interval": "PT10M",
    "clusterName": "myClusterName",
    "scopes": [
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace",
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myClusterName"
    ],
    "rules": [
      {
        "alert": "Billing_Processing_Very_Slow",
        "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30",
        "enabled": true,
        "severity": 2,
        "for": "PT5M",
        "labels": {
          "team": "prod"
        },
        "annotations": {
          "annotationName1": "annotationValue1"
        },
        "resolveConfiguration": {
          "autoResolved": true,
          "timeToResolve": "PT10M"
        },
        "actions": []
      }
    ]
  }
}
{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup",
  "type": "Microsoft.AlertsManagement/prometheusRuleGroups",
  "location": "East US",
  "properties": {
    "description": "This is a rule group with culster centric configuration",
    "interval": "PT10M",
    "clusterName": "myClusterName",
    "scopes": [
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace",
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myClusterName"
    ],
    "rules": [
      {
        "alert": "Billing_Processing_Very_Slow",
        "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30",
        "enabled": true,
        "severity": 2,
        "for": "PT5M",
        "labels": {
          "team": "prod"
        },
        "annotations": {
          "annotationName1": "annotationValue1"
        },
        "resolveConfiguration": {
          "autoResolved": true,
          "timeToResolve": "PT10M"
        },
        "actions": []
      }
    ]
  }
}

Create or Update a PrometheusRuleGroup

Sample Request

PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup?api-version=2023-03-01

{
  "location": "East US",
  "properties": {
    "description": "This is the description of the following rule group",
    "enabled": true,
    "interval": "PT10M",
    "clusterName": "myClusterName",
    "scopes": [
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"
    ],
    "rules": [
      {
        "record": "job_type:billing_jobs_duration_seconds:99p5m",
        "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))",
        "labels": {
          "team": "prod"
        }
      },
      {
        "alert": "Billing_Processing_Very_Slow",
        "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30",
        "enabled": true,
        "severity": 2,
        "for": "PT5M",
        "labels": {
          "team": "prod"
        },
        "annotations": {
          "annotationName1": "annotationValue1"
        },
        "resolveConfiguration": {
          "autoResolved": true,
          "timeToResolve": "PT10M"
        },
        "actions": [
          {
            "actionGroupId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup",
            "actionProperties": {
              "key11": "value11",
              "key12": "value12"
            }
          },
          {
            "actionGroupId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup",
            "actionProperties": {
              "key21": "value21",
              "key22": "value22"
            }
          }
        ]
      }
    ]
  }
}

Sample Response

{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup",
  "type": "Microsoft.AlertsManagement/prometheusRuleGroups",
  "location": "East US",
  "properties": {
    "description": "This is the description of the following rule group",
    "enabled": true,
    "interval": "PT10M",
    "clusterName": "myClusterName",
    "scopes": [
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"
    ],
    "rules": [
      {
        "record": "job_type:billing_jobs_duration_seconds:99p5m",
        "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))",
        "labels": {
          "team": "prod"
        }
      },
      {
        "alert": "Billing_Processing_Very_Slow",
        "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30",
        "enabled": true,
        "severity": 2,
        "for": "PT5M",
        "labels": {
          "team": "prod"
        },
        "annotations": {
          "annotationName1": "annotationValue1"
        },
        "resolveConfiguration": {
          "autoResolved": true,
          "timeToResolve": "PT10M"
        },
        "actions": [
          {
            "actionGroupId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup",
            "actionProperties": {
              "key11": "value11",
              "key12": "value12"
            }
          },
          {
            "actionGroupId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup",
            "actionProperties": {
              "key21": "value21",
              "key22": "value22"
            }
          }
        ]
      }
    ]
  }
}
{
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup",
  "type": "Microsoft.AlertsManagement/prometheusRuleGroups",
  "location": "East US",
  "properties": {
    "description": "This is the description of the following rule group",
    "enabled": true,
    "interval": "PT10M",
    "clusterName": "myClusterName",
    "scopes": [
      "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"
    ],
    "rules": [
      {
        "record": "job_type:billing_jobs_duration_seconds:99p5m",
        "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))",
        "labels": {
          "team": "prod"
        }
      },
      {
        "alert": "Billing_Processing_Very_Slow",
        "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30",
        "enabled": true,
        "severity": 2,
        "for": "PT5M",
        "labels": {
          "team": "prod"
        },
        "annotations": {
          "annotationName1": "annotationValue1"
        },
        "resolveConfiguration": {
          "autoResolved": true,
          "timeToResolve": "PT10M"
        },
        "actions": [
          {
            "actionGroupId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup",
            "actionProperties": {
              "key11": "value11",
              "key12": "value12"
            }
          },
          {
            "actionGroupId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup",
            "actionProperties": {
              "key21": "value21",
              "key22": "value22"
            }
          }
        ]
      }
    ]
  }
}

定義

名前 説明
createdByType

リソースを作成した ID の種類。

ErrorAdditionalInfo

リソース管理エラーの追加情報。

ErrorDetail

エラーの詳細。

ErrorResponse

エラー応答

PrometheusRule

Azure Prometheus のアラートまたは記録ルール。

PrometheusRuleGroupAction

アラート アクション。 アラートにのみ関連します。

PrometheusRuleGroupResource

Prometheus ルール グループ リソース。

PrometheusRuleResolveConfiguration

Prometheus アラート ルールの構成を指定します。

systemData

リソースの作成と最後の変更に関連するメタデータ。

createdByType

リソースを作成した ID の種類。

名前 説明
Application

string

Key

string

ManagedIdentity

string

User

string

ErrorAdditionalInfo

リソース管理エラーの追加情報。

名前 説明
info

object

追加情報。

type

string

追加情報の種類。

ErrorDetail

エラーの詳細。

名前 説明
additionalInfo

ErrorAdditionalInfo[]

エラーの追加情報。

code

string

エラー コード。

details

ErrorDetail[]

エラーの詳細です。

message

string

エラー メッセージ。

target

string

エラーのターゲット。

ErrorResponse

エラー応答

名前 説明
error

ErrorDetail

error オブジェクト。

PrometheusRule

Azure Prometheus のアラートまたは記録ルール。

名前 説明
actions

PrometheusRuleGroupAction[]

アラート ルールがアクティブになったとき、およびアラート条件が解決されたときに実行されるアクション。

alert

string

アラート ルール名。

annotations

object

annotations 句は、アラートの説明や Runbook リンクなど、より長い追加情報を格納するために使用できる一連の情報ラベルを指定します。 注釈の値はテンプレート化できます。

enabled

boolean

ルールを有効または無効にします。

expression

string

評価する PromQL 式。 https://prometheus.io/docs/prometheus/latest/querying/basics/. 'interval' で指定されたとおりに定期的に評価され、"record" によって指定されたメトリック名を持つ新しい時系列セットとして記録された結果。

for

string

発生する前にアラートをアクティブにする必要がある時間の量。

labels

object

結果を格納する前に追加または上書きするラベル。

record

string

記録されたメトリック名。

resolveConfiguration

PrometheusRuleResolveConfiguration

発生したアラートを解決するための構成を定義します。 アラートにのみ関連します。

severity

integer

ルールによって発生したアラートの重大度。 0 ~ 4 の間である必要があります。

PrometheusRuleGroupAction

アラート アクション。 アラートにのみ関連します。

名前 説明
actionGroupId

string

使用するアクション グループのリソース ID。

actionProperties

object

アクション グループ オブジェクトのプロパティ。

PrometheusRuleGroupResource

Prometheus ルール グループ リソース。

名前 説明
id

string

リソースの完全修飾リソース ID。 例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

location

string

リソースが保存されている地理的な場所

name

string

リソースの名前

properties.clusterName

string

特定のクラスターのデータにルールを適用します。

properties.description

string

ルール グループの説明。

properties.enabled

boolean

ルール グループを有効または無効にします。

properties.interval

string

ISO 8601 期間形式で表される Prometheus ルール グループを実行する間隔。 1 から 15 分の間にする必要があります

properties.rules

PrometheusRule[]

Prometheus ルール グループ内のルールを定義します。

properties.scopes

string[]

Azure Monitor ワークスペースのリソース ID をターゲットとする。 この API バージョンは現在、1 つのスコープを使用した 作成に制限されています。 これは将来変更される可能性があります。

systemData

systemData

createdBy および modifiedBy 情報を含む Azure Resource Manager メタデータ。

tags

object

リソース タグ。

type

string

リソースの型。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts"

PrometheusRuleResolveConfiguration

Prometheus アラート ルールの構成を指定します。

名前 説明
autoResolved

boolean

アラートの自動解決を有効にします。

timeToResolve

string

アラートの自動解決タイムアウト。

systemData

リソースの作成と最後の変更に関連するメタデータ。

名前 説明
createdAt

string

リソース作成のタイムスタンプ (UTC)。

createdBy

string

リソースを作成した ID。

createdByType

createdByType

リソースを作成した ID の種類。

lastModifiedAt

string

リソースの最終変更のタイムスタンプ (UTC)

lastModifiedBy

string

リソースを最後に変更した ID。

lastModifiedByType

createdByType

リソースを最後に変更した ID の種類。