LoginSignup
0
0

More than 5 years have passed since last update.

Zabbix監視テンプレート(Scality 6 SOFS Connector)

Last updated at Posted at 2018-03-19

Zabbix監視テンプレート(Scality 6 SOFS Connector)を作成しました。
Zabbix 3.0、Scality RING 6.4.5.4(Mithrandir)で検証しています。

前提条件

  • /etc/logrotate.dの設定がrestartではなく、reloadを使用している事。
  • Zabbixエージェントの設定ファイルにパラメータ"Include=/etc/zabbix/zabbix_agentd.d/"を設定している事。

Scality 6 SOFS Connector

テンプレート

  • Template App Scality 6 SOFS Connector Nodes Service(テンプレートとのリンク: なし)

アプリケーション

  • Scality 6 SOFS Connector Nodes service

アイテム

# アイテム名 トリガー キー データ型 単位 乗数の使用 更新間隔(秒) ヒストリ トレンド タイプ アプリケーション 内容 備考
1 httpd service is running 1 net.tcp.listen[81] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service TCP81ポート(httpd)のステータス取得 TCP81ポート(httpd)を使用しない場合は不要
2 sagentd service is running 1 net.tcp.listen[7084] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service TCP7084ポート(sagentd)のステータス取得 TCP7084ポート(sagentd)を使用しない場合は不要
3 sproxyd service is running 1 net.tcp.listen[10000] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service TCP10000ポート(sproxyd)のステータス取得 TCP10000ポート(sproxyd)を使用しない場合は不要
4 Number of running httpd processes 1 proc.num[httpd,root,,"-DFOREGROUND"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service httpdプロセスの個数取得
5 Number of running salt-minion processes 1 proc.num[,root,,"salt-minion"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service salt-minionプロセスの個数取得
6 Number of running sfused-\* processes 1 proc.num[sfused,root,,"sfused-*"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service sfused-*プロセスの個数取得
7 Number of running sagentd processes 1 proc.num[,root,,"/usr/bin/sagentd"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service sagentdプロセスの個数取得
8 Number of running sagentd/core processes 1 proc.num[,root,,"sagentd/core"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service sagentd/coreプロセスの個数取得
9 Number of running sagentd/heartbeat processes 1 proc.num[,root,,"sagentd/heartbeat"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service sagentd/heartbeatプロセスの個数取得
10 Number of running sagentd/poll processes 1 proc.num[,root,,"sagentd/poll"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service sagentd/pollプロセスの個数取得
11 Number of running sagentd/scheduler processes 1 proc.num[,root,,"sagentd/scheduler"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service sagentd/schedulerプロセスの個数取得
12 Number of running sagentd/webclient processes 1 proc.num[,root,,"sagentd/webclient"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service sagentd/webclientプロセスの個数取得
13 Number of running sagentd/webserver processes 1 proc.num[,root,,"sagentd/webserver"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service sagentd/webserverプロセスの個数取得
14 Number of running sproxyd processes 1 proc.num[,root,,"/usr/bin/sproxyd"] 数値 - - 30 90 365 Zabbixエージェント Scality 6 SOFS Connector Nodes service sproxydプロセスの個数取得
  • ヒストリとは各収集値の保持期間
  • トレンドとは数値データタイプの1時間あたりの最低値、最高値、平均値および合計値の保持期間
  • Zabbixにリトライ回数、リトライ間隔、タイムアウト時間は存在しない

トリガー

# 深刻度 トリガー 条件式 種別 内容 備考
1 軽度の障害 httpd service is down on {HOST.NAME} net.tcp.listen[81].max(#3)=0 ポート 直近3回のTCP81ポート(httpd)のステータス取得時の戻り値(最大値)が0(Close)だった場合 TCP81ポート(httpd)を使用しない場合は不要
2 軽度の障害 sagentd service is down on {HOST.NAME} net.tcp.listen[7084].max(#3)=0 ポート 直近3回のTCP7084ポート(sagentd)のステータス取得時の戻り値(最大値)が0(Close)だった場合 TCP7084ポート(sagentd)を使用しない場合は不要
3 軽度の障害 sproxyd service is down on {HOST.NAME} net.tcp.listen[10000].max(#3)=0 ポート 直近3回のTCP10000ポート(sproxyd)のステータス取得時の戻り値(最大値)が0(Close)だった場合 TCP10000ポート(sproxyd)を使用しない場合は不要
4 重度の障害 httpd process is not running on {HOST.NAME} proc.num[httpd,root,,"-DFOREGROUND"].last(0)<1 プロセス 稼働中のhttpdプロセスの最新個数が1未満だった場合
5 重度の障害 salt-minion process is not running on {HOST.NAME} proc.num[,root,,"salt-minion"].last(0)<3 プロセス 稼働中のsalt-minionプロセスの個数が3未満だった場合
6 重度の障害 sfused-\* process is not running on {HOST.NAME} proc.num[sfused,root,,"sfused-*"].last(0)<*N* プロセス 稼働中のsfused-*プロセスの個数が*N*未満だった場合
7 重度の障害 sagentd process is not running on {HOST.NAME} proc.num[,root,,"/usr/bin/sagentd"].last(0)<1 プロセス 稼働中のsagentdプロセスの個数が1未満だった場合
8 重度の障害 sagentd/core process is not running on {HOST.NAME} proc.num[,root,,"sagentd/core"].last(0)<1 プロセス 稼働中のsagentd/coreプロセスの個数が1未満だった場合
9 重度の障害 sagentd/heartbeat process is not running on {HOST.NAME} proc.num[,root,,"sagentd/heartbeat"].last(0)<1 プロセス 稼働中のsagentd/heartbeatプロセスの個数が1未満だった場合
10 重度の障害 sagentd/poll process is not running on {HOST.NAME} proc.num[,root,,"sagentd/poll"].last(0)<1 プロセス 稼働中のsagentd/pollプロセスの個数が1未満だった場合
11 重度の障害 sagentd/scheduler process is not running on {HOST.NAME} proc.num[,root,,"sagentd/scheduler"].last(0)<1 プロセス 稼働中のsagentd/schedulerプロセスの個数が1未満だった場合
12 重度の障害 sagentd/webclient process is not running on {HOST.NAME} proc.num[,root,,"sagentd/webclient"].last(0)<1 プロセス 稼働中のsagentd/webclientプロセスの個数が1未満だった場合
13 重度の障害 sagentd/webserver process is not running on {HOST.NAME} proc.num[,root,,"sagentd/webserver"].last(0)<1 プロセス 稼働中のsagentd/webserverプロセスの個数が1未満だった場合
14 重度の障害 sproxyd process is not running on {HOST.NAME} proc.num[,root,,"sproxyd"].last(0)<1 プロセス 稼働中のsproxydプロセスの個数が1未満だった場合

ディスカバリ

ディスカバリルール

# 名前 タイプ キー 更新間隔(秒) 例外の更新間隔 存在しなくなったリソースの保持期間(日) 説明 備考
1 Custom scality.fuse mounted filesystems for discovery Zabbixエージェント custom.vfs.fs.scality.fuse.discovery 60 - 0 Discovery of custom file systems of different types as defined in global regular expression "Custom file systems for discovery". 存在しなくなったリソースの保持期間(日)を「0」に設定すると要素は即時削除される

フィルター

  • なし

アイテムのプロトタイプ

# 名前 トリガー キー データ型 単位 乗数の使用 更新間隔(秒) ヒストリ トレンド タイプ アプリケーション 内容 備考
1 Scality 6 SOFS Connector Nodes service {#FSNAME} is mounted 1 custom.scality.fuse.mountpoint[{#FSNAME}] 数値 - - 30 90 365 Zabbixエージェント Scality Connector Nodes service 特定ボリュームのマウント状況結果(0: OK, 1: NG)
  • ヒストリとは各収集値の保持期間
  • トレンドとは数値データタイプの1時間あたりの最低値、最高値、平均値および合計値の保持期間
  • Zabbixにリトライ回数、リトライ間隔、タイムアウト時間は存在しない

トリガーのプロトタイプ

# 深刻度 トリガー 条件式 種別 内容 備考
1 重度の障害 Scality 6 SOFS Connector Nodes service {#FSNAME} is unmounted on {HOST.NAME} custom.scality.fuse.mountpoint[{#FSNAME}].min(#3)<>0 ファイルシステム 直近3回の特定ボリュームのマウント状況結果の戻り値(最小値)が0ではない場合

スクリプトの設置

/usr/local/bin/lld-scality-fuse.py
#!/usr/bin/python
# coding: utf-8
# ------------------------------------------------------------------------------
# Script Name  : lld-scality-fuse.py
# Tool Version : 1.0.0
# Argument     : -
# Option       : -h, --help     show this help message and exit
#              : -v, --version  show version and exit
#              : -t, --fstype   select virtual file system type
#              : -n, --fsname   select virtual file system name
# Usage        : $0 [Option]
# Return       : -
# -------------+-------------------------------------------+--------------------
# Date         | Changes                                   | Author
# -------------+-------------------------------------------+--------------------
# 2018/03/19   | New Creation                              | @bloodia
# ------------------------------------------------------------------------------
# --+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8

import json
import subprocess
import re
import argparse

parser = argparse.ArgumentParser()
parser.add_argument(
                       '-v', '--version',
                       action='version',
                       version='1.0.0',
                       help='show version and exit'
                   )
parser.add_argument(
                       '-t', '--fstype',
                       action='store',
                       help='select virtual file system type'
                   )
parser.add_argument(
                       '-n', '--fsname',
                       action='store',
                       help='select virtual file system name'
                   )
args = parser.parse_args()

if __name__ == '__main__':
    p1 = subprocess.Popen(['cat', '/proc/mounts'], stdout=subprocess.PIPE)
    p2 = subprocess.Popen(['awk', '{print $2,$3}'],stdin=p1.stdout,stdout=subprocess.PIPE)
    p3 = subprocess.Popen(['grep', '-v',  'sr|loop|ram'], stdin=p2.stdout, stdout=subprocess.PIPE)
    stdout, stderr = p3.communicate()
    data = list()
    for line in stdout.split('\n'):
        if line:
            fs = line.split(" ")
            fsname = fs[0]
            fstype = fs[1]
            if args.fstype:
                if fstype == args.fstype:
                    if args.fsname:
                        m = re.match(r"(%s)" % args.fsname, fsname)
                        if m:
                            data.append({"{#FSNAME}": fsname, "{#FSTYPE}": fstype})
                    else:
                        data.append({"{#FSNAME}": fsname, "{#FSTYPE}": fstype})
            else:
                data.append({"{#FSNAME}": fsname, "{#FSTYPE}": fstype})
    print(json.dumps({"data": data}, indent=4))

コンフィグの設置

/etc/zabbix/zabbix_agentd.d/userparameter_scality-fuse.conf
# Custom Discovery Rules
UserParameter=custom.vfs.fs.scality.fuse.discovery,/usr/local/bin/lld-scality-fuse.py -t 'fuse' -n '/ring'

# Custom Monitoring Items
UserParameter=custom.scality.fuse.mountpoint[*],mountpoint -q $1 && echo 0 || echo 1

zabbix-agentの再起動(CentOS 5, 6)

[root@localhost ~]# /etc/init.d/zabbix-agent restart

zabbix-agentの再起動(CentOS 7)

[root@localhost ~]# systemctl restart zabbix-agent

関連記事

Zabbix監視テンプレート(Scality 6 RING)
Zabbix監視テンプレート(Scality 6 Supervisor)

0
0
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
0
0