[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opennms-devel
Subject:    [opennms-devel] Remote polling on same IP schemes
From:       "Ryan Kagin" <rkagin () pavlovmedia ! com>
Date:       2007-08-08 20:12:56
Message-ID: 678CA7EF9C2ADE4D9EE4DB82E0F63D8F3E4B5B () caballus ! fusionbb ! corp
[Download RAW message or body]

--===============0071601708==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C7D9F8.828CBD4F"

This is a multi-part message in MIME format.


Our problem is as follows (I apologize for those who have already heard this):
We have several sites, each with a router and switches behind the router which are \
unaccessable from the web.  The switches all have the same IP scheme - 192.168.5.10, \
192.168.5.15, etc.  The problem is that when we have two remote pollers on two \
different sites polling the same service, the scheduler schedules all IPs that are \
the same, even if the node IDs are different.

A bug report has been filed on this issue, which is bug 1969.

Below is what I believe could be a start to patch this problem for us, but I am not \
                sure how to proceed.
------------------------------------------------------------------------
This is the original code from 
/usr/local/src/opennms-1.3.5-1/source/opennms-dao/src/main/java/org/opennms/netmgt/dao/hibernate/MonitoredServiceDaoHibernate.java
 ========================================================================
     73     public Collection<OnmsMonitoredService> \
                findMatchingServices(ServiceSelector selector) {
     74         Set<String> matchingIps = new \
                HashSet<String>(FilterDaoFactory.getInstance().getIPList(selector.getFilterRule()));
                
     75         Set<String> matchingSvcs = new \
HashSet<String>(selector.getServiceNames());  76
     77         List<OnmsMonitoredService> matchingServices = new \
LinkedList<OnmsMonitoredService>();  78         Collection<OnmsMonitoredService> \
services = findAll();  79         for (OnmsMonitoredService svc : services) {
     80             if ((matchingSvcs.contains(svc.getServiceName()) || \
matchingSvcs.isEmpty()) &&  81                 \
matchingIps.contains(svc.getIpAddress())) {  82
     83                 matchingServices.add(svc);
     84             }
     85
     86         }
     87
     88
     89         return matchingServices;
     90     }
========================================================================
I want to edit it to be the following:
========================================================================
     73     public Collection<OnmsMonitoredService> \
                findMatchingServices(ServiceSelector selector) {
     74         Set<String> matchingIps = new \
                HashSet<String>(FilterDaoFactory.getInstance().getIPList(selector.getFilterRule()));
                
     75         Set<String> matchingSvcs = new \
                HashSet<String>(selector.getServiceNames());
     >          Set<String> matchingNodeId = new HashSet<String>(select.getNodeId());
     76
     77         List<OnmsMonitoredService> matchingServices = new \
LinkedList<OnmsMonitoredService>();  78         Collection<OnmsMonitoredService> \
services = findAll();  79         for (OnmsMonitoredService svc : services) {
     80             if ((matchingSvcs.contains(svc.getServiceName()) || \
matchingSvcs.isEmpty()) &&  >                  \
matchingNodeId.contains(svc.getNodeId()) &&  81                 \
matchingIps.contains(svc.getIpAddress())) {  82
     83                 matchingServices.add(svc);
     84             }
     85
     86         }
     87
     88
     89         return matchingServices;
     90     }
========================================================================
This would require two things:
* The OnmsMonitoredService class has getNodeId() which would return the node id for \
                which the service is attached to.  This is already implemented.
* The ServiceSelector class has getNodeId() which would return the node ID for the \
service (similar to above).  This is not implemented. I would think that you could \
just throw in the function and the variable to be stored, but then we would have to \
go into all the files that instantiate ServiceSelector's, and make sure they assign \
the proper node ID.  This seems to only be effecting a few files, which include the \
Package class, a class which seems to be compiled on the fly through an xsd file.  \
The other file that uses ServiceSelector is DefaultCategoryStatusService.java, \
function createCategory, which creates a new ServiceSelector in the function.  I'm \
not sure if others use it or not, but we would have to find all of them (or minimally \
the ones that effect remote polling), and edit them to set and read data properly \
                from the ServiceSelector class.
------------------------------------------------------------------------
Any help would be greatly appreciated.  I have taken another position on solving this \
issue, by creating a test case that demonstrates the failure.  That information is \
posted in comment 2 of the bug listed above.

Thanks,
Ryan K


[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>Remote polling on same IP schemes</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Our problem is as follows (I apologize for those who have already \
heard this):<BR> We have several sites, each with a router and switches behind the \
router which are unaccessable from the web.&nbsp; The switches all have the same IP \
scheme - 192.168.5.10, 192.168.5.15, etc.&nbsp; The problem is that when we have two \
remote pollers on two different sites polling the same service, the scheduler \
schedules all IPs that are the same, even if the node IDs are different.<BR> <BR>
A bug report has been filed on this issue, which is bug 1969.<BR>
<BR>
Below is what I believe could be a start to patch this problem for us, but I am not \
                sure how to proceed.<BR>
------------------------------------------------------------------------<BR>
This is the original code from<BR>
/usr/local/src/opennms-1.3.5-1/source/opennms-dao/src/main/java/org/opennms/netmgt/dao/hibernate/MonitoredServiceDaoHibernate.java<BR>
 ========================================================================<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 73&nbsp;&nbsp;&nbsp;&nbsp; public \
Collection&lt;OnmsMonitoredService&gt; findMatchingServices(ServiceSelector selector) \
{<BR> &nbsp;&nbsp;&nbsp;&nbsp; 74&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Set&lt;String&gt; matchingIps = new \
HashSet&lt;String&gt;(FilterDaoFactory.getInstance().getIPList(selector.getFilterRule()));<BR>
 &nbsp;&nbsp;&nbsp;&nbsp; 75&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Set&lt;String&gt; matchingSvcs = new \
HashSet&lt;String&gt;(selector.getServiceNames());<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
76<BR> &nbsp;&nbsp;&nbsp;&nbsp; 77&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
List&lt;OnmsMonitoredService&gt; matchingServices = new \
LinkedList&lt;OnmsMonitoredService&gt;();<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
78&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Collection&lt;OnmsMonitoredService&gt; services = findAll();<BR> \
&nbsp;&nbsp;&nbsp;&nbsp; 79&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for \
(OnmsMonitoredService svc : services) {<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if \
((matchingSvcs.contains(svc.getServiceName()) || matchingSvcs.isEmpty()) \
&amp;&amp;<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
81&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
matchingIps.contains(svc.getIpAddress())) {<BR> &nbsp;&nbsp;&nbsp;&nbsp; 82<BR>
&nbsp;&nbsp;&nbsp;&nbsp; \
83&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
matchingServices.add(svc);<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
84&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR> \
&nbsp;&nbsp;&nbsp;&nbsp; 85<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
86&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
87<BR> &nbsp;&nbsp;&nbsp;&nbsp; 88<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 89&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
matchingServices;<BR> &nbsp;&nbsp;&nbsp;&nbsp; 90&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
========================================================================<BR>
I want to edit it to be the following:<BR>
========================================================================<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 73&nbsp;&nbsp;&nbsp;&nbsp; public \
Collection&lt;OnmsMonitoredService&gt; findMatchingServices(ServiceSelector selector) \
{<BR> &nbsp;&nbsp;&nbsp;&nbsp; 74&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Set&lt;String&gt; matchingIps = new \
HashSet&lt;String&gt;(FilterDaoFactory.getInstance().getIPList(selector.getFilterRule()));<BR>
 &nbsp;&nbsp;&nbsp;&nbsp; 75&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Set&lt;String&gt; matchingSvcs = new \
HashSet&lt;String&gt;(selector.getServiceNames());<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set&lt;String&gt; \
matchingNodeId = new HashSet&lt;String&gt;(select.getNodeId());<BR> \
&nbsp;&nbsp;&nbsp;&nbsp; 76<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
77&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;OnmsMonitoredService&gt; \
matchingServices = new LinkedList&lt;OnmsMonitoredService&gt;();<BR> \
&nbsp;&nbsp;&nbsp;&nbsp; 78&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Collection&lt;OnmsMonitoredService&gt; services = findAll();<BR> \
&nbsp;&nbsp;&nbsp;&nbsp; 79&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for \
(OnmsMonitoredService svc : services) {<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if \
((matchingSvcs.contains(svc.getServiceName()) || matchingSvcs.isEmpty()) \
&amp;&amp;<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
matchingNodeId.contains(svc.getNodeId()) &amp;&amp;<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
81&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
matchingIps.contains(svc.getIpAddress())) {<BR> &nbsp;&nbsp;&nbsp;&nbsp; 82<BR>
&nbsp;&nbsp;&nbsp;&nbsp; \
83&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
matchingServices.add(svc);<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
84&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR> \
&nbsp;&nbsp;&nbsp;&nbsp; 85<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
86&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR> &nbsp;&nbsp;&nbsp;&nbsp; \
87<BR> &nbsp;&nbsp;&nbsp;&nbsp; 88<BR>
&nbsp;&nbsp;&nbsp;&nbsp; 89&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
matchingServices;<BR> &nbsp;&nbsp;&nbsp;&nbsp; 90&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
========================================================================<BR>
This would require two things:<BR>
* The OnmsMonitoredService class has getNodeId() which would return the node id for \
                which the service is attached to.&nbsp; This is already \
                implemented.<BR>
* The ServiceSelector class has getNodeId() which would return the node ID for the \
service (similar to above).&nbsp; This is not implemented.<BR> I would think that you \
could just throw in the function and the variable to be stored, but then we would \
have to go into all the files that instantiate ServiceSelector's, and make sure they \
assign the proper node ID.&nbsp; This seems to only be effecting a few files, which \
include the Package class, a class which seems to be compiled on the fly through an \
xsd file.&nbsp; The other file that uses ServiceSelector is \
DefaultCategoryStatusService.java, function createCategory, which creates a new \
ServiceSelector in the function.&nbsp; I'm not sure if others use it or not, but we \
would have to find all of them (or minimally the ones that effect remote polling), \
                and edit them to set and read data properly from the ServiceSelector \
                class.<BR>
------------------------------------------------------------------------<BR>
Any help would be greatly appreciated.&nbsp; I have taken another position on solving \
this issue, by creating a test case that demonstrates the failure.&nbsp; That \
information is posted in comment 2 of the bug listed above.<BR> <BR>
Thanks,<BR>
Ryan K</FONT>
</P>

</BODY>
</HTML>


[Attachment #4 (--===============0071601708==)]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic