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