Welcome, Guest. Please login or register.

Author Topic: monitor specific interfaces  (Read 4263 times)

dobst

  • Full Member
  • ***
  • Posts: 153
    • View Profile
monitor specific interfaces
« on: January 17, 2014, 03:33:58 PM »
Hello,

how can I get notified if an uplink interface of a portchannel goes down? In this case the switch keeps reachable but one link isn't available any more. Is there an option to check defined interfaces?

Yours, Daniel

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2763
    • View Profile
    • NeDi
Re: monitor specific interfaces
« Reply #1 on: January 17, 2014, 04:11:20 PM »
Not yet. However you can use event forward with a regexp matching those interfaces and let the device send syslog to the nedi host, which will then generate a mail notification...
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

dobst

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: monitor specific interfaces
« Reply #2 on: January 20, 2014, 08:19:07 AM »
Hi Remo,

thank you for your quick response.

dobst

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: monitor specific interfaces
« Reply #3 on: January 20, 2014, 03:01:40 PM »
I added the following traphandler:
Code: [Select]
traphandle       default /usr/bin/perl /opt/nedi/trap.pl
But get the following error lines during receivment of traps:

Code: [Select]
Global symbol "$mq" requires explicit package name at /opt/nedi/trap.pl line 97.
Execution of /opt/nedi/trap.pl aborted due to compilation errors.

Is $mq = mail queue? Seems to be uninizialisied.

Even with the test string mentioned int the trap.pl script:

Code: [Select]
host:/ # echo Test\\n1.2.3.4\\nThis is a test\\nLooking good\\nI think|/opt/nedi/trap.pl
Global symbol "$mq" requires explicit package name at /opt/nedi/trap.pl line 97.
Execution of /opt/nedi/trap.pl aborted due to compilation errors.

By the way: You need to escape ! in your example:
echo Test\\n1.2.3.4\\nThis is a test\\nLooking good\!\\nI think|/opt/nedi/trap.pl
« Last Edit: January 20, 2014, 03:32:39 PM by dobst »

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2763
    • View Profile
    • NeDi
Re: monitor specific interfaces
« Reply #4 on: January 20, 2014, 06:46:48 PM »
Are you sure you're using the right trap.pl? I don't have $mq on line 97... (1.0.8's does)

Tx for the hint on escaping !
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

dobst

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: monitor specific interfaces
« Reply #5 on: January 21, 2014, 08:39:47 AM »
Hi Remo,

I downloaded trap.pl from the nedi package again but the error remains:

Code: [Select]
server:/opt/nedi # echo Test\\n1.2.3.4\\nThis is a test\\nLooking good\!\\nI think|/opt/nedi/trap.pl
Global symbol "$mq" requires explicit package name at /opt/nedi/trap.pl line 97.
Execution of /opt/nedi/trap.pl aborted due to compilation errors.
server:/opt/nedi #

I can't see an initialization or declaration of $mq in trap.pl. $mq is used just once int the AlertFlush function. Which perl version are you using?

Code: [Select]
server:/opt/nedi # /usr/bin/perl -v

This is perl, v5.10.0 built for x86_64-linux-thread-multi

Copyright 1987-2007, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Code: [Select]
server:/opt/nedi # zypper -v up perl
Verbosity: 1
Non-option program arguments: 'perl'
Initializing Target
Checking whether to refresh metadata for SLE11-SDK-SP1-Pool
Checking whether to refresh metadata for SLE11-SDK-SP1-Updates
Checking whether to refresh metadata for SLE11-SDK-SP2-Core
Checking whether to refresh metadata for SLE11-SDK-SP2-Updates
Checking whether to refresh metadata for SLES11-SP1-Pool
Checking whether to refresh metadata for SLES11-SP1-Updates
Checking whether to refresh metadata for SLES11-SP2-Core
Checking whether to refresh metadata for SLES11-SP2-Extension-Store
Checking whether to refresh metadata for SLES11-SP2-Updates
Loading repository data...
Reading installed packages...
Force resolution: No
No update candidate for 'perl-5.10.0-64.61.61.1.x86_64'. The highest available version is already installed.
Resolving package dependencies...
Force resolution: No

Nothing to do.
Code: [Select]
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2763
    • View Profile
    • NeDi
Re: monitor specific interfaces
« Reply #6 on: January 21, 2014, 08:46:17 PM »
I agree, declaration is missing, but what I don't get is why it's complaining about line 97. I have this on line 97:

   }elsif($info =~ s/SNMPv2-SMI::enterprises.9.2.9.3.1.1.2.1/Cisco TCPconnect/){


n8dev:~#perl -v

This is perl 5, version 12, subversion 2 (v5.12.2 (*)) built for i386-openbsd
(with 8 registered patches, see perl -V for more detail)

Copyright 1987-2010, Larry Wall
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

dobst

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: monitor specific interfaces
« Reply #7 on: January 22, 2014, 08:57:26 AM »
Line 97 in trap.pl is

Code: [Select]
        &mon::AlertFlush("NeDi Trap Forward for $tgt",$mq);
                                                      ^^^

Code: [Select]
        }elsif($info =~ s/SNMPv2-SMI::enterprises.9.2.9.3.1.1.2.1/Cisco TCPconnect/){ is line 89. Are you sure that you're using the trap.pl from your provided package? Compare it with my attached trap.pl. Perl v5.10 is the latest version for SLES 11.2.

I don't understand where $mq get's a value. In trap.pl it seems to be not declared and without a value. Where does it get its value from?

ascii

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: monitor specific interfaces
« Reply #8 on: January 22, 2014, 12:37:33 PM »
my trap.pl looks different
i attached it.
the section looks like these

Code: [Select]
84 if(exists $srcna{$ip}){                                                                                 # Source IP lookup (%srcna created by db::readmon)
 85         my $tgt = $srcna{$ip};
 86         $level = 50;
 87
 88 # TODO remove this legacy and put meaningful actions?
 89         if($info =~ s/IF-MIB::ifIndex/Ifchange/){
 90                 $level = 150;
 91         }elsif($info =~ s/SNMPv2-SMI::enterprises.45.1.6.4.3.5.1.0/Baystack Auth/){
 92                 $level = 150;
 93         }elsif($info =~ s/SNMPv2-SMI::enterprises.9.2.9.3.1.1.1.1/Cisco Auth/){
 94                 $level = 150;
 95         }elsif($info =~ s/SNMPv2-SMI::enterprises.9.2.1.5.0/Cisco Auth Failure!/){
 96                 $level = 150;
 97         }elsif($info =~ s/SNMPv2-SMI::enterprises.9.2.9.3.1.1.2.1/Cisco TCPconnect/){
 98         }elsif($info =~ s/SNMPv2-SMI::enterprises.9.9.43/IOS Config change/){
 99                 $level = 100;
100         }elsif($info =~ s/SNMPv2-SMI::enterprises.9.5.1.1.28/CatOS Config change/){
101                 $level = 100;
102         }elsif($info =~ s/SNMPv2-SMI::enterprises.9.9.46/Cisco VTP/){
103         }
104         my $mq = &mon::Event(1,$level,'trap',$tgt,$tgt,"$info","$info");
105         &mon::AlertFlush("NeDi Trap Forward for $tgt",$mq);
106 }else{

dobst

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: monitor specific interfaces
« Reply #9 on: January 22, 2014, 01:25:39 PM »
Omg. I think we're talking about different versions. I still use 1.0.8 and you're talking about 1.0.9, right? So your provided trap.pl is for 1.0.9 and not comtabible with 1.0.8 (1.0.8 is missing /nedi/inc/libdb.pm).

So I think the best way is to update to 1.0.9 and test again.

ascii

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: monitor specific interfaces
« Reply #10 on: January 22, 2014, 01:38:51 PM »
you are right.
i oversaw that you are using 1.0.8.