Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/foundation' into release-14.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Nov 26, 2014
2 parents 9e1a102 + ac501fc commit e068009
Show file tree
Hide file tree
Showing 32 changed files with 201 additions and 141 deletions.
Expand Up @@ -111,6 +111,9 @@ private static void initialize() {
SNMP4JSettings.setForwardRuntimeExceptions(true);
}

SNMP4JSettings.setAllowSNMPv2InV1(Boolean.getBoolean("org.opennms.snmp.snmp4j.allowSNMPv2InV1"));
SNMP4JSettings.setAllowSNMPv2InV1(Boolean.getBoolean("org.opennms.snmp.snmp4j.noGetBulk"));

s_initialized = true;
}

Expand Down
Expand Up @@ -437,9 +437,7 @@ public VertexHopGraphProvider.VertexHopCriteria getDefaultCriteria() {
if (node != null) {
final Vertex defaultVertex = getVertex(node);
if (defaultVertex != null) {
VertexHopGraphProvider.FocusNodeHopCriteria hopCriteria = new VertexHopGraphProvider.FocusNodeHopCriteria();
hopCriteria.add(defaultVertex);
return hopCriteria;
criterion = new LinkdHopCriteria(node.getNodeId(), node.getLabel(), m_nodeDao);
}
}

Expand Down
Expand Up @@ -49,7 +49,7 @@ public Object getFieldValue(JRField field) throws JRException {
long ts = new Long(m_data.getData().getRow(m_currentRow).getT().getContent()) * 1000L;
return new Date(ts);
}else if ("Step".equalsIgnoreCase(getColumnName(field))) {
return Integer.valueOf(m_data.getMeta().getStep().getContent());
return Long.valueOf(m_data.getMeta().getStep().getContent());
}
int index = getColumnIndex(field);
return new Double(m_data.getData().getRow(m_currentRow).getV(index).getContent());
Expand Down
38 changes: 25 additions & 13 deletions opennms-base-assembly/src/main/filtered/bin/opennms
Expand Up @@ -111,7 +111,7 @@ fi
show_help () {
cat <<END
Usage: $0 [-n] [-t] [-p] [-o] [-c timeout] [-v] [-Q] <command> [<service>]
Usage: $0 [-f] [-n] [-t] [-p] [-o] [-c timeout] [-v] [-Q] <command> [<service>]
command options: start|stop|restart|status|check|pause|resume|kill
Expand All @@ -120,6 +120,7 @@ Usage: $0 [-n] [-t] [-p] [-o] [-c timeout] [-v] [-Q] <command> [<service>]
The following options are available:
-f Foreground mode. Don't fork & execute.
-n "No execute" mode. Don't call Java to do anything.
-t Test mode. Enable JPDA on port 8001.
-p Enable TIJMP profiling
Expand Down Expand Up @@ -344,17 +345,24 @@ doStart(){
fi

if [ -z "$NOEXECUTE" ]; then
echo "------------------------------------------------------------------------------" >> "$REDIRECT"
date >> "$REDIRECT"
echo "begin ulimit settings:" >> "$REDIRECT"
ulimit -a >> "$REDIRECT"
echo "end ulimit settings" >> "$REDIRECT"
CMD="$JAVA_CMD -Djava.endorsed.dirs=$OPENNMS_HOME/lib/endorsed $APP_VM_PARMS -jar $BOOTSTRAP $APP_PARMS_CONTROLLER $APP_PARMS_BEFORE "$@" $APP_PARMS_AFTER"
echo "Executing command: $CMD" >> "$REDIRECT"
$CMD >>"$REDIRECT" 2>&1 &
OPENNMS_PID=$!
echo $OPENNMS_PID > "$OPENNMS_PIDFILE"
# disown # XXX specific to bash
if [ $BACKGROUND = 1 ]; then
echo "------------------------------------------------------------------------------" >> "$REDIRECT"
date >> "$REDIRECT"
echo "begin ulimit settings:" >> "$REDIRECT"
ulimit -a >> "$REDIRECT"
echo "end ulimit settings" >> "$REDIRECT"
echo "Executing command: $CMD" >> "$REDIRECT"
$CMD >>"$REDIRECT" 2>&1 &
OPENNMS_PID=$!
echo $OPENNMS_PID > "$OPENNMS_PIDFILE"
else
echo "running ulimit -a"
ulimit -a
echo "Executing command: $CMD"
$CMD
exit $?
fi
fi

if [ $START_TIMEOUT -eq 0 ]; then
Expand Down Expand Up @@ -588,19 +596,23 @@ TPROFILE=0
OPROFILE=0
NOEXECUTE=""
VERBOSE=0
BACKGROUND=1

NAME="opennms"

while getopts c:ntvpoQ c; do
while getopts c:fntvpoQ c; do
case $c in
c)
APP_PARMS_CONTROLLER="$APP_PARMS_CONTROLLER -t $OPTARG"
;;
f)
BACKGROUND=0
;;
n)
NOEXECUTE="foo"
;;
Q)
START_TIMEOUT=0
START_TIMEOUT=0
;;
t)
TEST=1
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -958,8 +958,8 @@
<mevalue>1000</mevalue>
</maskelement>
</mask>
<uei>uei.opennms.org/vendor/fortinet/traps/fortigate/fgFmTrapDeployComplete</uei>
<event-label>FORTINET-FORTIGATE-MIB defined trap event: fgFmTrapDeployComplete</event-label>
<uei>uei.opennms.org/vendor/fortinet/traps/fortigate/fgTrapDeployComplete</uei>
<event-label>FORTINET-FORTIGATE-MIB defined trap event: fgTrapDeployComplete</event-label>
<descr>
&lt;p&gt;Indicates when deployment of a new configuration has been completed. Used for verification by FortiManager.&lt;/p&gt;&lt;table&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;
Expand All @@ -968,7 +968,7 @@
%parm[#1]%;&lt;/td&gt;&lt;td&gt;&lt;p&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
</descr>
<logmsg dest="logndisplay">&lt;p&gt;
fgFmTrapDeployComplete trap received
fgTrapDeployComplete trap received
fnSysSerial=%parm[#1]%&lt;/p&gt;
</logmsg>
<severity>Indeterminate</severity>
Expand All @@ -988,8 +988,8 @@
<mevalue>1002</mevalue>
</maskelement>
</mask>
<uei>uei.opennms.org/vendor/fortinet/traps/fortigate/fgFmTrapDeployInProgress</uei>
<event-label>FORTINET-FORTIGATE-MIB defined trap event: fgFmTrapDeployInProgress</event-label>
<uei>uei.opennms.org/vendor/fortinet/traps/fortigate/fgTrapDeployInProgress</uei>
<event-label>FORTINET-FORTIGATE-MIB defined trap event: fgTrapDeployInProgress</event-label>
<descr>
&lt;p&gt;Indicates that a configuration change was not immediate and that the change is currently in progress. Used for verification by FortiManager.&lt;/p&gt;&lt;table&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;
Expand All @@ -998,7 +998,7 @@
%parm[#1]%;&lt;/td&gt;&lt;td&gt;&lt;p&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
</descr>
<logmsg dest="logndisplay">&lt;p&gt;
fgFmTrapDeployInProgress trap received
fgTrapDeployInProgress trap received
fnSysSerial=%parm[#1]%&lt;/p&gt;
</logmsg>
<severity>Indeterminate</severity>
Expand All @@ -1018,8 +1018,8 @@
<mevalue>1003</mevalue>
</maskelement>
</mask>
<uei>uei.opennms.org/vendor/fortinet/traps/fortigate/fgFmTrapConfChange</uei>
<event-label>FORTINET-FORTIGATE-MIB defined trap event: fgFmTrapConfChange</event-label>
<uei>uei.opennms.org/vendor/fortinet/traps/fortigate/fgTrapConfChange</uei>
<event-label>FORTINET-FORTIGATE-MIB defined trap event: fgTrapConfChange</event-label>
<descr>
&lt;p&gt;The device configuration has been changed by something other than the managing FortiManager device.&lt;/p&gt;&lt;table&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;
Expand All @@ -1028,7 +1028,7 @@
%parm[#1]%;&lt;/td&gt;&lt;td&gt;&lt;p&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
</descr>
<logmsg dest="logndisplay">&lt;p&gt;
fgFmTrapConfChange trap received
fgTrapConfChange trap received
fnSysSerial=%parm[#1]%&lt;/p&gt;
</logmsg>
<severity>Indeterminate</severity>
Expand All @@ -1048,8 +1048,8 @@
<mevalue>1004</mevalue>
</maskelement>
</mask>
<uei>uei.opennms.org/vendor/fortinet/traps/fortigate/fgFmTrapIfChange</uei>
<event-label>FORTINET-FORTIGATE-MIB defined trap event: fgFmTrapIfChange</event-label>
<uei>uei.opennms.org/vendor/fortinet/traps/fortigate/fgTrapIfChange</uei>
<event-label>FORTINET-FORTIGATE-MIB defined trap event: fgTrapIfChange</event-label>
<descr>
&lt;p&gt;Trap is sent to the managing FortiManager if an interface IP is changed&lt;/p&gt;&lt;table&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;
Expand All @@ -1074,7 +1074,7 @@
%parm[#5]%;&lt;/td&gt;&lt;td&gt;&lt;p&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
</descr>
<logmsg dest="logndisplay">&lt;p&gt;
fgFmTrapIfChange trap received
fgTrapIfChange trap received
fnSysSerial=%parm[#1]%
ifName=%parm[#2]%
fgManIfIp=%parm[#3]%
Expand Down
Expand Up @@ -165,8 +165,8 @@
<mevalue>106</mevalue>
</maskelement>
</mask>
<uei>uei.opennms.org/vendor/fortinet/traps/fortimail/fmlTrapAvThresholdEvent</uei>
<event-label>FORTINET-FORTIMAIL-MIB defined trap event: fmlTrapAvThresholdEvent</event-label>
<uei>uei.opennms.org/vendor/fortinet/traps/fortimail/fmlTrapMailAvThresholdEvent</uei>
<event-label>FORTINET-FORTIMAIL-MIB defined trap event: fmlTrapMailAvThresholdEvent</event-label>
<descr>
&lt;p&gt;Trap being sent when detected virus number reaches the threshold&lt;/p&gt;&lt;table&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;
Expand All @@ -175,7 +175,7 @@
%parm[#1]%;&lt;/td&gt;&lt;td&gt;&lt;p&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
</descr>
<logmsg dest="logndisplay">&lt;p&gt;
fmlTrapAvThresholdEvent trap received
fmlTrapMailAvThresholdEvent trap received
fmlSysSerial=%parm[#1]%&lt;/p&gt;
</logmsg>
<severity>Indeterminate</severity>
Expand Down
14 changes: 14 additions & 0 deletions opennms-base-assembly/src/main/filtered/etc/opennms.properties
Expand Up @@ -83,6 +83,20 @@ snmp4j.LogFactory=org.snmp4j.log.Log4jLogFactory
# to disable this workaround, comment out the following line.
org.opennms.snmp.workarounds.allow64BitIpAddress=true

# Some SNMP agents claim to support SNMPv2c, but either completely fail to
# respond to GET-BULK requests or return bad responses to them under some
# conditions. To disable the use of GET-BULK PDUs globally in the SNMP4J
# strategy, set this property to true. This change will adversely affect the
# efficiency of SNMP data collection from agents that properly support
# GET-BULK.
org.opennms.snmp.snmp4j.noGetBulk=false

# Some buggy SNMP agents fail to exclude Counter64 objects from view when
# responding to SNMPv1 requests (as mandated by RFC3584 § 4.2.2.1). To relax
# handling of v1 responses to permit Counter64 varbinds rather than discarding
# them as ill-formed (per the same RFC), set this property to true.
org.opennms.snmp.snmp4j.allowSNMPv2InV1=false

# ###### DATA COLLECTION ######
# On very large systems the OpenNMS default mechanism of storing one data
# source per RRD file can be very I/O Intensive. Many I/O subsystems fail
Expand Down
Expand Up @@ -415,7 +415,7 @@
SET severity=2, firstautomationtime = COALESCE(firstautomationtime, ${_ts}), lastautomationtime = ${_ts}
WHERE alarmType=1
AND severity &gt; 2
AND lastEventTime &lt; ${lastEventTime}
AND lastEventTime &lt;= ${lastEventTime}
AND reductionKey = ${clearKey}
</statement>
</action>
Expand Down
2 changes: 1 addition & 1 deletion opennms-icmp/opennms-icmp-jni/pom.xml
Expand Up @@ -34,7 +34,7 @@
<dependency>
<groupId>org.opennms</groupId>
<artifactId>jicmp-api</artifactId>
<version>1.4.1</version>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>org.opennms.core</groupId>
Expand Down
Expand Up @@ -101,11 +101,15 @@ public void setAttribute(String key, String value) {
m_node.setSysObjectId(value);
} else if (key.equals("sysName")) {
m_node.setSysName(value);
// If the node is labeled as just the IP address from the newSuspect that created it,
// use the SNMP sysName value instead and update the label source to indicate this
if (m_node.getLabelSource() == NodeLabelSource.ADDRESS) {
m_node.setLabel(value);
m_node.setLabelSource(NodeLabelSource.SYSNAME);

// If the sysName isn't null or empty...
if (value != null && !"".equals(value.trim())) {
// If the node is labeled as just the IP address from the newSuspect that created it,
// use the SNMP sysName value instead and update the label source to indicate this
if (m_node.getLabelSource() == NodeLabelSource.ADDRESS) {
m_node.setLabel(value);
m_node.setLabelSource(NodeLabelSource.SYSNAME);
}
}
}

Expand Down
Expand Up @@ -378,7 +378,7 @@ private DbNodeEntry createNode(Connection dbc, InetAddress ifaddr,
String str = sysgrp.getSysName();
LOG.debug("SuspectEventProcessor: {} has sysName: {}", str(ifaddr), str);

if (str != null && str.length() > 0) {
if (str != null && !"".equals(str.trim())) {
entryNode.setSystemName(str);

// Hostname takes precedence over sysName so only replace
Expand Down
Expand Up @@ -47,7 +47,7 @@
* @author ranger
* @version $Id: $
*/
@Transactional(readOnly = true)
@Transactional
public class DaoEventdServiceManager implements InitializingBean, EventdServiceManager {

private static final Logger LOG = LoggerFactory.getLogger(DaoEventdServiceManager.class);
Expand Down
Expand Up @@ -260,7 +260,7 @@ public Event createEvent(String uei, int nodeId, InetAddress address, String svc
&& this.getPollerConfig().isPathOutageEnabled()) {
String[] criticalPath = PathOutageManagerJdbcImpl.getInstance().getCriticalPath(nodeId);

if (criticalPath[0] != null && !"".equals(criticalPath[0])) {
if (criticalPath[0] != null && !"".equals(criticalPath[0].trim())) {
if (!this.testCriticalPath(criticalPath)) {
LOG.debug("Critical path test failed for node {}", nodeId);

Expand Down
Expand Up @@ -41,7 +41,7 @@ public interface PathOutageManager {

String[] getCriticalPath(int nodeId);

List<String> getNodesInPath(String criticalPathIp, String criticalPathServiceName) throws SQLException;
Set<Integer> getNodesInPath(String criticalPathIp, String criticalPathServiceName) throws SQLException;

String[] getLabelAndStatus(String nodeIDStr, Connection conn) throws SQLException;

Expand Down
Expand Up @@ -165,14 +165,14 @@ else if (cpath[1] == null || cpath[1].equals("")) {
* @return a {@link java.util.List} object.
* @throws java.sql.SQLException if any.
*/
public List<String> getNodesInPath(String criticalPathIp, String criticalPathServiceName) {
final List<String> pathNodes = new ArrayList<String>();
public Set<Integer> getNodesInPath(String criticalPathIp, String criticalPathServiceName) {
final Set<Integer> pathNodes = new TreeSet<Integer>();

List<OnmsPathOutage> outs = pathOutageDao.findAll();
for (OnmsPathOutage out: outs) {
String node = out.getCriticalPathServiceName();
if (node.equals(criticalPathServiceName)) {
pathNodes.add(String.valueOf(out.getNode().getId()));
pathNodes.add(out.getNode().getId());
}
}

Expand Down
Expand Up @@ -191,11 +191,11 @@ public void processRow(ResultSet rs) throws SQLException {
* @throws java.sql.SQLException if any.
*/
@Override
public List<String> getNodesInPath(String criticalPathIp, String criticalPathServiceName) throws SQLException {
public Set<Integer> getNodesInPath(String criticalPathIp, String criticalPathServiceName) throws SQLException {
final Connection conn = DataSourceFactory.getInstance().getConnection();
final DBUtils d = new DBUtils(PathOutageManagerJdbcImpl.class, conn);

final List<String> pathNodes = new ArrayList<String>();
final Set<Integer> pathNodes = new TreeSet<Integer>();

try {
final PreparedStatement stmt = conn.prepareStatement(GET_NODES_IN_PATH);
Expand All @@ -207,7 +207,7 @@ public List<String> getNodesInPath(String criticalPathIp, String criticalPathSer
d.watch(rs);

while (rs.next()) {
pathNodes.add(rs.getString(1));
pathNodes.add(rs.getInt(1));
}
} finally {
d.cleanUp();
Expand Down
Expand Up @@ -65,7 +65,6 @@
import org.opennms.test.JUnitConfigurationEnvironment;
import org.opennms.test.mock.MockUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Repeat;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.annotation.Transactional;

Expand Down Expand Up @@ -260,10 +259,10 @@ public void test() throws SQLException {
assertEquals("Firewall", cr[0]);
assertEquals("Normal", cr[1]);
assertEquals("All Services Up", cr[2]);
List<String> lno = m_pathOutageManager.getNodesInPath("192.168.1.1", "ICMP");
assertEquals("1",lno.get(0));
List<String> vno = m_pathOutageManager.getNodesInPath("192.168.1.4", "SMTP");
assertEquals("3",vno.get(0));
Set<Integer> lno = m_pathOutageManager.getNodesInPath("192.168.1.1", "ICMP");
assertEquals(new Integer(1), lno.iterator().next());
Set<Integer> vno = m_pathOutageManager.getNodesInPath("192.168.1.4", "SMTP");
assertEquals(new Integer(3), vno.iterator().next());
List<String[]> all = m_pathOutageManager.getAllCriticalPaths();
assertEquals("192.168.1.1",all.get(0)[0]);
assertEquals("ICMP", all.get(0)[1]);
Expand Down
Expand Up @@ -260,10 +260,10 @@ public void test() throws SQLException {
assertEquals("Firewall", cr[0]);
assertEquals("Normal", cr[1]);
assertEquals("All Services Up", cr[2]);
List<String> lno = PathOutageManagerJdbcImpl.getInstance().getNodesInPath("192.168.1.1", "ICMP");
assertEquals("1",lno.get(0));
List<String> vno = PathOutageManagerJdbcImpl.getInstance().getNodesInPath("192.168.1.4", "SMTP");
assertEquals("3",vno.get(0));
Set<Integer> lno = PathOutageManagerJdbcImpl.getInstance().getNodesInPath("192.168.1.1", "ICMP");
assertEquals(new Integer(1), lno.iterator().next());
Set<Integer> vno = PathOutageManagerJdbcImpl.getInstance().getNodesInPath("192.168.1.4", "SMTP");
assertEquals(new Integer(3), vno.iterator().next());
List<String[]> all = PathOutageManagerJdbcImpl.getInstance().getAllCriticalPaths();
assertEquals("192.168.1.1",all.get(0)[0]);
assertEquals("ICMP", all.get(0)[1]);
Expand Down

0 comments on commit e068009

Please sign in to comment.