cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 8

Using a multiple line script in NCM

Hello all,

I wanted to ask about a small issue that I ran into some time ago with using a multiple line config script (text file).  I wrote a script to change switchports in a stack group.  I ran a test before trying to schedule the script but I noticed only ports on the master member in the stack (g1/0/1-48) were changed.  The remaining ports on member switches 2 and 3 were not changed.  I've gone through the NCM documentation but there aren't any examples of running a script with multiple lines.  Only examples are to push a single change.  Are creating templates the answer to this simple problem?  Or am I missing something obvious?

Thanks!

0 Kudos
5 Replies

Without more details its tough to figure out what might have gone wrong, can you give us an example of what you did and we might have more details?

That being said, you might be missing a better solution, my favorite part of NCM, the compliance portion.  

The compliance portion of NCM is made to check configurations to make sure they comply to "standards" and if something is wrong about how they're configured, it can go an fix them.

Even better, quite some time ago they put in the ability to work with config blocks, of which the intended use was for working with all the interfaces on a box.    You simply define the start of a block, which could be as easy as "^interface" (which means a line that starts with (^) the word interface, and the end of the block, and then your able to check within that block for making sure things are correct.   AND, if they aren't, you can execute commands on that block to make it right..

Not great for little one time changes, but for keeping your configuration compliant, its great!

0 Kudos

@cnorborg Thanks for the reply and insight!  I should've given more details in my initial post.  The config was putting all ports into authentication open mode.  

Text config was:

bwilson13_0-1583863741628.png

Previously we used Kiwi Cattools and using the above script worked.  I know that it isn't a far comparison since there's so much more capability within NCM. 

0 Kudos

Hmm...  All I can think of is maybe put an extra newline before each "int range"?   Or maybe an "exit" on a line on its own to get out of the previous interface range before starting a new one?

0 Kudos

@cnorborg  I know that you replied to this earlier in the year but wanted to resume the conversation about multi-line text scripts in NCM.  I tried as you suggested add line between the int ranges and using exit also (I'm not sure if that exits out of the script or not).  I do realize that you're not a Solarwinds employee but do thank you for providing your previous suggestions!  It's somewhat frustrating seeing that if copy and paste these lines into the CLI, they take without issue.  So I'm trying to determine why the simple text file isn't working on these 3850 switch stacks through NCM.

0 Kudos

In general they do tend to work unless there is an error or something prone to misinterpretation.

Have you gone into the "Jobs" section where your scripts/results should be and looked at what the "History" is showing you?  It should be showing you how the Cisco box is interpreting what you're putting in.

One thing to be careful of, and I'm not sure how you're actually executing the script, is doing the "conf t" in the script itself AND checking the box to "Execute Script in Config Mode" can cause issues.   Make sure you only have one or the other, not both.

It's a bit different than Kiwi, but should be about as simple to work with if you want.  Don't be averse to exploring the additional options you have in Orion also for doing this type of stuff though.

0 Kudos