Trigger data migration if limits of a data source are changed in config file
[upsgraph] / upsgraph.pl
1 #!/usr/bin/perl -w
2
3 #Due to memory leak in Debian squeeze (Bug #545519)
4 my $use_rrds = 0;
5 my $rrd_result = 0;
6
7 if ((@ARGV != 1) && (@ARGV != 2)) {
8 print STDERR "Syntax: ${0} configfile [uid]\n";
9 exit(1);
10 }
11
12 use Net::SNMP;
13 use IO::Socket::INET;
14 use IO::Select;
15 use RRDs;
16 use File::Copy;
17 use Data::Dumper;
18
19 $UPSGRAPH::outdir = "";
20 $UPSGRAPH::daysCovered = 370;
21 $UPSGRAPH::step = 60;
22 $UPSGRAPH::stepsPerHour = (60 * 60) / $UPSGRAPH::step;
23 $UPSGRAPH::keep = ($UPSGRAPH::daysCovered*24*60*60)/$UPSGRAPH::step;
24 $UPSGRAPH::keepHours = ($UPSGRAPH::daysCovered*24*60*60)/$UPSGRAPH::stepsPerHour/$UPSGRAPH::step;
25 $UPSGRAPH::hosts = ();
26
27 do $ARGV[0] or die "can't read config: $!";
28
29 my $outdir = $UPSGRAPH::outdir;
30 my $step = $UPSGRAPH::step;
31 my $stepsPerHour = $UPSGRAPH::stepsPerHour;
32 my $keep = $UPSGRAPH::keep;
33 my $keepHours = $UPSGRAPH::keepHours;
34 my $hosts = $UPSGRAPH::hosts;
35
36 sub rrd_update(@) {
37 my @args = @_;
38
39 if ($use_rrds == 1) {
40 RRDs::update(@args);
41 $rrd_result = RRDs::error;
42 } else {
43 $rrd_result = system("rrdtool", "update", @args);
44 }
45 }
46
47 sub rrd_graph(@) {
48 my @args = @_;
49 my @rrd_out = ();
50
51 if ($use_rrds == 1) {
52 @rrd_out = RRDs::graph(@args);
53 $rrd_result = RRDs::error;
54 } else {
55 my $rrd_stdout;
56
57 open(RRDFD, '-|', 'rrdtool', 'graph', @args);
58 while(<RRDFD>) {
59 chomp;
60 $rrd_stdout = $_;
61 }
62 close(RRDFD);
63 $rrd_result = $?;
64 if ($rrd_result == 0) {
65 push @rrd_out, 0;
66 push @rrd_out, split(/x/, $rrd_stdout);
67 }
68 }
69
70 return @rrd_out;
71 }
72
73 sub rrdcreate(@) {
74 my $newrrd = shift;
75 my $field = shift;
76 my $vars = shift;
77 my $start = shift;
78
79 my @cmd = ("${newrrd}", "--step=${step}");
80
81 if (defined($start)) {
82 push @cmd, "--start=${start}";
83 }
84
85 push @cmd, "DS:${field}:GAUGE:600:" .
86 $vars->{$field}->{'min'} . ":" .
87 $vars->{$field}->{'max'};
88
89 push @cmd, "RRA:AVERAGE:0.5:1:${keep}";
90 push @cmd, "RRA:MIN:0.4:${stepsPerHour}:${keepHours}";
91 push @cmd, "RRA:MAX:0.4:${stepsPerHour}:${keepHours}";
92
93 RRDs::create(@cmd);
94 if (RRDs::error) {
95 print "Error while creating: " . RRDs::error . "\n";
96 exit 1;
97 }
98 }
99
100 sub fetch_snmp(@) {
101 my $address = shift;
102 my $community = shift;
103 my $oid = shift;
104
105 (my $session, my $error) = Net::SNMP->session(Hostname => $address,
106 Community => $community);
107
108 if (!$session) {
109 print STDERR "session error: $error";
110 return undef;
111 }
112
113 $session->translate(0);
114
115 my $result = $session->get_request($oid);
116
117 $session->close;
118
119 return undef if (!defined($result));
120
121 $result->{$oid};
122 }
123
124 sub fetch_tcp(@) {
125 my $address = shift;
126 my $port = shift;
127
128 my $sock = IO::Socket::INET->new(PeerAddr => $address,
129 PeerPort => $port,
130 Proto => 'tcp',
131 Timeout => 1);
132
133 return undef if (!$sock);
134
135 my $select = IO::Select->new($sock);
136
137 my $value = undef;
138
139 if ($select->can_read(1)) {
140 chomp($value) if (sysread($sock, $value, 4096) > 0);
141 }
142
143 close($sock);
144
145 if (!$value) {
146 return undef;
147 }
148
149 $value=~ s/\s//g;
150
151 $value;
152 }
153
154 sub fetch_tcp_multi(@) {
155 my $address = shift;
156 my $port = shift;
157 my $delimiter = shift;
158 my %values;
159
160 my $sock = IO::Socket::INET->new(PeerAddr => $address,
161 PeerPort => $port,
162 Proto => 'tcp',
163 Timeout => 1);
164
165 return undef if (!$sock);
166
167 my $select = IO::Select->new($sock);
168
169 while($select->can_read(1)) {
170 if (sysread($sock, my $buf, 16384) > 0) {
171 $buf=~s/\r//g;
172 foreach my $line (split(/\n/, $buf)) {
173 (my $key, my $value) = split(/${delimiter}/, $line);
174 $value=~ s/\s//g;
175 $values{$key} = $value;
176 }
177 } else {
178 last;
179 }
180 }
181
182 close($sock);
183
184 %values;
185 }
186
187 sub dayGraphFunc {
188 my $dataSrc = shift;
189 my $mode = shift;
190 my $color = shift;
191 my $label = shift;
192 my $dataPoints = shift;
193 my @args = ();
194 push @args, "CDEF:prev${mode}1=PREV(${dataSrc})";
195 for (my $i = 1; $i < $dataPoints - 1; ++$i) {
196 my $prev = $i;
197 my $next = $i+1;
198 push @args, "CDEF:prev${mode}${next}=PREV(prev${mode}${prev})";
199 }
200 my $dayCons = '';
201 my $consFunc = '';
202 for (my $i = 1; $i < $dataPoints; ++$i) {
203 $dayCons .= "prev${mode}${i},";
204 $consFunc .= ",${mode}";
205 }
206 push @args, "CDEF:day${mode}=${dayCons}${dataSrc}${consFunc}";
207 push @args, "CDEF:fillCalDay${mode}0=COUNT,${dataPoints},%,0,EQ,day${mode},UNKN,IF";
208 for (my $i = 1; $i < $dataPoints; ++$i) {
209 my $prev = $i-1;
210 my $next = $i;
211 push @args, "CDEF:fillCalDay${mode}${next}=PREV(fillCalDay${mode}${prev})";
212 }
213 my $fillPoint = '';
214 my $if = '';
215 for (my $i = 0; $i < $dataPoints; ++$i) {
216 $fillPoint .= "COUNT,${dataPoints},%,${i},EQ,fillCalDay${mode}${i},";
217 $if .= ",IF";
218 }
219 push @args, "CDEF:${mode}Curve=${fillPoint}UNKN${if}";
220 my $forwardShift = (24*60*60) * ($dataPoints - 1) / $dataPoints;
221 push @args, "SHIFT:${mode}Curve:-${forwardShift}";
222 push @args, "LINE1:${mode}Curve#${color}:${label}";
223 return \@args;
224 }
225
226 sub cfgToGraphDef {
227 my $cfg = shift;
228 my $varname = shift;
229 my $dpPerDay= shift;
230 my @graphDef = ();
231 foreach my $subGraph (@$cfg) {
232 if ($subGraph eq 'avg') {
233 push @graphDef, "LINE1:${varname}-avg#FF0000";
234 } elsif ($subGraph eq 'day-min') {
235 push @graphDef, @{dayGraphFunc("${varname}-min", 'MIN', '0000ff', 'Day Minimum Temperature', $dpPerDay)};
236 } elsif ($subGraph eq 'day-max') {
237 push @graphDef, @{dayGraphFunc("${varname}-max", 'MAX', '00ff00', 'Day Maximum Temperature', $dpPerDay)};
238 }
239 }
240 return \@graphDef;
241 }
242
243 if ($> == 0) {
244 if (@ARGV != 2) {
245 print STDERR "Running as root, please provide UID as 2th argument!\n";
246 exit(1);
247 }
248
249 print "Running as root, switching to ".$ARGV[1]."\n";
250 $< = $> = $ARGV[1];
251 }
252
253 foreach my $host (@$hosts) {
254 my $rrdfile = $host->{'rrdfile'};
255
256 foreach my $var (keys(%{$host->{'vars'}})) {
257 $host->{'vars'}->{$var}->{'min'} = 'U' if (!defined($host->{'vars'}->{$var}->{'min'}));
258 $host->{'vars'}->{$var}->{'max'} = 'U' if (!defined($host->{'vars'}->{$var}->{'max'}));
259 }
260
261 if (-e "${rrdfile}") {
262 print "Reading old ${rrdfile} to preserve data...\n";
263
264 my $rrdinfo = RRDs::info("${rrdfile}");
265 if (RRDs::error) {
266 print "Error while getting info: " . RRDs::error . "\n";
267 exit 1;
268 }
269
270 (my $start, my $ostep, my $names, my $data) =
271 RRDs::fetch("${rrdfile}",
272 "-s " . (time() - ($rrdinfo->{'rra[0].rows'} * $rrdinfo->{'step'})),
273 "AVERAGE");
274
275 if (RRDs::error) {
276 print "Error while fetching data: " . RRDs::error . "\n";
277 exit 1;
278 }
279
280 foreach my $field (@$names) {
281 if (! -e "${rrdfile}.${field}") {
282 rrdcreate("${rrdfile}.${field}",
283 "${field}",
284 $host->{'vars'},
285 (${start}-${ostep}));
286 }
287 }
288
289 my $pos = $start;
290 foreach my $line (@$data) {
291 foreach my $field (@$names) {
292 my $val = shift (@$line);
293 $val = 'U' if (!defined($val));
294
295 RRDs::update("${rrdfile}.${field}", "${pos}:${val}");
296 if (RRDs::error) {
297 print "Can't insert data: " . RRDs::error . "\n";
298 exit 1;
299 }
300
301 }
302
303 $pos += $ostep;
304
305 if ((($pos-$start)/$ostep) == $#$data) {
306 last;
307 }
308 }
309
310 rename("${rrdfile}", "${rrdfile}.old") or die "Can't rename old file: $!\n";
311 }
312
313 foreach my $field (@{$host->{'fields'}}) {
314 if (! -e "${rrdfile}.${field}") {
315 print "Creating ${rrdfile}.${field}...\n";
316 rrdcreate("${rrdfile}.${field}",
317 "${field}",
318 $host->{'vars'});
319 }
320
321 my $rrdinfo = RRDs::info("${rrdfile}.${field}");
322 if (RRDs::error) {
323 print "Error while getting info: " . RRDs::error . "\n";
324 exit 1;
325 }
326
327 my $limitsChanged = 0;
328 if (defined($rrdinfo->{"ds[${field}].min"})) {
329 if ($rrdinfo->{"ds[${field}].min"} ne $host->{'vars'}->{$field}->{'min'}) {
330 $limitsChanged = 1;
331 RRDs::tune("${rrdfile}.${field}","-i",$field.":".$host->{'vars'}->{$field}->{'min'});
332 }
333 } else {
334 if ($host->{'vars'}->{$field}->{'min'} ne 'U') {
335 $limitsChanged = 1;
336 RRDs::tune("${rrdfile}.${field}","-i",$field.":".$host->{'vars'}->{$field}->{'min'});
337 }
338 }
339
340 if (RRDs::error) {
341 print "Error while setting min: " . RRDs::error . "\n";
342 exit 1;
343 }
344
345 if (defined($rrdinfo->{"ds[${field}].max"})) {
346 if ($rrdinfo->{"ds[${field}].max"} ne $host->{'vars'}->{$field}->{'max'}) {
347 $limitsChanged = 1;
348 RRDs::tune("${rrdfile}.${field}","-a",$field.":".$host->{'vars'}->{$field}->{'max'});
349 }
350 } else {
351 if ($host->{'vars'}->{$field}->{'max'} ne 'U') {
352 $limitsChanged = 1;
353 RRDs::tune("${rrdfile}.${field}","-a",$field.":".$host->{'vars'}->{$field}->{'max'});
354 }
355 }
356
357 if (RRDs::error) {
358 print "Error while setting max: " . RRDs::error . "\n";
359 exit 1;
360 }
361
362 if ($rrdinfo->{'rra[0].rows'} != $keep ||
363 !defined($rrdinfo->{'rra[1].rows'}) || $rrdinfo->{'rra[1].rows'} != $keepHours ||
364 $limitsChanged == 1) {
365
366 print "Resizing ${rrdfile}.${field} from " . $rrdinfo->{'rra[0].rows'} .
367 " to ${keep} samples.\n";
368
369 (my $start, my $ostep, my $names, my $data) =
370 RRDs::fetch("${rrdfile}.${field}",
371 "-s " . (time() - ($rrdinfo->{'rra[0].rows'} * $rrdinfo->{'step'})),
372 "AVERAGE");
373
374 if (RRDs::error) {
375 print "Error while fetching data: " . RRDs::error . "\n";
376 exit 1;
377 }
378
379 rrdcreate("${rrdfile}.${field}.new",
380 "${field}",
381 $host->{'vars'},
382 (${start}-${ostep}));
383
384 print "Preserving data in file ${rrdfile}.${field} since " . localtime($start) . "\n";
385
386 my $pos = $start;
387 foreach my $line (@$data) {
388 my $vline = "${pos}";
389
390 foreach my $val (@$line) {
391 $val = 'U' if (!defined($val));
392 $vline .= ":${val}";
393 }
394 RRDs::update("${rrdfile}.${field}.new", $vline) or die "Can't insert data\n";
395
396 if (RRDs::error) {
397 print "Error while updating: " . RRDs::error . "\n";
398 exit 1;
399 }
400 $pos += $ostep;
401
402 if ((($pos-$start)/$ostep) == $#$data) {
403 last;
404 }
405 }
406
407 rename("${rrdfile}.${field}", "${rrdfile}.${field}.old") or die "Can't rename old file: $!\n";
408 rename("${rrdfile}.${field}.new", "${rrdfile}.${field}") or die "Can't rename new file: $!\n";
409
410 $rrdinfo = RRDs::info("${rrdfile}.${field}");
411 if (RRDs::error) {
412 print "Error while getting info: " . RRDs::error . "\n";
413 exit 1;
414 }
415
416 if ($rrdinfo->{'rra[0].rows'} != $keep) {
417 print "Failed!\n";
418 exit 1;
419 }
420 }
421 }
422 }
423
424 my $child = fork();
425
426 die "fork failed!" if (!defined($child));
427
428 exit 0 if ($child != 0);
429
430 while(1) {
431 open(HTML, ">${outdir}/index.html.new");
432
433 print HTML '<html><head><meta http-equiv="refresh" content="60"/><meta http-equiv="cache-control" content="no-cache"/><meta http-equiv="pragma" content="no-cache"/><meta http_equiv="expires" content="Sat, 26 Jul 1997 05:00:00 GMT"/><title>Status</title></head>';
434 print HTML '<body bgcolor="#ffffff">';
435
436 foreach my $host (@$hosts) {
437 print HTML "[<a href=\"#".${host}->{'name'}."\">".${host}->{'name'}."</a>]&nbsp;";
438 }
439 print HTML "<br>\n";
440
441 foreach my $host (@$hosts) {
442 print HTML "<br>\n";
443 print HTML "<a name=\"".${host}->{'name'}."\"></a>\n";
444 my $vars = $host->{'vars'};
445 my $rrdfile = $host->{'rrdfile'};
446 my $hostname = $host->{'name'};
447 my %multi_values = ();
448
449 foreach my $var (@{$host->{'fields'}}) {
450 delete $vars->{$var}->{'value'};
451
452 my $result;
453
454 if ((!defined($vars->{$var}->{'proto'})) ||
455 ($vars->{$var}->{'proto'} eq '') ||
456 ($vars->{$var}->{'proto'} eq 'snmp')) {
457 $result = fetch_snmp($host->{'address'}, $host->{'community'}, $vars->{$var}->{'oid'});
458 } elsif ($vars->{$var}->{'proto'} eq 'tcp') {
459 $result = fetch_tcp($host->{'address'}, $vars->{$var}->{'port'});
460 } elsif ($vars->{$var}->{'proto'} eq 'tcp_multi') {
461 if (defined($multi_values{$vars->{$var}->{'multi_id'}})) {
462 $result = $multi_values{$vars->{$var}->{'multi_id'}}
463 } else {
464 my %values = fetch_tcp_multi($host->{'address'}, $vars->{$var}->{'port'}, $vars->{$var}->{'multi_delimiter'});
465 @multi_values{keys %values} = values %values;
466 $result = $multi_values{$vars->{$var}->{'multi_id'}};
467 }
468 }
469
470 next unless (defined $result);
471
472 $vars->{$var}->{'value'} = $result;
473 if (defined($vars->{$var}->{'factor'})) {
474 $vars->{$var}->{'value'} *= $vars->{$var}->{'factor'};
475 }
476 }
477
478 foreach my $var (@{$host->{'fields'}}) {
479 if (!(defined($vars->{$var}->{'value'}))) {
480 $vars->{$var}->{'value'} = 'U';
481 }
482 rrd_update("${rrdfile}.${var}", "N:" . $vars->{$var}->{'value'});
483 }
484 if ($rrd_result) {
485 print "Error while updating: " . $rrd_result . "\n";
486 }
487
488 foreach my $var (@{$host->{'fields'}}) {
489 my $graphWidth = 365 * 3;
490 my $graphConfig;
491 if (defined $vars->{$var}->{'graph'}) {
492 $graphConfig = $vars->{$var}->{'graph'};
493 foreach my $subGraph (qw(day week year)) {
494 if (!defined($graphConfig->{$subGraph})) {
495 $graphConfig->{$subGraph} = [ 'avg'];
496 }
497 }
498 } else {
499 $graphConfig = {
500 'day' => [ 'avg' ],
501 'week' => [ 'avg' ],
502 'year' => [ 'avg' ],
503 };
504 }
505
506 my @graphdef = ('-P', "--lazy", "-t", $hostname." - ".$vars->{$var}->{'name'});
507
508 push @graphdef, "DEF:${var}-avg=${rrdfile}.${var}:${var}:AVERAGE";
509 push @graphdef, "DEF:${var}-min=${rrdfile}.${var}:${var}:MIN";
510 push @graphdef, "DEF:${var}-max=${rrdfile}.${var}:${var}:MAX";
511 push @graphdef, "LINE1:${var}-avg#FF0000";
512 push @graphdef, "VDEF:cur=${var}-avg,LAST";
513 push @graphdef, 'GPRINT:cur:Current\\: <span foreground="#FF0000">%.2lf</span>\\r';
514
515 my $mtime;
516 $mtime=(stat("${outdir}/${hostname}.${var}.png.work"))[9];
517
518 (my $averages, my $width, my $height) =
519 rrd_graph("${outdir}/${hostname}.${var}.png.work",
520 "-w", "720", @graphdef);
521
522 pop @graphdef;
523 pop @graphdef;
524 pop @graphdef;
525
526 if ($rrd_result) {
527 print "Error while graphing: " . $rrd_result . "\n";
528 } else {
529 my $newmtime=(stat("${outdir}/${hostname}.${var}.png.work"))[9];
530 if ((!defined($mtime)) || ($newmtime != $mtime)) {
531 copy("${outdir}/${hostname}.${var}.png.work", "${outdir}/${hostname}.${var}.png.new");
532 rename("${outdir}/${hostname}.${var}.png.new", "${outdir}/${hostname}.${var}.png");
533 }
534 }
535
536 print HTML "<a href=\"${hostname}.${var}.html\"><img src=\"${hostname}.${var}.png\" width=\"${width}\" height=\"${height}\" border=\"0\"></a><br>\n";
537
538 open (HTML2, ">${outdir}/${hostname}.${var}.html.new");
539 print HTML2 '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="refresh" content="60"/><meta http-equiv="cache-control" content="no-cache"/><meta http-equiv="pragma" content="no-cache"/><meta http_equiv="expires" content="Sat, 26 Jul 1997 05:00:00 GMT"/><title>' . $vars->{$var}->{'name'} . '</title></head>';
540 print HTML2 '<body bgcolor="#ffffff">';
541
542 push @graphdef, "VDEF:min=${var}-min,MINIMUM";
543 push @graphdef, "GPRINT:min:Minimum\\: %.2lf";
544
545 push @graphdef, "VDEF:avg=${var}-avg,AVERAGE";
546 push @graphdef, "GPRINT:avg:Average\\: %.2lf";
547
548 push @graphdef, "VDEF:max=${var}-max,MAXIMUM";
549 push @graphdef, "GPRINT:max:Maximum\\: %.2lf";
550
551 push @graphdef, "VDEF:cur=${var}-avg,LAST";
552 push @graphdef, "GPRINT:cur:Current\\: %.2lf";
553
554 my @dayGraphDef = @graphdef;
555 push @dayGraphDef, @{cfgToGraphDef($graphConfig->{'day'}, ${var}, 24)};
556
557 $mtime=(stat("${outdir}/${hostname}.${var}.long.png.work"))[9];
558 ($averages, $width, $height) =
559 rrd_graph("${outdir}/${hostname}.${var}.long.png.work",
560 "-w", $graphWidth, @dayGraphDef);
561
562 if ($rrd_result) {
563 print "Error while graphing: " . $rrd_result . "\n";
564 } else {
565 my $newmtime=(stat("${outdir}/${hostname}.${var}.long.png.work"))[9];
566 if ((!defined($mtime)) || ($newmtime != $mtime)) {
567 copy("${outdir}/${hostname}.${var}.long.png.work", "${outdir}/${hostname}.${var}.long.png.new");
568 rename("${outdir}/${hostname}.${var}.long.png.new", "${outdir}/${hostname}.${var}.long.png");
569 }
570 }
571
572 print HTML2 "<img src=\"${hostname}.${var}.long.png\" width=\"${width}\" height=\"${height}\"><br>\n";
573
574 $mtime=(stat("${outdir}/${hostname}.${var}.week.png.work"))[9];
575
576 my @weekGraphDef = @graphdef;
577 push @weekGraphDef, @{cfgToGraphDef($graphConfig->{'week'}, ${var}, 24)};
578
579 ($averages, $width, $height) =
580 rrd_graph("${outdir}/${hostname}.${var}.week.png.work",
581 "-w", "$graphWidth", "-e", "now", "-s", "00:00-8d", @weekGraphDef);
582
583 if ($rrd_result) {
584 print "Error while graphing: " . $rrd_result . "\n";
585 } else {
586 my $newmtime=(stat("${outdir}/${hostname}.${var}.week.png.work"))[9];
587 if ((!defined($mtime)) || ($newmtime != $mtime)) {
588 copy("${outdir}/${hostname}.${var}.week.png.work", "${outdir}/${hostname}.${var}.week.png.new");
589 rename("${outdir}/${hostname}.${var}.week.png.new", "${outdir}/${hostname}.${var}.week.png");
590 }
591 }
592
593 print HTML2 "<img src=\"${hostname}.${var}.week.png\" width=\"${width}\" height=\"${height}\"><br>\n";
594
595 $mtime=(stat("${outdir}/${hostname}.${var}.year.png.work"))[9];
596
597 my @yearGraphDef = @graphdef;
598 push @yearGraphDef, @{cfgToGraphDef($graphConfig->{'year'}, ${var}, 3)};
599
600 ($averages, $width, $height) =
601 rrd_graph("${outdir}/${hostname}.${var}.year.png.work",
602 "-w", "$graphWidth", "-e", "00:00", "-s", "end-365d", @yearGraphDef);
603
604 if ($rrd_result) {
605 print "Error while graphing: " . $rrd_result . "\n";
606 } else {
607 my $newmtime=(stat("${outdir}/${hostname}.${var}.year.png.work"))[9];
608 if ((!defined($mtime)) || ($newmtime != $mtime)) {
609 copy("${outdir}/${hostname}.${var}.year.png.work", "${outdir}/${hostname}.${var}.year.png.new");
610 rename("${outdir}/${hostname}.${var}.year.png.new", "${outdir}/${hostname}.${var}.year.png");
611 }
612 }
613
614 print HTML2 "<img src=\"${hostname}.${var}.year.png\" width=\"${width}\" height=\"${height}\"><br>\n";
615
616 print HTML2 "</body></html>\n";
617 close(HTML2);
618 rename("${outdir}/${hostname}.${var}.html.new", "${outdir}/${hostname}.${var}.html");
619 }
620 }
621
622 print HTML "</body></html>\n";
623 print HTML "<br>Generated on: " . localtime(time());
624 print HTML ' by <a href="http://git.zerfleddert.de/cgi-bin/gitweb.cgi/upsgraph">upsgraph</a>.';
625
626 close(HTML);
627
628 rename("${outdir}/index.html.new", "${outdir}/index.html");
629
630 sleep(${step}/2);
631 }
Impressum, Datenschutz