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}; |
print OUT "<html><head><title>$key</title></head><body>"; |
111 |
|
print OUT $html_file{$key}; |
112 |
|
print OUT "</body></html>"; |
113 |
close(OUT); |
close(OUT); |
114 |
|
|
115 |
} |
} |
116 |
|
|
117 |
exit; |
exit; |
166 |
|
|
167 |
my($dslist); |
my($dslist); |
168 |
|
|
|
my($filename)="$path/$name-$rangeLabel.html"; |
|
|
my($dir) = dirname($filename); |
|
|
if (! -d $dir) { |
|
|
Info("Making directory $dir to hold file $filename."); |
|
|
Common::Util::MkDir($dir); |
|
|
} |
|
|
|
|
169 |
if (defined($ttRef->{'view'})) |
if (defined($ttRef->{'view'})) |
170 |
{ |
{ |
171 |
my($v); |
my($v); |
180 |
|
|
181 |
$URL = "$gBaseURL?type=png&target=$paramtarget"; |
$URL = "$gBaseURL?type=png&target=$paramtarget"; |
182 |
$URL .= "&dslist=$dslist&range=$paramrange"; |
$URL .= "&dslist=$dslist&range=$paramrange"; |
183 |
my $desc = "view: "; |
my $desc = "$paramtarget $vname"; |
184 |
|
$desc .= " <b>".$target->{'short-desc'}."</b>" if (defined $target->{'short-desc'}); |
185 |
if ($paraminst ne "") { |
if ($paraminst ne "") { |
186 |
$URL .= "&inst=$paraminst"; |
$URL .= "&inst=$paraminst"; |
|
$desc.="$paraminst $paramtarget $vname"; |
|
|
} else { |
|
|
$desc.="$paramtarget $vname"; |
|
187 |
} |
} |
188 |
|
|
189 |
Info("Retrieving graph for $desc"); |
Info("Retrieving graph for $desc"); |
190 |
# getURL($URL,"$path/$name-$vname-$rangeLabel.png"); |
# getURL($URL,"$path/$name-$vname-$rangeLabel.png"); |
191 |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y&view=$vname"; |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y&view=$vname"; |
192 |
$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"; |
193 |
} |
} |
194 |
} else { |
} else { |
195 |
$dslist = $ttRef->{'ds'}; |
$dslist = $ttRef->{'ds'}; |
198 |
|
|
199 |
$URL = "$gBaseURL?type=png&target=$paramtarget"; |
$URL = "$gBaseURL?type=png&target=$paramtarget"; |
200 |
$URL .= "&dslist=$dslist&range=$paramrange"; |
$URL .= "&dslist=$dslist&range=$paramrange"; |
201 |
my $desc = "ds: "; |
my $desc ="$paraminst $rangeLabel"; |
202 |
|
$desc .= " <b>".$target->{'short-desc'}."</b>" if (defined $target->{'short-desc'}); |
203 |
if ($paraminst ne "") { |
if ($paraminst ne "") { |
204 |
$URL .= "&inst=$paraminst"; |
$URL .= "&inst=$paraminst"; |
|
$desc.="$paraminst $rangeLabel" |
|
|
} else { |
|
|
$desc.="$paramtarget $rangeLabel"; |
|
205 |
} |
} |
206 |
|
|
207 |
Info("Retrieving graph for $desc"); |
Info("Retrieving graph for $desc"); |
208 |
|
|
209 |
# getURL($URL,"$path/$name-$rangeLabel.png"); |
# getURL($URL,"$path/$name-$rangeLabel.png"); |
210 |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y"; |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y"; |
211 |
$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>"; |
212 |
} |
} |
213 |
} |
} |
214 |
} |
} |