Skip to content

Windows Remote


The Windows Remote Collector gathers various Windows basic metrics and objects remotely via WMI or SNMP, and uploads the data to help monitor and analyze Windows system anomalies.

Configuration

Prerequisites

  • The collector server requires Windows Server 2016 or Windows 10 or later
  • The monitored server does not need DataKit installed.
  • Enable SNMP on the monitored server for SNMP collection; only SNMP v2c is supported.

Enabling Windows SNMP Service

Run these PowerShell commands as Administrator on the monitored Windows Server:

# Install service
Install-WindowsFeature -Name 'SNMP-Service'

# Configure community string
$regPath = "HKLM:\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities"
New-ItemProperty -Path $regPath -Name "datakit" -PropertyType DWord -Value 4 -Force

# Configure allowed hosts
$allowedHostsPath = "HKLM:\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers"
New-ItemProperty -Path $allowedHostsPath -Name "1" -PropertyType String -Value "192.0.2.20" -Force

# Configure firewall
netsh advfirewall firewall add rule name="datakit-snmp" dir=in action=allow protocol=UDP localport=161

# Restart service
Restart-Service SNMP

Key Notes:

  1. Must be executed in PowerShell with Administrator privileges
  2. Community string must match inputs.windows_remote.snmp.community in the collector's configuration file. Recommended value: datakit
  3. Replace 192.0.2.20 with the collector server's IP address or hostname. Add separate entries named 1, 2, etc. for multiple collectors; CIDR ranges are not supported here.
  4. Firewall rule: Opens UDP port 161 (standard SNMP port). Rule name datakit-snmp can be customized
  5. Restart service to apply configurations

Use the following PowerShell commands to validate configurations:

# Check service status (ensure status is "Running")
Get-Service -Name SNMP

# View firewall rules
netsh advfirewall firewall show rule name="datakit-snmp"

# Optional: Verify connectivity using SNMP client tools
snmpwalk -v 2c -c datakit '192.0.2.10' .1.3.6.1.2.1.1.1.0

In conf.d/windows_remote/windows_remote.conf, set mode = "snmp" and use the same community value as above.

Collector Configuration

Go to the conf.d/samples directory under the DataKit installation directory, copy windows_remote.conf.sample to conf.d/windows_remote/windows_remote.conf. Examples are as follows:

[[inputs.windows_remote]]
  ## Network discovery configuration
  ip_list       = [ ]  # e.g. ["192.0.2.10"]
  cidrs         = [ ]  # e.g. ["10.100.1.0/24"]
  scan_interval = "10m"

  ## Set to 'true' to enable election.
  election = true
  ## Maximum number of workers. Default value is calculated as datakit.AvailableCPUs * 2 + 1.
  worker_num = 0

  ## Select mode 'wmi' or 'snmp'
  mode = "wmi"

  ## WMI Collection Module
  [inputs.windows_remote.wmi]
    port   = 135  # Port for WMI (DCOM 135)
    log_enable = true
    ## Authentication configuration
    [inputs.windows_remote.wmi.auth]
      ## Local account on the target: 'TARGET-HOST\user'; domain account: 'DOMAIN\user'.
      ## Use TOML single quotes to preserve backslashes; double quotes require escaping.
      ## These remote credentials are independent of the DataKit service account.
      username  = 'TARGET-HOST\user'
      password  = "password"

  ## SNMP Collection Module (Independent configuration)
  [inputs.windows_remote.snmp]
    ports     = [ 161 ]  # SNMP ports (default 161)
    community = "datakit"

  [inputs.windows_remote.tags]
  # "some_key" = "some_value"

After configuration, restart DataKit.

WMI Collection Guide

1 Prerequisites

Ensure the following services are running:

  1. Service name for Windows Management Instrumentation (WMI): winmgmt
  2. Service name for Remote Procedure Call (RPC): RpcSs
  3. Use 64-bit Windows PowerShell 5.1 for the scripts below (not PowerShell 7).
  4. The monitored server must provide the required WMI classes and remote permissions. Configure older Windows versions manually with their supported administration tools.
  5. The server running the current DataKit version requires Windows Server 2016 or Windows 10 or later.

2 Firewall Configuration

On the monitored server, run PowerShell as Administrator and configure these inbound firewall rules. If existing rules already allow access from the collector server, you do not need to add them again.

# Allow WMI DCOM communication
New-NetFirewallRule -DisplayName "WMI_DCOM" -Direction Inbound -Protocol TCP -LocalPort 135 -Action Allow -Program "%SystemRoot%\system32\svchost.exe" -Service rpcss

# Allow WMI service communication (dynamic ports)
New-NetFirewallRule -DisplayName "WMI_Service" -Direction Inbound -Protocol TCP -LocalPort Any -Action Allow -Program "%SystemRoot%\system32\svchost.exe" -Service winmgmt

# Allow WMI Unsecured Application communication
New-NetFirewallRule -DisplayName "WMI_UnsecApp" -Direction Inbound -Action Allow -Program "%SystemRoot%\system32\wbem\unsecapp.exe"

3 User Permission Setup

On the monitored server, run the following PowerShell script as Administrator to create a remote access account and grant access to the WMI namespaces. Enter the password when prompted. If an existing account already has the required WMI/DCOM permissions, reuse that account and skip account creation.

This account is used in the collector's inputs.windows_remote.wmi.auth configuration and can differ from the account running the DataKit service on the collector server. When using explicit remote credentials, you do not need to create an account with the same name on the collector server.

This script grants the new account membership in groups including Administrators. It stops if an account with the same name exists, without deleting it or resetting its password. Configure existing accounts as needed.

<#
Namespace permission configuration adapted from:
https://github.com/grbray/PowerShell/blob/main/Windows/Set-WMINameSpaceSecurity.ps1
#>
$ErrorActionPreference = 'Stop'
$UserName = 'datakit'
$password = Read-Host 'Password for the new remote WMI account' -AsSecureString
$namespace = 'root/cimv2'

if (Get-LocalUser -Name $UserName -ErrorAction SilentlyContinue) {
    throw "Account '$UserName' already exists. Configure its permissions separately."
}
$localUser = New-LocalUser -Name $UserName -Password $password -Description 'DataKit remote WMI account'

# Resolve built-in groups by SID so localized Windows installations work.
foreach ($sid in 'S-1-5-32-544', 'S-1-5-32-562', 'S-1-5-32-558', 'S-1-5-32-573') {
    $group = Get-LocalGroup -SID $sid
    Add-LocalGroupMember -Group $group -Member $localUser
}

$invokeParams = @{Namespace=$namespace; Path='__systemsecurity=@'}
$output = Invoke-WmiMethod @invokeParams -Name GetSecurityDescriptor
if ($output.ReturnValue -ne 0) {
    throw "GetSecurityDescriptor failed: $($output.ReturnValue)"
}
$acl = $output.Descriptor
$trustee = (New-Object System.Management.ManagementClass('Win32_Trustee')).CreateInstance()
$trustee.SidString = $localUser.SID.Value
$ace = (New-Object System.Management.ManagementClass('Win32_Ace')).CreateInstance()
$ace.AccessMask = 0x23  # Enable, MethodExecute, RemoteAccess
$ace.AceFlags = 0
$ace.AceType = 0  # Allow
$ace.Trustee = $trustee
$acl.DACL += $ace.psobject.immediateBaseObject
$output = Invoke-WmiMethod @invokeParams -Name SetSecurityDescriptor -ArgumentList $acl.psobject.immediateBaseObject
if ($output.ReturnValue -ne 0) {
    throw "SetSecurityDescriptor failed: $($output.ReturnValue)"
}

4 Connectivity Verification

On the collector server, run these commands in Windows PowerShell using the account intended for the collector. Replace TARGET-HOST with the monitored server's Windows computer name and <TargetIP> with its IP address. For a domain account, use DOMAIN\datakit. Get-WmiObject is not available in PowerShell 7.

$credential = Get-Credential -UserName 'TARGET-HOST\datakit' -Message 'Enter the remote WMI account password'
Get-WmiObject -ComputerName '<TargetIP>' -Namespace 'root\cimv2' -Class Win32_OperatingSystem -Credential $credential |
    Select-Object CSName, Caption

Expected result: the monitored server's computer name (CSName) and operating system name (Caption). If the connection fails, check network access, firewall rules, the account's host or domain, and WMI/DCOM permissions first.

At this point, the machine being collected has been configured.


DataKit Deployment

1. Prepare Remote Credentials

Use the account configured and verified on the monitored server above for inputs.windows_remote.wmi.auth. Specify the account as follows:

  • Local account on the target host: TARGET-HOST\datakit, where TARGET-HOST is the monitored server's Windows computer name.
  • Domain account: DOMAIN\datakit, with permission to access WMI on the target host remotely.

In a workgroup, an unqualified name such as datakit may fail authentication because its host is ambiguous. Specify the target host explicitly. In TOML, single quotes preserve backslashes, for example username = 'TARGET-HOST\datakit'. With double quotes, escape the backslash: username = "TARGET-HOST\\datakit".


2. Installation and Configuration

Objective: Complete DataKit installation and configure WMI collection mode.

  1. Install via Official Script
    After executing the installation command, DataKit will be deployed by default to:
    C:\Program Files\datakit

  2. Modify Collector Configuration
    Copy conf.d/samples/windows_remote.conf.sample to the following configuration file, creating the destination directory if necessary:

C:\Program Files\datakit\conf.d\windows_remote\windows_remote.conf

Set the target IP, WMI mode, and remote credentials, for example:

[[inputs.windows_remote]]
  ip_list = ["192.0.2.10"]
  mode = "wmi"
  [inputs.windows_remote.wmi]
    port = 135
    log_enable = true
  [inputs.windows_remote.wmi.auth]
    username = 'TARGET-HOST\datakit'
    password = '<REMOTE_ACCOUNT_PASSWORD>'

Replace the example IP, target computer name, and password with your values. Save the file and restart DataKit. If a configuration already exists, update its fields instead of adding a duplicate collector.


3. Optional Service Account

The DataKit service account and the remote WMI authentication account are separate settings. With valid target WMI credentials, network access, firewall rules, and target account permissions, the DataKit service can continue running as LocalSystem. Changing to a dedicated service account is optional.

Follow this section only if you need a dedicated service account. It must exist on the collector server or in its domain, have the "Log on as a service" right on the collector server, and have access to the DataKit installation directory, configuration, and files needed at runtime. Here, .\datakit refers to a local account on the collector server.

Configure the account through Services Manager:

  1. Open Services Manager (services.msc)
  2. Find the DataKit service → Right-click Properties
  3. Go to Log On tab → Select This account • Account format: .\datakit (local) or Domain\User
  4. Enter the password and confirm

Restart the DataKit service and confirm that it starts successfully. For a logon failure, check the password, account status, and "Log on as a service" right. Ask the administrator to update rights managed by domain policy.

Verify Deployment Results

  1. Check Service Status
Get-Service datakit

Confirm that the service status is Running.

  1. View Collected Metrics
datakit monitor

The output should include WMI-related metrics (e.g., data from the windows_remote collector).

  1. Troubleshoot with Logs

Inspect the log files at: C:\Program Files\datakit\log

WMI Collection Notes

  • Metrics and event logs are collected every minute; host and process objects every 5 minutes. scan_interval controls discovery frequency, and worker_num controls collection concurrency.
  • cidrs supports IPv4, including /31 and /32. Both expanded CIDR addresses and the combined target list are limited to 65536. WMI requires TCP 135 and the target's dynamic RPC ports; wmi.port must be 135.
  • Connections or queries request cancellation after 30 seconds and reconnect in a later cycle; actual completion depends on Windows RPC. Each query is limited to 4096 rows, with automatic batching for logs. Exceeding the process-object limit reports an error without preventing host metrics.
  • Event logs initially look back 1 minute, including after a restart. Failed feeds are retried and can produce duplicates. Progress is not persisted; recovery of downtime logs, overwritten events, or delayed writes is not guaranteed.

Collected Data

Measurement Type Content
cpu, mem, disk, diskio, net Metric CPU, memory, local disks, disk I/O and network; disk I/O is a host-wide total
HOST Object Host information and resource usage
host_processes Object Processes, memory, CPU and cumulative I/O
log_event Logging Windows events, including message, status, service and event_code

Field Semantics

Some historical field values have been corrected. Update dashboards and alerts that relied on the previous values. The misleading open_files field has been replaced with the handle count, handles.

Measurement and fields Meaning / unit
disk.used_percent; HOST.cpu_usage, mem_used_percent, disk_used_percent Percentage: 80 means 80%, instead of 0.8
diskio.read_bytes/sec, write_bytes/sec; HOST.diskio_read_bytes_per_sec, diskio_write_bytes_per_sec Read/write rates, bytes per second
diskio.read_bytes, write_bytes; reads, writes Cumulative bytes; cumulative operation counts
diskio.read_time, write_time, io_time Cumulative time, milliseconds
host_processes.proc_syscr, proc_syscw; proc_read_bytes, proc_write_bytes Cumulative read/write operation counts; cumulative bytes
host_processes.rss, vms Working Set and virtual memory, bytes
host_processes.cpu_usage, cpu_usage_top Lifetime-average and current sampled CPU percentages; multicore processes can exceed 100%
host_processes.start_time, started_duration Start time (Unix milliseconds) and elapsed time (seconds)
host_processes.handles Handle count

If the process creation time is unavailable, cpu_usage, start_time and started_duration are omitted.

Feedback

Is this page helpful?