Projet

Général

Profil

Révision 21c28638

ID21c28638e314ac3bf24e0b586f53fd917060e348
Parent 9b3aa267
Enfant 25a7b2c0

Ajouté par Mikkel Kirkgaard Nielsen il y a environ 7 ans

Generate cache file if missing

Don't exit with error if cache file is missing, instead refrain from sending values and daemonize() in an attempt to generate one.
Invocation using 'config' before generation is successful will fail, as mentioned in #914, but configuration will get picked up as soon as it is present.

Voir les différences:

plugins/disk/du-2
107 107
}
108 108

  
109 109
##### fetch
110
open (FILE, "<", $CACHEFILE) or munin_exit_fail();
111
while(defined (my $foo = <FILE>)) {
112
    if ($foo =~ m/(\d+)\s+(.+)/) {
113
        my ($field, $value) = ($2, $1);
114
        clean_path(\$field);
115
        print clean_fieldname($field), ".value ", $value, "\n";
110
if (open (FILE, "<", $CACHEFILE)) {
111
    while(defined (my $foo = <FILE>)) {
112
        if ($foo =~ m/(\d+)\s+(.+)/) {
113
            my ($field, $value) = ($2, $1);
114
            clean_path(\$field);
115
            print clean_fieldname($field), ".value ", $value, "\n";
116
        }
116 117
    }
118
    close(FILE);
117 119
}
118
close(FILE);
119 120
daemonize();
120 121

  
121 122
#

Formats disponibles : Unified diff