UJP - 技術情報1

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

使わなくなったPowerBookを監視サーバにする為にMacPortsでNagiosをインストールする

使わなくなったPowerBookを監視サーバにする為にMacPortsでNagiosをインストールする


0.改訂履歴

  • 2010.03.19 新規作成

1.はじめに

 このドキュメントでは,MacOS X10.4.11が動作するPowerBook G4 667MHzに統合監視ソフトであるnagios3.2をインストールする手順を説明する. 今回,この設定を行う為に,OSを新規でインストールし,全 てのパッチを適用した後に,OS付属でデフォルトではインストールされていないXcodeをインストールしている.

 リリースされて8年経過し,使用しなくなったPowerBook G4ですが監視サーバとして仕立てる事によって利用価値を見出そうという試みである.この構成のメリットは次の通りとなる.

  1. 未使用の古いパソコンの有効活用.
  2. ノートパソコンなのでバッテリ駆動ができるので,UPSが不要.
  3. ノートパソコンなので省電力.
  4. ノートパソコンなので省スペース.
  5. MacOS XはUNIXベースなのでnagiosを簡単に利用する事ができる.
  6. MacOS XはUNIXベースなのでリモート接続して利用する事ができる.
  7. MacOS Xの画面共有機能を利用してディスプレイ無しでもGUI設定ができる.
  8. MacOS XにはWebサーバとしてApacheが標準搭載されているので新たにインストールが必要ない.

2.MacPortsのインストール

  • MacPortsをダウンロードする.
  • Tiger用となるので,現時点では1.8.2となる.

  • パッケージをダウンロドしたら,ダブルクリックして実行する.

  • 続ける.



  • システム利用条件が表示されている.Xcodeが必要とされている.












  • インストール完了.

3.PHPのインストール

  • nagiosはPHPが必要なので,コンパイル済パッケージをダウンロードしてインストールする.
  • 入手先は次の通り.
  • ダウンロードしたファイルは次の通り.

  • MacOS X 10.4に対応しているのはこのパッケージとなる.
  • tarファイルだが,ダブルクリックで展開する.


  • 展開されたのはパッケージファイルなので,これを実行する.













  • インストール完了.

4.rootユーザを有効にする

  • macportsを利用する為には,rootユーザ権限が必要となる.rootユーザはMacOS Xでは初期設定では無効になっているので,これを有効化する.

  • [アプリケーション]→[ユーティリティ]フォルダにある,NetInfoマネージャを起動する.

  • [セキュリティ]メニューで[認証...]を選ぶ.
  • 管理者権限のあるユーザアカウントで認証する.
  • 認証が成功したら,再度[セキュリティ]メニューを選択する.

  • [ルートユーザを有効]を選択する.

  • rootユーザ用のパスワードを入力する.

  • これでrootユーザが有効化されせっていされた.

5.リモートログインの設定

  • PowerBookをサーバ化する為には,リモートで接続できる様に設定する.
  • システム環境設定を開き,共有アイコンを開く.

  • [サービス]タブにある[リモートログイン]をチェックする.

6.省電力設定とWOL

  • サーバとして利用する為には,コンピュータがスリープしない様に設定する必要がある.また,WOL(Wake On Lan)機能によりネットワーク
  • 省エネルギー設定を見直す必要があるので,システム環境設定の[省エネルギー]を開く.


  • スリープ設定で,スリープしない様に設定する.
  • 次に,オプションタブを開く.

  • つぎのポイントを確認する.
    • Ethernetネットワーク管理者のアクセスによってスリープを解除
      • WOLに対応する為に,チェックする.
    • 停電後に自動的に再起動
      • 意図しないシャットダウンが行われた時に,OSが自動的に再起動してくれる様になる.

7.MacPortsのアップデートを確認しア プリケーションリストを更新する

  • SSHで接続する.
macbook:~ nobuaki$ ssh ujpadmin@192.168.XX.XX
The authenticity of host '192.168.XX.XX (192.168.XX.XX)' can't be established.
RSA key fingerprint is 2d:df:ac:51:6d:28:3f:f6:92:5d:ae:32:76:b4:45:e6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.XX.XX' (RSA) to the list of known hosts.
Password:■■■■■■■■■
Last login: Fri Mar 19 12:55:36 2010
Welcome to Darwin!
ivory:~ ujpadmin$
  • 始めての接続の際はフィンガープリントを確認する.
  • ルートユーザにスイッチする.
ivory:~ ujpadmin$ su - 
Password:■■■■■■■■■
ivory:~ root#
  • ルートユーザに変更しないと,権限エラーがでる.
  • MacPortsを最新版にアップデートする.
ivory:~ root# /opt/local/bin/port -v selfupdate
---> Updating the ports tree
Synchronizing local ports tree from rsync://rsync.macports.org/release/ports/
receiving file list ... done
./
PortIndex
PortIndex.quick
_resources/
_resources/port1.0/
_resources/port1.0/fetch/
_resources/port1.0/group/
_resources/port1.0/group/tests/
_resources/port1.0/livecheck/
_resources/port1.0/package/
aqua/
aqua/AppHack/
aqua/AppKiDo/
aqua/AquaLess/
aqua/ArpSpyX/

〜略〜

sent 330 bytes received 7183 bytes 3005.20 bytes/sec
total size is 4023490 speedup is 535.54
MacPorts base version 1.8.2 installed,
MacPorts base version 1.8.2 downloaded.
---> MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
port upgrade outdated
ivory:~ root#
  • 最新版がインストールされている事が確認できた.
    • 接続エラーが出る場合は,rsyncが使用する873ポートが許可されているか確認する.
  • アプリケーションリストを更新する.
ivory:~ root# /opt/local/bin/port -d sync      
DEBUG: Synchronizing ports tree(s)
Synchronizing local ports tree from rsync://rsync.macports.org/release/ports/
DEBUG: /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/
ports/ /opt/local/var/macports/sources/rsync.macports.org/release/ports
receiving file list ... done

sent 36 bytes received 441394 bytes 58857.33 bytes/sec
total size is 28631119 speedup is 64.86
ivory:~ root#
  • リストが更新された事が確認できた.

8.nagiosをインストールする

  • portコマンドでsearchオプションを使いnagios関連パッケージを検索する.
ivory:~ root# /opt/local/bin/port search nagios
apan @0.3.0-sql (net)
apan plugin for nagios

monarch @2.5.0 (net)
A GUI configuration tool for Nagios written in perl

moodss @21.5 (net)
Modular Object Oriented Dynamic Spreadsheet - A graphical monitoring
application that supports external modules including Nagios
plugins. It supports SNMP when used with the Scotty Tcl extensions package.

nagios @3.2.0 (net)
Nagios is a host and service monitoring program

nagios-plugins @1.4.14 (net)
Nagios plugins for the Nagios host and service monitor

nrpe @2.12 (net)
Nagios Remote Plugin Executor

nsca @2.7.2 (net)
Nagios Service Check Acceptor

xserve-raid-tools @1.2 (sysutils, net)
The xserve-raid-tools package provides command line tools and a daemon for
monitoring Apple Xserve RAIDs. It also contains a
Nagios plugin to monitor Apple Xserve RAIDs.

Found 8 ports.
ivory:~ root#
  • 最低限必要なのは,nagios本体とプラグイン.
  • まずは,nagiosをインストールする.
ivory:~ root# /opt/local/bin/port install nagios
---> Computing dependencies for nagios
---> Fetching expat
---> Attempting to fetch expat-2.0.1.tar.gz from http://nchc.dl.sourceforge.net
/expat
---> Verifying checksum(s) for expat
---> Extracting expat
---> Configuring expat
---> Building expat
---> Staging expat into destroot
---> Installing expat @2.0.1_0
---> Activating expat @2.0.1_0
---> Cleaning expat
---> Fetching gperf
---> Attempting to fetch gperf-3.0.4.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/
gperf
---> Verifying checksum(s) for gperf
---> Extracting gperf
---> Configuring gperf
---> Building gperf
---> Staging gperf into destroot
---> Installing gperf @3.0.4_0
---> Activating gperf @3.0.4_0
---> Cleaning gperf
---> Fetching libiconv
---> Attempting to fetch libiconv-1.13.1.tar.gz from ftp://ftp.dti.ad.jp/pub/
GNU/libiconv
---> Verifying checksum(s) for libiconv
---> Extracting libiconv
---> Applying patches to libiconv
---> Configuring libiconv
---> Building libiconv
---> Staging libiconv into destroot
---> Installing libiconv @1.13.1_0
---> Activating libiconv @1.13.1_0
---> Cleaning libiconv
---> Fetching ncursesw
---> Attempting to fetch ncurses-5.7.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/
ncurses
---> Verifying checksum(s) for ncursesw
---> Extracting ncursesw
---> Configuring ncursesw
---> Building ncursesw
---> Staging ncursesw into destroot
---> Installing ncursesw @5.7_0
---> Activating ncursesw @5.7_0
---> Cleaning ncursesw
---> Fetching ncurses
---> Verifying checksum(s) for ncurses
---> Extracting ncurses
---> Configuring ncurses
---> Building ncurses
---> Staging ncurses into destroot
---> Installing ncurses @5.7_0
---> Activating ncurses @5.7_0
---> Cleaning ncurses
---> Fetching gettext
---> Attempting to fetch gettext-0.17.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/
gettext
---> Verifying checksum(s) for gettext
---> Extracting gettext
---> Applying patches to gettext
---> Configuring gettext
---> Building gettext
---> Staging gettext into destroot
---> Installing gettext @0.17_4
---> Activating gettext @0.17_4
---> Cleaning gettext
---> Fetching perl5.8
---> Attempting to fetch perl-5.8.9.tar.bz2 from http://distfiles.macports.org/
perl5.8
---> Verifying checksum(s) for perl5.8
---> Extracting perl5.8
---> Applying patches to perl5.8
---> Configuring perl5.8
---> Building perl5.8
---> Staging perl5.8 into destroot
---> Installing perl5.8 @5.8.9_3
---> Activating perl5.8 @5.8.9_3
---> Cleaning perl5.8
---> Fetching perl5
---> Verifying checksum(s) for perl5
---> Extracting perl5
---> Configuring perl5
---> Building perl5
---> Staging perl5 into destroot
---> Installing perl5 @5.8.9_0
---> Activating perl5 @5.8.9_0
---> Cleaning perl5
---> Fetching p5-locale-gettext
---> Attempting to fetch gettext-1.05.tar.gz from ftp://ftp.cpan.org/pub/CPAN/
modules/by-module/Locale
---> Attempting to fetch gettext-1.05.tar.gz from http://distfiles.macports.org
/perl5
---> Verifying checksum(s) for p5-locale-gettext
---> Extracting p5-locale-gettext
---> Applying patches to p5-locale-gettext
---> Configuring p5-locale-gettext
---> Building p5-locale-gettext
---> Staging p5-locale-gettext into destroot
---> Installing p5-locale-gettext @1.05_2
---> Activating p5-locale-gettext @1.05_2
---> Cleaning p5-locale-gettext
---> Fetching help2man
---> Attempting to fetch help2man-1.37.1.tar.gz from ftp://ftp.dti.ad.jp/pub/
GNU/help2man
---> Verifying checksum(s) for help2man
---> Extracting help2man
---> Configuring help2man
---> Building help2man
---> Staging help2man into destroot
---> Installing help2man @1.37.1_1
---> Activating help2man @1.37.1_1
---> Cleaning help2man
---> Fetching m4
---> Attempting to fetch m4-1.4.14.tar.bz2 from ftp://ftp.dti.ad.jp/pub/GNU/m4
---> Verifying checksum(s) for m4
---> Extracting m4
---> Configuring m4
---> Building m4
---> Staging m4 into destroot
---> Installing m4 @1.4.14_0
---> Activating m4 @1.4.14_0
---> Cleaning m4
---> Fetching autoconf
---> Attempting to fetch autoconf-2.65.tar.bz2 from ftp://ftp.dti.ad.jp/pub/GNU
/autoconf
---> Verifying checksum(s) for autoconf
---> Extracting autoconf
---> Applying patches to autoconf
---> Configuring autoconf
---> Building autoconf
---> Staging autoconf into destroot
---> Installing autoconf @2.65_1
---> Activating autoconf @2.65_1
---> Cleaning autoconf
---> Fetching automake
---> Attempting to fetch automake-1.11.1.tar.bz2 from ftp://ftp.dti.ad.jp/pub/
GNU/automake
---> Verifying checksum(s) for automake
---> Extracting automake
---> Configuring automake
---> Building automake
---> Staging automake into destroot
---> Installing automake @1.11.1_0
---> Activating automake @1.11.1_0
---> Cleaning automake
---> Fetching zlib
---> Attempting to fetch zlib-1.2.4.tar.bz2 from http://distfiles.macports.org/
zlib
---> Verifying checksum(s) for zlib
---> Extracting zlib
---> Configuring zlib
---> Building zlib
---> Staging zlib into destroot
---> Installing zlib @1.2.4_0
---> Activating zlib @1.2.4_0
---> Cleaning zlib
---> Fetching freetype
---> Attempting to fetch freetype-2.3.12.tar.bz2 from http://nchc.dl.
sourceforge.net/freetype
---> Attempting to fetch freetype-doc-2.3.12.tar.bz2 from http://nchc.dl.
sourceforge.net/freetype
---> Verifying checksum(s) for freetype
---> Extracting freetype
---> Applying patches to freetype
---> Configuring freetype
---> Building freetype
---> Staging freetype into destroot
---> Installing freetype @2.3.12_0+macosx
---> Activating freetype @2.3.12_0+macosx
---> Cleaning freetype
---> Fetching fontconfig
---> Attempting to fetch fontconfig-2.8.0.tar.gz from http://distfiles.macports.
org/fontconfig
---> Verifying checksum(s) for fontconfig
---> Extracting fontconfig
---> Applying patches to fontconfig
---> Configuring fontconfig
---> Building fontconfig
---> Staging fontconfig into destroot
---> Installing fontconfig @2.8.0_0+macosx
---> Activating fontconfig @2.8.0_0+macosx
---> Cleaning fontconfig
---> Fetching jpeg
---> Attempting to fetch jpegsrc.v8a.tar.gz from http://distfiles.macports.org/
jpeg
---> Verifying checksum(s) for jpeg
---> Extracting jpeg
---> Configuring jpeg
---> Building jpeg
---> Staging jpeg into destroot
---> Installing jpeg @8a_0
---> Activating jpeg @8a_0
---> Cleaning jpeg
---> Fetching libpng
---> Attempting to fetch libpng-1.2.42.tar.bz2 from http://nchc.dl.sourceforge.
net/libpng
---> Verifying checksum(s) for libpng
---> Extracting libpng
---> Configuring libpng
---> Building libpng
---> Staging libpng into destroot
---> Installing libpng @1.2.42_0
---> Activating libpng @1.2.42_0
---> Cleaning libpng
---> Fetching libtool
---> Attempting to fetch libtool-2.2.6b.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU
/libtool
---> Verifying checksum(s) for libtool
---> Extracting libtool
---> Configuring libtool
---> Building libtool
---> Staging libtool into destroot
---> Installing libtool @2.2.6b_1+darwin
---> Activating libtool @2.2.6b_1+darwin
---> Cleaning libtool
---> Fetching pkgconfig
---> Attempting to fetch pkg-config-0.23.tar.gz from http://distfiles.macports.
org/pkgconfig
---> Verifying checksum(s) for pkgconfig
---> Extracting pkgconfig
---> Configuring pkgconfig
---> Building pkgconfig
---> Staging pkgconfig into destroot
---> Installing pkgconfig @0.23_1
---> Activating pkgconfig @0.23_1
---> Cleaning pkgconfig
---> Fetching xorg-bigreqsproto
---> Attempting to fetch bigreqsproto-1.1.0.tar.bz2 from http://distfiles.
macports.org/xorg-bigreqsproto
---> Verifying checksum(s) for xorg-bigreqsproto
---> Extracting xorg-bigreqsproto
---> Configuring xorg-bigreqsproto
---> Building xorg-bigreqsproto
---> Staging xorg-bigreqsproto into destroot
---> Installing xorg-bigreqsproto @1.1.0_0
---> Activating xorg-bigreqsproto @1.1.0_0
---> Cleaning xorg-bigreqsproto
---> Fetching xorg-inputproto
---> Attempting to fetch inputproto-2.0.tar.bz2 from http://distfiles.macports.
org/xorg-inputproto
---> Verifying checksum(s) for xorg-inputproto
---> Extracting xorg-inputproto
---> Configuring xorg-inputproto
---> Building xorg-inputproto
---> Staging xorg-inputproto into destroot
---> Installing xorg-inputproto @2.0_0
---> Activating xorg-inputproto @2.0_0
---> Cleaning xorg-inputproto
---> Fetching xorg-kbproto
---> Attempting to fetch kbproto-1.0.4.tar.bz2 from http://distfiles.macports.
org/xorg-kbproto
---> Verifying checksum(s) for xorg-kbproto
---> Extracting xorg-kbproto
---> Configuring xorg-kbproto
---> Building xorg-kbproto
---> Staging xorg-kbproto into destroot
---> Installing xorg-kbproto @1.0.4_0
---> Activating xorg-kbproto @1.0.4_0
---> Cleaning xorg-kbproto
---> Fetching xorg-xproto
---> Attempting to fetch xproto-7.0.16.tar.bz2 from http://distfiles.macports.
org/xorg-xproto
---> Verifying checksum(s) for xorg-xproto
---> Extracting xorg-xproto
---> Configuring xorg-xproto
---> Building xorg-xproto
---> Staging xorg-xproto into destroot
---> Installing xorg-xproto @7.0.16_0
---> Activating xorg-xproto @7.0.16_0
---> Cleaning xorg-xproto
---> Fetching xorg-libXau
---> Attempting to fetch libXau-1.0.5.tar.bz2 from http://distfiles.macports.
org/xorg-libXau
---> Verifying checksum(s) for xorg-libXau
---> Extracting xorg-libXau
---> Configuring xorg-libXau
---> Building xorg-libXau
---> Staging xorg-libXau into destroot
---> Installing xorg-libXau @1.0.5_0
---> Activating xorg-libXau @1.0.5_0
---> Cleaning xorg-libXau
---> Fetching xorg-libXdmcp
---> Attempting to fetch libXdmcp-1.0.3.tar.bz2 from http://distfiles.macports.
org/xorg-libXdmcp
---> Verifying checksum(s) for xorg-libXdmcp
---> Extracting xorg-libXdmcp
---> Configuring xorg-libXdmcp
---> Building xorg-libXdmcp
---> Staging xorg-libXdmcp into destroot
---> Installing xorg-libXdmcp @1.0.3_0
---> Activating xorg-libXdmcp @1.0.3_0
---> Cleaning xorg-libXdmcp
---> Fetching xorg-util-macros
---> Attempting to fetch util-macros-1.6.1.tar.bz2 from http://distfiles.
macports.org/xorg-util-macros
---> Verifying checksum(s) for xorg-util-macros
---> Extracting xorg-util-macros
---> Configuring xorg-util-macros
---> Building xorg-util-macros
---> Staging xorg-util-macros into destroot
---> Installing xorg-util-macros @1.6.1_0
---> Activating xorg-util-macros @1.6.1_0
---> Cleaning xorg-util-macros
---> Fetching xorg-xcmiscproto
---> Attempting to fetch xcmiscproto-1.2.0.tar.bz2 from http://distfiles.
macports.org/xorg-xcmiscproto
---> Verifying checksum(s) for xorg-xcmiscproto
---> Extracting xorg-xcmiscproto
---> Configuring xorg-xcmiscproto
---> Building xorg-xcmiscproto
---> Staging xorg-xcmiscproto into destroot
---> Installing xorg-xcmiscproto @1.2.0_0
---> Activating xorg-xcmiscproto @1.2.0_0
---> Cleaning xorg-xcmiscproto
---> Fetching xorg-xextproto
---> Attempting to fetch xextproto-7.1.1.tar.bz2 from http://distfiles.macports.
org/xorg-xextproto
---> Verifying checksum(s) for xorg-xextproto
---> Extracting xorg-xextproto
---> Configuring xorg-xextproto
---> Building xorg-xextproto
---> Staging xorg-xextproto into destroot
---> Installing xorg-xextproto @7.1.1_0
---> Activating xorg-xextproto @7.1.1_0
---> Cleaning xorg-xextproto
---> Fetching xorg-xf86bigfontproto
---> Attempting to fetch xf86bigfontproto-1.2.0.tar.bz2 from http://distfiles.
macports.org/xorg-xf86bigfontproto
---> Verifying checksum(s) for xorg-xf86bigfontproto
---> Extracting xorg-xf86bigfontproto
---> Configuring xorg-xf86bigfontproto
---> Building xorg-xf86bigfontproto
---> Staging xorg-xf86bigfontproto into destroot
---> Installing xorg-xf86bigfontproto @1.2.0_0
---> Activating xorg-xf86bigfontproto @1.2.0_0
---> Cleaning xorg-xf86bigfontproto
---> Fetching xorg-xtrans
---> Attempting to fetch xtrans-1.2.5.tar.bz2 from http://distfiles.macports.
org/xorg-xtrans
---> Verifying checksum(s) for xorg-xtrans
---> Extracting xorg-xtrans
---> Configuring xorg-xtrans
---> Building xorg-xtrans
---> Staging xorg-xtrans into destroot
---> Installing xorg-xtrans @1.2.5_0
---> Activating xorg-xtrans @1.2.5_0
---> Cleaning xorg-xtrans
---> Fetching xorg-libX11
---> Attempting to fetch libX11-1.3.3.tar.bz2 from http://distfiles.macports.
org/xorg-libX11
---> Verifying checksum(s) for xorg-libX11
---> Extracting xorg-libX11
---> Configuring xorg-libX11
---> Building xorg-libX11
---> Staging xorg-libX11 into destroot
---> Installing xorg-libX11 @1.3.3_0
---> Activating xorg-libX11 @1.3.3_0
---> Cleaning xorg-libX11
---> Fetching xorg-libXext
---> Attempting to fetch libXext-1.1.1.tar.bz2 from http://distfiles.macports.
org/xorg-libXext
---> Verifying checksum(s) for xorg-libXext
---> Extracting xorg-libXext
---> Configuring xorg-libXext
---> Building xorg-libXext
---> Staging xorg-libXext into destroot
---> Installing xorg-libXext @1.1.1_0
---> Activating xorg-libXext @1.1.1_0
---> Cleaning xorg-libXext
---> Fetching xorg-libice
---> Attempting to fetch libICE-1.0.6.tar.bz2 from http://distfiles.macports.
org/xorg-libice
---> Verifying checksum(s) for xorg-libice
---> Extracting xorg-libice
---> Configuring xorg-libice
---> Building xorg-libice
---> Staging xorg-libice into destroot
---> Installing xorg-libice @1.0.6_0
---> Activating xorg-libice @1.0.6_0
---> Cleaning xorg-libice
---> Fetching xorg-libsm
---> Attempting to fetch libSM-1.1.1.tar.bz2 from http://distfiles.macports.org
/xorg-libsm
---> Verifying checksum(s) for xorg-libsm
---> Extracting xorg-libsm
---> Configuring xorg-libsm
---> Building xorg-libsm
---> Staging xorg-libsm into destroot
---> Installing xorg-libsm @1.1.1_0
---> Activating xorg-libsm @1.1.1_0
---> Cleaning xorg-libsm
---> Fetching xorg-libXt
---> Attempting to fetch libXt-1.0.8.tar.bz2 from http://distfiles.macports.org
/xorg-libXt
---> Verifying checksum(s) for xorg-libXt
---> Extracting xorg-libXt
---> Configuring xorg-libXt
---> Building xorg-libXt
---> Staging xorg-libXt into destroot
---> Installing xorg-libXt @1.0.8_0
---> Activating xorg-libXt @1.0.8_0
---> Cleaning xorg-libXt
---> Fetching xpm
---> Attempting to fetch libXpm-3.5.8.tar.bz2 from http://distfiles.macports.
org/xpm
---> Verifying checksum(s) for xpm
---> Extracting xpm
---> Configuring xpm
---> Building xpm
---> Staging xpm into destroot
---> Installing xpm @3.5.8_0
---> Activating xpm @3.5.8_0
---> Cleaning xpm
---> Fetching gd2
---> Attempting to fetch gd-2.0.35.tar.bz2 from http://distfiles.macports.org/
gd2
---> Verifying checksum(s) for gd2
---> Extracting gd2
---> Applying patches to gd2
---> Configuring gd2
---> Building gd2
---> Staging gd2 into destroot
---> Installing gd2 @2.0.35_7
---> Activating gd2 @2.0.35_7
---> Cleaning gd2
---> Fetching fping
---> Attempting to fetch fping-2.4b2_to-ipv6.tar.gz from http://distfiles.
macports.org/fping
---> Verifying checksum(s) for fping
---> Extracting fping
---> Configuring fping
---> Building fping
---> Staging fping into destroot
---> Installing fping @2.4b2_0
---> Activating fping @2.4b2_0
---> Cleaning fping
---> Fetching openssl
---> Attempting to fetch openssl-0.9.8m.tar.gz from http://distfiles.macports.
org/openssl
---> Verifying checksum(s) for openssl
---> Extracting openssl
---> Applying patches to openssl
---> Configuring openssl
---> Building openssl
---> Staging openssl into destroot
---> Installing openssl @0.9.8m_0+darwin
---> Activating openssl @0.9.8m_0+darwin
---> Cleaning openssl
---> Fetching p5-crypt-des
---> Attempting to fetch Crypt-DES-2.05.tar.gz from ftp://ftp.cpan.org/pub/CPAN
/modules/by-module/Crypt
---> Attempting to fetch Crypt-DES-2.05.tar.gz from http://distfiles.macports.
org/perl5
---> Verifying checksum(s) for p5-crypt-des
---> Extracting p5-crypt-des
---> Configuring p5-crypt-des
---> Building p5-crypt-des
---> Staging p5-crypt-des into destroot
---> Installing p5-crypt-des @2.05_0
---> Activating p5-crypt-des @2.05_0
---> Cleaning p5-crypt-des
---> Fetching p5-digest-sha1
---> Attempting to fetch Digest-SHA1-2.12.tar.gz from ftp://ftp.cpan.org/pub/
CPAN/modules/by-module/Digest
---> Attempting to fetch Digest-SHA1-2.12.tar.gz from http://distfiles.macports.
org/perl5
---> Verifying checksum(s) for p5-digest-sha1
---> Extracting p5-digest-sha1
---> Configuring p5-digest-sha1
---> Building p5-digest-sha1
---> Staging p5-digest-sha1 into destroot
---> Installing p5-digest-sha1 @2.12_0
---> Activating p5-digest-sha1 @2.12_0
---> Cleaning p5-digest-sha1
---> Fetching p5-digest-hmac
---> Attempting to fetch Digest-HMAC-1.02.tar.gz from ftp://ftp.cpan.org/pub/
CPAN/modules/by-module/Digest
---> Attempting to fetch Digest-HMAC-1.02.tar.gz from http://distfiles.macports.
org/perl5
---> Verifying checksum(s) for p5-digest-hmac
---> Extracting p5-digest-hmac
---> Configuring p5-digest-hmac
---> Building p5-digest-hmac
---> Staging p5-digest-hmac into destroot
---> Installing p5-digest-hmac @1.02_0
---> Activating p5-digest-hmac @1.02_0
---> Cleaning p5-digest-hmac
---> Fetching p5-net-snmp
---> Attempting to fetch Net-SNMP-5.2.0.tar.gz from ftp://ftp.cpan.org/pub/CPAN
/modules/by-module/Net
---> Attempting to fetch Net-SNMP-5.2.0.tar.gz from http://distfiles.macports.
org/perl5
---> Verifying checksum(s) for p5-net-snmp
---> Extracting p5-net-snmp
---> Configuring p5-net-snmp
---> Building p5-net-snmp
---> Staging p5-net-snmp into destroot
---> Installing p5-net-snmp @5.2.0_0
---> Activating p5-net-snmp @5.2.0_0
---> Cleaning p5-net-snmp
---> Fetching nagios-plugins
---> Attempting to fetch nagios-plugins-1.4.14.tar.gz from http://distfiles.
macports.org/nagios-plugins
---> Verifying checksum(s) for nagios-plugins
---> Extracting nagios-plugins
---> Configuring nagios-plugins
---> Building nagios-plugins
---> Staging nagios-plugins into destroot
---> Installing nagios-plugins @1.4.14_1
---> Activating nagios-plugins @1.4.14_1
---> Cleaning nagios-plugins
---> Fetching nagios
---> Attempting to fetch nagios-3.2.0.tar.gz from http://nchc.dl.sourceforge.
net/nagios
---> Verifying checksum(s) for nagios
---> Extracting nagios
---> Configuring nagios
---> Building nagios
---> Staging nagios into destroot
---> Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting nagios with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo launchctl load -w /Library/LaunchDaemons/org.macports.nagios.plist
###########################################################
---> Installing nagios @3.2.0_0+darwin_8
---> Activating nagios @3.2.0_0+darwin_8


************************************************************
The basic steps to complete the installation are below. But Nagios is
a complex program so you should read the documentation online at
http://www.nagios.org or locally at /opt/local/share/nagios/docs/index.
html
to fully understand Nagios.
************************************************************

IMPORTANT: A user and group called 'nagios' has been created and you must run
nagios as that user.



1) Setup Apache's httpd.conf file for Nagios (restart Apache when done)

Insert the "Nagios stuff" text block somewhere *above* your Apache cgi-bin
ScriptAlias statement:

ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"

#
# Nagios stuff

ScriptAlias /nagios/cgi-bin/ "/opt/local/sbin/nagios/"
<Directory "/opt/local/sbin/nagios">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /opt/local/etc/nagios/htpasswd.users
require valid-user
</Directory>

Alias /nagios "/opt/local/share/nagios"
<Directory "/opt/local/share/nagios">
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>

# End Nagios stuff
#


2) Configure the Nagios sample files in /opt/local/etc/nagios.

a) First, backup the Nagios sample files.

cd /opt/local/etc/nagios
sudo mkdir sample
sudo cp *.cfg-sample sample/

b) Then rename the sample files for use.

sudo -s
for i in *cfg-sample; do mv $i `echo $i | sed -e s/cfg-sample/cfg/`; done;
exit

c) Configure the default commands.cfg file to your requirements. Then test
the Nagios configuration with this command until you get no errors:

sudo nagios -v /opt/local/etc/nagios/nagios.cfg


3) Set user 'nagiosadmin' as a "superuser" to browse all hosts/services in
/opt/local/etc/nagios/cgi.cfg

authorized_for_system_information= nagiosadmin
authorized_for_configuration_information= nagiosadmin
authorized_for_system_commands= nagiosadmin
authorized_for_all_services= nagiosadmin
authorized_for_all_hosts= nagiosadmin
authorized_for_all_service_commands= nagiosadmin
authorized_for_all_host_commands= nagiosadmin


4) Create a 'nagiosadmin' Apache user/password to correspond with the Nagios
Apache
user created above

htpasswd -c /opt/local/etc/nagios/htpasswd.users nagiosadmin

Create other users as desired, omit '-c' since it creates the password file.
Make
additional users login names match Nagios contact names to restrict web
viewing to your
host's by contact.


5) Set Nagios to start at system boot, and start Nagios

OS X 10.4 - Run launchctl so Nagios will start at system boot
sudo launchctl load -w /Library/LaunchDaemons/org.macports.nagios.plist

OS X 10.3 - A startup item was created in /Library/StartupItems
Add "NAGIOS=-YES-" to the /etc/hostconfig file to run Nagios at system boot

You may now start Nagios manually with this command (or a reboot):
sudo /opt/local/var/nagios/nagios.init start


6) You may now login as 'nagiosadmin' to the Nagios web interface at http://
localhost/nagios


NOTE: The SMTP server Postfix is required to enable Nagios email notifications


File Locations:

Configuration files: /opt/local/etc/nagios
Nagios plugins: /opt/local/libexec/nagios
Lock file: /opt/local/var/nagios/nagios.lock
Init file: /opt/local/var/nagios/nagios.init
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/



---> Cleaning nagios
ivory:~ root#
  • とても時間がかかった・・・
  • ログメッセージを読むと,この後に必要な手順が書かれている.
  • インストールされたパッケージを確認する.
ivory:~ root# /opt/local/bin/port installed     
The following ports are currently installed:
autoconf @2.65_1 (active)
automake @1.11.1_0 (active)
expat @2.0.1_0 (active)
fontconfig @2.8.0_0+macosx (active)
fping @2.4b2_0 (active)
freetype @2.3.12_0+macosx (active)
gd2 @2.0.35_7 (active)
gettext @0.17_4 (active)
gperf @3.0.4_0 (active)
help2man @1.37.1_1 (active)
jpeg @8a_0 (active)
libiconv @1.13.1_0 (active)
libpng @1.2.42_0 (active)
libtool @2.2.6b_1+darwin (active)
m4 @1.4.14_0 (active)
nagios @3.2.0_0+darwin_8 (active)
nagios-plugins @1.4.14_1 (active)
ncurses @5.7_0 (active)
ncursesw @5.7_0 (active)
openssl @0.9.8m_0+darwin (active)
p5-crypt-des @2.05_0 (active)
p5-digest-hmac @1.02_0 (active)
p5-digest-sha1 @2.12_0 (active)
p5-locale-gettext @1.05_2 (active)
p5-net-snmp @5.2.0_0 (active)
perl5 @5.8.9_0 (active)
perl5.8 @5.8.9_3 (active)
pkgconfig @0.23_1 (active)
xorg-bigreqsproto @1.1.0_0 (active)
xorg-inputproto @2.0_0 (active)
xorg-kbproto @1.0.4_0 (active)
xorg-libice @1.0.6_0 (active)
xorg-libsm @1.1.1_0 (active)
xorg-libX11 @1.3.3_0 (active)
xorg-libXau @1.0.5_0 (active)
xorg-libXdmcp @1.0.3_0 (active)
xorg-libXext @1.1.1_0 (active)
xorg-libXt @1.0.8_0 (active)
xorg-util-macros @1.6.1_0 (active)
xorg-xcmiscproto @1.2.0_0 (active)
xorg-xextproto @7.1.1_0 (active)
xorg-xf86bigfontproto @1.2.0_0 (active)
xorg-xproto @7.0.16_0 (active)
xorg-xtrans @1.2.5_0 (active)
xpm @3.5.8_0 (active)
zlib @1.2.4_0 (active)
ivory:~ root#
  • プラグインがインストールされている事が確認できた.

9.パーソナルWeb共有 (httpd.conf)の設定を行う

  • NagiosはWebインタフェイスを用いるので,パーソナルWeb共有を使ってGUIが使える様に設定する.
  • パーソナルWeb共有(Apache)の設定をする為に,httpd.confファイルを探す.
  • ファイルを探す為に,locateコマンドを使用する.
ivory:~ root# locate httpd.conf
locate: `/var/db/locate.database': No such file or directory
ivory:~ root#
  • ファイルリストがデータベース化されてないので,locateのデータベースをアップデートする.
ivory:~ root# /usr/libexec/locate.updatedb
>>> WARNING
>>> Executing updatedb as root. This WILL reveal all filenames
>>> on your machine to all login users, which is a security risk.
ivory:~ root#
  • この作業は約3分程かかった.(利用状況によって異なる)
  • ファイルを探す.
ivory:~ root# locate httpd.conf
/opt/local/var/macports/sources/rsync.macports.org/release/ports/sysutils/
backuppc/files/httpd.conf
/opt/local/var/macports/sources/rsync.macports.org/release/ports/www/apache2/
files/patch-httpd.conf.in-sensitive-files.diff
/opt/local/var/macports/sources/rsync.macports.org/release/ports/www/lighttpd/
files/patch-doc-lighttpd.conf.diff
/opt/local/var/macports/sources/rsync.macports.org/release/ports/www/lighttpd-
devel/files/patch-doc-lighttpd.conf
/private/etc/httpd/httpd.conf
/private/etc/httpd/httpd.conf.bak
/private/etc/httpd/httpd.conf.default
ivory:~ root#
  • MacOS Xに最初からインストールされているhttpd.confは,/private/etc以下に有ることが分かった.
ivory:~ root# cp /private/etc/httpd/httpd.conf /private/etc/httpd/httpd.conf.20100319
ivory:~ root#
  • ScriptAliasの定義の前に,設定を追加する.
変更前

# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"

#
# "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased
変更後
    # The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
# Nagios stuff

ScriptAlias /nagios/cgi-bin/ "/opt/local/sbin/nagios/"
<Directory "/opt/local/sbin/nagios">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /opt/local/etc/nagios/htpasswd.users
require valid-user
</Directory>

Alias /nagios "/opt/local/share/nagios"
<Directory "/opt/local/share/nagios">
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>

# End Nagios stuff
#

#
ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"

#
# "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased
  • httpd.confの設定が終了したら,Webサーバを起動する.
  • Webサーバは,MacOS Xに搭載しているパーソナルWeb共有(Apache)を起動する.

  • 正常に起動する事が確認できた.

10.nagios.cfgファイルを作成する

  • サンプルを元に,nagiosの設定ファイルを作成する.
  • 設定ファイルを準備する為,サンプルファイルをバックアップした上でリネームする.
  • まずは,設定ファイルが格納されているディレクトリに移動し,ファイルを確認する.
ivory:~ root# cd /opt/local/etc/nagios
ivory:/opt/local/etc/nagios root# ls -la
total 120
drwxrwxr-x 6 nagios nagios 204 Mar 19 17:11 .
drwxr-xr-x 7 root admin 238 Mar 19 17:11 ..
-rw-rw-r-- 2 nagios nagios 11408 Mar 19 17:11 cgi.cfg-sample
-rw-rw-r-- 2 nagios nagios 43769 Mar 19 17:11 nagios.cfg-sample
drwxrwxr-x 10 nagios nagios 340 Mar 19 17:11 objects
-rw-rw---- 2 nagios nagios 1340 Mar 19 17:11 resource.cfg-sample
ivory:/opt/local/etc/nagios root#
  • sampleディレクトリを作成しサンプルファイルを保存する為に複写する.
ivory:/opt/local/etc/nagios root# mkdir sample
ivory:/opt/local/etc/nagios root# cp *.cfg-sample sample/
ivory:/opt/local/etc/nagios root#
  • サンプルファイルをリネームする.(-sampleを取る)
ivory:/opt/local/etc/nagios root# for i in *cfg-sample; do mv $i `echo $i | sed -e s/cf
g-sample/cfg/`; done;

ivory:/opt/local/etc/nagios root# ls -la
total 120
drwxrwxr-x 7 nagios nagios 238 Mar 19 18:10 .
drwxr-xr-x 7 root admin 238 Mar 19 17:11 ..
-rw-rw-r-- 2 nagios nagios 11408 Mar 19 17:11 cgi.cfg
-rw-rw-r-- 2 nagios nagios 43769 Mar 19 17:11 nagios.cfg
drwxrwxr-x 10 nagios nagios 340 Mar 19 17:11 objects
-rw-rw---- 2 nagios nagios 1340 Mar 19 17:11 resource.cfg
drwxr-xr-x 5 root nagios 170 Mar 19 18:08 sample
ivory:/opt/local/etc/nagios root#
  • 文法をチェックする.
ivory:/opt/local/etc/nagios root# /opt/local/bin/nagios -v /opt/local/etc/nagios
/nagios.cfg


Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Error in configuration file '/opt/local/etc/nagios/nagios.cfg' - Line 465 (Check
result path is not a valid directory)

Error processing main config file!



***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

ivory:/opt/local/etc/nagios root#
  • エラーがでている.nagios.cfgファイルの465行目を確認する.
ivory:/opt/local/etc/nagios root# cat -n nagios.cfg|head -n 466|tail -n 10
457
458 # CHECK RESULT PATH
459 # This is directory where Nagios stores the results of host and
460 # service checks that have not yet been processed.
461 #
462 # Note: Make sure that only one instance of Nagios has access
463 # to this directory!
464
465 check_result_path=/opt/local/var/nagios/spool/checkresults
466
ivory:/opt/local/etc/nagios root#
  • ディレクトリがあるか確認する.
ivory:/opt/local/etc/nagios root# ls -la /opt/local/var/nagios/spool/checkresults
ls: /opt/local/var/nagios/spool/checkresults: No such file or directory
ivory:/opt/local/etc/nagios root# ls -la /opt/local/var/nagios/spool
ls: /opt/local/var/nagios/spool: No such file or directory
ivory:/opt/local/etc/nagios root# ls -la /opt/local/var/nagios
total 16
drwxr-xr-x 4 nagios nagios 136 Mar 19 17:11 .
drwxr-xr-x 5 root admin 170 Mar 19 17:11 ..
-rwxr-xr-x 2 nagios nagios 5228 Mar 19 17:11 nagios.init
drwxrwsr-x 3 nagios nagios 102 Mar 19 17:11 rw
ivory:/opt/local/etc/nagios root#
  • 無かったので作成し,権限を変更する.
ivory:/opt/local/etc/nagios root# mkdir -p /opt/local/var/nagios/spool/checkresults
ivory:/opt/local/etc/nagios root# chown -R nagios:nagios /opt/local/var/nagios/spoo
l/checkresults

ivory:/opt/local/etc/nagios root#
  • 再度チェックする.
ivory:/opt/local/etc/nagios root# /opt/local/bin/nagios -v /opt/local/etc/nagios
/nagios.cfg


Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/opt/local/etc/nagios/objects/commands.cfg'...
Error: Cannot open config file '/opt/local/etc/nagios/objects/commands.cfg' for
reading: No such file or directory
Error processing object config files!



***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

ivory:/opt/local/etc/nagios root#
  • command.cfgファイルが無いとエラーがでた...
  • cfgファイルがどれくらい必要なのか,確認する.
ivory:/opt/local/etc/nagios root# grep cfg  /opt/local/etc/nagios/nagios.cfg|grep -v ^#
cfg_file=/opt/local/etc/nagios/objects/commands.cfg
cfg_file=/opt/local/etc/nagios/objects/contacts.cfg
cfg_file=/opt/local/etc/nagios/objects/timeperiods.cfg
cfg_file=/opt/local/etc/nagios/objects/templates.cfg
cfg_file=/opt/local/etc/nagios/objects/localhost.cfg
resource_file=/opt/local/etc/nagios/resource.cfg

ivory:/opt/local/etc/nagios root#
  • objectsディレクトリを確認する.
ivory:/opt/local/etc/nagios root# ls -la /opt/local/etc/nagios/objects/
total 96
drwxrwxr-x 10 nagios nagios 340 Mar 19 17:11 .
drwxrwxr-x 7 nagios nagios 238 Mar 19 18:29 ..
-rw-rw-r-- 2 nagios nagios 7730 Mar 19 17:11 commands.cfg-sample
-rw-rw-r-- 2 nagios nagios 2166 Mar 19 17:11 contacts.cfg-sample
-rw-rw-r-- 2 nagios nagios 5403 Mar 19 17:11 localhost.cfg-sample
-rw-rw-r-- 2 nagios nagios 3124 Mar 19 17:11 printer.cfg-sample
-rw-rw-r-- 2 nagios nagios 3293 Mar 19 17:11 switch.cfg-sample
-rw-rw-r-- 2 nagios nagios 10812 Mar 19 17:11 templates.cfg-sample
-rw-rw-r-- 2 nagios nagios 3209 Mar 19 17:11 timeperiods.cfg-sample
-rw-rw-r-- 2 nagios nagios 4019 Mar 19 17:11 windows.cfg-sample
ivory:/opt/local/etc/nagios root#
  • 先ほどと同じ様の,sampleディレクトリを作成しバックアップした上で,リネームする.
ivory:/opt/local/etc/nagios root# cd /opt/local/etc/nagios/objects/
ivory:/opt/local/etc/nagios/objects root# mkdir sample
ivory:/opt/local/etc/nagios/objects root# cp *.cfg-sample sample/
ivory:/opt/local/etc/nagios/objects root# for i in *cfg-sample; do mv $i `echo $
i | sed -e s/cfg-sample/cfg/`; done;

ivory:/opt/local/etc/nagios/objects root# ls -la
total 96
drwxrwxr-x 11 nagios nagios 374 Mar 19 18:40 .
drwxrwxr-x 7 nagios nagios 238 Mar 19 18:29 ..
-rw-rw-r-- 2 nagios nagios 7730 Mar 19 17:11 commands.cfg
-rw-rw-r-- 2 nagios nagios 2166 Mar 19 17:11 contacts.cfg
-rw-rw-r-- 2 nagios nagios 5403 Mar 19 17:11 localhost.cfg
-rw-rw-r-- 2 nagios nagios 3124 Mar 19 17:11 printer.cfg
drwxr-xr-x 10 root nagios 340 Mar 19 18:40 sample
-rw-rw-r-- 2 nagios nagios 3293 Mar 19 17:11 switch.cfg
-rw-rw-r-- 2 nagios nagios 10812 Mar 19 17:11 templates.cfg
-rw-rw-r-- 2 nagios nagios 3209 Mar 19 17:11 timeperiods.cfg
-rw-rw-r-- 2 nagios nagios 4019 Mar 19 17:11 windows.cfg
ivory:/opt/local/etc/nagios/objects root#
  • 再度文法チェックする.
ivory:/opt/local/etc/nagios/objects root# /opt/local/bin/nagios -v /opt/local/
etc/nagios/nagios.cfg


Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/opt/local/etc/nagios/objects/commands.cfg'...
Processing object config file '/opt/local/etc/nagios/objects/contacts.cfg'...
Processing object config file '/opt/local/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/opt/local/etc/nagios/objects/templates.cfg'...
Processing object config file '/opt/local/etc/nagios/objects/localhost.cfg'...
Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Checked 8 services.
Checking hosts...
Checked 1 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check
ivory:/opt/local/etc/nagios/objects root#
  • 文法だけは通った.

11.nagios用ユーザの設定

  • nagiosはCGIで動作するが,CGIで使用するスーパーユーザの設定を確認する.
ivory:/opt/local/etc/nagios/objects root# grep authorized /opt/local/etc/nagios/cgi.cfg
authorized_for_system_information=nagiosadmin
authorized_for_configuration_information=nagiosadmin
authorized_for_system_commands=nagiosadmin
authorized_for_all_services=nagiosadmin
authorized_for_all_hosts=nagiosadmin
authorized_for_all_service_commands=nagiosadmin
authorized_for_all_host_commands=nagiosadmin

#authorized_for_read_only=user1,user2
ivory:/opt/local/etc/nagios/objects root#
  • デフォルトはnagiosadminユーザの設定となっている.個別に分けたい場合はこれらの設定を変更すれば良いようだが,今回は変更しな い.
  • nagiosユーザ用の基本認証で接続する為のユーザを作成する.
  • 基本認証用のパスワードファイルが有るか,確認する.
ivory:/opt/local/etc/nagios/objects root# ls -la /opt/local/etc/nagios/htpasswd.users
ls: /opt/local/etc/nagios/htpasswd.users: No such file or directory
ivory:/opt/local/etc/nagios/objects root#
  • htpasswdコマンドを使用し,-cオプションで新規にファイルを作成しながらnagiosadminユーザ用のパスワードを設定する.
ivory:/opt/local/etc/nagios/objects root# /usr/bin/htpasswd -c /opt/local/etc/
nagios/htpasswd.users nagiosadmin

New password:■■■■■■■■■■
Re-type new password:■■■■■■■■■■
Adding password for user nagiosadmin
ivory:/opt/local/etc/nagios/objects root#
  • 作成されたファイルを確認する.
ivory:/opt/local/etc/nagios/objects root# ls -la /opt/local/etc/nagios/htpasswd.
users

-rw-r--r-- 1 root nagios 26 Mar 19 18:57 /opt/local/etc/nagios/htpasswd.
users

ivory:/opt/local/etc/nagios/objects root# cat /opt/local/etc/nagios/htpasswd.
users

nagiosadmin:ve5gU37mosxPU
ivory:/opt/local/etc/nagios/objects root#
  • nagiosadminユーザが確認できた.

12.nagiosを起動する

  • OSが起動した時に自動的に起動する様に,launchctlコマンドを使ってnagiosを登録する.
ivory:/opt/local/etc/nagios/objects root# launchctl load -w /Library/LaunchDaem
ons/org.macports.nagios.plist

ivory:/opt/local/etc/nagios/objects root#
  • nagiosを起動する.
ivory:/opt/local/etc/nagios/objects root# /opt/local/var/nagios/nagios.init 
start

Starting nagios: done.
ivory:/opt/local/etc/nagios/objects root#
  • 起動したプロセスを確認する.
ivory:/opt/local/etc/nagios/objects root# ps -aux | grep nagios
nagios 359 0.3 0.0 28312 484 ?? Ss 7:00PM 0:00.86 /opt/local
/bin/nagios -d /opt/local/etc/nagios/nagios.cfg

nagios 252 0.0 0.2 39216 2364 ?? SNs 6:10PM 0:00.49 /System/
Library/Frameworks/CoreServices.framework/Versions/A/Fra
root 349 0.0 0.2 27884 2100 ?? Ss 7:00PM 0:00.02 /opt/local
/bin/daemondo --label=nagios --start-cmd /opt/local/et
root 396 0.0 0.0 27376 420 p1 S+ 7:04PM 0:00.01 grep
nagios
ivory:/opt/local/etc/nagios/objects root#
  • デーモンとして起動している事が確認できた.
  • Webサーバに接続してみる.
  • nagiosの管理画面に接続できた.
  • 左のメニューから管理画面を選択する.
  • 基本認証画面が表示されるので,ユーザIDをnagiosadmin,パスワードは設定したものを入力する.
  • 動作が確認できた.






広告スペース
Google