Changeset 3520

Show
Ignore:
Timestamp:
04/25/10 11:08:07 (2 years ago)
Author:
steve.schnepp
Message:

- Using a SPOOLDIR

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • people/snide/async-polling/munin-async-client

    r3518 r3520  
    2323use warnings; 
    2424 
     25my $SPOOLDIR = "/tmp"; 
     26 
    2527# Use STDIN/STDOUT, in order to be :  
    2628# 1. secure over internet (SSH), munin-node needs only  
     
    2830# 2. very simple to launch 
    2931 
     32die "spooldir [$SPOOLDIR] not found" unless -d $SPOOLDIR; 
     33 
    3034while (my $line = <>) { 
    3135        if ($line =~ m/^list/) { 
    32                 cat_file("/tmp/munin-daemon.list"); 
     36                cat_file("$SPOOLDIR/munin-daemon.list"); 
    3337        } elsif ($line =~ m/config (\w+)/) { 
    34                 cat_file("/tmp/munin-daemon.$1.config"); 
     38                cat_file("$SPOOLDIR/munin-daemon.$1.config"); 
    3539        } elsif ($line =~ m/fetch (\w+)/) { 
    3640                # Fetching all values since last time 
    37                 cat_file("/tmp/munin-daemon.$1.data"); 
     41                cat_file("$SPOOLDIR/munin-daemon.$1.data"); 
    3842                print(".\n"); 
    3943                # XXX - there is a race condition here 
    40                 unlink("/tmp/munin-daemon.$1.data");  
     44                unlink("$SPOOLDIR/munin-daemon.$1.data");  
    4145        } 
    4246} 
  • people/snide/async-polling/munin-async-server

    r3518 r3520  
    2828# TODO - might be directly inserted in munin-node 
    2929my $host = "localhost:4949"; 
     30my $SPOOLDIR = "/tmp"; 
     31 
     32# Q&D spooldir creation 
     33`mkdir -p $SPOOLDIR`; 
    3034 
    3135my $verbose; 
     
    4549        <$sock>; # Read the first header comment line 
    4650        my $plugins_line = <$sock>; 
    47         open(OUTFILE, "> /tmp/munin-daemon.list"); 
     51        open(OUTFILE, "> $SPOOLDIR/munin-daemon.list"); 
    4852        print OUTFILE $plugins_line; 
    4953        close(OUTFILE); 
     
    5660                $plugins_rate{$plugin} = 300; # default : 5 min 
    5761                print $sock "config $plugin\n"; 
    58                 open (OUTFILE, "> /tmp/munin-daemon.$plugin.config"); 
     62                open (OUTFILE, "> $SPOOLDIR/munin-daemon.$plugin.config"); 
    5963                while(my $line = <$sock>) { 
    6064                        print OUTFILE $line; 
    6165                        if ($line =~ m/^update_rate (\d+)/) { 
     66                                # The plugin has a special update_rate: overriding it 
     67                                # XXX - Doesn't take into account a per field update_rate 
    6268                                $plugins_rate{$plugin} = $1; 
    6369                        } 
     
    112118                print $sock "fetch $plugin\n"; 
    113119                 
    114                 open (OUTFILE, ">> /tmp/munin-daemon.$plugin.data"); 
     120                open (OUTFILE, ">> $SPOOLDIR/munin-daemon.$plugin.data"); 
    115121                while(my $line = <$sock>) { 
    116122                        print STDERR "[sock] $line" if $debug;