Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default config is not accepted by Alloy on Windows11 #2281

Open
igolets opened this issue Dec 13, 2024 · 3 comments
Open

Default config is not accepted by Alloy on Windows11 #2281

igolets opened this issue Dec 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@igolets
Copy link

igolets commented Dec 13, 2024

What's wrong?

I've followed steps from Windows configuration wizard, but Alloy service evev can not start with default config file.

Steps to reproduce

  1. Install alloy using configurator from web console
  2. Use default settings in section 2 (Make configuration selections)
  3. Copy script from "Set up Grafana Alloy to use the Windows integration" and APPEND to %PROGRAMFILES%\GrafanaLabs\Alloy\config.alloy
  4. Restart Alloy service
  5. See that is fails to start, see errors in Windows event log

System information

Windows 11 x64 PRO 24H2

Software version

Grafana Alloy 1.5.1

Configuration

remotecfg {
	url            = "https://fleet-management-prod-016.grafana.net"
	id             = "*********"
	poll_frequency = "60s"

	basic_auth {
		username = "*********"
		password = "*********"
	}
}
prometheus.exporter.windows "integrations_windows_exporter" {
  enabled_collectors = ["cpu", "cs", "logical_disk", "net", "os", "service", "system", "time", "diskdrive"]
}
discovery.relabel "integrations_windows_exporter" {
  targets = prometheus.exporter.windows.integrations_windows_exporter.targets

  rule {
    target_label = "job"
    replacement  = "integrations/windows_exporter"
  }

  rule {
    target_label = "instance"
    replacement  = constants.hostname
  }
}
prometheus.scrape "integrations_windows_exporter" {
  targets    = discovery.relabel.integrations_windows_exporter.output
  forward_to = [prometheus.relabel.integrations_windows_exporter.receiver]
  job_name   = "integrations/windows_exporter"
}
prometheus.relabel "integrations_windows_exporter" {
  forward_to = [prometheus.remote_write.metrics_service.receiver]

  rule {
    source_labels = ["volume"]
    regex         = "HarddiskVolume.*"
    action        = "drop"
  }

  rule {
    action = "keep"
    regex = "up|windows_cpu_interrupts_total|windows_cpu_time_total|windows_cs_hostname|windows_cs_logical_processors|windows_cs_physical_memory_bytes|windows_disk_drive_status|windows_logical_disk_avg_read_requests_queued|windows_logical_disk_avg_write_requests_queued|windows_logical_disk_free_bytes|windows_logical_disk_idle_seconds_total|windows_logical_disk_read_bytes_total|windows_logical_disk_read_seconds_total|windows_logical_disk_reads_total|windows_logical_disk_size_bytes|windows_logical_disk_write_bytes_total|windows_logical_disk_write_seconds_total|windows_logical_disk_writes_total|windows_net_bytes_received_total|windows_net_bytes_sent_total|windows_net_packets_outbound_discarded_total|windows_net_packets_outbound_errors_total|windows_net_packets_received_discarded_total|windows_net_packets_received_errors_total|windows_net_packets_received_unknown_total|windows_os_info|windows_os_paging_limit_bytes|windows_os_physical_memory_free_bytes|windows_os_timezone|windows_service_status|windows_system_context_switches_total|windows_system_processor_queue_length|windows_system_system_up_time|windows_time_computed_time_offset_seconds|windows_time_ntp_round_trip_delay_seconds|"
    source_labels = ["__name__"]
  }
}

loki.process "logs_integrations_windows_exporter_application" {
  forward_to = [loki.write.grafana_cloud_loki.receiver]

  stage.json {
    expressions = {
      level  = "levelText",
      source = "source",
    }
  }

  stage.labels {
    values = {
      level  = "",
      source = "",
    }
  }
}
loki.relabel "logs_integrations_windows_exporter_application" {
  forward_to = [loki.process.logs_integrations_windows_exporter_application.receiver]

  rule {
    source_labels = ["computer"]
    target_label  = "agent_hostname"
  }
}
loki.source.windowsevent "logs_integrations_windows_exporter_application" {
  locale                 = 1033
  eventlog_name          = "Application"
  bookmark_path          = "./bookmarks-app.xml"
  poll_interval          = "0s"
  use_incoming_timestamp = true
  forward_to             = [loki.relabel.logs_integrations_windows_exporter_application.receiver]
  labels                 = {
    instance = constants.hostname,
    job      = "integrations/windows_exporter",
  }
}
loki.process "logs_integrations_windows_exporter_system" {
  forward_to = [loki.write.grafana_cloud_loki.receiver]

  stage.json {
    expressions = {
      level  = "levelText",
      source = "source",
    }
  }

  stage.labels {
    values = {
      level  = "",
      source = "",
    }
  }
}
loki.relabel "logs_integrations_windows_exporter_system" {
  forward_to = [loki.process.logs_integrations_windows_exporter_system.receiver]

  rule {
    source_labels = ["computer"]
    target_label  = "agent_hostname"
  }
}
loki.source.windowsevent "logs_integrations_windows_exporter_system" {
  locale                 = 1033
  eventlog_name          = "System"
  bookmark_path          = "./bookmarks-sys.xml"
  poll_interval          = "0s"
  use_incoming_timestamp = true
  forward_to             = [loki.relabel.logs_integrations_windows_exporter_system.receiver]
  labels                 = {
    instance = constants.hostname,
    job      = "integrations/windows_exporter",
  }
}

Logs

#1:
level=info msg="starting program" command="C:\\Program Files\\GrafanaLabs\\Alloy\\alloy-windows-amd64.exe run C:\\Program Files\\GrafanaLabs\\Alloy\\config.alloy --storage.path=C:\\ProgramData\\GrafanaLabs\\Alloy\\data --stability.level=public-preview"


#2:
Error: C:\Program Files\GrafanaLabs\Alloy\config.alloy:49:17: component "loki.write.grafana_cloud_loki.receiver" does not exist or is out of scope

48 | loki.process "logs_integrations_windows_exporter_application" {
49 |   forward_to = [loki.write.grafana_cloud_loki.receiver]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50 | 

Error: C:\Program Files\GrafanaLabs\Alloy\config.alloy:86:17: component "loki.write.grafana_cloud_loki.receiver" does not exist or is out of scope

85 | loki.process "logs_integrations_windows_exporter_system" {
86 |   forward_to = [loki.write.grafana_cloud_loki.receiver]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87 | 

Error: C:\Program Files\GrafanaLabs\Alloy\config.alloy:33:17: component "prometheus.remote_write.metrics_service.receiver" does not exist or is out of scope

32 | prometheus.relabel "integrations_windows_exporter" {
33 |   forward_to = [prometheus.remote_write.metrics_service.receiver]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34 | 


#3:
interrupt received
Error: could not perform the initial load successfully


#4:
level=error msg="service exited with error" err="exit status 1" exit_code=1
@igolets igolets added the bug Something isn't working label Dec 13, 2024
@johannaojeling
Copy link
Member

Hi @igolets, the Windows integration assumes that you installed Alloy without remote configuration enabled. In that case, the base Alloy configuration would include the prometheus.remote_write.metrics_service and loki.write.grafana_cloud_loki blocks that the Windows integration needs declared in your config.alloy file.

You can resolve this by:

  1. Go to the Connections > Collector > Configure page and click the Installation tab to manage your Alloy configuration.
  2. Make sure the Enable Remote Configuration option is switched off.
  3. Run the command in the Install and run Grafana Alloy section. Note that this will overwrite your existing config.alloy file, so make sure to back up any content first that you want to use later on.
  4. Paste the Windows integration configuration (and the remotecfg block if you want to use that too) into the new config.alloy file.
  5. Start Alloy.

@igolets
Copy link
Author

igolets commented Dec 16, 2024

Hi, @johannaojeling, thanks a lot for your advice, now I see data in windows dashboards.
I wonder why configurator does not take this into account and require some specific knowledge from beginners, hope this could be fixed at some moment. I'd expect some warning near "Remote config" checkbox or different snippet in "Prepare your configuration file" section. Could you send this feature request of mine to proper people?
Thanks in advance!

@johannaojeling
Copy link
Member

Great to hear that it is working now! Yes, thank you for your feedback - we are currently working on improving the user onboarding experience for this, so it should be easier to get started in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants