diff --git a/contrib/freemobile-munin b/contrib/freemobile-munin index 7bb9cba5..66273acc 100755 --- a/contrib/freemobile-munin +++ b/contrib/freemobile-munin @@ -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; }