Windows上のApache httpdでドメイン認証を使う
mod_auth_sspiを使うとドメインアカウントによる認証が可能です。例えば、Active Directory環境にあるSubversionリポジトリの認証をシングルサインオン化できたりします。
使い方はとても簡単です。
- ドメインに参加済みとします。
- Apache httpdをインストール済みとします。
- http://sourceforge.net/projects/mod-auth-sspi/ からアーカイブを入手します。
- アーカイブに含まれる mod_auth_sspi.so をApache httpdのモジュールディレクトリにコピーします。
- 設定ファイルに以下を追加し、Apache httpdを再起動します。
# サイト全体にWindows認証を適用する # (最小限の設定です) <Location /> AuthType SSPI SSPIAuth On SSPIAuthoritative On Require valid-user </Location>
mod_auth_ntlm_winbindより簡単に使えるのでおすすめです。アプリケーションや環境によって追加設定が必要ですが、大抵はググると見つかります。
ちなみに、CollabNet Subversion Edgeにはすでに mod_auth_sspi.so が入っていたりします。
Options of mod_auth_sspi
残念ながらmod_auth_sspiの公式ドキュメントはないようです。ソースコードから設定項目をまとめてみました。参考になりましたら幸いです。
Name | Type | Description |
---|---|---|
SSPIAuth | flag | set to 'on' to activate SSPI authentication here |
SSPIOfferSSPI | flag | set to 'off' to allow access control to be passed along to lower modules if the UserID is not known to this module |
SSPIAuthoritative | flag | set to 'off' to allow access control to be passed along to lower modules if the UserID is not known to this module |
SSPIOfferBasic | flag | set to 'on' to allow the client to authenticate against NT with 'Basic' authentication instead of using the NTLM protocol |
SSPIPackage | string | set to the name of the package you want to use to authenticate users |
SSPIPackages | string | set to the name of the package you want to use to authenticate users |
SSPIDomain | string | set to the domain you want users authenticated against for cleartext authentication - if not specified, the local machine, then all trusted domains are checked |
SSPIOmitDomain | flag | set to 'on' if you want the usernames to have the domain prefix OMITTED, on = user, off = DOMAIN\user |
SSPIUsernameCase | string | set to 'lower' if you want the username and domain to be lowercase, set to 'upper' if you want the username and domain to be uppercase, if not specified, username and domain case conversion is disabled |
SSPIBasicPreferred | flag | set to 'on' if you want basic authentication to be the higher priority |
SSPIMSIE3Hack | flag | set to 'on' if you expect MSIE 3 clients to be using this server |
SSPIPerRequestAuth | flag | set to 'on' if you want authorization per request instead of per connection |
(mod_auth_sspi.c in mod_auth_sspi-1.0.4-2.2.2.zip)
Windows版Zabbixエージェントをワンクリックでインストールする
Windows版のZabbixエージェントをインストールするバッチファイルを書きました。 ZABBIX-JPにインストーラが用意されていることに後で気づきましたが、バッチなら本当にワンクリックでインストールできます(キリッ
Windows版のZabbixエージェントをインストール(またはアップデート)する手順です:
- (すでに実行中の場合は)サービスを停止する。
- バイナリをコピーする。
- ファイアウォールでzabbix_agentd.exeの通信を許可する。
- サービスを登録する。
- サービスを開始する。
これらの手順をバッチファイルにしてみました。
set PKG_BASE=\\ファイルサーバ\パス set AGENT=%PKG_BASE%\zabbix_agents_1.8.11.win\win64 set CONF=%PKG_BASE%\zabbix_agentd.conf set ZABBIX_HOME=C:\Program Files\Zabbix net stop "Zabbix Agent" ping localhost -n 3 > NUL mkdir "%ZABBIX_HOME%" cd "%ZABBIX_HOME%" copy /y "%AGENT%\*" "%ZABBIX_HOME%" copy /y "%CONF%" "%ZABBIX_HOME%" dir "%ZABBIX_HOME%" netsh advfirewall firewall delete rule name=zabbix_agentd netsh advfirewall firewall add rule name=zabbix_agentd dir=in program="%ZABBIX_HOME%\zabbix_agentd.exe" action=allow "%ZABBIX_HOME%\zabbix_agentd.exe" -i --config "%ZABBIX_HOME%\zabbix_agentd.conf" net start "Zabbix Agent" pause
使い方です:
- install-zabbix-agent.batとか名前を付けて、ファイルサーバに保存してください。
- ファイルサーバにZabbix Agentのバイナリ(zipを解凍したもの)も配置します。
- ファイルサーバに設定ファイル(zabbix_agentd.conf)も配置します。
- 環境変数 PKG_BASE, AGENT, CONF, ZABBIX_HOME をファイルサーバの場所に合わせて修正してください。
- Windows Serverでファイルサーバを開き、バッチファイルを右クリックして管理者権限で実行します。
なお、通知を飛ばしたくない場合は抑止をお忘れなく。
ZabbixでHyper-Vの統計情報を取得する
Hyper-Vクラスタを運用する上で、ノードの負荷状況やメモリ使用量などは重要な監視項目になります。特に、仮想デスクトップを運用している場合は一部の利用者が全体のパフォーマンスを落とすことがあるため、原因調査と改善のために記録を残すことが重要です。
Hyper-Vの統計情報はWindowsのパフォーマンスカウンターを通して取得できます。
例えば、起動中の仮想マシン数を取得するには下記のキーを使います。テンプレートを作ってHyper-Vクラスタ内のホストに適用しておくと簡単です。
名前 | Number of running VMs |
---|---|
種類 | Zabbixエージェント |
キー | perf_counter[\Hyper-V Virtual Machine Summary\Running] |
パフォーマンスカウンターの一覧は [サーバーマネジャー]-[診断]-[パフォーマンス]-[モニターツール]-[パフォーマンスモニター] で確認できます。カテゴリーの先頭に Hyper-V と付いているものがHyper-Vのカウンターです。
監視項目の選定にあたっては下記を参考にさせて頂いています。
午前8時ぐらいから起動VM数が増えていき、それに伴ってメモリ使用量やディスク負荷が上がっていく、というのを見てニヤニヤしています。みんな早起きダナー。