[freeside-commits] freeside/FS/FS Conf.pm, 1.468.2.26, 1.468.2.27 svc_Common.pm, 1.62.2.2, 1.62.2.3 svc_dsl.pm, 1.10.2.4, 1.10.2.5 svc_acct.pm, 1.317.2.2, 1.317.2.3 svc_broadband.pm, 1.24.2.4, 1.24.2.5

Ivan,,, ivan at wavetail.420.am
Thu Dec 8 21:09:23 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv25055/FS/FS

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	Conf.pm svc_Common.pm svc_dsl.pm svc_acct.pm svc_broadband.pm 
Log Message:
auto-add service ips to network monitoring, RT#15536

Index: svc_Common.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_Common.pm,v
retrieving revision 1.62.2.2
retrieving revision 1.62.2.3
diff -u -w -d -r1.62.2.2 -r1.62.2.3
--- svc_Common.pm	11 Nov 2011 23:55:35 -0000	1.62.2.2
+++ svc_Common.pm	9 Dec 2011 05:09:20 -0000	1.62.2.3
@@ -5,6 +5,7 @@
              $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::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 @@
 
   }
 
+  $self->nms_ip_insert;
+
   if ( exists $options{'jobnums'} ) {
     push @{ $options{'jobnums'} }, @jobnums;
   }
@@ -1160,6 +1164,32 @@
 
 }
 
+=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

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.468.2.26
retrieving revision 1.468.2.27
diff -u -w -d -r1.468.2.26 -r1.468.2.27
--- Conf.pm	8 Dec 2011 21:13:56 -0000	1.468.2.26
+++ Conf.pm	9 Dec 2011 05:09:20 -0000	1.468.2.27
@@ -2650,14 +2650,28 @@
 
   {
     '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.',

Index: svc_acct.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_acct.pm,v
retrieving revision 1.317.2.2
retrieving revision 1.317.2.3
diff -u -w -d -r1.317.2.2 -r1.317.2.3
--- svc_acct.pm	10 Nov 2011 21:40:21 -0000	1.317.2.2
+++ svc_acct.pm	9 Dec 2011 05:09:20 -0000	1.317.2.3
@@ -254,6 +254,7 @@
     'sorts' => [ 'username', 'uid', 'seconds', 'last_login' ],
     'display_weight' => 10,
     'cancel_weight'  => 50, 
+    'ip_field' => 'slipip',
     'fields' => {
         'dir'       => 'Home directory',
         'uid'       => {

Index: svc_broadband.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_broadband.pm,v
retrieving revision 1.24.2.4
retrieving revision 1.24.2.5
diff -u -w -d -r1.24.2.4 -r1.24.2.5
--- svc_broadband.pm	7 Dec 2011 21:35:13 -0000	1.24.2.4
+++ svc_broadband.pm	9 Dec 2011 05:09:20 -0000	1.24.2.5
@@ -95,6 +95,7 @@
     '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.',

Index: svc_dsl.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_dsl.pm,v
retrieving revision 1.10.2.4
retrieving revision 1.10.2.5
diff -u -w -d -r1.10.2.4 -r1.10.2.5
--- svc_dsl.pm	11 Nov 2011 23:29:28 -0000	1.10.2.4
+++ svc_dsl.pm	9 Dec 2011 05:09:20 -0000	1.10.2.5
@@ -137,6 +137,7 @@
         'sorts' => [ 'phonenum' ],
         'display_weight' => 55,
         'cancel_weight' => 75,
+        'ip_field' => 'staticips',
         'fields' => {
             'pushed'                => { label => 'Pushed', 
                                          type  => 'disabled' },



More information about the freeside-commits mailing list