Monitor Windows with Managed Service for Prometheus

更新时间:
复制 MD 格式

This topic describes how to use Managed Service for Prometheus to monitor Windows.

Step 1: Install Windows Exporter (optional)

Note

There are two methods to deploy the Exporter to Collection Windows metrics. If you select the Automatic Installation method, you can skip Step 1.

  • Automatic Installation: The system automatically discovers ECS instances based on your filter policy and installs the Windows Exporter service on them.

  • Self Installation: You must manually install the Windows Exporter service on your ECS instance and open the required port for VPC access before you start the integration.

  1. Download Windows Exporter: Log on to your Windows system as an administrator and download the Windows Exporter package to your Windows ECS instance.

  2. Install Windows Exporter: Double-click the downloaded installer file windows_exporter-1.22.0-amd64.msi, or run the command msiexec /i windows_exporter-1.22.0-amd64.msi.

    • By default, the exporter is installed in the C:\Program Files (x86)\windows_exporter directory.

    • The default listening port is 9182.

    • By default, the following metrics are scraped: cpu, cpu_info, memory, process, tcp, cs, logical_disk, net, os, system, textfile, and time.

    • After installation, the service appears in the Windows Services console.

  3. Verify the exporter: Run the command curl localhost:{listening_port}/metrics or open localhost:{listening_port}/metrics in a browser to check for Prometheus metrics. The exporter is working correctly if metrics are returned.

  4. Modify the configuration file: After modifying the configuration, you can restart the exporter service by running the command sc stop windows_exporter && sc start windows_exporter or using the Windows Services console. For more information, see the official Windows Exporter documentation.

Step 2: Integrate Windows

  1. Log on to the Managed Service for Prometheus console. In the navigation pane on the left, click Integration Center, then find and click the Windows integration.

    image

  2. Configure the access environment: On the Start Integration tab in the Windows panel, complete the integration and then click OK.

    image

    Parameter

    Note

    Select the environment type.

    The integration environment.

    • ECS (VPC)

    Windows Exporter installation mode

    Installation modes:

    • Automatic Installation

    • Self Installation

    Instance service discovery mode

    Service discovery modes:

    • Unconditional (Select all Windows instances in the current VPC)

    • Stain label selection

    • Tag label selection

    • IP CIDR

    • Instance ID

    Collect textfile

    Enter the absolute path to the textfile collector directory. Environment variables are not supported. Example: C:\ProgramData\prometheus\textfile_collector.

    Windows Exporter service port

    The exporter service port. The default port is automatically populated.

    Automatically configure security groups

    If you enable this option, the system verifies the security group rules of the target ECS instance. If verification fails, the system adds the necessary rules to ensure the integration succeeds.

    Custom ECS tag injection

    Specify the ECS tag keys. The system automatically injects the tag key-value pairs into the Prometheus metrics.

    Metric scrape interval (seconds)

    The interval at which Managed Service for Prometheus scrapes metrics. Default: 15 seconds.

Step 3: View Windows dashboards

  1. Select the target environment: Log on to the Cloud Monitor console. In the left-side navigation pane, click Integration Management. On the Integration Management page, on the Integrated Environments tab, click the name of the target environment to go to its details page.

    image

  2. On the Component Management tab, in the Addon Type section, click Windows and then click Dashboards to list the available dashboards.

    image

  3. Click a dashboard name to open its Grafana dashboard.

    image

Step 4: Configure Windows monitoring alerts

To create a Prometheus alert rule, see Create a Prometheus alert rule.