■munin用CommuniGate Pro監視プラグインサンプル
 CommuniGate Proの各プロトコルの接続状況を確認できるプラグインのサンプル。net-snmpとCommuniGate Pro側のsnmpサーバ設定が必須。OS側のsnmp設定と重ならないようにするためにCGPのポート番号を変更している場合には ホストIP:ポート番号 で記述する。

■プラグインを作成する
# vi /etc/munin/plugins/cgp_active
以下

  1. #!/bin/sh
  2.  
  3. if [ "$1" = "autoconf" ]; then
  4.        if [ -x /usr/bin/snmpwalk ]; then
  5.                echo yes
  6.                exit 0
  7.        else
  8.                echo no
  9.                exit 1
  10.        fi
  11. fi
  12.  
  13. if [ "$1" = "config" ]; then
  14.  
  15.        # ___WARNING=10000
  16.  
  17.        echo 'graph_title CGP Active Sessions'
  18.        echo "graph_args -l 0"
  19.        echo 'graph_vlabel CGP Active Sessions'
  20.        echo 'graph_info This graph shows CGP Active Sessions'
  21.        echo 'graph_category CGP'
  22.  
  23.        echo 'sip_server.label SIP Server'
  24.        echo 'sip_server.draw LINE2'
  25.        echo "sip_server.info SIP Server"
  26.  
  27.        echo 'sip_clients.label SIP Clients'
  28.        echo 'sip_clients.draw LINE2'
  29.        echo "sip_clients.info SIP Clients"
  30.  
  31.        echo 'sip_act.label SIP Con'
  32.        echo 'sip_act.draw LINE2'
  33.        echo "sip_act.info SIP Con"
  34.  
  35.        echo 'media_act.label Media Ch'
  36.        echo 'media_act.draw LINE2'
  37.        echo "media_act.info Media Ch"
  38.  
  39.        echo 'media_leg.label Media Leg'
  40.        echo 'media_leg.draw LINE2'
  41.        echo "media_leg.info Media Leg"
  42.  
  43.        echo 'prox_act.label Proxy'
  44.        echo 'prox_act.draw LINE2'
  45.        echo "prox_act.info Proxy"
  46.  
  47.        echo 'ximss.label XIMSS'
  48.        echo 'ximss.draw LINE2'
  49.        echo "ximss.info XIMSS"
  50.  
  51.        echo 'airsync.label AirSync'
  52.        echo 'airsync.draw LINE2'
  53.        echo "airsync.info AirSync"
  54.  
  55.        exit 0
  56. fi
  57.  
  58.        echo -n "sip_server.value "
  59.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.2.2.1 | awk '{ print $4 }'
  60.  
  61.        echo -n "sip_clients.value "
  62.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.2.3.1 | awk '{ print $4 }'
  63.  
  64.        echo -n "sip_act.value "
  65.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.2.1.41 | awk '{ print $4 }'
  66.  
  67.        echo -n "media_act.value "
  68.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.15.1 | awk '{ print $4 }'
  69.  
  70.        echo -n "media_leg.value "
  71.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.15.21 | awk '{ print $4 }'
  72.  
  73.        echo -n "prox_act.value "
  74.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.7.1 | awk '{ print $4 }'
  75.  
  76.        echo -n "ximss.value "
  77.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.10.1 | awk '{ print $4 }'
  78.  
  79.        echo -n "airsync.value "
  80.        snmpwalk -v 2c -c password 192.168.0.xxx 1.3.6.1.4.1.5678.2.1.1.15.1 | awk '{ print $4 }'

■値が取得できることを確認する
# cd /etc/munin/plugins/
# munin-run cgp_active

, , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

RH5.8にmunin-nodeを無理やり導入したメモ

■RH5.8にmunin-nodeを無理やり導入したメモ
 RH5.8のサブスクリプション無しのテスト環境に無理やりmunin-nodeを追加したメモ。RHはインストール時にサブスクリプション番号を入力しないと、yum等でアップデートができないためパッケージ導入等もままならないのだが、とりあえずテストでとある数値を取るためだけにサブスクリプションを消費できなかったので、無理やりインストール可能か試してみた。VirtualboxのVMにRH5.8をインストールしたものに以下の手順で導入。一応munin-nodeは動作して、一部数値が取れないプラグインもあったものの、およそ必要そうなものは数値が取れることが確認できたので目的は完了。VMは破棄。

■手順
1)epelリポジトリ導入

  1. # wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/5Server/x86_64/epel-release-5-4.noarch.rpm
  2. # rpm -ivh epel-release-5-4.noarch.rpm
  3. # yum update

2)CentOSのディレクトリから不足分を調達

  1. # wget http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.8/os/x86_64/CentOS/sysstat-7.0.2-11.el5.x86_64.rpm
  2. # rpm -ivh sysstat-7.0.2-11.el5.x86_64.rpm
  3. # wget http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.8/os/x86_64/CentOS/perl-DBI-1.52-2.el5.x86_64.rpm
  4. # rpm -ivh perl-DBI-1.52-2.el5.x86_64.rpm
  5. # wget http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.8/os/x86_64/CentOS/perl-Digest-SHA1-2.11-1.2.1.x86_64.rpm
  6. # rpm -ivh perl-Digest-SHA1-2.11-1.2.1.x86_64.rpm
  7. # wget http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.8/os/x86_64/CentOS/perl-Digest-HMAC-1.01-15.noarch.rpm
  8. # rpm -ivh perl-Digest-HMAC-1.01-15.noarch.rpm

3)munin-nodeをインストール

  1. # yum install munin-node
, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■muninでアラートメールを送信するメモ
 muninはグラフ書くだけじゃないよということでアラートメールを送信できるようにしたメモ。

■監視アラート設定の追加
/etc/munin/munin.confに以下追記

1) 送り先と送る内容を追加

  1. contact.email.command mail -s "Munin ${var:group}::${var:host}" user@example.com
  2. contact.email.always_send warning critical

2)監視対象サーバにアラート用設定を追加

  1. [localhost]
  2.    address 127.0.0.1
  3.    use_node_name yes
  4.    load.load.warning 5
  5.    load.load.critical 10
  6.    df._dev_sda3.warning 50
  7.    hddtemp_smartctl.sda.warning 50
  8.    hddtemp_smartctl.sda.critical 60

 追加したい内容は以下の方法で項目と数値を決定する

 # /usr/sbin/munin-run プラグイン名

 出力されるパラメータを見て

 プラグイン.パラメータ.レベル 数値 で記述。
 数値は範囲指定も可能 上限:下限

3) アラートの強制送信で動作確認

  1. # su - munin --shell=/bin/bash -c "/usr/share/munin/munin-limits --contact email --force"

■プロセス監視/URL監視(サイト監視/コンテンツ監視)/ログ監視
 便利そうなのでご紹介

 お前の血は何色だ!! 4:muninでヘルスチェック(死活監視/生存監視/サイト監視とか)
 http://d.hatena.ne.jp/rti7743/20110604/1307219520

■より詳細な設定
 こちらを参考にさせていただきました

 棚からパルチャギ:Muninでアラートメールの送信 (メール送信編)
 http://castor.s26.xrea.com/blog/2007/10/19

, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■CommuniGate Proの稼働状況をmuninで監視する
 CommuniGate Proの稼働状態をmuninで監視するためのメモ。前記事の続き。CommuniGate Proでのsnmp取得設定ができていることを前提とする。

■サーバ設定
 snmpwalkを使用可能にする
 # yum install net-snmp-utils
 CGPから値が取得できることを確認する
 # snmpwalk -v 2c -c password servername .1.3.6.1.4.1.5678.2

■script作成から設置まで
 サンプルとしてCGPのスレッド数を取得するscriptを作成する
 # cd /usr/share/munin/plugins/
 以下のscriptを作成
 # vi cgp_threads

  1. #!/bin/sh
  2.  
  3. if [ "$1" = "autoconf" ]; then
  4.         if [ -x /usr/bin/snmpwalk ]; then
  5.                 echo yes
  6.                 exit 0
  7.         else
  8.                 echo no
  9.                 exit 1
  10.         fi
  11. fi
  12.  
  13. if [ "$1" = "config" ]; then
  14.  
  15.         # THREADWARNING=200
  16.  
  17.         echo 'graph_title CGP Active Threads'
  18.         echo "graph_args -l 0"
  19.         echo 'graph_vlabel CGP Active Threads'
  20.         echo 'graph_info This graph shows CGP Active Threads'
  21.         echo 'graph_category CGP'
  22.  
  23.         echo 'threads.label CGP Active Threads'
  24.         echo 'threads.draw LINE2'
  25.         echo "threads.warning $THREADWARNING"
  26.         echo "threads.info CGP Active Threads"
  27.  
  28.         exit 0
  29. fi
  30.  
  31.         echo -n "threads.value "
  32.         snmpwalk -v 2c -c password servername 1.3.6.1.4.1.5678.2.100.20 | awk '{ print $4 }'

 実行権を付与する
 # chmod +x cgp_threads
 値が取得できるか確認する
 # munin-run -servicedir /usr/share/munin/plugins/ cgp_threads
 値が取得できれば実行できるよう設定する
 # cd /etc/munin/plugins/
 # ln -s /usr/share/munin/plugins/cgp_threads cgp_threads

これで後はグラフが更新されるのを待てばよい。

, , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■CommuniGate Proからsnmpで稼働状況取得
 CommuniGate Proの稼働状態をsnmpで取得するためのメモ。muninやzabbixなどの監視ツールで稼働状況を詳細に把握するためデータ取得を可能にする。

■サーバ設定
 CGPサーバ側でsnmpを有効にする(OSではなくCGPで)
 管理画面>設定>サービス>SNMP
 パスワードとトラップパスワードを設定する
 リスナーのリンクを開いてポートに161を指定する
 必要ならリモートIPアドレス制限に値を入力し制限をかける

■取得側設定
 CGPのsnmp出力はSNMPV2なので以下のコマンドで全パラメータが取得できる
 $ snmpwalk -v 2c -c password servername .1.3.6.1.4.1.5678.2

 MIB情報は以下より取得可能
 管理画面>モニター>統計>MIBのリンクをクリック

muninでグラフを作成するには、/usr/share/munin/plugins以下にあるsnmp関連のscriptを改造すればよいと思われる。

, , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■muninでグラフが作成されない時の対処メモ
 cpubyuserのグラフがうまく作成されていなかったので調べて対処した時のメモ。

・グラフの作成ログをチェック
 # tail -200 /var/log/munin/munin-graph.log
 以下のエラーを確認

  1. [RRD ERROR] Unable to graph /var/www/html/munin/localhost/localhost/cpubyuser-month.png : opening '/var/lib/munin/--g.rrd': No such file or directory
  2. [RRD ERROR] Unable to graph /var/www/html/munin/localhost/localhost/cpubyuser-week.png : opening '/var/lib/munin/--g.rrd': No such file or directory
  3. [RRD ERROR] Unable to graph /var/www/html/munin/localhost/localhost/cpubyuser-day.png : opening '/var/lib/munin/--g.rrd': No such file or directory
  4. [RRD ERROR] Unable to graph /var/www/html/munin/localhost/localhost/cpubyuser-year.png : opening '/var/lib/munin/--g.rrd': No such file or directory

・以下のページを参考に該当箇所を修正
 http://munin-monitoring.org/ticket/794
 http://munin-monitoring.org/attachment/ticket/794/diff

 # vi /usr/lib/perl5/vendor_perl/5.8.8/Munin/Master/HTMLOld.pm
 # vi /usr/lib/perl5/vendor_perl/5.8.8/Munin/Master/LimitsOld.pm
 # vi /usr/lib/perl5/vendor_perl/5.8.8/Munin/Master/Utils.pm

 これで問題なくグラフが作成されるようになった。

,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■CPUとHDDをmuninで監視する設定メモ
 稼働中のマシンのCPU温度やHDDの状況をmuninで監視する設定のメモ。

■CPU温度の監視
 事前にlm_sensors設定を行っていること

・有効な設定の確認をする
 # /usr/share/munin/plugins/sensors_ suggest

・temp設定を追加する
 # cd /etc/munin/plugins/
 # ln -s /usr/share/munin/plugins/sensors_ sensors_temp

・動作確認
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins sensors_temp

・設定を有効にする
 # service munin-node restart

■HDDの温度及びSMARTデータの監視
 HDDがSMART対応の必要があるので注意

・温度監視を追加
 # cd /etc/munin/plugins/
 # ln -s /usr/share/munin/plugins/hddtemp_smartctl hddtemp_smartctl

・SMARTデータの監視追加
 # ln -s /usr/share/munin/plugins/smart_ smart_sda

・設定ファイルを作成して設定追加
 # vi /etc/munin/plugin-conf.d/hddtemp_smartctl
 以下を追記
 env.drives sda
 env.type_sda ata

 # vi /etc/munin/plugin-conf.d/smart_
 以下を追記
 [smart_*]
 user root
 
 [smart_sda]
 env.smartargs -d ata

・動作確認
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins hddtemp_smartctl
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins smart_sda
 以下のエラーが出た場合には修正をする

  Traceback (most recent call last):
   File “/etc/munin/plugins/smart_sda”, line 398, in ?
   exit(0)
  TypeError: ‘str’ object is not callable

 398行目の exit(0) → sys.exit(0) に修正

・設定を有効にする
 # service munin-node restart

,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

mysqlの障害を監視する各種設定メモ
 mysqlが過負荷になる現象が確認されたので、障害対応と監視を強化するために行った作業のメモ。

■muninによる監視の追加
・muninは導入済みの想定
 /usr/share/munin/plugins/mysql_ を利用する

・基本監視可能項目のリスト 出力された項目が設定可能
 # /usr/share/munin/plugins/mysql_ suggest
 Cache::Cacheのエラーが出る場合は以下を実行
 # yum install perl-Cache-Cache

・基本監視項目を設定
 # cd /etc/munin/plugins
 # ln -s /usr/share/munin/plugins/mysql_ mysql_commands
 # ln -s /usr/share/munin/plugins/mysql_ mysql_connections
 # ln -s /usr/share/munin/plugins/mysql_ mysql_slow
 # ln -s /usr/share/munin/plugins/mysql_ mysql_myisam_indexes
 # ln -s /usr/share/munin/plugins/mysql_ mysql_network_traffic
 # ln -s /usr/share/munin/plugins/mysql_ mysql_qcache
 # ln -s /usr/share/munin/plugins/mysql_ mysql_qcache_mem

・設定の追加
 # vi /etc/munin/plugin-conf.d/munin-node
 以下を追記
 [mysql_*]
 env.mysqlconnection DBI:mysql:mysql;host=127.0.0.1;port=3306
 env.mysqluser root
 env.mysqlpassword password

・データ取得できているか動作確認する
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins mysql_commands
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins mysql_connections
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins mysql_slow
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins mysql_myisam_indexes
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins mysql_network_traffic
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins mysql_qcache
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins mysql_qcache_mem

・設定を有効にする
 # service munin-node restart

■mysqlに障害対応用ログ取得設定を追記
・slowログとバイナリーログを7日分出力する
 # vi /etc/my.cnf
 log-slow-queries=/var/log/mysql/slow.log
 long_query_time=3
 log-bin = /var/log/mysql/mysql-bin
 set-variable = expire_logs_days=7

・保存場所を作成してmysqlを再起動
 # mkdir /var/log/mysql
 # chown -R mysql:mysql /var/log/mysql
 # service mysqld restart

■稼働中のmysqlの状態把握ができるようにする
・mytopをインストールする
 # yum install mytop

・設定ファイルを作成する
 # vi ~/.mytop
 以下の内容を設定に合わせて記入
 user=root
 pass=password
 host=localhost
 db=mysqldbname
 delay=3
 port=3306
 socket=
 batchmode=0
 header=1
 color=1
 idle=1

・mytopを実行する
 # mytop
 終了時はqキー

・innotopをインストールする
 # yum install innotop

・innotopを起動する
 # innotop
 画面の指示に従い設定を入力する
 ヘルプは?、終了はqキー

・innotopの設定を編集する
 # vi ~/.innotop/innotop.ini
 connectionsの設定を編集
 mysqldbname=user=root pass=password have_user= have_pass=
  dsn=DBI:mysql:;host=localhost;port=3306 savepass= dl_table=

■プロセス監視ツールを追加する
・atopをインストールする
 # yum install atop
 実行は以下
 # atop
 異常値を色で示してくれるのでわかりやすい

■プロセスの状況を監視する設定をmuninに追加する
・user単位の使用状況を確認可能なmuninプラグインcpubyuserを設定する
 http://exchange.munin-monitoring.org/plugins/cpubyuser/details
 # cd /usr/share/munin/plugins/
 # wget http://exchange.munin-monitoring.org/plugins/cpubyuser/version/1/download
 # mv download cpubyuser

・cpubyuserの設定を追加
 # vi /etc/munin/plugin-conf.d/munin-node
 以下監視したいuser名を追記
 [cpubyuser]
 env.USERS root postfix mysql apache munin munin-node

・process単位の使用状況を確認可能なmuninプラグインcpu_by_processを設定する
 http://exchange.munin-monitoring.org/plugins/cpu_by_process/details
 # wget http://exchange.munin-monitoring.org/plugins/cpu_by_process/version/1/download
 # mv download cpu_by_process

・cpu_by_processの設定を追加
 # vi /etc/munin/plugin-conf.d/munin-node
 以下を追記
 [cpu_by_process]
 user root

・プラグインを有効にする
 # cd /etc/munin/plugins
 # ln -s /usr/share/munin/plugins/cpubyuser cpubyuser
 # ln -s /usr/share/munin/plugins/cpu_by_process cpu_by_process

・データ取得できているか動作確認する
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins cpubyuser
 # /usr/sbin/munin-run -servicedir /etc/munin/plugins cpu_by_process

・設定を有効にする
 # service munin-node restart

, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■Scientific Linux 5.6でSNSサーバを構築するメモ
 CentOS5系で運用中のSNSサーバをScientific Linux5系に移行するため、試験環境としてDell D520にインストールを行った時のメモ。ここからはSNS等アプリケーション導入前までの構築メモ。OS自体は前記事を参照。

 D520にScientific Linux 5.6をインストールしたメモ
 http://blog.isnext.net/issy/archives/1281

■高機能メールサーバCommuniGate Proをインストール
 phpアプリで必要なケースが多いのでpostfixを活かしたままCGPを有効にする
・postfix側の設定変更
 # vi /etc/postfix/master.cf
  smtp inet n – n – – smtpd
   ↓
  #smtp inet n – n – – smtpd
 # vi /etc/postfix/main.cf
  mydestination = $myhostname, localhost.$mydomain, localhost
   ↓
  mydestination = localhost
  追記
  relayhost = 自IPアドレス
  myhostname = po.ホストネーム セルフループ回避呪文
・postfixを再起動
 # service postfix restart
・postfixがsmtpをLISTENしてないことを確認
 # lsof -i

・CommuniGate Proの最新版をインストール
 (商用だがCommunityライセンス下で5ユーザまで無料で利用可能)
 # wget http://www.communigate.com/pub/CommuniGatePro/CGatePro-Linux.x86_64.rpm
 # rpm -ivh CGatePro-Linux.x86_64.rpm
 # service CommuniGate start
・CGPの管理画面にアクセスするためにiptableでポート追加
 # vi /etc/sysconfig/iptables
  -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8010 -j ACCEPT 追記
 # service iptables restart
・ブラウザでhttp://サーバIPアドレス:8010/へアクセスして設定
 postmasterのパスワード設定
 Basic認証が表示されるのでID:postmasterと設定したパスワードでログイン
  japanese japanese(ISO) (+0900)japan/Korea expert で設定

■日本語全文検索対応mysql/Tritonnインストール
・標準導入のMySQLを削除する
 # yum remove mysql
・perl-DBIのインストールを確認(あればOK)
 # rpm -qa | grep -i perl-DBI
・最新のtritonnパッケージ群をダウンロード
 # wget http://iij.dl.sourceforge.jp/tritonn/44614/MySQL-client-5.0.87-tritonn.1.0.12a.x86_64.rpm
 # wget http://iij.dl.sourceforge.jp/tritonn/44614/MySQL-devel-5.0.87-tritonn.1.0.12a.x86_64.rpm
 # wget http://iij.dl.sourceforge.jp/tritonn/44614/MySQL-server-5.0.87-tritonn.1.0.12a.x86_64.rpm
 # wget http://iij.dl.sourceforge.jp/tritonn/44614/MySQL-shared-5.0.87-tritonn.1.0.12a.x86_64.rpm
 # wget http://iij.dl.sourceforge.jp/tritonn/44614/mecab-0.98-tritonn.1.0.12a.x86_64.rpm
 # wget http://iij.dl.sourceforge.jp/tritonn/44614/mecab-ipadic-2.7.0.20070801-tritonn.1.0.12a.x86_64.rpm
 # wget http://iij.dl.sourceforge.jp/tritonn/44614/senna-1.1.4-tritonn.1.0.12a.x86_64.rpm
・以下の順番でインストール
 # rpm -ivh mecab-0.98-tritonn.1.0.12a.x86_64.rpm
 # rpm -ivh mecab-ipadic-2.7.0.20070801-tritonn.1.0.12a.x86_64.rpm
 # rpm -ivh senna-1.1.4-tritonn.1.0.12a.x86_64.rpm
 # rpm -ivh MySQL-shared-5.0.87-tritonn.1.0.12a.x86_64.rpm
 # rpm -ivh MySQL-client-5.0.87-tritonn.1.0.12a.x86_64.rpm
 # rpm -ivh MySQL-server-5.0.87-tritonn.1.0.12a.x86_64.rpm
 # rpm -ivh MySQL-devel-5.0.87-tritonn.1.0.12a.x86_64.rpm
・MySQLのパスワード設定を行う
 # /usr/bin/mysqladmin -u root password ‘rootpassword’
・ログインして動作確認
 # mysql -u root -p
・設定ファイルを適当に選んで配置する
 # cp /usr/share/mysql/my-large.cnf /etc/my.cnf
・utf8で使いたい場合には以下の行を各項目で追記
 # vi /etc/my.cnf
  [mysqld]
  default-character-set = utf8
  [mysqldump]
  default-character-set = utf8
  
  default-character-set = utf8
・設定を反映させる(mysqldでないことに注意)
 # service mysql restart
・設定変更を確認
 # mysql -u root -p
  mysql> status
  …
  Server characterset: utf8
  Db characterset: utf8
  Client characterset: utf8
  Conn. characterset: utf8
  …

■MyNETS(SNSサーバアプリ)の導入準備をする
・MyNETSに必要なコンポーネントをインストール
 # yum install php-mcrypt php-mbstring php-gd php-mysql php-xmlrpc php-xml php-eaccelerator ImageMagick
・ImageMagickの強制アップデートをする
 SL5.6のImageMagickにもCentOSと同じ問題があるので最新版で入替えする
 # wget http://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-6.7.1-3.x86_64.rpm
 # rpm -Uvh –force ImageMagick-6.7.1-3.x86_64.rpm

■監視系に必要なアプリを導入する
・sysstatをインストール
 # yum install sysstat
・lm_sensorsをインストール
 # yum install lm_sensors
 # sensors-detect で設定
 # sensors で動作確認
・muninをインストール
 # yum install munin munin-node
 # munin-node-configure で設定確認
・apacheの監視を有効にする
 # vi /etc/httpd/conf/httpd.conf
  #ExtendedStatus On
   ↓
  ExtendedStatus On

  #<Location /server-status>
  # SetHandler server-status
  # Order deny,allow
  # Deny from all
  # Allow from .example.com
  #</Location>
   ↓
  <Location /server-status>
   SetHandler server-status
   Order deny,allow
   Deny from all
   Allow from 127.0.0.1
  </Location>
・muninを再設定する
 # munin-node-configure -suggest で設定可能な内容を確認
 # munin-node-configure -shell | sh で設定
 # munin-node-configure 設定を確認
 # service munin-node start 監視を開始

※MySQLに関するmunin監視設定は以下を参照

 muninで複数mysqldを監視する設定メモ
 http://blog.isnext.net/issy/archives/957

■SNSアプリケーションの導入
 以下のURLの「8)SNSサーバとしての設定」を参照

 カスタム版MyNETSとCentOS5で1万人規模のSNSを構築する
 http://blog.isnext.net/issy/archives/384

, , , , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■muninで複数mysqldを監視する設定メモ
 CentOS環境で同一ホスト内に設定された複数mysqld自体やデータベースサイズの監視をmuninで行う設定のメモ。epelリポジトリが必要。munin設定ができている前提。複数mysqldの起動設定メモはこちら

■複数mysqld自体の監視

1)必要なモジュールをインストールする
# yum install perl-Cache perl-Cache-Cache perl-DBD-MySQL

2)監視ファイルがサポートしているパラメータの参照
/usr/share/munin/plugins/mysql_ のファイルを利用する
以下のコマンドで出てきたリストのパラメータが取得可能

# /usr/share/munin/plugins/mysql_ suggest
mysql_bin_relay_log
mysql_commands
mysql_connections
mysql_files_tables
mysql_innodb_bpool
mysql_innodb_bpool_act
mysql_innodb_insert_buf
mysql_innodb_io
mysql_innodb_io_pend
mysql_innodb_log
mysql_innodb_rows
mysql_innodb_semaphores
mysql_innodb_tnx
mysql_myisam_indexes
mysql_network_traffic
mysql_qcache
mysql_qcache_mem
mysql_replication
mysql_select_types
mysql_slow
mysql_sorts
mysql_table_locks
mysql_tmp_tables

3)複数mysqldの分をコピーで作成し必要な編集を行う

# cp /usr/share/munin/plugins/mysql_ /usr/share/munin/plugins/mysql01_
# vi /usr/share/munin/plugins/mysql01_

132行目からデータソースを指定
my %config = (
‘dsn’ => $ENV{‘mysqlconnection’} || ‘DBI:mysql:mysql;host=localhost;mysql_socket=/path/to/mysql01/mysql.sock’,
‘user’ => $ENV{‘mysqluser’} || ‘dbuser’,
‘password’ => $ENV{‘mysqlpassword’} || ‘password’,
);

145行目でキャッシュネームを指定
‘namespace’ => ‘munin_mysql01’,

690行目で接頭値を指定
my $graph = substr(basename($0), length(‘mysql01_’));

814行目でmunin上で表示するカテゴリ名を指定
print “graph_category mysql01\n”;

これをmysqldの数だけ値を変えて作成

4)監視したいパラメータのリンクを貼る

# cd /etc/munin/plugins/
# ln -s /usr/share/munin/plugins/mysql01_ mysql01_commands
# ln -s /usr/share/munin/plugins/mysql01_ mysql01_qcache
# ln -s /usr/share/munin/plugins/mysql01_ mysql01_qcache_mem
# ln -s /usr/share/munin/plugins/mysql01_ mysql01_slow

5)値が取得できているか確認
ここでエラーが出ているようだと設定にミスがある

# /usr/sbin/munin-run –servicedir /etc/munin/plugins mysql01_commands
# /usr/sbin/munin-run –servicedir /etc/munin/plugins mysql01_qcache
# /usr/sbin/munin-run –servicedir /etc/munin/plugins mysql01_qcache_mem
# /usr/sbin/munin-run –servicedir /etc/munin/plugins mysql01_slow

■複数mysqld内のデータベースサイズを監視

1)プラグインを入手して設置する
http://exchange.munin-monitoring.org/plugins/mysql_size_/details からプラグインダウンロード
/usr/share/munin/plugins/ にmysql01_size_ 等番号を付けて必要分配置する

42行目
unless ($0 =~ /mysql_size(?:_([^_]+)|)_(.+)\s*$/)

48行目
my $MYSQLADMIN = $ENV{mysqladmin} || “mysql”;

を設定や環境に合わせて修正
例えば

unless ($0 =~ /mysql01_size(?:_([^_]+)|)_(.+)\s*$/)
my $MYSQLADMIN = “/usr/bin/mysql”;

2)munin-nodeに必要なパラメータを設定する

# vi /etc/munin/plugin-conf.d/munin-node

[mysql01_*]
env.mysqlopts -uroot -ppassword –socket=/path/to/mysql01/mysql.sockk
env.mysqladmin /usr/bin/mysqladmin

[mysql02_*]
env.mysqlopts -uroot -ppassword –socket=/path/to/mysql02/mysql.sock
env.mysqladmin /usr/bin/mysqladmin

など

3)監視したいDBのリンクを設定する

# cd /etc/munin/plugins/
# ln -s /usr/share/munin/plugins/mysql01_size_ mysql01_size_dbname01
# ln -s /usr/share/munin/plugins/mysql01_size_ mysql01_size_dbname02
# ln -s /usr/share/munin/plugins/mysql02_size_ mysql02_size_dbname03

4)値が取得できているか確認
ここでエラーが出ているようだと設定にミスがある

# /usr/sbin/munin-run –servicedir /etc/munin/plugins mysql01_size_dbname01
# /usr/sbin/munin-run –servicedir /etc/munin/plugins mysql01_size_dbname02
# /usr/sbin/munin-run –servicedir /etc/munin/plugins mysql02_size_dbname03

■動作が確認できたら設定を反映する

# /sbin/service munin-node restart

, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...