Freemobile munin plugin needs a cache directory to store previous
results. Let's create it and not expect the user to do it.
This commit is contained in:
parent
e9e41a9c7c
commit
327cb4f618
1 changed files with 8 additions and 2 deletions
|
|
@ -3,7 +3,7 @@
|
|||
=head1 NAME
|
||||
freemobile - A plugin to monitor a freemobile subscription
|
||||
|
||||
=head1 Installation
|
||||
=head1 Installation
|
||||
|
||||
Create a link to this script in /etc/munin/plugins/
|
||||
|
||||
|
|
@ -41,7 +41,8 @@ use encoding 'iso-8859-1'; # Munin doesn't like utf-8 :-(
|
|||
use Encode;
|
||||
|
||||
my @monitored = split / /, $ENV{'freemonitored'} || 'voice sms';
|
||||
my $cachefile = $ENV{'HOME'} . '/.config/weboob/munin/freemobile-munin';
|
||||
my $cachedir = $ENV{'HOME'} . '/.config/weboob/munin/';
|
||||
my $cachefile = "$cachedir/freemobile-munin";
|
||||
|
||||
my $refreshtime = $ENV{'cache_expire'} || 10_800;
|
||||
my $weboob = '/usr/bin/env weboob-cli ICapBill get_details coin -f table';
|
||||
|
|
@ -173,6 +174,11 @@ sub fetch {
|
|||
return 0;
|
||||
}
|
||||
|
||||
# Create the munin cache dir if missing
|
||||
if ( !-d $cachedir ) {
|
||||
mkdir $cachedir;
|
||||
}
|
||||
|
||||
if ( $ARGV[0] and $ARGV[0] eq 'config' ) {
|
||||
config;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue