34 |
# You need to update this to point to the URL |
# You need to update this to point to the URL |
35 |
# you use to access Cricket. |
# you use to access Cricket. |
36 |
# $gBaseURL = "http://localhost/~cricket/grapher.cgi"; |
# $gBaseURL = "http://localhost/~cricket/grapher.cgi"; |
37 |
$gBaseURL = "http://romul.pliva.hr/cgi-bin/cricket/grapher.cgi"; |
my $hostname = `hostname -f`; |
38 |
|
chomp($hostname); |
39 |
|
$gBaseURL = "http://$hostname/cgi-bin/cricket/grapher.cgi"; |
40 |
|
|
41 |
# change this to destination directory |
# change this to destination directory |
42 |
$path = "/home/dpavlin/public_html"; |
$path = "/data/mon/"; |
|
# this is basename of all html files |
|
|
$name = "overview"; |
|
43 |
} |
} |
44 |
|
|
45 |
#use lib "$gInstallRoot/../lib"; |
#use lib "$gInstallRoot/../lib"; |
87 |
} |
} |
88 |
} |
} |
89 |
|
|
90 |
foreach my $filename (keys %html) { |
my %html_file; |
91 |
|
|
92 |
|
foreach my $item (sort keys %html) { |
93 |
|
my ($range,$target) = split(/\t/,$item,2); |
94 |
|
my (undef,$service,$arg) = split(/\//,$target,3); |
95 |
|
|
96 |
|
$html_file{"$range/$service"} .= $html{$item}; |
97 |
|
$html_file{"overview-$range"} .= $html{$item}; |
98 |
|
} |
99 |
|
|
100 |
|
foreach my $key (keys %html_file) { |
101 |
|
|
102 |
|
my $filename = "$path/$key.html"; |
103 |
|
my($dir) = dirname($filename); |
104 |
|
if (! -d $dir) { |
105 |
|
Info("Making directory $dir to hold file $filename."); |
106 |
|
Common::Util::MkDir($dir); |
107 |
|
} |
108 |
|
Info("Dumping HTML for $key to $filename."); |
109 |
open(OUT,"> $filename") || die "can't open output html '$filename': $!"; |
open(OUT,"> $filename") || die "can't open output html '$filename': $!"; |
110 |
print OUT $html{$filename},"</body></html>"; |
print OUT '<html><head><title>'.$key.'</title> |
111 |
|
<meta content="no-cache" http-equiv="Pragma"> |
112 |
|
<meta content="300" http-equiv="Refresh"> |
113 |
|
</head><body>'; |
114 |
|
print OUT $html_file{$key}; |
115 |
|
print OUT "</body></html>"; |
116 |
close(OUT); |
close(OUT); |
117 |
|
|
118 |
} |
} |
119 |
|
|
120 |
exit; |
exit; |
169 |
|
|
170 |
my($dslist); |
my($dslist); |
171 |
|
|
|
my($filename)="$path/$name-$rangeLabel.html"; |
|
|
if (! defined $html{$filename}) { |
|
|
$html{$filename}="<html><head><title>$rangeLabel</title></head><body>"; |
|
|
} |
|
|
my($dir) = dirname($filename); |
|
|
if (! -d $dir) { |
|
|
Info("Making directory $dir to hold file $filename."); |
|
|
Common::Util::MkDir($dir); |
|
|
} |
|
|
|
|
172 |
if (defined($ttRef->{'view'})) |
if (defined($ttRef->{'view'})) |
173 |
{ |
{ |
174 |
my($v); |
my($v); |
183 |
|
|
184 |
$URL = "$gBaseURL?type=png&target=$paramtarget"; |
$URL = "$gBaseURL?type=png&target=$paramtarget"; |
185 |
$URL .= "&dslist=$dslist&range=$paramrange"; |
$URL .= "&dslist=$dslist&range=$paramrange"; |
186 |
my $desc = "view: "; |
my $desc = "$paramtarget $vname"; |
187 |
|
$desc .= " <b>".$target->{'short-desc'}."</b>" if (defined $target->{'short-desc'}); |
188 |
if ($paraminst ne "") { |
if ($paraminst ne "") { |
189 |
$URL .= "&inst=$paraminst"; |
$URL .= "&inst=$paraminst"; |
|
$desc.="$paraminst $paramtarget $vname"; |
|
|
} else { |
|
|
$desc.="$paramtarget $vname"; |
|
190 |
} |
} |
191 |
|
|
192 |
Info("Retrieving graph for $desc"); |
Info("Retrieving graph for $desc"); |
193 |
# getURL($URL,"$path/$name-$vname-$rangeLabel.png"); |
# getURL($URL,"$path/$name-$vname-$rangeLabel.png"); |
194 |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y&view=$vname"; |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y&view=$vname"; |
195 |
$html{$filename}.="$desc<br><a href=\"$tmp_URL\"><img src=$URL></a><br>"; |
$html{"$rangeLabel\t$paramtarget"}.="$desc<br><a href=\"$tmp_URL\"><img src=$URL></a><br>\n"; |
196 |
} |
} |
197 |
} else { |
} else { |
198 |
$dslist = $ttRef->{'ds'}; |
$dslist = $ttRef->{'ds'}; |
201 |
|
|
202 |
$URL = "$gBaseURL?type=png&target=$paramtarget"; |
$URL = "$gBaseURL?type=png&target=$paramtarget"; |
203 |
$URL .= "&dslist=$dslist&range=$paramrange"; |
$URL .= "&dslist=$dslist&range=$paramrange"; |
204 |
my $desc = "ds: "; |
my $desc ="$paraminst $rangeLabel"; |
205 |
|
$desc .= " <b>".$target->{'short-desc'}."</b>" if (defined $target->{'short-desc'}); |
206 |
if ($paraminst ne "") { |
if ($paraminst ne "") { |
207 |
$URL .= "&inst=$paraminst"; |
$URL .= "&inst=$paraminst"; |
|
$desc.="$paraminst $rangeLabel" |
|
|
} else { |
|
|
$desc.="$paramtarget $rangeLabel"; |
|
208 |
} |
} |
209 |
|
|
210 |
Info("Retrieving graph for $desc"); |
Info("Retrieving graph for $desc"); |
211 |
|
|
212 |
# getURL($URL,"$path/$name-$rangeLabel.png"); |
# getURL($URL,"$path/$name-$rangeLabel.png"); |
213 |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y"; |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y"; |
214 |
$html{$filename}.="$desc:<br><a href=\"$tmp_URL\"><img src=$URL><a/><br>"; |
$html{"$rangeLabel\t$paramtarget"}.="$desc:<br><a href=\"$tmp_URL\"><img src=$URL><a/><br>"; |
215 |
} |
} |
216 |
} |
} |
217 |
} |
} |