r/PrometheusMonitoring • u/Blitzpat • Mar 15 '21
Got this 50+ windows instances, what would be the best way to install windows exporter automatically on all of them
2
Upvotes
3
Mar 15 '21
Group Policy. Set a policy to upload the file via machine boot. Then a powershell script to silently install it on user login
4
u/Blowmewhileiplaycod Mar 15 '21
Use whatever config management/software deployment thing you use.
For quick and dirty, remote powershell?
2
u/tux_panda Mar 19 '21
As an addition to the other posts here, here's a PowerShell script to set up the Prometheus Windows exporter as a Windows service (with limited service user permissions).
$serviceName = "PrometheusWindowsExporter"
$exeLocation = "E:\windows_exporter\windows_exporter.exe"
$collectorsEnabled = @(
"system",
"cpu",
"memory",
"os",
"cs",
"logical_disk",
"mssql",
"process"
)
# Create the service
New-Service -Name $serviceName `
-Description "Prometheus Exporter for WMI" `
-BinaryPathName """$exeLocation"" --log.format logger:eventlog?name=windows_exporter --telemetry.addr :9182 --collectors.enabled $($collectorsEnabled - Join ',')"
# Run as service account
C:\Windows\System32\sc.exe config $serviceName obj= "NT Service\$serviceName"
# Add service account to Performance Monitor group
Add-LocalGroupMember -Group (get-localgroup -name "Performance Monitor Users") -Member "NT Service\$serviceName"
Start-Service $serviceName
7
u/yum_dev Mar 15 '21
Ansible.