X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FNetworkMonitoringSystem%2FTorrus_Internal.pm;h=9df19755ec29c7971468e5bf844d95206abc462e;hb=b5c4237a34aef94976bc343c8d9e138664fc3984;hp=dc6cb8f9356c8d1e6c8249c4223b5adcc018ed38;hpb=4ac0d2e3a22e4e49a593aaf683754fea75fce546;p=freeside.git diff --git a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm index dc6cb8f93..9df19755e 100644 --- a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm +++ b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm @@ -11,7 +11,7 @@ use FS::Record qw(qsearch qsearchs dbh); use FS::svc_port; use FS::torrus_srvderive; use FS::torrus_srvderive_component; -use Torrus::ConfigTree; +#use Torrus::ConfigTree; #$DEBUG = 0; #$me = '[FS::NetworkMonitoringSystem::Torrus_Internal]'; @@ -108,6 +108,11 @@ sub port_graphs_link { my @keys = keys %$hash; # yeah this is weird... my $host = $keys[0]; my $iface = $hash->{$keys[0]}; + + #Torrus::ConfigTree is only available when running under the web UI + eval 'use Torrus::ConfigTree;'; + die $@ if $@; + my $config_tree = new Torrus::ConfigTree( -TreeName => 'main' ); my $token = $config_tree->token("/Routers/$host/Interface_Counters/$iface/InOut_bps"); return $Torrus::Freeside::FSURL."/torrus/main?token=$token"; @@ -144,7 +149,7 @@ sub report { if ($m == 0) { $m=12; $y-- } #i should have better error checking system('torrus', 'report', '--report=MonthlyUsage', "--date=$y-$m-01"); - system('torrus', 'report', '--genhtml', '--tree=main'); + system('torrus', 'report', '--genhtml', '--all2tree=main'); } } @@ -207,7 +212,7 @@ sub add_interface { unless ( $added ) { $new .= qq( \n). - qq( $newline\n"). + qq( $newline\n). qq( \n); } $new .= "$hostline\n";