Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2010-11-02 12:54:30 UTC (rev 5282)
+++ trunk/CHANGES 2010-11-02 15:53:48 UTC (rev 5283)
@@ -7,6 +7,7 @@
See https://docs.opsview.com/doku.php?id=opsview-community:performancedataimports for details of how this works
Performance data in ODW is now summarised on an hourly basis, to allow fast queries of performance data for reporting
ODW now defaults to on for all new systems
+ Integration with SolarWinds SNMP trap forwarding, so you can forward traps for processing on Opsview master or slaves
ENHANCEMENTS:
Refreshed page headers, to increase amount of visible area (contributed by Capside)
Modified: trunk/opsview-core/bin/snmptrap2nagios
===================================================================
--- trunk/opsview-core/bin/snmptrap2nagios 2010-11-02 12:54:30 UTC (rev 5282)
+++ trunk/opsview-core/bin/snmptrap2nagios 2010-11-02 15:53:48 UTC (rev 5283)
@@ -1,6 +1,5 @@
#!/usr/bin/perl
#
-#
# SYNTAX:
# snmptrap2nagios [-r { -f } ] [-d] [-c configfile]
#
@@ -123,12 +122,19 @@
next;
}
- unless ( exists $hostip_lookup->{ $trap->hostip } ) {
+ my $hostip = $trap->hostip;
+
+ # Switch host IP if trap forwarded by Solarwinds
+ if ( $trap->expand('${SOLARWINDS-TRAPS::nodeIP}') =~ m/(\d+\.\d+\.\d+\.\d+)/ ) {
+ $hostip = $1;
+ }
+
+ unless ( exists $hostip_lookup->{$hostip} ) {
exception_exit( $trap, 5 ); # Not expecting this hostip
next;
}
- my $hosts = $hostip_lookup->{ $trap->hostip };
+ my $hosts = $hostip_lookup->{$hostip};
foreach my $opsview_host (@$hosts) {
$host = $opsview_host;
@@ -141,7 +147,7 @@
next;
}
- my $config = $advsnmptrap->{ $trap->hostip };
+ my $config = $advsnmptrap->{$hostip};
process_advanced($config);
}
}
Modified: trunk/opsview-core/t/30snmptraps.t
===================================================================
--- trunk/opsview-core/t/30snmptraps.t 2010-11-02 12:54:30 UTC (rev 5282)
+++ trunk/opsview-core/t/30snmptraps.t 2010-11-02 15:53:48 UTC (rev 5283)
@@ -5,7 +5,7 @@
use strict;
use warnings;
-use Test::More tests => 23;
+use Test::More qw(no_plan);
use FindBin qw($Bin);
use lib "$Bin/lib", "$Bin/../etc", "$Bin/../lib";
@@ -37,7 +37,7 @@
@output = <F>;
close F;
-...@expected = "SERVICE CHECK: cisco Coldstart 1 Device coldstarted\n";
+...@expected = ("SERVICE CHECK: cisco Coldstart 1 Device coldstarted\n", "SERVICE CHECK: cisco Coldstart 1 Device coldstarted\n");
is_deeply( \...@output, \...@expected, "Output as expected" );
@@ -90,6 +90,19 @@
192.168.10.20
SNMPv2-MIB::sysUpTime.0 0:0:00:22.66
SNMPv2-MIB::snmpTrapMalformedOID.0 Malformed',
+ # Check for exception here from solarwinds forwarded trap. If solarwinds code not in snmptrap2nagios,
+ # then the exception would be different (IP not found)
+ '6 cisco 81,82
+192.168.100.100
+192.168.100.100
+SNMPv2-MIB::sysUpTime.0 0:0:00:22.66
+SNMPv2-MIB::snmpTrapOID.0 SNMPv2-MIB::coldStart
+SNMPv2-MIB::sysUpTime.0 0:0:00:22.66
+SNMPv2-SMI::enterprises.9.2.1.2.0 "reload"
+SOLARWINDS-TRAPS::nodeIP 192.168.10.20
+SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.16.0.1
+SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 "solarwindsforwarding"
+SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.9.1.186'
);
is_deeply( \...@output, \...@expected, "Trap exceptions at $exceptions correct" );
@@ -104,8 +117,8 @@
row_ok(
sql => "SELECT count(*) as count from snmptrapexceptions",
- tests => [ count => 4 ],
- label => "Should be 4 exceptions",
+ tests => [ count => 5 ],
+ label => "Should be 5 exceptions",
);
row_ok(
@@ -119,9 +132,9 @@
row_ok(
table => "snmptrapexceptions",
where => [ reason => 6 ],
- results => 1,
+ results => 2,
tests => [ hostip => "192.168.10.20", trapname => "SNMPv2-MIB::coldStart", hostname => "cisco", trapdebug => undef, arg1 => "81,82" ],
- label => "At least 1 servicecheck failed",
+ label => "2 servicechecks failed",
);
row_ok(
Modified: trunk/opsview-core/t/var/snmptraps
===================================================================
--- trunk/opsview-core/t/var/snmptraps 2010-11-02 12:54:30 UTC (rev 5282)
+++ trunk/opsview-core/t/var/snmptraps 2010-11-02 15:53:48 UTC (rev 5283)
@@ -28,4 +28,14 @@
192.168.10.20
192.168.10.20
SNMPv2-MIB::sysUpTime.0 0:0:00:22.66
-SNMPv2-MIB::snmpTrapMalformedOID.0 Malformed
+SNMPv2-MIB::snmpTrapMalformedOID.0 Malformed#---next trap---#
+192.168.100.100
+192.168.100.100
+SNMPv2-MIB::sysUpTime.0 0:0:00:22.66
+SNMPv2-MIB::snmpTrapOID.0 SNMPv2-MIB::coldStart
+SNMPv2-MIB::sysUpTime.0 0:0:00:22.66
+SNMPv2-SMI::enterprises.9.2.1.2.0 "reload"
+SOLARWINDS-TRAPS::nodeIP 192.168.10.20
+SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.16.0.1
+SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 "solarwindsforwarding"
+SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.9.1.186#---next trap---#