Plugin approx: migrate to Python3, format documentation

This commit is contained in:
Lars Kruse 2020-11-26 02:00:48 +01:00
parent 4387edfa8c
commit e7e8ff9916
1 changed files with 30 additions and 21 deletions

View File

@ -1,23 +1,32 @@
#!/usr/bin/env python
#
# vim:syntax=python
#
# Plugin to monitor the amount of packages in an approx cache.
#
# Usage: place in /etc/munin/plugins/ (or link it there using ln -s)
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
# #%# family=manual
# #%# capabilities=autoconf
#
# Now for the real work...
#!/usr/bin/env python3
"""
=head1 NAME
approx - monitor the amount of packages in an approx cache
=head1 CONFIGURATION
Usage: place in /etc/munin/plugins/ (or link it there using ln -s)
Parameters understood:
config (required)
autoconf (optional - used by munin-config)
=head1 AUTHORS
Copyright 2008 Morten Siebuhr <unknown@munin-monitoring.org>
=head1 MAGIC MARKERS
#%# family=manual
#%# capabilities=autoconf
=cut
"""
from os.path import walk, exists, isfile, join
from sys import argv, exit
@ -58,7 +67,7 @@ if len(argv) > 1:
print("%s.label %s" % (filetype.lower(), filetype))
exit()
for filetype, count in get_file_types().iteritems():
for filetype, count in get_file_types().items():
print("%s.value %d" % (filetype.lower(), count))
exit()