Révision e7e8ff99
Plugin approx: migrate to Python3, format documentation
| plugins/apt/approx | ||
|---|---|---|
| 1 |
#!/usr/bin/env python |
|
| 2 |
# |
|
| 3 |
# vim:syntax=python |
|
| 4 |
# |
|
| 5 |
# Plugin to monitor the amount of packages in an approx cache. |
|
| 6 |
# |
|
| 7 |
# Usage: place in /etc/munin/plugins/ (or link it there using ln -s) |
|
| 8 |
# |
|
| 9 |
# Parameters understood: |
|
| 10 |
# |
|
| 11 |
# config (required) |
|
| 12 |
# autoconf (optional - used by munin-config) |
|
| 13 |
# |
|
| 14 |
# Magic markers - optional - used by installation scripts and |
|
| 15 |
# munin-config: |
|
| 16 |
# |
|
| 17 |
# #%# family=manual |
|
| 18 |
# #%# capabilities=autoconf |
|
| 19 |
# |
|
| 20 |
# Now for the real work... |
|
| 1 |
#!/usr/bin/env python3 |
|
| 2 |
""" |
|
| 3 |
=head1 NAME |
|
| 4 |
|
|
| 5 |
approx - monitor the amount of packages in an approx cache |
|
| 6 |
|
|
| 7 |
|
|
| 8 |
=head1 CONFIGURATION |
|
| 9 |
|
|
| 10 |
Usage: place in /etc/munin/plugins/ (or link it there using ln -s) |
|
| 11 |
|
|
| 12 |
Parameters understood: |
|
| 13 |
|
|
| 14 |
config (required) |
|
| 15 |
autoconf (optional - used by munin-config) |
|
| 16 |
|
|
| 17 |
|
|
| 18 |
=head1 AUTHORS |
|
| 19 |
|
|
| 20 |
Copyright 2008 Morten Siebuhr <unknown@munin-monitoring.org> |
|
| 21 |
|
|
| 22 |
|
|
| 23 |
=head1 MAGIC MARKERS |
|
| 24 |
|
|
| 25 |
#%# family=manual |
|
| 26 |
#%# capabilities=autoconf |
|
| 27 |
|
|
| 28 |
=cut |
|
| 29 |
""" |
|
| 21 | 30 |
|
| 22 | 31 |
from os.path import walk, exists, isfile, join |
| 23 | 32 |
from sys import argv, exit |
| ... | ... | |
| 58 | 67 |
print("%s.label %s" % (filetype.lower(), filetype))
|
| 59 | 68 |
exit() |
| 60 | 69 |
|
| 61 |
for filetype, count in get_file_types().iteritems():
|
|
| 70 |
for filetype, count in get_file_types().items(): |
|
| 62 | 71 |
print("%s.value %d" % (filetype.lower(), count))
|
| 63 | 72 |
|
| 64 | 73 |
exit() |
Formats disponibles : Unified diff