fix ports with dashes (-) not showing their monitoring status, RT#14926
[freeside.git] / FS / FS / NetworkMonitoringSystem / Torrus_Internal.pm
index 63a9326..04a6b29 100644 (file)
@@ -155,11 +155,14 @@ sub report {
 }
 
 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;
@@ -173,8 +176,10 @@ sub add_router {
 sub add_interface {
   my($self, $router_ip, $interface, $serviceid ) = @_;
 
+  #false laziness w/torrus/perllib/Torrus/Renderer.pm iface_underscore, update both
   $interface =~ s(\/)(_)g; #slashes become underscores
   $interface =~ s(\.)(_)g; #periods too, huh
+  $interface =~ s(\-)(_)g; #yup, and dashes
 
   #should just use a proper XML parser huh
 
@@ -212,7 +217,7 @@ sub add_interface {
         unless ( $added ) {
           $new .= 
             qq(   <param name="RFC2863_IF_MIB::external-serviceid">\n).
-            qq(     $newline\n").
+            qq(     $newline\n).
             qq(   </param>\n);
         }
         $new .= "$hostline\n";