summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-12-09 05:09:20 +0000
committerivan <ivan>2011-12-09 05:09:20 +0000
commit653530ba04e038b70dc2b392ca36e9c6c6920d88 (patch)
treeddedea85eac0e71c7aea5612297276018a7f26bf
parent4a0324a7aa9dc63b055fd230f13dfcb2ff6aab82 (diff)
auto-add service ips to network monitoring, RT#15536
-rw-r--r--FS/FS/Conf.pm18
-rw-r--r--FS/FS/svc_Common.pm30
-rw-r--r--FS/FS/svc_acct.pm1
-rwxr-xr-xFS/FS/svc_broadband.pm1
-rw-r--r--FS/FS/svc_dsl.pm1
5 files changed, 49 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index fcdcd5766..94669ffbd 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2650,14 +2650,28 @@ and customer address. Include units.',
{
'key' => 'network_monitoring_system',
- 'section' => '',
+ 'section' => 'network_monitoring',
'description' => 'Networking monitoring system (NMS) integration. <b>Torrus_Internal</b> uses the built-in Torrus ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Torrus_Installation">integrated networking monitoring system installation instructions</a>).',
'type' => 'select',
- #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
'select_enum' => [ '', qw(Torrus_Internal) ],
},
{
+ 'key' => 'nms-auto_add-svc_ips',
+ 'section' => 'network_monitoring',
+ 'description' => 'Automatically add (and remove) IP addresses from these service tables to the network monitoring system.',
+ 'type' => 'selectmultiple',
+ 'select_enum' => [ 'svc_acct', 'svc_broadband', 'svc_dsl' ],
+ },
+
+ {
+ 'key' => 'nms-auto_add-community',
+ 'section' => 'network_monitoring',
+ 'description' => 'SNMP community string to use when automatically adding IP addresses from these services to the network monitoring system.',
+ 'type' => 'text',
+ },
+
+ {
'key' => 'ticket_system-default_queueid',
'section' => 'ticketing',
'description' => 'Default queue used when creating new customer tickets.',
diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index 02e159bfa..fbab64d49 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -5,6 +5,7 @@ use vars qw( @ISA $noexport_hack $DEBUG $me
$overlimit_missing_cust_svc_nonfatal_kludge );
use Carp qw( cluck carp croak confess ); #specify cluck have to specify them all
use Scalar::Util qw( blessed );
+use FS::Conf;
use FS::Record qw( qsearch qsearchs fields dbh );
use FS::cust_main_Mixin;
use FS::cust_svc;
@@ -13,6 +14,7 @@ use FS::queue;
use FS::cust_main;
use FS::inventory_item;
use FS::inventory_class;
+use FS::NetworkMonitoringSystem;
@ISA = qw( FS::cust_main_Mixin FS::Record );
@@ -316,6 +318,8 @@ sub insert {
}
+ $self->nms_ip_insert;
+
if ( exists $options{'jobnums'} ) {
push @{ $options{'jobnums'} }, @jobnums;
}
@@ -1160,6 +1164,32 @@ sub getstatus_html {
}
+=item nms_ip_insert
+
+=cut
+
+sub nms_ip_insert {
+ my $self = shift;
+ my $conf = new FS::Conf;
+ return '' unless grep { $self->table eq $_ }
+ $conf->config('nms-auto_add-svc_ips');
+ my $ip_field = $self->table_info->{'ip_field'};
+
+ #XXX perhaps i should be job-queued, i take awhile, right?
+ my $nms = new FS::NetworkMonitoringSystem;
+ $nms->add_router( $self->$ip_field(),
+ $conf->config('nms-auto_add-community')
+ );
+}
+
+=item nms_delip
+
+=cut
+
+sub nms_ip_delete {
+#XXX not yet implemented
+}
+
=back
=head1 BUGS
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm
index 12d3b8ecf..53f3b2608 100644
--- a/FS/FS/svc_acct.pm
+++ b/FS/FS/svc_acct.pm
@@ -254,6 +254,7 @@ sub table_info {
'sorts' => [ 'username', 'uid', 'seconds', 'last_login' ],
'display_weight' => 10,
'cancel_weight' => 50,
+ 'ip_field' => 'slipip',
'fields' => {
'dir' => 'Home directory',
'uid' => {
diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm
index 2ac24e55b..83c481ef3 100755
--- a/FS/FS/svc_broadband.pm
+++ b/FS/FS/svc_broadband.pm
@@ -95,6 +95,7 @@ sub table_info {
'longname_plural' => 'Fixed (username-less) broadband services',
'display_weight' => 50,
'cancel_weight' => 70,
+ 'ip_field' => 'ip_addr',
'fields' => {
'description' => 'Descriptive label for this particular device.',
'speed_down' => 'Maximum download speed for this service in Kbps. 0 denotes unlimited.',
diff --git a/FS/FS/svc_dsl.pm b/FS/FS/svc_dsl.pm
index 5e6a149e8..8c47f8887 100644
--- a/FS/FS/svc_dsl.pm
+++ b/FS/FS/svc_dsl.pm
@@ -137,6 +137,7 @@ sub table_info {
'sorts' => [ 'phonenum' ],
'display_weight' => 55,
'cancel_weight' => 75,
+ 'ip_field' => 'staticips',
'fields' => {
'pushed' => { label => 'Pushed',
type => 'disabled' },