mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
commit
e6ece317a6
@ -5,10 +5,9 @@
|
||||
|
||||
du - Plugin to monitor multiple directories size
|
||||
|
||||
=head1 AUTHOR
|
||||
=head1 AUTHOR AND COPYRIGHT
|
||||
|
||||
Luc Didry <luc AT didry.org>
|
||||
April 2011
|
||||
Copyright 2011-2012 Luc Didry <luc AT didry.org>
|
||||
|
||||
=head1 HOWTO CONFIGURE AND USE :
|
||||
|
||||
@ -44,6 +43,21 @@
|
||||
#%# family=auto
|
||||
#%# 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
|
||||
|
||||
use warnings;
|
||||
@ -107,7 +121,7 @@ daemonize();
|
||||
|
||||
#
|
||||
##
|
||||
### PUBLiC FONCTiONS
|
||||
### PUBLIC FONCTIONS
|
||||
###############################################################################
|
||||
## Used to create the fork
|
||||
sub daemonize {
|
||||
@ -135,7 +149,7 @@ sub 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 {
|
||||
return 1 if (! -e $TIMEFILE);
|
||||
my ($time) = `cat $TIMEFILE`;
|
||||
@ -145,21 +159,33 @@ sub cache_is_too_old {
|
||||
} ## cache_is_too_old
|
||||
|
||||
sub du_not_running {
|
||||
return 0 if (-e $LOCKFILE);
|
||||
return 1;
|
||||
if (-e $LOCKFILE) {
|
||||
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 {
|
||||
__munin_exit(0);
|
||||
} ## sub munin_exit_done
|
||||
|
||||
|
||||
sub munin_exit_fail {
|
||||
__munin_exit(1);
|
||||
} ## sub munin_exit_fail
|
||||
|
||||
#
|
||||
##
|
||||
### iNTERNALS FONCTiONS
|
||||
### INTERNALS FONCTIONS
|
||||
###############################################################################
|
||||
sub __munin_exit {
|
||||
my $exitcode = shift;
|
||||
|
Loading…
Reference in New Issue
Block a user