DX NetOps

 View Only
  • 1.  RegExp Syntax in Event Procedures

    Posted Oct 14, 2016 06:47 AM


    I receive the following trapmessage:


    SNMPv2-SMI::enterprises.23151. = STRING: "ERROR [SeeTec Cayuga] / [INR 6013256] [14:33:45]: Cannot establish stream to []/[DBUG-03-B2] from []."


    I want to grep the text inside the [ ] square brackets and give it to new variables. I only need the parts after the "Cannot establish stream" message.


    var1 =

    var2 = DBUG-03-B2

    var3 =

    I've looked into the Event and Procedure Documentation. While I understand how to create a new event with eventvariables I do not comprehend the RegExp syntax Part.


    Can someone explain what the characters mean or do?

    S \"[(]([^)]+)\"

    S \"Service: *(.*?) +\"

    S \".*?:.*?:(.*)\"


    How do I get the RegExp to grep the text from the second and third square bracket?





  • 2.  Re:  RegExp Syntax in Event Procedures

    Posted Jul 17, 2017 08:23 AM

    Does this code work and you do not understand it? Or does the code not work at all?


    I would have written this as the following regex for function Event Procedure function GetRegexpList


    S \"Cannot establish stream to \[([^\]]+)[^\[]+\[([^\]]+)\] from \[([^\]]+)\"


    • S \"[(]([^)]+)\"   
      This probably does not work with the unmatched parentesis


      S \"Service: *(.*?) +\"
      I don't see how this would work considering the example does not have "Service" in it

    • S \".*?:.*?:(.*)\"
      "Grab everything after the second semi colon"
      Technically works, does not look like it fills your requirements though