Changeset 3520
- Timestamp:
- 04/25/10 11:08:07 (2 years ago)
- Files:
-
- people/snide/async-polling/munin-async-client (modified) (2 diffs)
- people/snide/async-polling/munin-async-server (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
people/snide/async-polling/munin-async-client
r3518 r3520 23 23 use warnings; 24 24 25 my $SPOOLDIR = "/tmp"; 26 25 27 # Use STDIN/STDOUT, in order to be : 26 28 # 1. secure over internet (SSH), munin-node needs only … … 28 30 # 2. very simple to launch 29 31 32 die "spooldir [$SPOOLDIR] not found" unless -d $SPOOLDIR; 33 30 34 while (my $line = <>) { 31 35 if ($line =~ m/^list/) { 32 cat_file(" /tmp/munin-daemon.list");36 cat_file("$SPOOLDIR/munin-daemon.list"); 33 37 } elsif ($line =~ m/config (\w+)/) { 34 cat_file(" /tmp/munin-daemon.$1.config");38 cat_file("$SPOOLDIR/munin-daemon.$1.config"); 35 39 } elsif ($line =~ m/fetch (\w+)/) { 36 40 # Fetching all values since last time 37 cat_file(" /tmp/munin-daemon.$1.data");41 cat_file("$SPOOLDIR/munin-daemon.$1.data"); 38 42 print(".\n"); 39 43 # XXX - there is a race condition here 40 unlink(" /tmp/munin-daemon.$1.data");44 unlink("$SPOOLDIR/munin-daemon.$1.data"); 41 45 } 42 46 } people/snide/async-polling/munin-async-server
r3518 r3520 28 28 # TODO - might be directly inserted in munin-node 29 29 my $host = "localhost:4949"; 30 my $SPOOLDIR = "/tmp"; 31 32 # Q&D spooldir creation 33 `mkdir -p $SPOOLDIR`; 30 34 31 35 my $verbose; … … 45 49 <$sock>; # Read the first header comment line 46 50 my $plugins_line = <$sock>; 47 open(OUTFILE, "> /tmp/munin-daemon.list");51 open(OUTFILE, "> $SPOOLDIR/munin-daemon.list"); 48 52 print OUTFILE $plugins_line; 49 53 close(OUTFILE); … … 56 60 $plugins_rate{$plugin} = 300; # default : 5 min 57 61 print $sock "config $plugin\n"; 58 open (OUTFILE, "> /tmp/munin-daemon.$plugin.config");62 open (OUTFILE, "> $SPOOLDIR/munin-daemon.$plugin.config"); 59 63 while(my $line = <$sock>) { 60 64 print OUTFILE $line; 61 65 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 62 68 $plugins_rate{$plugin} = $1; 63 69 } … … 112 118 print $sock "fetch $plugin\n"; 113 119 114 open (OUTFILE, ">> /tmp/munin-daemon.$plugin.data");120 open (OUTFILE, ">> $SPOOLDIR/munin-daemon.$plugin.data"); 115 121 while(my $line = <$sock>) { 116 122 print STDERR "[sock] $line" if $debug;
