Install ServiceWatch Agent
Users can install the ServiceWatch Agent on a Virtual Server to collect custom metrics and logs.
ServiceWatch Agent
There are two main types of agents that need to be installed on a Virtual Server to collect custom metrics and logs for ServiceWatch. It is a Prometheus Exporter and Open Telemetry Collector.
| Category | Detailed description | |
|---|---|---|
| Prometheus Exporter | Provide 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 (filtering, sampling, etc.) it, and exports it to multiple backends (e.g., Prometheus, Jaeger, Elasticsearch, etc.)
|
Pre-configuration for Using ServiceWatch Agent
To use the ServiceWatch Agent, please refer to Prerequisite Settings for ServiceWatch Agent and prepare the prerequisite settings.
Installation of Prometheus Exporter for Virtual Server (for Linux)
Install the Prometheus Exporter on a Linux server according to the steps below.
Node Exporter installation
Install Node Exporter according to the steps below.
Node Exporter User creation
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 for installing Node Exporter.
This guide provides the version below.
- Download path: /tmp
- Installed 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
Install the downloaded Node Exporter and grant permission to the executable file.
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 configuration command Create service file Configure Node Exporter to collect memory metrics (meminfo) or block storage metrics (filesystem).
Color modesudo vi /etc/systemd/system/node_exporter.servicesudo vi /etc/systemd/system/node_exporter.serviceCode block. Command to open the 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 metrics --collector.meminfo \ # Enable memory metrics --collector.filesystem # Block Storage enable 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 metrics --collector.meminfo \ # Enable memory metrics --collector.filesystem # Block Storage enable filesystem metrics Restart=on-failure [Install] WantedBy=multi-user.targetcode block. Result of opening Node Exporter service file
The collector can be enabled or disabled using a flag.
–collector.{name}: Used to enable a specific metric.–no-collector.{name}: You can disable a specific metric.- To disable all default metrics and enable only specific collectors, you can use
–collector.disable-defaults –collector.{name} ….
Below is a description of the main collector.
| Collector | Explanation | Label |
|---|---|---|
| meminfo | Provide memory statistics | - |
| filesystem | Provide file system statistics such as used disk space |
|
- In the Node Exporter Metrics, you can view the main metrics provided by Node Exporter and how to configure the Node Exporter Collector.
- Detailed information about the collectable metrics and how to configure them can be found in Node Exporter > Collector.
- The metrics available may vary depending on the version of the Node Exporter you are using. * Please refer to Node Exporter.
- Service activation and start
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. Node Exporter service activation and start command Color modesudo systemctl status node_exportersudo systemctl status node_exporterCode block. Node Exporter service check command Color modecurl http://localhost:9100/metrics | grep node_memorycurl http://localhost:9100/metrics | grep node_memoryCode block. Command to view Node Exporter metric information
For more details, refer to ServiceWatch > ServiceWatch Agent Usage.
Installing Prometheus Exporter for Virtual Server (for Windows)
To use the Prometheus Exporter on a Windows server, install it following the steps below.
Windows Exporter installation
Install the Windows Exporter according to the steps below.
Windows Exporter configuration
- Download the installation file to install the Windows Exporter.
- 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
- Windows Exporter execution test
Windows Exporter enables all collectors by default, but to collect only the desired metrics, you need to enable the following collectors. The following is an example that activates a collector specified by the user.- Memory metric: memory
- Block storage metric: local_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. Windows Exporter execution test
The collector can be enabled using a flag.
–collectors.enabled “[defaults]"Metrics provided by default–collector.enabled {name},{name},{name}…: Used to enable a specific metric.
Below is a description of the main collectors.
| Collector | Explanation | Label |
|---|---|---|
| memory | Provide memory statistics | |
| logical_disk | Collect performance and health metrics of logical disks (e.g., C:, D: drives) on the local system. |
|
- In the Windows Exporter Metrics, you can see the main metrics provided by Windows Exporter and how to configure the Windows Exporter Collector.
Detailed information about the collectable metrics and how to configure them can be found in Windows Exporter > Collector.
The metrics that can be provided may vary depending on the version of the Windows Exporter you are using. * Please refer to Windows Exporter.
Service registration and verification Register the Windows Exporter service and verify the configured metrics.
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# Service verification $ Get-Service windows_exporter # Check metrics $ Invoke-WebRequest -Uri "http://localhost:9182/metrics" | Select-String memory# Service verification $ Get-Service windows_exporter # Check metrics $ Invoke-WebRequest -Uri "http://localhost:9182/metrics" | Select-String memoryCode block. Check Windows Exporter service Configuration file settings
- You can configure it to use a YAML configuration file by using the
–config.fileoption.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, the path must be enclosed 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, the path must be enclosed in quotes.Code block. Windows Exporter configuration file settings 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 configuration file - Please refer to Windows Exporter > Official Configuration File Example.Refer to the following to register a service using a configuration file.Color mode
--- #Note this is not an exhaustive list of all configuration values collectors: enabled: cpu,logical_disk,net,os,service,system 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: cpu,logical_disk,net,os,service,system collector: service: include: windows_exporter scheduled_task: include: /Microsoft/.+ log: level: debug scrape: timeout-margin: 0.5 telemetry: path: /metrics web: listen-address: :9182Code block. Example of Windows Exporter configuration file Color mode$ 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_exporterCode block. Service registration using Windows Exporter configuration file
- You can configure it to use a YAML configuration file by using the
For more details, refer to ServiceWatch > ServiceWatch Agent Using.
#Node Exporter metrics
Below is the collector and metric information that can be viewed through Node Exporter. You can configure it as a Collector, or enable only specific metrics.
| Category | Collector | Metric | Description |
|---|---|---|---|
| Memory | meminfo | node_memory_MemTotal_bytes | Total memory |
| Memory | meminfo | node_memory_MemAvailable_bytes | Available memory (used to determine if memory is insufficient) |
| Memory | meminfo | node_memory_MemFree_bytes | Free memory (unused memory) |
| Memory | meminfo | node_memory_Buffers_bytes | IO buffer |
| 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 file system size |
| Filesystem | filesystem | node_filesystem_free_bytes | total free space(total free space) |
| Filesystem | filesystem | node_filesystem_avail_bytes | Space actually usable by the user (available space for unprivileged users) |
Node Exporter enables most collectors by default, but you can enable or disable only the collectors you want.
- 메모리, 파일 시스템 Collector만 사용하고 싶을 때:Color mode
./node_exporter --collector.meminfo --collector.filesystem./node_exporter --collector.meminfo --collector.filesystemCode block. Enable specific collector for Node Exporter - Default 설정은 모두 해제하고 메모리, 파일 시스템 Collector만 사용하고 싶을 때:Enable file system Collector for a specific mount pointColor mode
./node_exporter --collector.disable-defaults --collector.meminfo --collector.filesystem./node_exporter --collector.disable-defaults --collector.meminfo --collector.filesystemCode block. Enable specific collector for Node Exporter Enable the file system Collector, excluding specific mount pointsColor mode./node_exporter --collector.disable-defaults --collector.filesystem.mount-points-include="/|/data"./node_exporter --collector.disable-defaults --collector.filesystem.mount-points-include="/|/data"Code block. Enable specific collector for Node Exporter Color mode./node_exporter --collector.disable-defaults --collector.filesystem.mount-points-exclude="/boot|/var/log"./node_exporter --collector.disable-defaults --collector.filesystem.mount-points-exclude="/boot|/var/log"Code block. Enable specific collector for Node Exporter
파일 시스템 collector를 사용하고 싶지 않을때:
./node_exporter --no-collector.filesystem./node_exporter --no-collector.filesystem[Unit]
Description=Node Exporter
After=network-online.target
[Service]
User=nodeexp
ExecStart=/usr/local/bin/node_exporter
--collector.disable-defaults
--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
--collector.meminfo
--collector.filesystem
[Install]
WantedBy=multi-user.targetYou can configure the Open Telemetry Collector to select and collect only the necessary metrics gathered from the Node Exporter. When you want to collect only specific metrics among those provided by a particular collector of Node Exporter, [Preconfiguration of OpenTelemetry Collector for ServiceWatch](../../../management/service_watch/how_to_guides/service_watch_agent.md/
#Windows Exporter metrics
Below is the collector and metric information that can be viewed through the Windows Exporter. You can set it as a Collector, or you can enable only specific metrics.
| Category | Collector | Indicator name | Explanation |
|---|---|---|---|
| Memory | memory | windows_memory_available_bytes | Available memory |
| Memory | memory | windows_memory_cache_bytes | cache 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 information | logical_disk | windows_logical_disk_free_bytes | Remaining capacity |
| Disk information | logical_disk | windows_logical_disk_size_bytes | Total capacity |
| Disk information | logical_disk | windows_logical_disk_read_bytes_total | Number of bytes read |
| Disk information | logical_disk | windows_logical_disk_write_bytes_total | Write byte count |
| Disk information | logical_disk | windows_logical_disk_read_seconds_total | read latency |
| Disk information | logical_disk | windows_logical_disk_write_total | write latency |
| Disk information | logical_disk | windows_logical_disk_idle_seconds_total | idle time |
Windows Exporter enables most collectors by default, but you can configure only the collectors you want.
CPU, 메모리, 논리 디스크만 사용하고 싶을 때:
#--collector.enabled option disables the default and activates only the specified Collector
.\windows_exporter.exe --collectors.enabled="memory,logical_disk"#--collector.enabled option disables the default and activates only the specified Collector
.\windows_exporter.exe --collectors.enabled="memory,logical_disk"–collector.enabled will collect only the collectors specified in that option.#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
#Service start
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
#Service start
Start-Service windows_exporter#Note this is not an exhaustive list of all configuration values
collectors:
enabled: logical_disk,memory
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
collector:
service:
include: windows_exporter
scheduled_task:
include: /Microsoft/.+
log:
level: debug
scrape:
timeout-margin: 0.5
telemetry:
path: /metrics
web:
listen-address: :9182You can configure the OpenTelemetry Collector to select and collect only the necessary metrics gathered from the Windows Exporter. When you want to collect only specific metrics among those provided by a particular collector of the Windows Exporter, Preconfigured Open Telemetry Collector for ServiceWatch