LoginSignup
1
1

More than 1 year has passed since last update.

OCI computeで動いているOSWatcherの起動停止、ログの位置情報

Last updated at Posted at 2021-05-15

OS Watcher(oswbb)について

OS Watcherはサーバー上のOS稼働情報(iostatやpsなどど)をバックグラウンドで定期取得するツールで、ログメンテナンスまでおこなってくれます。
便利なツールではあるのですが、知る人ぞ知るツールだった印象。また、インストールの仕方が複数あり環境によってどこにログがおいてある場所が違う、実行されているスクリプトの名前が違う、などがあり混乱を招く部分もあると思います。
そこで、OCI ComputeやDBCSを使ってみて初めてこのツールの存在を知ったという方を対象としまして、OSWatcherの起動停止、各種ログがどこに置いてあるのかという情報をまとめます。

OS Watcher(oswbb)の動作状況でみかける3パターン

  1. Oracle Linuxにパッケージインストールされたパターン
    (OCI Computeはこちら。今回の内容
  2. TFAデータベースサポートツールの一部としてインストールされているパターン
    (DBCSはこちら)
  3. MOSドキュメント(ID 301137.1)からtarをダウンロードして解凍実行したパターン
    (任意のディレクトリで解凍してstartOSWbb.shを実行。MOSドキュメントOS Watcher User's Guide (ドキュメントID 1531223.1)のoswbbの開始/停止などは、こちらを想定して書かれているため、このドキュメントだけ見て上記1,2のパターンに当てはめようとすると違うやん、となる)

OCI ComputeでのOS Watcher情報

起動停止はserviceコマンドで実施

OS WatcherはLinuxサービスとして登録されているので、serviceコマンドで、ステータス確認、起動、停止、再起動を実施。

service oswatcher status
service oswatcher stop
service oswatcher start
service oswatcher restart

実行中のservice oswatcher statusの表示はこんな感じ

# service oswatcher status
Redirecting to /bin/systemctl status oswatcher.service
● oswatcher.service - OSWatcher:set of scripts used to periodically collect OS and network metrics.
   Loaded: loaded (/usr/lib/systemd/system/oswatcher.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-05-15 15:47:24 GMT; 1h 28min ago
 Main PID: 2087 (OSWatcher)
   Memory: 8.7M
   CGroup: /system.slice/oswatcher.service
           tq 2087 /bin/sh /usr/sbin/OSWatcher 30 48 gzip /var/oled/oswatcher
           mq27317 sleep 30

May 15 15:47:24 hostname systemd[1]: Started OSWatcher:set of scripts used to periodically collect OS and network metrics..
May 15 15:47:24 hostname OSWatcher[2087]: Info...Zip option IS specified.
May 15 15:47:24 hostname OSWatcher[2087]: Info...OSW will use gzip to compress files.
May 15 15:47:24 hostname OSWatcher[2087]: Changing current working directory to /var/oled/oswatcher
May 15 15:47:30 hostname OSWatcher[2087]: cat: /etc/oratab: No such file or directory

/usr/lib/systemd/system/oswatcher.serviceの中身はこんな感じ。これを見ると、設定ファイルが/etc/sysconfig/oswatcherにあることがわかる。

# cat /usr/lib/systemd/system/oswatcher.service
[Unit]
Description=OSWatcher:set of scripts used to periodically collect OS and network metrics.
After=network-online.target

[Service]
Type=simple
EnvironmentFile=/etc/sysconfig/oswatcher
Restart=on-abort
ExecStart=/usr/sbin/OSWatcher $INTERVAL $MAXAGE $ZIP $DATADIR

[Install]
WantedBy=multi-user.target

設定ファイルは/etc/sysconfig/oswatcher

/etc/sysconfig/oswatcherで設定できる項目は下記。
設定反映は設定ファイル変更後、サービス再起動service oswatcher restart

# The directory where oswatcher logs should be kept
DATADIR=/var/oled/oswatcher
# The interval (in seconds) between runs runs of statistics collections
INTERVAL=30
# The maximum age (in hours) of the various log files
MAXAGE=48
# An optional program used to compress the log files
ZIP=gzip

PSでのOSW実行プロセスの見え方

$ ps -ef|grep osw
root      2087     1  0 15:47 ?        00:00:00 /bin/sh /usr/sbin/OSWatcher 30 48 gzip /var/oled/oswatcher

/usr/sbin/OSWatcher 30 48 gzip /var/oled/oswatcher
から下記であることがわかります。

取得間隔 30秒
保存期間 48時間
圧縮形式 gzip
出力先ディレクトリ /var/oled/oswatcher

ログファイルの出力先は/var/oled/oswatcher/archive

各OS稼働ログファイルは/var/oled/oswatcher/archiveの下に
以下のような稼働ログの種類ごとのディレクトリが作成されており、

# ls -1
oswarp
oswbuddyinfo
oswcpuinfo
oswifconfig
oswiostat
oswmeminfo
oswmpstat
oswnetstat
oswnfsiostat
oswnumastat
oswpagetype
oswpidstat
oswprvtnet
oswps
oswslabinfo
oswtop
oswvmstat
oswxentop
oswzoneinfo

この中に下記のような形で1時間毎にgzip化されたファイルがたまっていきます。以下はiostatの例

# ls -1
hostname_iostat_21.05.15.1500.dat.gz
hostname_iostat_21.05.15.1600.dat.gz
hostname_iostat_21.05.15.1700.dat
1
1
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
1
1