added the option 'url_prefix' in the 'traffacct' graph

This commit is contained in:
Jordi Sanfeliu 2013-07-15 15:09:46 +02:00
parent 5260941672
commit 34609ea6f7
3 changed files with 10 additions and 2 deletions

View File

@ -338,10 +338,10 @@ sub traffacct_sendreports {
$to = $traffacct->{reports}->{default_mail} unless $to; $to = $traffacct->{reports}->{default_mail} unless $to;
# get the monthly graph # get the monthly graph
my $url = "http://127.0.0.1" . $base_cgi . "/monitorix.cgi?mode=traffacct.$n&graph=all&when=1month&color=&silent=imagetagbig"; my $url = $traffacct->{reports}->{url_prefix} . $base_cgi . "/monitorix.cgi?mode=traffacct.$n&graph=all&when=1month&color=&silent=imagetagbig";
my $ua = LWP::UserAgent->new(timeout => 30); my $ua = LWP::UserAgent->new(timeout => 30);
$ua->request(HTTP::Request->new('GET', $url)); $ua->request(HTTP::Request->new('GET', $url));
$url = "http://127.0.0.1" . $base_url . "/" . $imgs_dir . "traffacct" . $n . ".1month.png"; $url = $traffacct->{reports}->{url_prefix} . $base_url . "/" . $imgs_dir . "traffacct" . $n . ".1month.png";
my $image = $ua->request(HTTP::Request->new('GET', $url)); my $image = $ua->request(HTTP::Request->new('GET', $url));
if(!$image->is_success) { if(!$image->is_success) {
logger("$myself: ERROR: Unable to connect to '$url'."); logger("$myself: ERROR: Unable to connect to '$url'.");

View File

@ -1600,6 +1600,13 @@ This is the default email address used to send the monthly reports. This option
Default value: \fIroot@localhost\fP Default value: \fIroot@localhost\fP
.RE .RE
.P .P
.BI url_prefix
.RS
This is the prefix of the same URL you use to connect to Monitorix. This is needed in order to get the graphs of the same machine.
.P
Default value: \fIhttp://localhost:8080\fP
.RE
.P
.BI smtp_hostname .BI smtp_hostname
.RS .RS
This is the hostname that will be used as a SMTP relay to deliver the monthly report emails. This is the hostname that will be used as a SMTP relay to deliver the monthly report emails.

View File

@ -474,6 +474,7 @@ secure_log_date_format = %b %e
enabled = n enabled = n
language = en language = en
default_mail = root@localhost default_mail = root@localhost
url_prefix = http://localhost:8080
smtp_hostname = localhost smtp_hostname = localhost
from_address = noreply@example.com from_address = noreply@example.com
</reports> </reports>