ResourceGroup, VMs und alle benötigten Ressourcen für diese VMs < /li>
Loganalytics Arbeitsspace < /li>
DatacollectionRule < /li> < /li> DATACOLLECOLLECULERRUGE < /li> < /> DataCollectionRuleaseSociation < /li>
virtualMachinextsion (azuremonitorLinuxagent) < /li>
Benutzerdefinierte Identitätsidentität < /li>
< /ul>
Alle Ressourcen sind zusammengefügt, und die Einstellungen für die Erweiterung werden in den Einstellungen in die Auslöser geschrieben in den Einstellungen geschrieben in den Einstellungen in den Einstellungen sind in den Einstellungen geschrieben in den Einstellungen in den Einstellungen in den Einigungen geschrieben, in der die Einstellungen in den Einstellungen in den Einstellungen geschrieben werden, in der Einstellungen in den Einstellungen in den Einigungen geschrieben werden. "azurerm_virtual_maachine_extension". Aber: Keine Maschine ist mit dem Arbeitsbereich Loganalytics verbunden. Der Agent - "Zähler" für Linux -Server bleibt bei 0. Es war jedoch nicht möglich, eine Lösung dafür zu finden. Zum Beispiel: Sind dort alle benötigten Ressourcen aufgeführt (siehe Beispielcode unten)? Was bedeutet der Parameter "gcs_auto_config" beispielsweise (ohne ihn wird die Erweiterungsinstallation in einen Fehler geraten)? Ist im Block etwas falsch? required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.25.0"
}
}
}
provider "azurerm" {
features {}
subscription_id = "..."
}
#Remote-State configuration
terraform {
backend "azurerm" {
resource_group_name = "MonitoringTest2StateStore"
storage_account_name = "montststatestore2"
container_name = "opentofustate"
key = "tofu.tfstate"
}
}
resource "azurerm_resource_group" "monitorsimple" {
name = "monitorsimple"
location = "West Europe"
}
resource "azurerm_virtual_network" "monitorsimple" {
name = "monitorsimple-vnet"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.monitorsimple.location
resource_group_name = azurerm_resource_group.monitorsimple.name
}
resource "azurerm_subnet" "monitorsimple" {
name = "monitorsimple-subnet"
resource_group_name = azurerm_resource_group.monitorsimple.name
virtual_network_name = azurerm_virtual_network.monitorsimple.name
address_prefixes = ["10.0.1.0/24"]
}
resource "azurerm_network_interface" "monitorsimple" {
name = "monitorsimple-nic"
location = azurerm_resource_group.monitorsimple.location
resource_group_name = azurerm_resource_group.monitorsimple.name
ip_configuration {
name = "monitorsimple-ip-config"
subnet_id = azurerm_subnet.monitorsimple.id
private_ip_address_allocation = "Dynamic"
}
}
resource "azurerm_linux_virtual_machine" "monitorsimple" {
name = "monitorsimple-vm"
resource_group_name = azurerm_resource_group.monitorsimple.name
location = azurerm_resource_group.monitorsimple.location
size = "Standard_DS1_v2"
disable_password_authentication = false
admin_username = "adminuser"
admin_password = "

network_interface_ids = [azurerm_network_interface.monitorsimple.id]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "18.04-LTS"
version = "latest"
}
identity {
type = "UserAssigned"
identity_ids = [azurerm_user_assigned_identity.monitorsimple.id]
}
}
resource "azurerm_eventhub_namespace" "monitorsimple" {
name = "monitorsimpleehns"
location = azurerm_resource_group.monitorsimple.location
resource_group_name = azurerm_resource_group.monitorsimple.name
sku = "Standard"
capacity = 1
}
resource "azurerm_eventhub" "monitorsimple" {
name = "monitorsimple-eventhub"
namespace_id = azurerm_eventhub_namespace.monitorsimple.id
partition_count = 2
message_retention = 1
}
resource "azurerm_log_analytics_workspace" "monitorsimple" {
name = "monitorsimple-law"
location = azurerm_resource_group.monitorsimple.location
resource_group_name = azurerm_resource_group.monitorsimple.name
sku = "PerGB2018"
retention_in_days = 30
}
resource "azurerm_log_analytics_solution" "vminsights" {
solution_name = "VMInsights"
resource_group_name = azurerm_resource_group.monitorsimple.name
location = azurerm_resource_group.monitorsimple.location
workspace_resource_id = azurerm_log_analytics_workspace.monitorsimple.id
workspace_name = azurerm_log_analytics_workspace.monitorsimple.name
plan {
publisher = "Microsoft"
product = "OMSGallery/VMInsights"
}
}
resource "azurerm_monitor_data_collection_rule" "monitorsimple" {
name = "monitorsimpledcr"
location = azurerm_resource_group.monitorsimple.location
resource_group_name = azurerm_resource_group.monitorsimple.name
destinations {
log_analytics {
workspace_resource_id = azurerm_log_analytics_workspace.monitorsimple.id
name = "laws-store"
}
}
data_flow {
streams = ["Microsoft-InsightsMetrics", "Microsoft-Syslog", "Microsoft-Perf"]
destinations = ["laws-store"]
}
data_sources {
syslog {
facility_names = ["*"]
log_levels = ["*"]
name = "example-datasource-syslog"
streams = ["Microsoft-Syslog"]
}
performance_counter {
streams = ["Microsoft-Perf", "Microsoft-InsightsMetrics"]
sampling_frequency_in_seconds = 60
counter_specifiers = ["Processor(*)\\% Processor Time"]
name = "example-datasource-perfcounter"
}
}
depends_on = [
azurerm_log_analytics_solution.vminsights
]
}
resource "azurerm_monitor_data_collection_rule_association" "monitorsimple" {
name = "monitorsimpledcra"
target_resource_id = azurerm_linux_virtual_machine.monitorsimple.id
data_collection_rule_id = azurerm_monitor_data_collection_rule.monitorsimple.id
description = "assoc between vm and dcr"
}
resource "azurerm_user_assigned_identity" "monitorsimple" {
location = azurerm_resource_group.monitorsimple.location
name = "monitorsimpleusid"
resource_group_name = azurerm_resource_group.monitorsimple.name
}
resource "azurerm_virtual_machine_extension" "monitor_agent" {
name = "AzureMonitorLinuxAgent"
virtual_machine_id = azurerm_linux_virtual_machine.monitorsimple.id
publisher = "Microsoft.Azure.Monitor"
type = "AzureMonitorLinuxAgent"
type_handler_version = "1.33"
auto_upgrade_minor_version = true
settings = jsonencode({
GCS_AUTO_CONFIG = true
workspaceId = azurerm_log_analytics_workspace.monitorsimple.id
azureResourceId = azurerm_linux_virtual_machine.monitorsimple.id
stopOnMultipleConnections = false
authentication = {
managedIdentity = {
identifier-name = "mi_res_id"
identifier-value = azurerm_user_assigned_identity.monitorsimple.id
}
}
})
protected_settings = jsonencode({
"workspaceKey" = azurerm_log_analytics_workspace.monitorsimple.primary_shared_key
})
}
< /code>
Unsere Erwartung ist, dass der Loganalytics-Arbeitsbereich verbundene Linux-Maschinen zeigt und diese Maschinen zählt, die einen Azure-Überwachungsmittel ausführen und über eine DCR verbunden sind. aktuell Hinweise?
Vielen Dank.>