NRPEでNagiosPluginsのMySQLチェックスクリプトを導入する

Pocket

検証環境はCentOS 5.6です。NagiosプラグインであるNRPEを監視対象サーバーにインストールし、MySQLサーバーの監視を行おうとしました。
参考サイトの手順通り進められ、CPU負荷、空きメモリ領域等は正しく取得できたのですが、MySQLの監視結果は以下のようになってしまいました。

NRPE: Unable to read output 

監視対象サーバーを調べてみると、どうやらMySQL監視プログラムが存在しないようです。

/usr/local/nagios/libexec/check_mysql

(よくよく確認したら参考サイトにyum -y install mysql-develするように書いてありました)

おかしいなーと思い、コンパイルを行ったディレクトリをあさってみましたがそれらしいバイナリがなさそうです。

nagios-plugins-1.4.16# find . -name "*mysql*"
./plugins/t/check_mysql_query.t
./plugins/t/check_mysql.t
./plugins/check_mysql_query.c
./plugins/.deps/check_mysql_query-check_mysql_query.Po
./plugins/.deps/check_mysql-check_mysql.Po
./plugins/check_mysql.c
./m4/np_mysqlclient.m4

仕切り直してもう一度configureを走らせます。

# make clean
# ./configure

... ずらずらずらー ...

            --with-apt-get-command: 
              --with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s
               --with-ping-command: /bin/ping -n -U -w %d -c %d %s
                       --with-ipv6: yes
                      --with-mysql: no
                    --with-openssl: yes
                     --with-gnutls: no
               --enable-extra-opts: no
                       --with-perl: /usr/local/bin/perl
             --enable-perl-modules: no
                     --with-cgiurl: /nagios/cgi-bin
               --with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin
                   --enable-libtap: no

--with-mysqlオプションがnoになっているのを発見。

configureの中身を調べてみます。

  --with-mysql=DIR        Locates mysql libraries. Expects
                          DIR/bin/mysql_config. Default to search for
                          mysql_config in PATH

mysql_configのパスを指定せよとあります。

# ./configure --with-mysql=/usr/bin/mysql_config

だめでした。configureの結果をmysqlで絞り込んでみます。

# ./configure --with-mysql=/usr/bin/mysql_config | grep mysql
configure: WARNING: Skipping PostgreSQL plugin (check_pgsql)
configure: WARNING: LIBS="-lcrypt " CPPFLAGS=""
configure: WARNING: install PostgreSQL libs to compile this plugin (see REQUIREMENTS).
configure: WARNING: Skipping radius plugin
configure: WARNING: install radius libs to compile this plugin (see REQUIREMENTS).
configure: WARNING: Skipping mysql plugin
configure: WARNING: install mysql client libs to compile this plugin (see REQUIREMENTS).
configure: WARNING: Get lmstat from Globetrotter Software to monitor flexlm licenses
configure: WARNING: Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins
configure: WARNING: Tried /usr/local/bin/perl - install Net::SNMP perl module if you want to use the perl snmp plugins
configure: WARNING: Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin
configure: WARNING: Get fping from http://www.fping.com in order to make check_fping plugin
configure: WARNING: Could not find qmail-qstat or eqivalent
                      --with-mysql: no
install mysql client libs to compile this plugin

MySQLクライアントのライブラリをインストールするように書いてありました。
MySQLクライアント開発用ヘッダをインストールします。

# yum -y install mysql-devel

今度はconfigureもうまく通って、make install後にちゃんとcheck_mysqlのバイナリがインストールされました。

参考

リモートホストサービス監視(Nagios+nrpe) – CentOSで自宅サーバー構築

投稿者紹介

株式会社ユニキャスト
私たちは、テクノロジに魅せられた個性あふれるメンバーによって構成された茨城県日立市に本社を構えるベンチャー企業です。
”テクノロジを通して「驚き」と「感動」を創造し、人々の「夢」と「笑顔」を支えます。” の経営理念をモットーに明るい未来を描き、ワクワクする企画提案を続けて参ります。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください