2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #120 from ldidry/master

Plugin du-2 update
This commit is contained in:
Steve Schnepp 2012-05-21 02:51:00 -07:00
commit e6ece317a6

View File

@ -5,10 +5,9 @@
du - Plugin to monitor multiple directories size du - Plugin to monitor multiple directories size
=head1 AUTHOR =head1 AUTHOR AND COPYRIGHT
Luc Didry <luc AT didry.org> Copyright 2011-2012 Luc Didry <luc AT didry.org>
April 2011
=head1 HOWTO CONFIGURE AND USE : =head1 HOWTO CONFIGURE AND USE :
@ -44,6 +43,21 @@
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=head1 LICENSE
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
the Free Software Foundation, either version 3 of the License, or
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/>.
=cut =cut
use warnings; use warnings;
@ -107,7 +121,7 @@ daemonize();
# #
## ##
### PUBLiC FONCTiONS ### PUBLIC FONCTIONS
############################################################################### ###############################################################################
## Used to create the fork ## Used to create the fork
sub daemonize { sub daemonize {
@ -135,7 +149,7 @@ sub clean_path {
} }
} ## clean_path } ## clean_path
## Do you really need I told you what this function is going to check ? ## Do you really need I told you what this functions are going to check ?
sub cache_is_too_old { sub cache_is_too_old {
return 1 if (! -e $TIMEFILE); return 1 if (! -e $TIMEFILE);
my ($time) = `cat $TIMEFILE`; my ($time) = `cat $TIMEFILE`;
@ -145,21 +159,33 @@ sub cache_is_too_old {
} ## cache_is_too_old } ## cache_is_too_old
sub du_not_running { sub du_not_running {
return 0 if (-e $LOCKFILE); if (-e $LOCKFILE) {
return 1; my ($time) = `cat $TIMEFILE`;
chomp $time;
if ( (time - $time) > ($ENV{interval}*60*60) ) {
# The cache is really old (60xinterval) => Maybe the lockfile wasn't properly deleted.
# Let's delete it.
system("rm $LOCKFILE;");
return 1;
} else {
return 0;
}
} else {
return 1;
}
} }
sub munin_exit_done { sub munin_exit_done {
__munin_exit(0); __munin_exit(0);
} ## sub munin_exit_done } ## sub munin_exit_done
sub munin_exit_fail { sub munin_exit_fail {
__munin_exit(1); __munin_exit(1);
} ## sub munin_exit_fail } ## sub munin_exit_fail
# #
## ##
### iNTERNALS FONCTiONS ### INTERNALS FONCTIONS
############################################################################### ###############################################################################
sub __munin_exit { sub __munin_exit {
my $exitcode = shift; my $exitcode = shift;