[opennms-devel] Question about how opennms-model handle isDown method on nodes, interfaces and services
Alejandro Galue <[email protected]> Wed, 22 Apr 2009 13:47:01 -0430
| Newsgroups | gmane.network.opennms.bugs,gmane.network.opennms.devel |
|---|---|
| Organization | Sync Consultores |
| Message-ID | <[email protected]> |
Hello All,
I'm creating a web service that returns a Json Tree with
the availability of all services, and I found something
weird on how isDown is implemented on OnmsNode,
OnmsIpInterface and OnmsMonitoredService.
From the code, the implementation of
OnmsMonitoredService.isDown return false (i.e service is
up) only if service has no current outages or status is
different of "Managed". The current code is:
@Transient
public boolean isDown() {
boolean down = true;
if (!"A".equals(getStatus()) ||
m_currentOutages.isEmpty()) {
return !down;
}
return down;
}
So, if a service has a status of "Not Monitored", isDown()
will return false. I understand here that if a service is
not managed will be trated always as "Up" (am I right?)
Let's see OnmsIpInterface isDown implementation:
@Transient
@XmlElement(name="isDown")
public boolean isDown() {
boolean down = true;
for (OnmsMonitoredService svc : m_monitoredServices) {
if (!svc.isDown()) {
return !down;
}
}
return down;
}
This method return false, only if at least one service is
"Up".... (interface down = all service down, am I right?)
Now imagine this scenario:
I have 6 services on one interface: 3 are "Not Monitored",
and 3 are "Monitored", for example:
Postgres - Monitored
SNMP - Not Monitored
StrafePing - Not Monitored
SSH - Monitored
Router - Not Monitored
ICMP - Monitored
Now suppose that all services are down, because node is
unreachable. In this case, ICMP, Postgres and SHH will be
down and I will have 3 outages (apart from nodeDown alarm).
The problem is that ipinterface.isDown() will return false
and node.isDown() will also return false (node down = all
interfaces down), because of the existance of two "Not
Monitored" service.....
I think that this is wrong. Am I right ? or am I missing
something ?
I think that OnmsIpInterface.isDown must be check
service.getStatus().equals("A").
Maybe this method must be implemented like this:
@Transient
@XmlElement(name="isDown")
public boolean isDown() {
boolean down = true;
for (OnmsMonitoredService svc : m_monitoredServices) {
if (!svc.isDown() && svc.getStatus().equals("A")) {
return !down;
}
}
return down;
}
or like this:
@Transient
@XmlElement(name="isDown")
public boolean isDown() {
boolean down = true;
if (!isManaged())
return !down;
for (OnmsMonitoredService svc : m_monitoredServices) {
if (!svc.isDown() && svc.getStatus().equals("A")) {
return !down;
}
}
return down;
}
If this second suggestion sounds good, then isDown for
OnmsNode must be changed like this:
@Transient
public boolean isDown() {
boolean down = true;
for (OnmsIpInterface ipIf : m_ipInterfaces) {
if (!ipIf.isDown() && ipIf.isManaged()) {
return !down;
}
}
return down;
}
I included an example picture of part of the result after
applying only the FIRST change (this is a ExtJS Column
Tree, Second Column is Status and Thrird Column is
Availability). As you can see, the behavior looks correct.
Without this, the ip address and node appears UP.
Alejandro.
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
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