2
1
0

Hello,

We have been using NMIS4 for years and moved to latest NMIS8 recently. We were using syscontact as email contact for escalation emails (email:syscontact also tried sysContact). It used to work in NMIS4. However, it has stopped working since we moved to NMIS8. I do get emails sent to individual contacts but not to syscontact. I would appreciate any pointers to resolve this. Thank you.

    CommentAdd your comment...

    3 answers

    1.  
      2
      1
      0

      Shekher,

      If you change the block of code you you identified in the following way, it should work.  Notice the data structure for variable $NI changed slightly to $NI->{system}->{sysContact}. 

      foreach $contact (@x) {
              my $contactLevelSend = 0;
              my $contactDutyTime = 0;
              # if sysContact, use device syscontact as key into the contacts table hash
              if ( $contact eq "syscontact") {
                      if ($NI->{system}->{sysContact} ne '') {
                              $contact = lc $NI->{system}->{sysContact};
                              dbg("Using node $thisevent->{node} sysContact $NI->{system}->{sysContact}");
                      } else {
                              $contact = 'default';
                      }       
              }   

      You'll need an entry in /usr/local/nmis8/conf/Contacts.nmis that matches the value that the node has provisioned for SNMP contact. 

      In my lab the following worked.

      ### Router snmp config
      R1#show run | inc contact
      snmp-server contact TheDude
      /usr/local/nmis8/conf/Contacts.nmis
         'thedude' => {
          'Contact' => 'TheDude',
          'DutyTime' => '00:24:MonTueWedThuFriSatSun',
          'Email' => 'thedude@localhost',
          'Level' => '(Fatal|Critical|Major|Minor|Warning|Normal)',
          'Location' => 'default',
          'Mobile' => '',
          'Pager' => '',
          'Phone' => '',
          'TimeZone' => '0'
        }
      /usr/local/nmis8/conf/Escalations.nmis
         'default_core_default_default__' => {
          'Event' => 'default',
          'Event_Element' => '',
          'Event_Node' => '',
          'Group' => 'default',
          'Level0' => 'email:sysContact',
          'Level1' => '',
          'Level10' => '',
          'Level2' => 'email:Contact1',
          'Level3' => '',
          'Level4' => '',
          'Level5' => '',
          'Level6' => '',
          'Level7' => '',
          'Level8' => '',
          'Level9' => '',
          'Role' => 'core',
          'Type' => 'default',
          'UpNotify' => 'true'
        }
      1. pooshgul

        Great. It worked. Thank you so much. :) . Really appreciate your efforts.

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hi Mark,

      Thank you for the reply.

      Your understanding is correct. I am sure that there was no customization in NMIS4. It just worked. It was also mentioned in NMIS4 documentation. I also see some code in NMIS8 related to this in nmis.pl and view-events.pl but it doesn't work. In NMIS4, there was a code related to this in NMIS.pm. However, in NMIS8, I dont know see any code about syscontact in NMIS.pm. Sadly, I dont know anything about coding. 

      From nmis.pl

      # pager:contact1:contact2,email:sysContact
      $level = lc($EST->{$esc_key}{'Level'.$thisevent->{escalate}});

      if ( $level ne "")
      {
      # Now we have a string, check for multiple notify types
      foreach $field ( split "," , $level ) {
      $target = "";
      @x = split /:/ , lc $field;
      $type = shift @x; # first entry is email, ccopy, netsend or pager

      dbg("Escalation type=$type");

      if ( $type =~ /email|ccopy|pager/ )
      {
      foreach $contact (@x) {
      my $contactLevelSend = 0;
      my $contactDutyTime = 0;
      # if sysContact, use device syscontact as key into the contacts table hash
      if ( $contact eq "syscontact") {
      if ($NI->{sysContact} ne '') {
      $contact = lc $NI->{sysContact};
      dbg("Using node $thisevent->{node} sysContact $NI->{sysContact}");
      } else {
      $contact = 'default';
      }
      }

      Best regards,

      Shekher

       

      1. Mark Henry

        Shekhar, Thanks for the added detail. I'll open a ticket with our support team and we will investigate. Best, Mark H

      2. pooshgul

        Thank you very much, Mark. Appreciate your help. regards, Shekher

      CommentAdd your comment...
    3.  
      1
      0
      -1

      Hello pooshgul,

      To clarify, are you looking to use the sysContact field from a device's SNMP to dynamically drive the Contact email? If that's correct, it sounds like your original NMIS4 implementation may have been customized at some point.

      I believe this could be done, but could require some customization of your NMIS implementation. All the NMIS code is open source and uncompiled PERL, so you can customize as needed. If you still have your NMIS4 code base you may be able to repurpose some of the original code from there.

      Best,

      Mark H

        CommentAdd your comment...