summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRamesh Nachimuthu <rnachimu@redhat.com>2016-09-16 17:20:16 +0530
committerSahina Bose <sabose@redhat.com>2016-09-18 23:21:24 -0700
commitb91d50b07b26041fa2205600cc8c7e95a10b870a (patch)
tree9e5aa15b4e056dbf369406416cfc83c454a5b6ca /plugins
parent5c3865717de1a2ef58a0021e6a1ff4d17e0f9056 (diff)
check perf data exists before processing
We may not have performance data for a given period of time. So in this case perf statistics returned by sadf will be None. We should make sure that it not None before further processing the perf data. Change-Id: If311035ae76403b356e51f0fe50f5ffddec9d18b Bug-Url: https://bugzilla.redhat.com/1328191 Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com> Reviewed-on: http://review.gluster.org/15526 Reviewed-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/network.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/network.py b/plugins/network.py
index 920cee3..c449357 100755
--- a/plugins/network.py
+++ b/plugins/network.py
@@ -121,9 +121,16 @@ def main():
try:
stat = sadf.getLatestStat(sadf.sadfExecCmd(_sadfNetCommand),
args.interval)
- (rc, msg) = _getStatMessage(stat, all=args.all,
- includes=args.include,
- excludes=args.exclude)
+
+ if stat:
+ (rc, msg) = _getStatMessage(stat, all=args.all,
+ includes=args.include,
+ excludes=args.exclude)
+ else:
+ logging.error("unable to get network status for the given "
+ "interval: %s" % args.interval)
+ (rc, msg) = utils.PluginStatusCode.UNKNOWN, "UNKNOWN"
+
print msg
sys.exit(rc)
except (sadf.SadfCmdExecFailedException,