The page has been translated by Gen AI.

Install ServiceWatch Agent

Users can install the ServiceWatch Agent on a Virtual Server to collect custom metrics and logs.

Reference
Custom metric/log collection via the ServiceWatch Agent is currently available only on Samsung Cloud Platform For Enterprise. It will also be available in other offerings in the future.
Caution
Metric collection through the ServiceWatch Agent is classified as custom metrics and, unlike the default metrics collected from each service, incurs charges; therefore, we recommend removing or disabling unnecessary metric collection settings.

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.

CategoryDetailed description
Prometheus ExporterProvide metrics of a specific application or service in a format that Prometheus can scrape
  • Depending on the OS, you can use Node Exporter for Linux servers and Windows Exporter for Windows servers
Open Telemetry CollectorActs 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.)
  • Exports data to the ServiceWatch Gateway so that ServiceWatch can collect metric and log data.
Table. Explanation of Prometheus Exporter and Open Telemetry Collector

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.

  1. Create Node Exporter User
  2. Node Exporter configuration

Node Exporter User creation

Create a dedicated user to securely isolate the Node Exporter process.

Color mode
sudo useradd --no-create-home --shell /bin/false node_exporter
sudo useradd --no-create-home --shell /bin/false node_exporter
Code block. Node Exporter User creation command

Node Exporter configuration

  1. Download for installing Node Exporter. This guide provides the version below.
    • Download path: /tmp
    • Installed version: 1.7.0
      Color mode
      cd /tmp
      wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz
      cd /tmp
      wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz
      Code block. Node Exporter download command
Reference
The latest version of Node Exporter can be found at Node Exporter > Releases > Lastest, and specific versions of Node Exporter can be found at Node Exporter > Releases.
  1. Install the downloaded Node Exporter and grant permission to the executable file.

    Color mode
    cd /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_exporter
    cd /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_exporter
    Code block. Node Exporter installation command
    Color mode
    sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
    sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
    Code block. Node Exporter permission configuration command

  2. Create service file Configure Node Exporter to collect memory metrics (meminfo) or block storage metrics (filesystem).

    Color mode
    sudo vi /etc/systemd/system/node_exporter.service
    sudo vi /etc/systemd/system/node_exporter.service
    Code 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.target
    code block. Result of opening Node Exporter service file

Reference
  • 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.

CollectorExplanationLabel
meminfoProvide memory statistics-
filesystemProvide file system statistics such as used disk space
  • device: the physical or virtual device path where the filesystem resides
    • Example: /dev/sda1
  • fstype: the type of the filesystem
    • Example: ext4, xfs, nfs, tmpfs
  • mountpoint: the path where the filesystem is mounted on the host OS. It is the most intuitive criterion for distinguishing disks
    • Example: /, /var/lib/docker, /mnt/data
Table. Description of major Node Exporter collectors
  • In the Node Exporter Metrics, you can view the main metrics provided by Node Exporter and how to configure the Node Exporter Collector.
Reference
  • 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.
Caution
Since metric collection through the ServiceWatch Agent is classified as custom metrics and incurs charges unlike the default collected metrics, unnecessary metric collection must be removed or disabled to avoid excessive charges.
  1. 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_exporter
    sudo systemctl daemon-reload
    sudo systemctl enable --now node_exporter
    Code block. Node Exporter service activation and start command
    Color mode
    sudo systemctl status node_exporter
    sudo systemctl status node_exporter
    Code block. Node Exporter service check command
    Color mode
    curl http://localhost:9100/metrics | grep node_memory
    curl http://localhost:9100/metrics | grep node_memory
    Code block. Command to view Node Exporter metric information
information
If you have completed the Node Exporter configuration, you must install the OpenTelemetry Collector provided by ServiceWatch to finish the ServiceWatch Agent setup.
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.

  1. Windows Exporter configuration

Windows Exporter configuration

  1. Download the installation file to install the Windows Exporter.
    • Download path: C:\Temp
    • Test version: 0.31.3
      Color 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
Reference
You can find the Windows Exporter versions and installation files at Windows Exporter > Releases.
  1. 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: os
      Color 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,os
      Code block. Windows Exporter execution test
Reference
  • 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.

CollectorExplanationLabel
memoryProvide memory statistics
logical_diskCollect performance and health metrics of logical disks (e.g., C:, D: drives) on the local system.
  • volume: the physical or virtual device path where the file system is located
    • Example: C:D:
Table. Windows Exporter Main Collector Description
  • In the Windows Exporter Metrics, you can see the main metrics provided by Windows Exporter and how to configure the Windows Exporter Collector.
Reference
  • 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.

Caution
Since metric collection through the ServiceWatch Agent is classified as custom metrics and incurs charges unlike the default collected metrics, unnecessary metric collection must be removed or disabled to avoid excessive charges.
  1. 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_exporter
    Code 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 memory
    Code block. Check Windows Exporter service

  2. Configuration file settings

    • You can configure it to use a YAML configuration file by using the –config.file option.
      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 mode
      collectors:
        enabled: cpu,net,service
      collector:
        service:
          include: windows_exporter
      log:
        level: warn
      collectors:
        enabled: cpu,net,service
      collector:
        service:
          include: windows_exporter
      log:
        level: warn
      Code block. Sample Windows Exporter configuration file
    • Please refer to Windows Exporter > Official Configuration File Example.
      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: :9182
      Code block. Example of Windows Exporter configuration file
      Refer to the following to register a service using a 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_exporter
      Code block. Service registration using Windows Exporter configuration file
Reference
When using a configuration file together with command-line options, the values specified in the command-line options take precedence. Consequently, command-line options override the configuration file settings.
guide
If you have completed the Node Exporter configuration, you need to install the Open Telemetry Collector provided by ServiceWatch and finish setting up the ServiceWatch Agent.
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.

CategoryCollectorMetricDescription
Memorymeminfonode_memory_MemTotal_bytesTotal memory
Memorymeminfonode_memory_MemAvailable_bytesAvailable memory (used to determine if memory is insufficient)
Memorymeminfonode_memory_MemFree_bytesFree memory (unused memory)
Memorymeminfonode_memory_Buffers_bytesIO buffer
Memorymeminfonode_memory_Cached_bytesPage cache
Memorymeminfonode_memory_SwapTotal_bytestotal swap
Memorymeminfonode_memory_SwapFree_bytesRemaining swap
Filesystemfilesystemnode_filesystem_size_bytesTotal file system size
Filesystemfilesystemnode_filesystem_free_bytestotal free space(total free space)
Filesystemfilesystemnode_filesystem_avail_bytesSpace actually usable by the user (available space for unprivileged users)
Table. Node Exporter key metrics

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.filesystem
    Code block. Enable specific collector for Node Exporter
  • Default 설정은 모두 해제하고 메모리, 파일 시스템 Collector만 사용하고 싶을 때:
    Color mode
    ./node_exporter
      --collector.disable-defaults
      --collector.meminfo
      --collector.filesystem
    ./node_exporter
      --collector.disable-defaults
      --collector.meminfo
      --collector.filesystem
    Code block. Enable specific collector for Node Exporter
    Enable file system Collector for a specific mount point
    Color 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
    Enable the file system Collector, excluding specific mount points
    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를 사용하고 싶지 않을때:

Color mode
./node_exporter --no-collector.filesystem
./node_exporter --no-collector.filesystem
Code block. Disable specific collector in Node Exporter

Color mode
[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.target
Code block. Node Exporter > /etc/systemd/system/node_exporter.service configuration

You 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/

Caution
Metric collection through the ServiceWatch Agent is classified as custom metrics, and unlike the default metrics collected from each service, it incurs charges; therefore, we recommend configuring only the metrics that are essential.

#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.

CategoryCollectorIndicator nameExplanation
Memorymemorywindows_memory_available_bytesAvailable memory
Memorymemorywindows_memory_cache_bytescache memory
Memorymemorywindows_memory_committed_bytesCommitted memory
Memorymemorywindows_memory_commit_limitcommit limit
Memorymemorywindows_memory_pool_paged_bytespaged pool
Memorymemorywindows_memory_pool_nonpaged_bytesnon-paged pool
Disk informationlogical_diskwindows_logical_disk_free_bytesRemaining capacity
Disk informationlogical_diskwindows_logical_disk_size_bytesTotal capacity
Disk informationlogical_diskwindows_logical_disk_read_bytes_totalNumber of bytes read
Disk informationlogical_diskwindows_logical_disk_write_bytes_totalWrite byte count
Disk informationlogical_diskwindows_logical_disk_read_seconds_totalread latency
Disk informationlogical_diskwindows_logical_disk_write_totalwrite latency
Disk informationlogical_diskwindows_logical_disk_idle_seconds_totalidle time
Table. Windows Exporter key metrics

Windows Exporter enables most collectors by default, but you can configure only the collectors you want.

CPU, 메모리, 논리 디스크만 사용하고 싶을 때:

Color mode
#--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"
Code block. Enable specific collector for Windows Exporter
Reference
Even without disabling unused collectors, using –collector.enabled will collect only the collectors specified in that option.

Color mode
#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
Code block. Service registration
Color mode
#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
Code block. Service configuration file

You 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

Caution
Metric collection through the ServiceWatch Agent is classified as custom metrics, and unlike the default metrics collected from each service, it incurs charges, so we recommend configuring only the metrics that are absolutely necessary.
Configure RHEL Repo and WKMS
Release Note