web-dev-qa-db-ja.com

glusterfsボリュームを監視する方法

Glusterfsは、Nice分散ファイルシステムでありながら、整合性を監視する方法をほとんど提供していません。サーバーが行き来する可能性があり、レンガが古くなったり失敗したりする可能性があります。

最近、すべてが正常に機能しているように見えるときに奇妙な障害が発生しましたが、ボリュームから1つのレンガが脱落しました(純粋な偶然で見つかりました)。

GlusterFS .2ボリュームのヘルスステータスについて通知するシンプルで信頼できる方法(cronスクリプト?)はありますか?

12
Arie Skliarouk

これは、しばらくの間GlusterFS開発者への要求であり、すぐに使用できるソリューションはありません。ただし、いくつかのスクリプトでは不可能ではありません。

Glusterシステムのほとんど全体が1つのglusterコマンドで管理され、いくつかのオプションを使用して、ヘルスモニタリングスクリプトを作成できます。ブリックとボリュームのリスト情報については、こちらをご覧ください- http://gluster.org/community/documentation/index.php/Gluster_3.2:_Displaying_Volume_Information

パフォーマンスを監視するには、次のリンクを参照してください- http://gluster.org/community/documentation/index.php/Gluster_3.2:_Monitoring_your_GlusterFS_Workload

更新: http://gluster.org/community/documentation/index.php/About_GlusterFS_3. へのアップグレードを検討してください

彼らはより多くのバグ修正とサポートされているように見えるので、あなたは常に最新のリリースにいることでより良いです。もちろん、新しいリリースに移行する前に独自のテストを実行してください http://vbellur.wordpress.com/2012/05/31/upgrading-to-glusterfs-3-3/ :)

第10章には、GlusterFS 3.3のインストールを監視するための特定のセクションがある管理ガイドがあります http://www.gluster.org/wp-content/uploads/2012/05/Gluster_File_System-3.3.0-Administration_Guide -en-US.pdf

別のnagiosスクリプトについては、ここを参照してください- http://code.google.com/p/glusterfs-status/

3
Chida

添付のスクリプトで https://www.gluster.org/pipermail/gluster-users/2012-June/010709.html でgluster 3.3を確認してください。おそらくgluster 3.2に簡単に適応できます。

#!/bin/bash

# This Nagios script was written against version 3.3 of Gluster.  Older
# versions will most likely not work at all with this monitoring script.
#
# Gluster currently requires elevated permissions to do anything.  In order to
# accommodate this, you need to allow your Nagios user some additional
# permissions via Sudo.  The line you want to add will look something like the
# following in /etc/sudoers (or something equivalent):
#
# Defaults:nagios !requiretty
# nagios ALL=(root) NOPASSWD:/usr/sbin/gluster peer status,/usr/sbin/gluster volume list,/usr/sbin/gluster volume heal [[\:graph\:]]* info
#
# That should give us all the access we need to check the status of any
# currently defined peers and volumes.

# define some variables
ME=$(basename -- $0)
Sudo="/usr/bin/Sudo"
PIDOF="/sbin/pidof"
GLUSTER="/usr/sbin/gluster"
PEERSTATUS="peer status"
VOLLIST="volume list"
VOLHEAL1="volume heal"
VOLHEAL2="info"
peererror=
volerror=

# check for commands
for cmd in $Sudo $PIDOF $GLUSTER; do
    if [ ! -x "$cmd" ]; then
        echo "$ME UNKNOWN - $cmd not found"
        exit 3
    fi
done

# check for glusterd (management daemon)
if ! $PIDOF glusterd &>/dev/null; then
    echo "$ME CRITICAL - glusterd management daemon not running"
    exit 2
fi

# check for glusterfsd (brick daemon)
if ! $PIDOF glusterfsd &>/dev/null; then
    echo "$ME CRITICAL - glusterfsd brick daemon not running"
    exit 2
fi

# get peer status
peerstatus="peers: "
for peer in $(Sudo $GLUSTER $PEERSTATUS | grep '^Hostname: ' | awk '{print $2}'); do
    state=
    state=$(Sudo $GLUSTER $PEERSTATUS | grep -A 2 "^Hostname: $peer$" | grep '^State: ' | sed -nre 's/.* \(([[:graph:]]+)\)$/\1/p')
    if [ "$state" != "Connected" ]; then
        peererror=1
    fi
    peerstatus+="$peer/$state "
done

# get volume status
volstatus="volumes: "
for vol in $(Sudo $GLUSTER $VOLLIST); do
    thisvolerror=0
    entries=
    for entries in $(Sudo $GLUSTER $VOLHEAL1 $vol $VOLHEAL2 | grep '^Number of entries: ' | awk '{print $4}'); do
        if [ "$entries" -gt 0 ]; then
            volerror=1
            let $((thisvolerror+=entries))
        fi
    done
    volstatus+="$vol/$thisvolerror unsynchronized entries "
done

# drop extra space
peerstatus=${peerstatus:0:${#peerstatus}-1}
volstatus=${volstatus:0:${#volstatus}-1}

# set status according to whether any errors occurred
if [ "$peererror" ] || [ "$volerror" ]; then
    status="CRITICAL"
else
    status="OK"
fi

# actual Nagios output
echo "$ME $status $peerstatus $volstatus"

# exit with appropriate value
if [ "$peererror" ] || [ "$volerror" ]; then
    exit 2
else
    exit 0
fi
2
S19N

監視に使用できるnagiosプラグインがあります 。ただし、バージョンに合わせて編集する必要があります。

2
chandank

以下のように、glusterfsのnagiosモニタリングを設定できました。

http://gopukrish.wordpress.com/2014/11/16/monitor-glusterfs-using-nagios-plugin/

1
user173141

@Arie Skliarouk、あなたのcheck_gluster.shにはタイプミスがあります。最後の行では、exitstではなくexistをgrepします。私は先に進んで、それをもう少しコンパクトになるように書き直し、一時ファイルの要件を削除しました。

#!/bin/bash

# Ensure that all peers are connected
gluster peer status | grep -q Disconnected && echo "Peer disconnected." && exit 1

# Ensure that all bricks have a running log file (i.e., are sending/receiving)
for vol in $(gluster volume list); do
  for brick in $(gluster volume info "$vol" | awk '/^Brick[0-9]*:/ {print $2}'); do
    gluster volume log locate "$vol" "$brick";
  done;
done |
 grep -qE "does not (exist|exitst)" &&
 echo "Log file missing - $vol/$brick ." &&
 exit 1
1
BMDan