Install ServiceWatch Agent
Users can install the ServiceWatch Agent on a Virtual Server to collect custom metrics and logs.
ServiceWatch Agent
The agents that must be installed on a Virtual Server to collect ServiceWatch’s custom metrics and logs can be divided into two main types. It is the Prometheus Exporter and OpenTelemetry 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.), and exports them to various backends (e.g., Prometheus, Jaeger, Elasticsearch, etc.)
|
Pre-configuration for Using ServiceWatch Agent
To use the ServiceWatch Agent, please refer to ServiceWatch Agent를 위한 사전 환경 설정 and prepare the prerequisite configuration.
Install 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.
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 to install Node Exporter.
This guide refers to 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 setting 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 filesystem metrics enable 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 filesystem metrics enable Restart=on-failure [Install] WantedBy=multi-user.targetcode block. Result of opening the 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}: Disables a specific metric.- To disable all default metrics and enable only a specific collector, you can use
–collector.disable-defaults –collector.{name} ….
Below is a description of the main collector.
| Collector | Explanation | Label |
|---|---|---|
| meminfo | Provide memory statistics | - |
| filesystem | Provides file system statistics such as used disk space |
|
- Node Exporter 지표 you can check the main metrics provided by Node Exporter and the Node Exporter Collector configuration method.
- 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. Node Exporter metric information check command
For more details, see ServiceWatch > ServiceWatch Agent 사용하기.
Install Prometheus Exporter for Virtual Server (for Windows)
Install according to the steps below to use Prometheus Exporter on a Windows server.
Install Windows Exporter
Install the Windows Exporter following 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. Download Windows Exporter
- Windows Exporter execution test
Windows Exporter enables all collectors by default, but to collect only the metrics you want, 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 specific metrics.
Below is a description of the main collector.
| 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. |
|
- Windows Exporter 지표 you can find the main metrics provided by Windows Exporter and the method 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 Windoes 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. Windows Exporter service registration Color mode# Service check $ Get-Service windows_exporter # Check metrics $ Invoke-WebRequest -Uri "http://localhost:9182/metrics" | Select-String memory# Service check $ 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 set 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" # If you use an absolute path, you must enclose the path in quotes.$ .\windows_exporter.exe --config.file=config.yml $ .\windows_exporter.exe --config.file="C:\Program Files\windows_exporter\config.yml" # If you use an absolute path, you must enclose the path 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. Example of a part of a Windows Exporter configuration file - Please refer to Windows Exporter > Official Example Configuration File.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 a 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 set it to use a YAML configuration file by using the
For detailed information, refer to ServiceWatch > ServiceWatch Agent 사용하기.
#Node Exporter metrics
Below is the collector and metric information that can be viewed through Node Exporter. It can be set as a Collector, or you can 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 (empty 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 |
| Filesystem | filesystem | node_filesystem_avail_bytes | Space actually available to 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 in 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 of 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 in 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 in 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, ServiceWatch를 위한 Open Telemetry Collector 사전 설정
#Windows Exporter metrics
Below is the collector and metric information that can be viewed through the Windows Exporter. You can configure it as a Collector, or 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_seconds_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: ":9182"Through the Open Telemetry Collector configuration, you can set it to collect only the required 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, [ServiceWatch를 위한 Open Telemetry Collector 사전 설정](/userguide/management/service_watch/how_to_guides/service_watch_agent/