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

Alloy does not work on Windows 11 #2225

Open
igolets opened this issue Dec 6, 2024 · 6 comments
Open

Alloy does not work on Windows 11 #2225

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

Comments

@igolets
Copy link

igolets commented Dec 6, 2024

What's wrong?

I've installed alloy on my win11 machine using script provided by configurationmaster. "C:\Program Files\GrafanaLabs\Alloy\config.alloy" was created and contain my token. But test connection fails (No metrics were found for this integration. ).
I did some basic check and here is wha I've found:

  1. Service is running.
  2. in Windows Application logs I see one error message — ts=2024-12-06T09:11:45.650179Z level=error source=/go/pkg/mod/github.com/!kim!machine!gun/[email protected]/memlimit/memlimit.go:117 msg="failed to set GOMEMLIMIT" package=github.com/KimMachineGun/automemlimit/memlimit error="failed to set GOMEMLIMIT: cgroups is not supported on this system"

Googling did not give any clue.

Steps to reproduce

  1. Get setup script using configuration master (cd "%TEMP%" && powershell -c Invoke-WebRequest "https://storage.googleapis.com/cloud-onboarding/alloy/scripts/install-windows.ps1" -OutFile "install-windows.ps1" && powershell -executionpolicy Bypass -File ".\install-windows.ps1"....)
  2. Run it in elevated CMD
  3. Check Windows eventlog (Application)

System information

Windows 11 x64 PRO 24H2

Software version

Grafana Alloy 1.5.1

Configuration

remotecfg {
	url            = "https://******.grafana.net"
	id             = "******"
	poll_frequency = "60s"

	basic_auth {
		username = "******"
		password = "glc_******"
	}
}

Logs

ts=2024-12-06T09:11:45.650179Z level=error source=/go/pkg/mod/github.com/!kim!machine!gun/[email protected]/memlimit/memlimit.go:117 msg="failed to set GOMEMLIMIT" package=github.com/KimMachineGun/automemlimit/memlimit error="failed to set GOMEMLIMIT: cgroups is not supported on this system"
ts=2024-12-06T09:11:45.8593396Z level=info msg="no peer discovery configured: both join and discover peers are empty" service=cluster
ts=2024-12-06T09:11:45.8593396Z level=info msg="running usage stats reporter"
ts=2024-12-06T09:11:45.8593396Z level=info msg="starting complete graph evaluation" controller_path=/ controller_id="" trace_id=8916bce04d8fa5b0e0d3de118bd490fa
ts=2024-12-06T09:11:45.8593396Z level=info msg="enabled windows_exporter collectors" component_path=/ component_id=prometheus.exporter.windows.integrations_windows_exporter collectors=cpu,cs,diskdrive,logical_disk,net,os,service,system,time
ts=2024-12-06T09:11:45.8593396Z level=warn msg="No where-clause specified for service collector. This will generate a very large number of metrics!" component_path=/ component_id=prometheus.exporter.windows.integrations_windows_exporter collector=service
ts=2024-12-06T09:11:45.8593396Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=8916bce04d8fa5b0e0d3de118bd490fa node_id=prometheus.exporter.windows.integrations_windows_exporter duration=191.5318ms
ts=2024-12-06T09:11:45.8593396Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=8916bce04d8fa5b0e0d3de118bd490fa node_id=discovery.relabel.integrations_windows_exporter duration=0s
ts=2024-12-06T09:11:45.8593396Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=8916bce04d8fa5b0e0d3de118bd490fa node_id=tracing duration=0s
ts=2024-12-06T09:11:45.8593396Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=8916bce04d8fa5b0e0d3de118bd490fa node_id=logging duration=0s

@igolets igolets added the bug Something isn't working label Dec 6, 2024
@naZzethe3rd
Copy link

We confirmed the same error with Windows Server 2019.

@dehaansa
Copy link
Contributor

dehaansa commented Dec 9, 2024

While that error log is annoying it should be a red herring, as it only affects automatic setting of the GOMEMLIMIT variable.

I see that you mentioned test connection failed in Fleet Management, however if you go to look at your collector fleet does the alloy instance appear? I believe FM is working on some issues where the test connection fails but the collector is actually successfully connected.

@humbberto
Copy link

facing the same issue here

.\alloy-windows-amd64.exe run .\config.alloy --stability.level public-preview
ts=2024-12-10T21:31:05.266222Z level=info "boringcrypto enabled"=false
ts=2024-12-10T21:31:04.9237752Z level=error source=/go/pkg/mod/github.com/!kim!machine!gun/[email protected]/memlimit/memlimit.go:117 msg="failed to set GOMEMLIMIT" package=github.com/KimMachineGun/automemlimit/memlimit error="failed to set GOMEMLIMIT: cgroups is not supported on this system"
ts=2024-12-10T21:31:05.2667357Z level=info msg="no peer discovery configured: both join and discover peers are empty" service=cluster
ts=2024-12-10T21:31:05.2667357Z level=info msg="running usage stats reporter"
ts=2024-12-10T21:31:05.2667357Z level=info msg="starting complete graph evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143
ts=2024-12-10T21:31:05.2667357Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 node_id=remotecfg duration=340.2089ms
ts=2024-12-10T21:31:05.2667357Z level=info msg="applying non-TLS config to HTTP server" service=http
ts=2024-12-10T21:31:05.2667357Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 node_id=http duration=0s
ts=2024-12-10T21:31:05.267259Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 node_id=cluster duration=0s
ts=2024-12-10T21:31:05.267259Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 node_id=livedebugging duration=0s
ts=2024-12-10T21:31:05.267259Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 node_id=ui duration=0s
ts=2024-12-10T21:31:05.267259Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 node_id=labelstore duration=0s
ts=2024-12-10T21:31:05.267259Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 node_id=tracing duration=0s
ts=2024-12-10T21:31:05.267259Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 node_id=logging duration=1.037ms
ts=2024-12-10T21:31:05.267804Z level=info msg="finished node evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 node_id=otel duration=0s
ts=2024-12-10T21:31:05.267804Z level=info msg="finished complete graph evaluation" controller_path=/ controller_id="" trace_id=196bc9dce13d4fdea8cc515903d8c143 duration=342.3349ms
ts=2024-12-10T21:31:05.267804Z level=info msg="scheduling loaded components and services"
ts=2024-12-10T21:31:05.267804Z level=info msg="starting cluster node" service=cluster peers_count=0 peers="" advertise_addr=127.0.0.1:12345

@erikbaranowski
Copy link
Contributor

The error message is a typical error message to be addressed with alloy running in windows and I believe unrelated.

There are a few things going on here. I think the question lies more grafana cloud than alloy from here.

  • It looks like you have installed alloy with the Enable Remote Configuration option.
  • The Test Connection button looks for the existence of a specific alloy metric in order to succeed
  • Using Fleet Management should create some enabled pipelines which match to your collector such as self_monitoring_metrics
  • This self_monitoring_metrics pipeline should create the metric that you need for Test Connection

Debug

Navigate here

Image

Does this pipeline exist and is enabled?

Image

Is your collector showing here and status green?

Image

When you click on your collector, does any health data show?

Image

What remote configuration is being served?

Image

Additional Thoughts

Each remote configuration is an independent pipeline. We are working on a long-term solution so that there exists a Fleet Management native integration workflow but for now if you create a remote configuration you will need to add the remote write component so that it forwards the data when copy/pasting integration config. This may be relevant if you are, for example, setting up the windows integration using Fleet Management.

Alternatively, you can go back to the install steps for alloy and uncheck the Enable Remote Configuration option to use the original alloy grafana cloud workflow.

@humbberto
Copy link

humbberto commented Dec 11, 2024 via email

@igolets
Copy link
Author

igolets commented Dec 12, 2024

Thanks for pointing out to this screen.

I see my 2 connections in fleet management, but there is no data from both (Win11 and CentOS). As I see from config, I should see at least Alloy logs. Could you give me any clues what to rey to see something?

Win11 config:
`
declare "self_monitoring_logs_windows" {

// THIS IS A GENERATED REMOTE CONFIGURATION.
// 
//   * You can edit the contents and matchers for this configuration without them being overwritten.
//   * If you delete ALL generated configurations, the latest default versions will be recreated.
//   * This configuration requires the following environment variables to be set wherever alloy is running:
//     * GCLOUD_RW_API_KEY: The Grafana Cloud API key with write access to Loki.
//     * GCLOUD_FM_COLLECTOR_ID: A unique collector ID matching the remotecfg id argument value.

// Write logs to your Grafana Cloud Loki instance.
loki.write "grafana_cloud_loki" {
	endpoint {
		url = "https://logs-prod-025.grafana.net/loki/api/v1/push"

		basic_auth {
			username = "*******"
			password = sys.env("GCLOUD_RW_API_KEY")
		}
	}
}

// Read Alloy logs from the Windows Event Log with the following additional labels:
//   * job: "integrations/alloy" is compatible with Grafana Cloud's Alloy Health Integrations.
//   * collector_id: The unique collector ID matching the remotecfg id argument value.
//                   Used to match collector-specific metrics to power the 'Collector
//                   Health' section of the Fleet Management UI.
loki.source.windowsevent "alloy_logs" {
	xpath_query = `<QueryList>
*[System[Provider[@name='Alloy']]] `
	forward_to = [loki.write.grafana_cloud_loki.receiver]
	labels     = {"job" = "integrations/alloy", "collector_id" = sys.env("GCLOUD_FM_COLLECTOR_ID")}
}

}

self_monitoring_logs_windows "default" { }

declare "self_monitoring_metrics" {

// THIS IS A GENERATED REMOTE CONFIGURATION.
//
//   * You can edit the contents and matchers for this configuration without them being overwritten.
//   * If you delete ALL generated configurations, the latest default versions will be recreated.
//   * This configuration requires the following environment variables to be set wherever alloy is running:
//     * GCLOUD_RW_API_KEY: The Grafana Cloud API key with write access to Loki.
//     * GCLOUD_FM_COLLECTOR_ID: A unique collector ID matching the remotecfg id argument value.

// Export Alloy metrics in memory.
prometheus.exporter.self "integrations_alloy_health" { }

// Target Alloy metrics with the following additional labels:
//   * job: "integrations/alloy" is compatible with Grafana Cloud's Alloy Health Integrations.
//   * collector_id: The unique collector ID matching the remotecfg id argument value.
//                   Used to match collector-specific metrics to power the 'Collector
//                   Health' section of the Fleet Management UI.
//   * instance: The hostname of the machine running Alloy.
discovery.relabel "integrations_alloy_health" {
	targets = prometheus.exporter.self.integrations_alloy_health.targets

	rule {
		action       = "replace"
		target_label = "collector_id"
		replacement  = sys.env("GCLOUD_FM_COLLECTOR_ID")
	}

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}

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

// Scrape Alloy metrics and forward them to the remote write component.
prometheus.scrape "integrations_alloy_health" {
	targets = array.concat(
		discovery.relabel.integrations_alloy_health.output,
	)
	forward_to = [prometheus.remote_write.default.receiver]
	job_name   = "integrations/alloy"
}

// Write metrics to your Grafana Cloud Prometheus instance.
prometheus.remote_write "default" {
	endpoint {
		url = "https://prometheus-prod-39-prod-eu-north-0.grafana.net/api/prom/push"

		basic_auth {
			username = "*******"
			password = sys.env("GCLOUD_RW_API_KEY")
		}
	}
}

}

self_monitoring_metrics "default" { }
`

Linux one:
`
declare "self_monitoring_logs_linux" {

// THIS IS A GENERATED REMOTE CONFIGURATION.
// 
//   * You can edit the contents and matchers for this configuration without them being overwritten.
//   * If you delete ALL generated configurations, the latest default versions will be recreated.
//   * This configuration requires the following environment variables to be set wherever alloy is running:
//     * GCLOUD_RW_API_KEY: The Grafana Cloud API key with write access to Loki.
//     * GCLOUD_FM_COLLECTOR_ID: A unique collector ID matching the remotecfg id argument value.

// Write logs to your Grafana Cloud Loki instance.
loki.write "grafana_cloud_loki" {
	endpoint {
		url = "https://logs-prod-025.grafana.net/loki/api/v1/push"

		basic_auth {
			username = "******"
			password = sys.env("GCLOUD_RW_API_KEY")
		}
	}
}

// Read Alloy logs when running as a systemd service with the following additional labels:
//   * job: "integrations/alloy" is compatible with Grafana Cloud's Alloy Health Integrations.
//   * collector_id: The unique collector ID matching the remotecfg id argument value.
//                   Used to match collector-specific metrics to power the 'Collector
//                   Health' section of the Fleet Management UI.
loki.source.journal "alloy_logs_unit" {
	matches    = "_SYSTEMD_UNIT=alloy.service"
	forward_to = [loki.write.grafana_cloud_loki.receiver]
	labels     = {"job" = "integrations/alloy", "collector_id" = sys.env("GCLOUD_FM_COLLECTOR_ID")}
}

// Read Alloy logs from syslog with the following additional labels:
//   * job: "integrations/alloy" is compatible with Grafana Cloud's Alloy Health Integrations.
//   * collector_id: The unique collector ID matching the remotecfg id argument value.
//                   Used to match collector-specific metrics to power the 'Collector
//                   Health' section of the Fleet Management UI.
loki.source.journal "alloy_logs_tag" {
	matches    = "SYSLOG_IDENTIFIER=alloy"
	forward_to = [loki.write.grafana_cloud_loki.receiver]
	labels     = {"job" = "integrations/alloy", "collector_id" = sys.env("GCLOUD_FM_COLLECTOR_ID")}
}

}

self_monitoring_logs_linux "default" { }

declare "self_monitoring_metrics" {

// THIS IS A GENERATED REMOTE CONFIGURATION.
//
//   * You can edit the contents and matchers for this configuration without them being overwritten.
//   * If you delete ALL generated configurations, the latest default versions will be recreated.
//   * This configuration requires the following environment variables to be set wherever alloy is running:
//     * GCLOUD_RW_API_KEY: The Grafana Cloud API key with write access to Loki.
//     * GCLOUD_FM_COLLECTOR_ID: A unique collector ID matching the remotecfg id argument value.

// Export Alloy metrics in memory.
prometheus.exporter.self "integrations_alloy_health" { }

// Target Alloy metrics with the following additional labels:
//   * job: "integrations/alloy" is compatible with Grafana Cloud's Alloy Health Integrations.
//   * collector_id: The unique collector ID matching the remotecfg id argument value.
//                   Used to match collector-specific metrics to power the 'Collector
//                   Health' section of the Fleet Management UI.
//   * instance: The hostname of the machine running Alloy.
discovery.relabel "integrations_alloy_health" {
	targets = prometheus.exporter.self.integrations_alloy_health.targets

	rule {
		action       = "replace"
		target_label = "collector_id"
		replacement  = sys.env("GCLOUD_FM_COLLECTOR_ID")
	}

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}

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

// Scrape Alloy metrics and forward them to the remote write component.
prometheus.scrape "integrations_alloy_health" {
	targets = array.concat(
		discovery.relabel.integrations_alloy_health.output,
	)
	forward_to = [prometheus.remote_write.default.receiver]
	job_name   = "integrations/alloy"
}

// Write metrics to your Grafana Cloud Prometheus instance.
prometheus.remote_write "default" {
	endpoint {
		url = "https://prometheus-prod-39-prod-eu-north-0.grafana.net/api/prom/push"

		basic_auth {
			username = "******"
			password = sys.env("GCLOUD_RW_API_KEY")
		}
	}
}

}

self_monitoring_metrics "default" { }
`

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

5 participants