cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
646
Views
0
Helpful
3
Replies

NCM Dynamic Groups

josephenix
Level 1
Level 1

We are currently runing CiscoWorks Network Compliance Manager 1.3.SP2 (Build 4755-070308) and our dynamic groups are limited by 10 "Search  Criteria" and because some of the devices dont follow the same naming standard and NCM is case sensitive I am having issues getting all the correct devices into the correct groups.  Is there a way to use linux grep commands to add devices to groups?  I see NCM has a command line but it does not appear to allow any type of grep or regular expression commands.

1 Accepted Solution

Accepted Solutions

Jason Davis
Cisco Employee
Cisco Employee

Hey josephenix, I'm not sure how many devices you are talking about modifying.  If

it's a reasonable number and you already know the groups you want to put things in, then you can use the NCM telnet/
SSH proxy server, get a shell and issue a command like the following:

add device to group


Add a device to a device group.
Synopsis
add device to group [-ip ] [-host ] [-fqdn ] [-deviceid ] -group
Description
•    -ip - a.b.c.d where 0 <= a,b,c,d <= 255. You may optionally prefix the IP with SITE: where SITE is the name of the Site the device is in.
•    -host - A valid hostname

•    -fqdn - A valid Fully Qualified Domain Name

•    -deviceid - A device ID
•    -group - The name of the device group to which the device should be added. Examples

Examples

•    add device to group -ip 192.0.2.10 -group tech-dev

•    add device to group -ip "Default Site:192.0.2.10" -group tech-dev

What I'm envisioning for you is to get a list of devices with their planned device groups - put it into an editor, connect to the NCM proxy server, then paste it into the session...

If I didn't understand this clearly, feel free to reply to the thread with examples.

View solution in original post

3 Replies 3

Jason Davis
Cisco Employee
Cisco Employee

Hey josephenix, I'm not sure how many devices you are talking about modifying.  If

it's a reasonable number and you already know the groups you want to put things in, then you can use the NCM telnet/
SSH proxy server, get a shell and issue a command like the following:

add device to group


Add a device to a device group.
Synopsis
add device to group [-ip ] [-host ] [-fqdn ] [-deviceid ] -group
Description
•    -ip - a.b.c.d where 0 <= a,b,c,d <= 255. You may optionally prefix the IP with SITE: where SITE is the name of the Site the device is in.
•    -host - A valid hostname

•    -fqdn - A valid Fully Qualified Domain Name

•    -deviceid - A device ID
•    -group - The name of the device group to which the device should be added. Examples

Examples

•    add device to group -ip 192.0.2.10 -group tech-dev

•    add device to group -ip "Default Site:192.0.2.10" -group tech-dev

What I'm envisioning for you is to get a list of devices with their planned device groups - put it into an editor, connect to the NCM proxy server, then paste it into the session...

If I didn't understand this clearly, feel free to reply to the thread with examples.

We have a little under 10,000 devices and we support multiple store chains for example one store chain is labeled as a and the other as b.  So store numbers with routers and switches are named as such a0101rt1, a0101sw1, a0101sw2 and a0101ap1.  I have created groups call StoreA and StoreB with subgroups Routers, Switches and APs so that running jobs on all the devices of a particular type is easier.  I was hoping for a more dynamic way of grouping devices, because we have multiple engineers adding and removing devices all the time.

Hey josephenix, it sounds like you have a very reasonable need and use.  Be aware that dynamic groups do require higher CPU resources because of the need to process conditional logic on the device inventory.  I would think that having 10 conditional rules puts you at the extreme case.

I can appreciate your need to have the inventory dynamically updated as multiple users are adding/changing things.  However, you might be negatively impacting normal use with your current process.

I might suggest this...

Using the method I described earlier, connect to the NCM proxy and issue a 'list device" - this will get you a list of all devices in inventory - put this into an array.  Iterate over the array and send each into a query for the NCM proxy with command "list groups -type device -host $DEVICENAME" - this will show you the device groups the device is in - this can go into another array.  You can use your Linux grep commands to determine if it's in the right group.  Then use the 'add device to group' command we discussed earlier, if it isn't in the right group.

You could automate/cron this to run once every 2 hours or so.  This would allow you to programmatically map devices to static device groups and get the benefits of performance with that, but still allow you some flexibility in dynamic naming...

I hope that helps!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: