2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Instana で Windows OSのサービスやプロセスを監視する

Last updated at Posted at 2025-07-18

はじめに

Observability や APM の製品である Instana ですが、監視製品として活用する場面も少なくありません。本記事では、Windows OS のサービスやプロセスの監視を Instana で実施する方法を解説します。

Instana がサポートしているテクノロジーか?

監視対象のプロセスやサービスが、Instana がサポートしているテクノロジーか否かで設定手順は変わってきます。

Instana はITシステムやアプリケーションの環境で利用されている、数多くの仮想インフラ、データベース、アプリケーションサーバー製品や、プログラム実行環境をサポートしています。
サポートしているテクノロジーは以下リンク先を参照してください。

Instana がサポートしているテクノロジーには含まれないが、運用上監視したいプロセスやサービスもあります。例えば運用作業においてリモート接続に利用するRDPなどです。

この記事では以下3パターンの設定を紹介します。

  1. SQL Server 2022 の起動状態を監視する。(Instanaがサポートするテクノロジー)
  2. RDP サービスの起動状態を監視する。(未サポートのテクノロジー)
  3. PingTool プロセスの起動状態を監視する。(未サポートのテクノロジー)

1. SQL Server 2022 の監視

SQL Server 2022 は Instana がサポートするテクノロジーに含まれるため、自動的にホストのダッシュボード上に、「MS SQL インスタンス」が検出・表示されます。停止を検出するための事前設定は必要ありません。

image.png

※ SQL Server の性能情報・トレースを取得するために必要な設定はあります。以下リンク先を参照してください。

イベント設定(SQL Server 2022 監視設定)

SQL Server 2022 の停止を検出するイベントの設定です。

image.png

SQL Server 2022 停止と検出

SQL Server 2022 のサービスを止めます。
ホストのダッシュボードを確認し、先ほどまで表示されていた「MS SQL インスタンス」が表示されていません。

image.png

先ほど設定した監視設定での検出画面です。

image.png

2. Windows サービスの監視(RDP)

監視対象サービスの定義

Windows サービスを監視するためには、Instana の「configuration.yaml」ファイルに設定を行います。
以下に設定箇所の抜粋を記載します。(ファイルの87~105行目です。)

設定ファイル内にコメントが記載されていますが、定義するのはサービス名・表示名のいずれかです。

configuration.yaml
# Host
# Instana will by default only monitor local filesystems. It is possible to
# explicitly list the remote filesystems that shall be monitored.
# The name for the config setting is the device name, that is the first column
# in mtab / df
com.instana.plugin.host:
#  tags:
#    - 'production'
#    - 'app1'
#  filesystems:
#    - 'server:/usr/local/pub'
#    - 'tmpfs:/mount/point/path'
#  collectInstalledSoftware: true # [true, false]
  collectSystemId: true
#  aixEventsPollRate: 900 # (Optional) Only for AIX systems. Setting a value to 900 seconds or larger will enable error report event collection and removing it will stop it.
#  # Regular expressions that identify network interfaces to include or exclude. If both are defined, exclusive regex has priority over inclusive regex.
#  interface-inclusive-regex: '' # Regex pattern for matching network interface names to include
#  interface-exclusive-regex: '' # Regex pattern for matching network interface names to exclude
  winServiceRegex: 'Remote Desktop Services' # Regex pattern for matching Windows services name or display name to include

ホストのダッシュボードを確認し、Windows サービスに RDP(Remote Desktop Services)が表示されていれば、準備は完了です。RDP に依存しているサービス(子プロセス)として、「Remote Desktop Services UserMode Port Redirector」も自動的に検出されます。

image.png

イベント設定(RDP 監視設定)

RDP の停止を検出するイベントの設定です。この設定は特定の Windows サービスが停止したことを検出します。

image.png

複数の Windows サービスを監視し、いずれかのサービスの状態が変わったことを検出する場合の設定です。
カウントの数値「4」はサービスがRunning状態を表します。「4」(Running)以外の状態を検出します。

image.png

RDP 停止と検出

RDP のサービスを止めます。
ホストのダッシュボードを確認し、Windows サービスの状態が変わっています。

image.png

先ほど設定した2パターンの監視設定での検出画面です。

image.png

image.png

3. Windows プロセスの監視(PingTool)

Windows サービスに登録されていない、単体のプログラムとして実行されている場合の監視方法です。今回はネットワーク監視のツールである「PingTool」を例に設定をします。

このソフトウェアは、インストールするタイプではなく、実行ファイル(exe)を直接実行するタイプです。したがって、Windows サービスに登録されません。

監視対象プロセスの定義

Windows プロセスを監視するためには、Instana の「configuration.yaml」ファイルに設定を行います。
以下に設定箇所の抜粋を記載します。(ファイルの1185~1202行目です。)

設定項目が「services」となっていますが、定義するのはプロセス名(基本的には実行ファイル名)です。PingTool の実行ファイルは、「PingTool.exe」です。

configuration.yaml
# Custom processes
# To enable low level metric and availability monitoring for not automatically
# discovered processes, uncomment the com.instana.plugin.process section and
# list all process names of processes that should be monitored.
# Sometimes scripts or other jobs are started through the same command, but
# only the execution of a single command should be monitored. In this case use
# arguments to specify any argument that should cause a process to be monitored.
# Set env_vars_enabled as false will globally disable collection for environment variables.
com.instana.plugin.process:
#  env_vars_enabled: true
#  processes:
#    - 'sshd'
#    - 'slapd'
#  arguments:
#    - '/opt/script.sh'
  services:
    - 'PingTool'
#    - 'windows-service'

ホストのダッシュボードを確認し、「.NET アプリケーション」や「プロセス」として、「PingTool.exe」が表示されていれば、準備は完了です。「PingToolHelper.exe」「PingToolTcpHelper.exe」「??\C:\Windows\system32\conhost.exe」は、いずれも「PingTool」の関連プロセスです。

image.png

イベント設定(PingTool 監視設定)

PingTool の停止を検出するイベントの設定です。

image.png

PingTool 停止と検出

PingTool を終了します。
ホストのダッシュボードを確認し、先ほどまで表示されていた「.NET アプリケーション」や「プロセス」が表示されていません。

image.png

先ほど設定した監視設定での検出画面です。

image.png

まとめ

Windows OS におけるサービスやプロセスの監視方法は、上記3パターンでほぼ対応できると思います。
なお、今回各パターンで例示した監視設定は一例です。

  • 同一アプリを複数起動し、プロセス数が●●個以下になったら検知・通知したい。
  • 同一アプリを複数起動し、どのプロセスが停止したかを検知・通知したい。

といったように、監視方法・対象によって設定は異なります。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?