Changeset 3829
- Timestamp:
- 07/27/10 14:42:48 (2 years ago)
- Files:
-
- trunk/node/lib/Munin/Node/SpoolWriter.pm (modified) (1 diff)
- trunk/node/t/munin_node_spoolwriter.t (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/node/lib/Munin/Node/SpoolWriter.pm
r3828 r3829 41 41 42 42 print {$fh} "timestamp $timestamp\n"; 43 print {$fh} "multigraph $service\n" unless $data->[0] =~ m{^multigraph}; 43 44 44 45 foreach my $line (@$data) { trunk/node/t/munin_node_spoolwriter.t
r3828 r3829 3 3 use strict; 4 4 5 use Test::More tests => 1 7;5 use Test::More tests => 19; 6 6 use Test::LongString; 7 7 … … 51 51 is_string($data, <<EOC, 'Data was written correctly'); 52 52 timestamp 1234567890 53 multigraph fnord 53 54 graph_title CPU usage 54 55 graph_order system user nice idle iowait irq softirq … … 73 74 is_string($data, <<EOC, 'Spool file was appended to'); 74 75 timestamp 1234567890 76 multigraph fnord 75 77 graph_title CPU usage 76 78 graph_order system user nice idle iowait irq softirq … … 80 82 system.value 999999 81 83 timestamp 1234567891 84 multigraph fnord 82 85 graph_title CPU usage! 83 86 graph_order system user nice idle iowait irq softirq … … 89 92 90 93 } 91 ### writing different types of value. 92 ### values can also include a timestamp: http://munin-monitoring.org/wiki/protocol-multifetch 94 95 # writing different types of value. 96 # values can also include a timestamp: http://munin-monitoring.org/wiki/protocol-multifetch 93 97 { 94 98 my @tests = ( … … 131 135 } 132 136 137 # writing multigraph results 138 { 139 my $dir = tempdir( CLEANUP => 1 ); 140 my $writer = Munin::Node::SpoolWriter->new(spooldir => $dir); 141 142 $writer->write(1234567890, 'fnord', [ 143 'multigraph fnord', 144 'graph_title CPU usage', 145 'system.label system', 146 'system.value 999999', 147 'multigraph fnord.one', 148 'graph_title subfnord', 149 'subsystem.label subsystem', 150 'subsystem.value 123', 151 ]); 152 153 my $data_file = "$dir/munin-daemon.fnord"; 154 ok( -r $data_file, 'spool file is readable') or last; 155 156 my $data = read_file($data_file); 157 is_string($data, <<EOC, 'Data was written correctly'); 158 timestamp 1234567890 159 multigraph fnord 160 graph_title CPU usage 161 system.label system 162 system.value 999999 163 multigraph fnord.one 164 graph_title subfnord 165 subsystem.label subsystem 166 subsystem.value 123 167 EOC 168 169 } 170
