みなさん、こんにちは。
@tana_ra です。
この前VoyageGroupのSunriseというインターンに中の人として参加しました。
2年前参加した時、ゴミ未満でしたが、ある程度知識がついていてよかったです。
ただ、ある程度はわかってきたとはいえ、インフラ力が明らかに足りないので、
もっと勉強しようと思いました。
※ Sunrise
ところで、今仕事とは関係なく manavee 関連のサービスをたてようとしてるんですが、そこで何かが起きた時のために、とりあえず、サーバ監視方法を知ろうと思いました。
ということで、今回はxymonによるサーバ監視を試してみようと思います。
試してみようと思ったけど、まだサービスのサーバもできてないので、今回はインストールのみですw
※ manavee
Install
以下の内容を、install.shとして実行すればインストールされます
※Vagrantで作ったVMのboxは tarata/xymon-getting-started · GitHub です。
Install Script
xymon_version='4.3.17' # 必要なパッケージインストール yum install -y make vim gcc pcre-devel rrdtool-devel libpng-devel openssl-devel openldap-devel wget fping httpd if [ -f /usr/bin/fping ];then ln -s /usr/sbin/fping /usr/bin/fping fi # 監視対象のhttpd起動 chkconfig httpd on service httpd start # xymonユーザ作成 grep '^xymon:' /etc/passwd if [ $? -ne 0 ]; then useradd xymon fi # xymonインストール cd /tmp if [ ! -f /tmp/xymon-${xymon_version}.tar.gz ];then wget http://sourceforge.net/projects/xymon/files/Xymon/${xymon_version}/xymon-${xymon_version}.tar.gz tar zxvf xymon-${xymon_version}.tar.gz cd xymon-${xymon_version} ./configure make make install fi # httpd用xymon設定ファイルコピー if [ ! -f /etc/httpd/conf.d/xymon.conf ];then cp /home/xymon/server/etc/xymon-apache.conf /etc/httpd/conf.d/xymon.conf service httpd reload fi # xymon Service起動スクリプトの作成(sedコマンドによりPATHを変更) sed -e "s/DAEMON=\/usr\/lib\/xymon\/server\/bin\/xymon.sh/DAEMON=\/home\/xymon\/server\/bin\/xymon.sh/g" /tmp/xymon-${xymon_version}/rpm/xymon-init.d > /etc/init.d/xymon chmod +x /etc/init.d/xymon if [ ! -f /etc/logrotate.d/xymon ];then cp /tmp/xymon-${xymon_version}/rpm/xymon.logrotate /etc/logrotate.d/xymon fi # xymon Service起動 chmod 701 /home/xymon chkconfig xymon on service xymon restart
これでインストールが完了します。
この後、 http://{serverのip address}/xymon/xymon.html にアクセスすれば以下の様な画面が見れます。
き・・・きいろい・・・けど気にしません。
ほとんどXymonインストールに書いてあったことをまんまやっただけですw
対応はこんな感じです。
# 必要なパッケージインストール yum install -y make vim gcc pcre-devel rrdtool-devel libpng-devel openssl-devel openldap-devel wget fping httpd if [ -f /usr/bin/fping ];then ln -s /usr/sbin/fping /usr/bin/fping fi
# xymonユーザ作成 grep '^xymon:' /etc/passwd if [ $? -ne 0 ]; then useradd xymon fi # xymonインストール cd /tmp if [ ! -f /tmp/xymon-${xymon_version}.tar.gz ];then wget http://sourceforge.net/projects/xymon/files/Xymon/${xymon_version}/xymon-${xymon_version}.tar.gz tar zxvf xymon-${xymon_version}.tar.gz cd xymon-${xymon_version} ./configure make make install fi
# httpd用xymon設定ファイルコピー if [ ! -f /etc/httpd/conf.d/xymon.conf ];then cp /home/xymon/server/etc/xymon-apache.conf /etc/httpd/conf.d/xymon.conf service httpd reload fi # xymon Service起動スクリプトの作成(sedコマンドによりPATHを変更) sed -e "s/DAEMON=\/usr\/lib\/xymon\/server\/bin\/xymon.sh/DAEMON=\/home\/xymon\/server\/bin\/xymon.sh/g" /tmp/xymon-${xymon_version}/rpm/xymon-init.d > /etc/init.d/xymon chmod +x /etc/init.d/xymon if [ ! -f /etc/logrotate.d/xymon ];then cp /tmp/xymon-${xymon_version}/rpm/xymon.logrotate /etc/logrotate.d/xymon fi # xymon Service起動 chmod 701 /home/xymon chkconfig xymon on service xymon restart
サービスの方が進んできたら コンフィグファイルについて の方もやってみようかなと思います。