Start a Conversation

Unsolved

This post is more than 5 years old

1176

December 25th, 2009 22:00

Unmanage interfaces

Hello,

I want to monitor only few interfaces in devices,is there a way  (script) to do so for 100 devices in one go.Alos is there a way to discover devices as unmanaged

December 28th, 2009 02:00

Hi Vivkas,

I guess you need be more specific in determining the condition on basis of which an interface will be unmanaged. For simple conditions you can use the snippet below:

/*******************************************************************************************************************************/
count = 0;
START do {
foreach rtr ( getInstances("Router") ) {
routerObj = object("Router",rtr);
  foreach intf ( routerObj->ComposedOf ) {
   if (intf->CreationClassName == "Interface") {
    if (glob("Null[0-9]*", intf->Description) && !glob("*UNMANAGED",intf->getManagedState()) ){
     print(" Unmanaging ".intf);
     intf->unmanage(); //Will unmanage and set the managed state as EXPLICITLY_UNMANAGED
     //intf->setManagedState("UNMANAGED"); //Will unmanage and set the state as UNMANAGED
     count = count +  1;
    }
   }
  }
  stop();
  }
print("Unmanaged ".count." interfaces");
}
/*******************************************************************************************************************************/

This will unmanage all the interfaces having Null in their description.

Also you can put same code in custom-end-post.asl to unmanage in discovery post-process.

Similar functions are present for Devices also. But be careful as it will unmanage all the childrens of devices ( ie : interfaces etc.) in one go.

There is a subtle difference between function unmange and setManagedState. You need to use either one of them.

And you can use the same code in custom-end-system.asl which runs on per device basis in post-discovery. Just remove the part getIns Router.

Regards,

Raghvendra

8 Posts

December 28th, 2009 13:00

Thanks for the ASL - this is exactly what I was thinking of writing (except to set interfaces with a description to Managed instead of Unmanaged), but you've saved me the headache!

6 Posts

December 28th, 2009 20:00

Thanks Raghvendra,

I have already discovered the devices(router,switches etc) in SMARTS with all interfaces as MANAGED.

Now my requirement is say for ROUTER1 I want to manage only Fast Ethernet interface fa0/1 and keep rest as unmanaged

for ROUTER2 I want only serial 1/1 managed and rest all unmanaged

for SWITCH1 I want only port1/1 managed and rest all unmanaged.

How can I achieve this considering there are more than 800 devices.

One way I was thinking was to UNMANAGE all interfaces first and then use a script to manage the required interfaces.

Please suggest

Is your script going to help me in that

Thanks

December 28th, 2009 23:00

I hope you you code-able logic to identify ROUTER1 ROUTER2 etc.

Since you want to do this for 800 devices. You can do this in 3 ways

1. External script (easiest) : you can just recurse through all devices+their interfaces apply logic to manage/unmanage. Then reconfigure (very important step).

     But this is really an overhead as discovery has already taken place,hence better to do it in discovery.

2. Discovery post processing( little cumbersome) : you can modify the scripts suggested in my earlier post. put your logic. reconfigure takes place anyways after this step. But this elongates you discovery process. And considering post process is a single threaded process unlike rest of discovery. This will strain your CPU. not recommended as well.

3. look at ic-if-state.asl and ic-end-if-state.asl in /opt/InCharge7/IP/smarts/rules/discovery. These scripts will run during the discovery. basically ic-if-state.asl makes note of managed state in a table and ic-end-if-state finally sets that managed state. You can write your whole logic here.VOILA !!

The code in the posts before and these two scripts should set you up.

Its cumbersome but a one time job.

Regards,

Raghvendra

No Events found!

Top