我目前正在运行CentOS 5并寻找一个terminal命令,可以让我监视RAID设置的状态(即,如果一个驱动器已closures),而不必进入内核。 这是一个真正的Web服务器毕竟。
更新:规格是与SAS 5i / R控制器的戴尔SC1435。
如果您使用常规磁盘控制器使用软件RAID,请使用:
mdadm --detail <dev>
例如,/ dev / md0在哪里。 这会告诉你当前的状态。 如果一个驱动器出现故障,你也会在/ var / log / messages中看到很多不合适的东西。
这是突袭依赖。 对于lsi [这是在大量的戴尔和惠普服务器]你使用的工具称为MegaCLI 。
3ware卡 – tw_cli
它通常带有“驱动程序”或硬件文档。
如果这是一个软件raid(mdadm),你想看看目前的状态,你可以简单地做一个猫/ proc / mdstat 。 如果你想有一个屏幕每隔10秒刷新一次,你可以做一个手表-n 10 cat / proc / mdstat 。
戴尔可能提供了一个工具来监视它,但我可以冒险猜测它会臃肿和实施与Java,像大多数平淡的OEM公用事业。
幸运的是,似乎SC1435是由美妙的mpt-status工具支持的。 只要确保在内核中启用了以下选项:
CONFIG_FUSION=y CONFIG_FUSION_SAS=y CONFIG_FUSION_MAX_SGE=128 CONFIG_FUSION_CTL=y
然后,您可以使用CLI中的mpt-status查看RAIDarrays的运行状况。
我个人然后使用从cron调用的简单的Python脚本,定期检查状态,并通过电子邮件向我们发出警报。 与mdadm的行为方式类似。 你当然可以指定你想检查的频率。 随意使用它自己:
#!/usr/bin/env python # Copyright (c) 2009 Dan Carley <[email protected]> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ Report failures from hardware RAID controllers. Requires the supporting utilities: mpt-status(8) for MPT controllers. tw_cli(8) for 3ware controllers. Intended to be scheduled from crontab as follows: MAILTO="[email protected]" 0 */3 * * * /usr/local/sbin/hwraid_monitor.py options """ from re import search from sys import exit from os.path import isfile from optparse import OptionParser from subprocess import Popen, PIPE def check_controller(type): ret = True if type == 'mpt': cmd = [ '/usr/sbin/mpt-status', '-s' ] array = {'regex': '^log_id$', 'pos': 2, 'string': 'OPTIMAL'} drive = {'regex': '^phys_id$', 'pos': 2, 'string': 'ONLINE'} elif type == 'tw': cmd = [ '/sbin/tw_cli', 'info' ] contr = {'regex': '^c\d+$'} array = {'regex': '^u\d+$', 'pos': 2, 'string': 'OK'} drive = {'regex': '^p\d+$', 'pos': 1, 'string': 'OK'} if not isfile(cmd[0]): print "%s: Utility not found" % cmd[0] return False if type == 'tw': controllers = [] p = Popen(cmd, stdout=PIPE) o, e = p.communicate() if e: print e for c in o.split('\n'): c = c.split() if len(c) > 2 and search(contr['regex'], c[0]): controllers.append(c[0]) elif type == 'mpt': controllers = [''] for c in controllers: p = Popen(cmd + [c], stdout=PIPE) o, e = p.communicate() if e: print e.split('\n') for v in o.split('\n'): v = v.split() if len(v) > 2: # Array check. if search(array['regex'], v[0]) and v[array['pos']] != array['string']: print "Array failure: \n\t%s" % '\t'.join(v) ret = False # Drive check. if search(drive['regex'], v[0]) and v[drive['pos']] != drive['string']: print "Drive failure: \n\t%s" % '\t'.join(v) ret = False return ret def main(): usage = "usage: %prog options" parser = OptionParser(usage=usage) parser.add_option("--mpt", action="store_true", default=False, dest="mpt", help="MPT controller support.") parser.add_option("--tw", action="store_true", default=False, dest="tw", help="3ware controller support.") (options, args) = parser.parse_args() if not options.mpt and not options.tw: parser.print_help() exit(2) fail = False if options.mpt: if not check_controller('mpt'): fail = True if options.tw: if not check_controller('tw'): fail = True if fail: exit(1) if __name__ == "__main__": main()
mdadm提供了有关Linux软件raid各个方面的详细信息。
看-n 10猫/ proc / mdstat这将设置在你的系统上