1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Plugin swift-dispersion: migrate to Python3, format documentation

This commit is contained in:
Lars Kruse 2020-11-26 00:17:07 +01:00
parent bde90ba910
commit db7403f2d4

View file

@ -1,25 +1,37 @@
#!/usr/bin/env python #!/usr/bin/env python3
# -*- encoding: utf-8 -*- """
#
# Swift monitoring script for munin =head1 NAME
#
# Copyright © 2012 eNovance <licensing@enovance.com> swift-dispersion - Swift monitoring script for munin
#
# Author: Julien Danjou <julien@danjou.info>
# =head1 COPYRIGHT
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by Copyright (C) 2012 eNovance <licensing@enovance.com>
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. Author: Julien Danjou <julien@danjou.info>
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of =head1 LICENSE
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License the Free Software Foundation, either version 3 of the License, or
# along with this program. If not, see <http://www.gnu.org/licenses/>. (at your option) any later version.
#
This program 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/>.
SPDX-License-Identifier: GPL-3.0-or-later
=cut
"""
import os import os
import sys import sys
@ -67,6 +79,6 @@ with os.popen("swift-dispersion-report -j %s"
% os.getenv("SWIFT_DISPERSION_CONFIG", "/etc/swift/dispersion.conf")) as report: % os.getenv("SWIFT_DISPERSION_CONFIG", "/etc/swift/dispersion.conf")) as report:
stats = json.load(report) stats = json.load(report)
for type_, values in stats.iteritems(): for type_, values in stats.items():
for key, value in values.iteritems(): for key, value in values.items():
print("%s_%s.value %d" % (type_, key, value)) print("%s_%s.value %d" % (type_, key, value))