diff options
| author | Tim <timothyasir@gluster.com> | 2011-08-17 17:24:21 +0530 |
|---|---|---|
| committer | Tim <timothyasir@gluster.com> | 2011-08-17 17:24:21 +0530 |
| commit | 8478d0893ca8452f5e3ef8efa6c86f634db39e5b (patch) | |
| tree | 9929cb0ac6eff6bb6789b491de78f07762273ee7 /src/com.gluster.storage.management.gateway.scripts | |
| parent | 16757d8552d2964099113e14c9ad70f11b49ad83 (diff) | |
Added license information and enhanced error handling in get_rrd_net_details.py
Diffstat (limited to 'src/com.gluster.storage.management.gateway.scripts')
| -rwxr-xr-x | src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_net_details.py | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_net_details.py b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_net_details.py index c319c888..f4a7a465 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_net_details.py +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/get_rrd_net_details.py @@ -1,20 +1,8 @@ #!/usr/bin/python -# Copyright (C) 2010 Gluster, Inc. <http://www.gluster.com> -# This file is part of Gluster Storage Platform. +# Copyright (C) 2011 Gluster, Inc. <http://www.gluster.com> +# This file is part of Gluster Management Gateway. # -# Gluster Storage Platform is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 of -# the License, or (at your option) any later version. -# -# Gluster Storage Platform is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# <http://www.gnu.org/licenses/>. + import os import sys p1 = os.path.abspath(os.path.dirname(sys.argv[0])) @@ -42,14 +30,11 @@ def main(): XPORT:received:received \ XPORT:transmitted:transmitted \ XPORT:total:total" % (period, device, device) + rv = Utils.runCommand(command, output=True, root=True) - message = Utils.stripEmptyLines(rv["Stdout"]) - if rv["Stderr"]: - error = Utils.stripEmptyLines(rv["Stderr"]) - message += "Error: [%s]" % (error) - Utils.log("failed to get RRD information of device %s" % file) + if rv["Status"] != 0: rs.appendTagRoute("status.code", rv["Status"]) - rs.appendTagRoute("status.message", message) + rs.appendTagRoute("status.message", "Failed to get RRD information of device %s" % device) print rs.toxml() print rv["Stdout"] sys.exit(0) |
