This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

NCM Block Text Expressions

We have a section of config in our routers and switches that should be consistent across all nodes, and it VERY large.  I have tried just copying and pasting the 100 lines or so into a text block in the NCM string matching area to create a new rule.  Seems like it should be simple since the text is the EXACT SAME THING across all nodes.. but for some reason it fails.  Surely it is not that difficult when one needs to create a text block that is EXACTLY THE SAME ACROSS ALL NODES..

I cant post an example of the text as it deals with security.. but just visualize any 100 lines of Cisco code that is EXACTLY the same.

Help is greatly appreciated.

Jim

  • Hi Jim,

    I don't think you can paste multiple lines in that way and get it to work.  I suspect that newline characters are the root of why they don't match.

    There is a "canned" rule that uses RegEx and checks for all transport mechanisms enabled.  It looks like this

    line con 0.*\n(.*\n)*.*transport input all


    You may get yours to work with a similar approach.  It should be easy enough to test the concept it with just a few lines.


    Good Luck!

  • FormerMember
    0 FormerMember

    Simply create a rule and make it Regex, then add the following to each line, \r

    Paste in the entire block, it should look like:

    line 1\r

    line 2\r

    line 3\r

    You will need to escape any special characters through out the text as well.  If you have any problems paste a screenshot of the text, and I will reply.

    ** edited, I must have been asleep, I meant a \r not \n **

  • Tim

    Thanks.  Yea, that didnt seem to work either and I am thinking I have to be over thinking this.  So here is a copy of a small part of the config that I grabbed of a router and made sure that the NCM config I was comparing it to was the same.  I added the \n as you suggested and tested against the config.  It came back as violated even though, obviously, the config is there. In the detailed it shows the config but it puts it all on one line and say string "was not found". 

    ip access-list extended POS-inboundfilter\n

    remark POS-inboundfilter Version 20140214\n

    evaluate POS2-traffic\n

    remark Allow ICMP (ping)\n

    permit icmp any any reflect POS-traffic\n

  • FormerMember
    0 FormerMember in reply to jim.couch

    The rule should look like this:

    ip access-list extended POS-inboundfilter\r

    remark POS-inboundfilter Version 20140214\r

    evaluate POS2-traffic\r

    remark Allow ICMP (ping)\r

    permit icmp any any reflect POS-traffic\r\n

    Of note, when you hit the return button in the rule you are adding a \n

    NCM stores the configs with a \r\n

    jim.couch@loves.com

  • I am assuming that you are doing regular expression match. The choice of newline characters varies from device to device. Even among Cisco devices I have found newer versions are using just '\r' whereas older versions have \r\n. The most reliable way to identify why the regex failed is to open the config file using Notepad++ and perform regex search providing the exact same string that you would provide to NCM String matching area.

  • FormerMember
    0 FormerMember in reply to thamizh85

    thamizh85 You can check by copying the text config out of Firefox or IE into notepad++.  I haven't ran into any where Solarwinds didn't have a \r\n at the end of each line.   This is the best way to validate what is actually stored in the configuration.  There is also a feature request I created to show you endline and whitespace characters throughout the config, if you would +1 it; that would be great.