root / plugins / other / apt-proxy @ 08b6b881
Historique | Voir | Annoter | Télécharger (1,94 ko)
| 1 |
#!/usr/bin/perl -w |
|---|---|
| 2 |
# |
| 3 |
# Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU General Public License |
| 7 |
# as published by the Free Software Foundation; version 2 dated June, |
| 8 |
# 1991. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 |
# |
| 19 |
# If you improve this script please send your version to my email address |
| 20 |
# with the copyright notice upgrade with your name. |
| 21 |
# |
| 22 |
# Plugin to monitor number of files in apt-proxy cache |
| 23 |
# |
| 24 |
# $Log$ |
| 25 |
# Revision 1.1 2006/03/28 21:04:01 rodo |
| 26 |
# Created by Rodolphe Quiedeville |
| 27 |
# |
| 28 |
# Must run on aptproxy user or root |
| 29 |
# |
| 30 |
#%# family=apt-proxy |
| 31 |
#%# capabilities=autoconf |
| 32 |
|
| 33 |
use strict; |
| 34 |
|
| 35 |
if ($ARGV[0] and $ARGV[0] eq "config") |
| 36 |
{
|
| 37 |
print "graph_title Files in apt-proxy cache\n"; |
| 38 |
print "graph_args --base 1000 -l 0\n"; |
| 39 |
print "graph_category apt-proxy\n"; |
| 40 |
print "graph_vlabel files\n"; |
| 41 |
print "main.label main\n"; |
| 42 |
print "main.info Packages in main\n"; |
| 43 |
print "main.draw AREA\n"; |
| 44 |
print "security.label security\n"; |
| 45 |
print "security.info Packages in security\n"; |
| 46 |
print "security.draw STACK\n"; |
| 47 |
exit 0; |
| 48 |
} |
| 49 |
|
| 50 |
my $cache = "/var/cache/apt-proxy/debian/pool/main "; |
| 51 |
my $security = "/var/cache/apt-proxy/security/pool/updates/main "; |
| 52 |
|
| 53 |
open (HOME,"find $cache -type f | wc -l |"); |
| 54 |
my $files = <HOME>; |
| 55 |
close(HOME); |
| 56 |
|
| 57 |
open (HOME,"find $security -type f | wc -l |"); |
| 58 |
my $files_secu = <HOME>; |
| 59 |
close(HOME); |
| 60 |
|
| 61 |
chomp($files);chomp($files_secu); |
| 62 |
|
| 63 |
print "main.value ".$files."\n"; |
| 64 |
print "security.value ".$files_secu."\n"; |
| 65 |
|
| 66 |
# vim:syntax=perl |
