はじめに
最近AzureのOMS(Microsoft Operations Management Suite)を利用するケースが増えています。
導入の手順は、マイクロソフトさんが用意しているのですが、ワークスペースを変更する手順が見当たらなかったので実施してみました。
環境
サーバーOS:CentOS release 6.5
クラウド環境:AWS EC2
OMSエージェント:omsagent-1.2.0-75
前提
omsagentはソースを見ればわかる通り、td-agentdをカスタマイズしています。
まだ初期の段階という事もあってか、利用ポートがtd-agentdと同じになっています。
その為既にtd-agentdを稼働しているサーバに導入するには工夫が必要です。
(pluginで対応とか。その辺はまた次回に記載します)
omsagentは、インストール時に登録したワークスペース ID とプライマリキーのワークスペースにログ(デフォルトではsyslog)を転送します。
途中で転送先のワークスペースを変更するには、再インストールを指定上げる必要があります。
※設定ファイルを全て見切れておらず、今後ファイルの更新で対応できる方法を検討中。
作業手順
インストールスクリプトomsagent-1.2.0-75.universal.x64.shのオプション確認
echo "usage: $1 [OPTIONS]"
echo "Options:"
echo " --extract Extract contents and exit."
echo " --force Force upgrade (override version checks)."
echo " --install Install the package from the system."
echo " --purge Uninstall the package and remove all related data."
echo " --remove Uninstall the package from the system."
echo " --restart-deps Reconfigure and restart dependent service(s)."
echo " --source-references Show source code reference hashes."
echo " --upgrade Upgrade the package in the system."
echo " --version Version of this shell bundle."
echo " --version-check Check versions already installed to see if upgradable."
echo " --debug use shell debug mode."
echo " --collectd Enable collectd."
echo
echo " -w id, --id id Use workspace ID <id> for automatic onboarding."
echo " -s key, --shared key Use <key> as the shared key for automatic onboarding."
echo " -d dmn, --domain dmn Use <dmn> as the OMS domain for onboarding. Optional."
echo " default: opinsights.azure.com"
echo " ex: opinsights.azure.us (for FairFax)"
echo " -p conf, --proxy conf Use <conf> as the proxy configuration."
echo " ex: -p [protocol://][user:password@]proxyhost[:port]"
echo " -a id, --azure-resource id Use Azure Resource ID <id>."
echo
echo " -? | -h | --help shows this usage text."
オプションを見ると、--restart-depsが使えそうかなーと思ったのですが、使い方がまだ未解決です。
なので一旦アンストールして入れ直す方法を検討します。
omsagentをアンインストールする
# sh ./omsagent-1.2.0-75.universal.x64.sh --remove
----- Removing package: omsconfig -----
Removing module nx
Removing resource MSFT_nxAvailableUpdatesResource
Removing resource MSFT_nxPackageResource
Removing resource MSFT_nxUserResource
Removing resource MSFT_nxGroupResource
Removing resource MSFT_nxServiceResource
Removing module nxOMSAgent
Removing resource MSFT_nxOMSAgentResource
Removing resource MSFT_nxOMSKeyMgmtResource
Removing resource MSFT_nxOMSSyslogResource
Removing module nxOMSCustomLog
Removing resource MSFT_nxOMSCustomLogResource
Removing module nxOMSPlugin
Removing resource MSFT_nxOMSPluginResource
Starting Operations Management Suite agent: [ OK ]
----- Removing package: omsagent -----
Unconfiguring rsyslog for OMS logging
Restarting service: rsyslog
システムロガーを停止中: [ OK ]
システムロガーを起動中: [ OK ]
Shutting down Operations Management Suite agent: (Forced) [ OK ]
Unconfiguring OMS agent service ...
警告: /etc/opt/microsoft/omsagent/sysconf/installinfo.txt は /etc/opt/microsoft/omsagent/sysconf/installinfo.txt.rpmsave として保存されました。
Shutting down Microsoft OMI Server: [ OK ]
Starting Microsoft OMI Server: [ OK ]
Deleting omsagent service account ...
Removing cross-platform agent(s) ...
----- Removing package: apache-cimprov -----
Apache not previously configured; nothing to unconfigure
警告: /etc/opt/microsoft/apache-cimprov/conf/installinfo.txt は /etc/opt/microsoft/apache-cimprov/conf/installinfo.txt.rpmsave として保存されました。
Shutting down Microsoft OMI Server: [ OK ]
Starting Microsoft OMI Server: [ OK ]
----- Removing package: scx -----
警告: /etc/opt/microsoft/scx/conf/scxconfig.conf は /etc/opt/microsoft/scx/conf/scxconfig.conf.rpmsave として保存されました。
警告: /etc/opt/microsoft/scx/conf/scx-release は /etc/opt/microsoft/scx/conf/scx-release.rpmsave として保存されました。
警告: /etc/opt/microsoft/scx/conf/installinfo.txt は /etc/opt/microsoft/scx/conf/installinfo.txt.rpmsave として保存されました。
Shutting down Microsoft OMI Server: [ OK ]
Starting Microsoft OMI Server: [ OK ]
----- Removing package: omi -----
Shutting down Microsoft OMI Server: [ OK ]
Unconfiguring omid service ...
Deleting omiusers group ...
omsagentを再インストールする
# sh ./omsagent-1.2.0-75.universal.x64.sh --install -w <ワークスペース ID> -s <プライマリキー>
Checking host architecture ...
Checking for ctypes python module ...
Extracting...
Installing OMS agent ...
----- Installing package: omi (omi-1.1.0-0.universal.x64) -----
----- Installing package: scx (scx-cimprov-1.6.3-13.universal.x64) -----
----- Installing package: omsagent (omsagent-1.2.0-75.universal.x64) -----
Checking for ctypes python module ...
----- Installing package: omsconfig (omsconfig-1.1.1-316.x64) -----
準備中... ########################################### [100%]
Creating omiusers group ...
1:omi ########################################### [ 25%]
************************************************************
* Warning: The certificate and keyfile were not generated *
* since they already exist. *
************************************************************
Configuring OMI service ...
Starting Microsoft OMI Server: [ OK ]
2:scx ########################################### [ 50%]
Shutting down Microsoft OMI Server: [ OK ]
Starting Microsoft OMI Server: [ OK ]
Creating omsagent group ...
Creating omsagent service account ...
3:omsagent ########################################### [ 75%]
info Reading onboarding params from: /etc/omsagent-onboard.conf
info Reusing previous agent GUID
info Onboarding success
Configuring OMS agent service ...
Starting Operations Management Suite agent: [ OK ]
Shutting down Microsoft OMI Server: [ OK ]
Starting Microsoft OMI Server: [ OK ]
Configuring rsyslog for OMS logging
Restarting service: rsyslog
システムロガーを停止中: [ OK ]
システムロガーを起動中: [ OK ]
Checking for ctypes python module...ok!
4:omsconfig ########################################### [100%]
Installing resource MSFT_nxAvailableUpdatesResource
Installing resource MSFT_nxPackageResource
Installing resource MSFT_nxUserResource
Installing resource MSFT_nxGroupResource
Installing resource MSFT_nxServiceResource
Installing resource MSFT_nxOMSAgentResource
Installing resource MSFT_nxOMSKeyMgmtResource
Installing resource MSFT_nxOMSSyslogResource
Installing resource MSFT_nxOMSCustomLogResource
gpg: 鍵44BC4178:“Microsoft (Release Signing) <msgpgkey@microsoft.com>”変更なし
gpg: 処理数の合計: 1
gpg: 変更なし: 1
gpg: 鍵DE321294:“Microsoft (Release Signing) <dscgpgkey@microsoft.com>”変更なし
gpg: 処理数の合計: 1
gpg: 変更なし: 1
Shutting down Microsoft OMI Server: [ OK ]
Starting Microsoft OMI Server: [ OK ]
Successfully configured omsconfig.
Shutting down Operations Management Suite agent: (Forced) [ OK ]
Starting Operations Management Suite agent: [ OK ]
----- Installing bundled packages -----
Checking if Apache is installed ...
Apache found, Apache agent will be installed
Extracting...
Installing Apache agent ...
----- Installing package: apache-cimprov (apache-cimprov-1.0.1-7.universal.1.x86_64) -----
Detected Apache v2.2 ...
Shutting down Microsoft OMI Server: [ OK ]
Starting Microsoft OMI Server: [ OK ]
Checking if Docker is installed...
Docker not found. Docker agent will not be installed.
Checking if MySQL is installed ...
MySQL not found, will not install
これで新しいワークスペースにログが流入します。
最後に
OMS使い始めてまだ日が浅いですが、ログの受け皿としてs3との比較が今後できたらと思います。