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]';
foreach my $host ( @hosts ) {
my $param = $host->{param};
if($param && $param->{'snmp-host'}
- && (!$router || $param->{'snmp-host'}->{'value'} eq $router)
&& $param->{'RFC2863_IF_MIB::external-serviceid'}) {
my $serviceids =
$param->{'RFC2863_IF_MIB::external-serviceid'}->{'content'};
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";
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');
}
}
sub add_router {
- my($self, $ip) = @_;
+ my($self, $ip, $community) = @_;
+
+ $community = qq!<param name="snmp-community" value="$community"/>\n !
+ if length($community) > 1;
my $newhost =
qq( <host>\n).
- qq( <param name="snmp-host" value="$ip"/>\n).
+ qq( <param name="snmp-host" value="$ip"/>\n).$community.
qq( </host>\n);
my $ddx = $self->_torrus_loadddx;
unless ( $added ) {
$new .=
qq( <param name="RFC2863_IF_MIB::external-serviceid">\n).
- qq( $newline\n").
+ qq( $newline\n).
qq( </param>\n);
}
$new .= "$hostline\n";