diff options
author | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-09-26 17:44:22 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-09-26 17:44:22 -0400 |
commit | 14d2c2cfc8962ab5d6ee3bf97dc3f40ba0790714 (patch) | |
tree | a0f09a94b204f5c493218407f311e97b27c9b763 /examples | |
parent | c0d4b8c9a66c642fef93fd4508f8dbee1c338fa7 (diff) | |
download | func-14d2c2cfc8962ab5d6ee3bf97dc3f40ba0790714.tar.gz func-14d2c2cfc8962ab5d6ee3bf97dc3f40ba0790714.tar.xz func-14d2c2cfc8962ab5d6ee3bf97dc3f40ba0790714.zip |
Added demo script for checking smart status across all systems and showing
extended output only for systems that have problems.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/drive_checker.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/drive_checker.py b/examples/drive_checker.py new file mode 100644 index 0000000..77e9181 --- /dev/null +++ b/examples/drive_checker.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# report on any drives with SMART issues +# these are likely going to kick the bucket +# (C) Michael DeHaan, 2007 <mdehaan@redhat.com> +# =============================================== + +import func.overlord.client as fc + +info = fc.Client("*").smart.info() +failures = 0 + +for (host,details) in info.iteritems(): + + if type(details) != list: + print "%s had an error : %s" % (host,str(details)) + break + + (rc, list_of_output) = details + if rc != 0: + print "============================================" + print "Host %s may have problems" % host + print "\n".join(list_of_output[3:]) + failures = failures + 1 + +print "\n%s systems reported problems" % failures + |