Installing ServiceWatch Agent
Users can install the ServiceWatch Agent on a Virtual Server to collect custom metrics and logs.
ServiceWatch Agent
The agents required to collect custom metrics and logs for ServiceWatch on a Virtual Server can be broadly divided into two types: Prometheus Exporter and Open Telemetry Collector.
| Category | Description | |
|---|---|---|
| Prometheus Exporter | Provides metrics of a specific application or service in a format that Prometheus can scrape.
| |
| Open Telemetry Collector | Acts as a centralized collector that gathers telemetry data such as metrics and logs from distributed systems, processes them (filtering, sampling, etc.), and exports them to multiple backends (e.g., Prometheus, Jaeger, Elasticsearch).
|
Prerequisites for Using ServiceWatch Agent
To use the ServiceWatch Agent, please refer to Prerequisite environment configuration for ServiceWatch Agent and prepare the necessary settings.
Installing Prometheus Exporter for Virtual Server (Linux)
Install the Prometheus Exporter on a Linux server following the steps below.
Installing Node Exporter
Install Node Exporter according to the steps below.
Create Node Exporter User
Create a dedicated user to securely isolate the Node Exporter process.
sudo useradd --no-create-home --shell /bin/false node_exportersudo useradd --no-create-home --shell /bin/false node_exporterNode Exporter Configuration
Download Node Exporter for installation. The guide uses the following version:
- Download path: /tmp
- Version: 1.7.0Color mode
cd /tmp wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gzcd /tmp wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gzCode block. Node Exporter download command NoteThe latest Node Exporter version can be found at Node Exporter > Releases > Latest, and specific versions are available at Node Exporter > Releases.
Install the downloaded Node Exporter and set permissions on the executable.
Color modecd /tmp sudo tar -xvf node_exporter-1.7.0.linux-amd64.tar.gz -C /usr/local/bin --strip-components=1 node_exporter-1.7.0.linux-amd64/node_exportercd /tmp sudo tar -xvf node_exporter-1.7.0.linux-amd64.tar.gz -C /usr/local/bin --strip-components=1 node_exporter-1.7.0.linux-amd64/node_exporterCode block. Node Exporter installation command Color modesudo chown node_exporter:node_exporter /usr/local/bin/node_exportersudo chown node_exporter:node_exporter /usr/local/bin/node_exporterCode block. Node Exporter permission setting command Create a service file. Configure Node Exporter to collect memory (meminfo) or block storage (filesystem) metrics.
Color modesudo vi /etc/systemd/system/node_exporter.servicesudo vi /etc/systemd/system/node_exporter.serviceCode block. Open Node Exporter service file Color mode[Unit] Description=Prometheus Node Exporter (meminfo only) Wants=network-online.target After=network-online.target [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=/usr/local/bin/node_exporter \ --collector.disable-defaults \ # Disable default collectors --collector.meminfo \ # Enable memory metrics --collector.filesystem # Enable block storage filesystem metrics Restart=on-failure [Install] WantedBy=multi-user.target[Unit] Description=Prometheus Node Exporter (meminfo only) Wants=network-online.target After=network-online.target [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=/usr/local/bin/node_exporter \ --collector.disable-defaults \ # Disable default collectors --collector.meminfo \ # Enable memory metrics --collector.filesystem # Enable block storage filesystem metrics Restart=on-failure [Install] WantedBy=multi-user.targetCode block. Node Exporter service file content NoteCollectors can be enabled or disabled using flags.
<code>--collector.{name}</code>: Enables a specific metric collector.<code>--no-collector.{name}</code>: Disables a specific metric collector.- To disable all default metrics and enable only specific collectors, use
<code>--collector.disable-defaults --collector.{name} ...</code>.
Below is a description of the main collectors.
Collector Description Labels meminfo Provides memory statistics - filesystem Provides filesystem statistics such as used disk space device: Physical or virtual device path where the filesystem is located (e.g.,/dev/sda1)
fstype: Filesystem type (e.g.,ext4,xfs,nfs,tmpfs)
mountpoint: Path where the filesystem is mounted on the host OS; serves as an intuitive way to distinguish disks (e.g.,/,/var/lib/docker,/mnt/data)
Table. Description of main Node Exporter collectors- For detailed information on available metrics and configuration, see the Node Exporter > Collector page.
- Available metrics may vary depending on the version of Node Exporter you use. See the Node Exporter repository.
- Enable and start the service.
Register the Node Exporter service and verify the registered service and configured metrics.Color mode
sudo systemctl daemon-reload sudo systemctl enable --now node_exportersudo systemctl daemon-reload sudo systemctl enable --now node_exporterCode block. Enable and start Node Exporter service Color modesudo systemctl status node_exportersudo systemctl status node_exporterCode block. Check Node Exporter service status Color modecurl http://localhost:9100/metrics | grep node_memorycurl http://localhost:9100/metrics | grep node_memoryCode block. Verify Node Exporter metrics
See ServiceWatch > Using ServiceWatch Agent for details.
Installing Prometheus Exporter for Virtual Server (Windows)
Install the Prometheus Exporter on a Windows server following the steps below.
Installing Windows Exporter
Install the Windows Exporter according to the steps below.
Windows Exporter Configuration
Download the Windows Exporter installation file.
- Download path: C:\Temp
- Test version: 0.31.3Color mode
$ mkdir /Temp $ Invoke-WebRequest -Uri "https://github.com/prometheus-community/windows_exporter/releases/download/v0.31.3/windows_exporter-0.31.3-amd64.exe" -OutFile "C:\Temp\windows_exporter-0.31.3-amd64.exe"$ mkdir /Temp $ Invoke-WebRequest -Uri "https://github.com/prometheus-community/windows_exporter/releases/download/v0.31.3/windows_exporter-0.31.3-amd64.exe" -OutFile "C:\Temp\windows_exporter-0.31.3-amd64.exe"Code block. Windows Exporter download NoteWindows Exporter versions and installation files can be found at Windows Exporter > Releases.
Test the Windows Exporter execution. By default, Windows Exporter enables all collectors, but to collect only desired metrics, enable the following collectors:
- Memory metrics: memory
- Block storage metrics: logical_disk
- Host name: osColor mode
$ cd C:\Temp $ .\windows_exporter-0.31.3-amd64.exe --collectors.enabled memory,logical_disk,os$ cd C:\Temp $ .\windows_exporter-0.31.3-amd64.exe --collectors.enabled memory,logical_disk,osCode block. Test Windows Exporter execution
Collectors can be enabled using flags.
<code>--collectors.enabled "[defaults]"</code>: Enables the default provided metrics.<code>--collector.enabled {name},{name},{name}...</code>: Enables specific metrics.
Below is a description of the main collectors.
| Collector | Description | Labels |
|---|---|---|
| memory | Provides memory statistics | |
| logical_disk | Collects performance and status metrics of local logical disks (e.g., C:, D: drives) |
|
- For detailed information on available metrics and configuration, see the Windows Exporter > Collector page.
- Available metrics may vary depending on the version of Windows Exporter you use. See the Windows Exporter repository.
Register the service and verify.
Color mode$ sc.exe create windows_exporter binPath= "C:\Temp\windows_exporter-0.31.3-amd64.exe --collectors.enabled memory,logical_disk,os" DisplayName= "Prometheus Windows Exporter" start= auto $ Start-Service windows_exporter$ sc.exe create windows_exporter binPath= "C:\Temp\windows_exporter-0.31.3-amd64.exe --collectors.enabled memory,logical_disk,os" DisplayName= "Prometheus Windows Exporter" start= auto $ Start-Service windows_exporterCode block. Register Windows Exporter service Color mode# Verify service $ Get-Service windows_exporter # Verify metrics $ Invoke-WebRequest -Uri "http://localhost:9182/metrics" | Select-String memory# Verify service $ Get-Service windows_exporter # Verify metrics $ Invoke-WebRequest -Uri "http://localhost:9182/metrics" | Select-String memoryCode block. Verify Windows Exporter service Set configuration file.
- Use the
--config.fileoption to specify a YAML configuration file.Color mode$ .\windows_exporter.exe --config.file=config.yml $ .\windows_exporter.exe --config.file="C:\Program Files\windows_exporter\config.yml" # When using an absolute path, wrap it in quotes$ .\windows_exporter.exe --config.file=config.yml $ .\windows_exporter.exe --config.file="C:\Program Files\windows_exporter\config.yml" # When using an absolute path, wrap it in quotesCode block. Run Windows Exporter with config file Color modecollectors: enabled: cpu,net,service collector: service: include: windows_exporter log: level: warncollectors: enabled: cpu,net,service collector: service: include: windows_exporter log: level: warnCode block. Sample Windows Exporter config
- Use the
- Refer to the official example config file at Windows Exporter > Example config file.
$ sc.exe create windows_exporter binPath= "C:\Temp\windows_exporter-0.31.3-amd64.exe --config.file=C:\Temp\config.yml" DisplayName= "Prometheus Windows Exporter" start= auto
$ Start-Service windows_exporter$ sc.exe create windows_exporter binPath= "C:\Temp\windows_exporter-0.31.3-amd64.exe --config.file=C:\Temp\config.yml" DisplayName= "Prometheus Windows Exporter" start= auto
$ Start-Service windows_exporterSee ServiceWatch > Using ServiceWatch Agent for details.
Node Exporter Metrics
Main Node Exporter metrics
The following are the collector and metric information available through Node Exporter. Collectors can be enabled, and specific metrics can be activated.
| Category | Collector | Metric | Description |
|---|---|---|---|
| Memory | meminfo | node_memory_MemTotal_bytes | Total memory |
| Memory | meminfo | node_memory_MemAvailable_bytes | Available memory (used for determining memory shortage) |
| Memory | meminfo | node_memory_MemFree_bytes | Free memory |
| Memory | meminfo | node_memory_Buffers_bytes | IO buffers |
| Memory | meminfo | node_memory_Cached_bytes | Page cache |
| Memory | meminfo | node_memory_SwapTotal_bytes | Total swap |
| Memory | meminfo | node_memory_SwapFree_bytes | Remaining swap |
| Filesystem | filesystem | node_filesystem_size_bytes | Total filesystem size |
| Filesystem | filesystem | node_filesystem_free_bytes | Total free space |
| Filesystem | filesystem | node_filesystem_avail_bytes | Space actually available to unprivileged users |
Node Exporter collector and metric collection settings
Node Exporter enables most collectors by default, but you can enable or disable specific collectors as needed.
Enable specific collectors only
- When you want to use only memory and filesystem collectors:Color mode
./node_exporter \ --collector.meminfo # Enable memory collector --collector.filesystem # Enable filesystem collector./node_exporter \ --collector.meminfo # Enable memory collector --collector.filesystem # Enable filesystem collectorCode block. Enable specific Node Exporter collectors - When you want to disable all default collectors and use only memory and filesystem collectors:Color mode
./node_exporter \ --collector.disable-defaults # Disable default metrics --collector.meminfo # Enable memory collector --collector.filesystem # Enable filesystem collector./node_exporter \ --collector.disable-defaults # Disable default metrics --collector.meminfo # Enable memory collector --collector.filesystem # Enable filesystem collectorCode block. Enable specific Node Exporter collectors (disable defaults) - Enable filesystem collector for specific mount points:Color mode
./node_exporter \ --collector.disable-defaults \ --collector.filesystem.mount-points-include="/|/data" # Enable filesystem collector for / (root) and /data mount points./node_exporter \ --collector.disable-defaults \ --collector.filesystem.mount-points-include="/|/data" # Enable filesystem collector for / (root) and /data mount pointsCode block. Enable filesystem collector for specific mount points - Enable filesystem collector excluding specific mount points:Color mode
./node_exporter \ --collector.disable-defaults \ --collector.filesystem.mount-points-exclude="/boot|/var/log" # Exclude /boot and /var/log mount points./node_exporter \ --collector.disable-defaults \ --collector.filesystem.mount-points-exclude="/boot|/var/log" # Exclude /boot and /var/log mount pointsCode block. Exclude specific mount points from filesystem collector
Disable specific collectors (no-collector)
When you do not want to use the filesystem collector:
./node_exporter --no-collector.filesystem./node_exporter --no-collector.filesystemConfigure collector as a systemd service (recommended)
[Unit]
Description=Node Exporter
After=network-online.target
[Service]
User=nodeexp
ExecStart=/usr/local/bin/node_exporter \
--collector.disable-defaults # Disable all default metric collectors
--collector.meminfo
--collector.filesystem
[Install]
WantedBy=multi-user.target[Unit]
Description=Node Exporter
After=network-online.target
[Service]
User=nodeexp
ExecStart=/usr/local/bin/node_exporter \
--collector.disable-defaults # Disable all default metric collectors
--collector.meminfo
--collector.filesystem
[Install]
WantedBy=multi-user.targetFilter specific metrics
Using the Open Telemetry Collector configuration, you can select only the required metrics collected by Node Exporter.
For guidance on pre‑configuring the Open Telemetry Collector for ServiceWatch, see Prerequisite Open Telemetry Collector configuration for ServiceWatch.
Windows Exporter Metrics
Main Windows Exporter metrics
The following are the collector and metric information available through Windows Exporter. Collectors can be enabled, and specific metrics can be activated.
| Category | Collector | Metric | Description |
|---|---|---|---|
| Memory | memory | windows_memory_available_bytes | Available memory |
| Memory | memory | windows_memory_cache_bytes | Cached memory |
| Memory | memory | windows_memory_committed_bytes | Committed memory |
| Memory | memory | windows_memory_commit_limit | Commit limit |
| Memory | memory | windows_memory_pool_paged_bytes | Paged pool |
| Memory | memory | windows_memory_pool_nonpaged_bytes | Non‑paged pool |
| Disk | logical_disk | windows_logical_disk_free_bytes | Free space |
| Disk | logical_disk | windows_logical_disk_size_bytes | Total capacity |
| Disk | logical_disk | windows_logical_disk_read_bytes_total | Total read bytes |
| Disk | logical_disk | windows_logical_disk_write_bytes_total | Total written bytes |
| Disk | logical_disk | windows_logical_disk_read_seconds_total | Read latency |
| Disk | logical_disk | windows_logical_disk_write_seconds_total | Write latency |
| Disk | logical_disk | windows_logical_disk_idle_seconds_total | Idle time |
Windows Exporter collector and metric collection settings
Windows Exporter enables most collectors by default, but you can configure only the desired collectors.
Enable specific collectors only
If you want to use only CPU, memory, and logical disk collectors:
# The --collector.enabled option disables defaults and enables only the listed collectors
.\windows_exporter.exe --collectors.enabled="memory,logical_disk"# The --collector.enabled option disables defaults and enables only the listed collectors
.\windows_exporter.exe --collectors.enabled="memory,logical_disk"--collector.enabled will collect only the collectors specified in the option.Configure collector as a service (recommended)
# Register windows_exporter as a service
sc.exe create windows_exporter binPath= "C:\Temp\windows_exporter-0.31.3-amd64.exe --config.file=C:\Temp\config.yml" DisplayName= "Prometheus Windows Exporter" start= auto
# Start the service
Start-Service windows_exporter# Register windows_exporter as a service
sc.exe create windows_exporter binPath= "C:\Temp\windows_exporter-0.31.3-amd64.exe --config.file=C:\Temp\config.yml" DisplayName= "Prometheus Windows Exporter" start= auto
# Start the service
Start-Service windows_exporter# Note this is not an exhaustive list of all configuration values
collectors:
enabled: logical_disk,memory # Set collectors to enable
collector:
service:
include: "windows_exporter"
scheduled_task:
include: /Microsoft/.+
log:
level: debug
scrape:
timeout-margin: 0.5
telemetry:
path: /metrics
web:
listen-address: ":9182"# Note this is not an exhaustive list of all configuration values
collectors:
enabled: logical_disk,memory # Set collectors to enable
collector:
service:
include: "windows_exporter"
scheduled_task:
include: /Microsoft/.+
log:
level: debug
scrape:
timeout-margin: 0.5
telemetry:
path: /metrics
web:
listen-address: ":9182"Filter specific metrics
Using the Open Telemetry Collector configuration, you can select only the required metrics collected by Windows Exporter.
For guidance on pre‑configuring the Open Telemetry Collector for ServiceWatch, see Prerequisite Open Telemetry Collector configuration for ServiceWatch.