LoginSignup
8
9

More than 5 years have passed since last update.

MuninでTomcatのモニタリング

Last updated at Posted at 2016-02-16

はじめに

MuninでTomcatをモニタリングします。
MuninやTomcatはすでにインストールされている前提で、
Tomcat側の受け入れ設定とMunin側の監視設定をします。

Tomcat本体の設定は、過去の記事の通りで、
Muninはポート8080を経由してTomcat側のデータを取得します。

環境

  • CentOS Linux release 7.2
  • JDK 1.8.0_112
  • Tomcat 8.5.9
  • munin-node 2.0.25

手順

Tomcat側にユーザ・ユーザ権限の追加

$ vi $TOMCAT_HOME/conf/tomcat-users.xml
$TOMCAT_HOME/conf/tomcat-users.xml
<tomcat-users...>
  (省略)
  # 追記
  <role rolename="manager-status"/>
  <user username="munin" password="munin" roles="manager-status"/>
</tomcat-users>

Tomcatを再起動し、監視用のI/Fにアクセスできるか確認します。

$ curl --user munin:munin http://localhost:8080/manager/status?XML=true
<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="/manager/xform.xsl" ?>
<status><jvm><memory free='112838232' total='261750784' max='261750784'/>(省略)</status>

Muninの監視用プラグイン等のインストール・配置

$ yum install munin-java-plugins
$ ln -s /usr/share/munin/plugins/tomcat_access /etc/munin/plugins/
$ ln -s /usr/share/munin/plugins/tomcat_jvm /etc/munin/plugins/
$ ln -s /usr/share/munin/plugins/tomcat_threads /etc/munin/plugins/
$ ln -s /usr/share/munin/plugins/tomcat_volume /etc/munin/plugins/
$ yum install perl-XML-Simple

MuninのTomcat監視設定

$ vi /etc/munin/plugin-conf.d/munin-node
/etc/munin/plugin-conf.d/munin-node
# 設定ファイル追記
[tomcat*]
env.host      localhost
env.port      8080
env.request   /manager/status?XML=true
env.user      munin
env.password  munin
env.timeout   30
env.connector "http-nio-8080"

Muninの設定反映・再起動(必要に応じて)

$ munin-node-configure --shell | sh -x
$ systemctl restart munin-node

動作確認

次回以降のグラフ生成のタイミングでTomcatのグラフが生成されていることを確認します。
1455647583283.jpg

Webツールも公開しています。
Web便利ツール@ツールタロウ

8
9
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
8
9