diff options
author | ivan <ivan> | 2011-02-27 00:52:29 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-02-27 00:52:29 +0000 |
commit | f4f7bb4086cdaf2699c6d028b76e99b3e9be1e90 (patch) | |
tree | ea1d3ad4c176a286f71758b524aee18b4aa722c1 /FS/FS/NetworkMonitoringSystem | |
parent | 8cec20dd7f69a3fb7b6a5e6a853747833e8a7784 (diff) |
torrus virtual ports, RT#10574
Diffstat (limited to 'FS/FS/NetworkMonitoringSystem')
-rw-r--r-- | FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm index 985b1be05..b55d0aaf7 100644 --- a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm +++ b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm @@ -8,7 +8,7 @@ use File::Slurp qw(slurp); use Date::Format; use XML::Simple; use FS::svc_port; -use FS::Record qw(qsearch); +use FS::Record qw(qsearch dbh); use Torrus::ConfigTree; #$DEBUG = 0; @@ -226,4 +226,23 @@ sub _torrus_reload { } +sub torrus_serviceids { + my $self = shift; + + #is this going to get too slow or will the index make it okay? + my $sth = dbh->prepare("SELECT DISTINCT(serviceid) FROM srvexport") + or die dbh->errstr; + $sth->execute or die $sth->errstr; + my %serviceid = (); + while ( my $row = $sth->fetchrow_arrayref ) { + my $serviceid = $row->[0]; + $serviceid =~ s/_(IN|OUT)$//; + $serviceid{$serviceid}=1; + } + my @serviceids = sort keys %serviceid; + + @serviceids; + +} + 1; |