#!/usr/bin/env python
import sys
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
from transaction import commit
dmd = ZenScriptBase(connect=True).dmd
for dev in dmd.Devices.getSubDevices():
  if dev.id.startswith(sys.argv[1]):
   for interface in dev.os.interfaces():
    if interface.id.startswith(sys.argv[2]):
     interface.speed = float(sys.argv[3])
     interface.lockFromUpdates()
commit()
save the script as script.py
[zenoss@server ~]chmod 755 script.py
You can then use this script on the commandline as zenoss user, usage: ./script.py
e. g.[zenoss@server ~]./script.py cisco Fast 100000000
##for setting speed to 100Mbps on all FastEthernet interfaces on ALL devices that begin with cisco (like cisco-002.net.myorg.com, cisco-003. ... ...)###NOTE: use appropriate indention in the script
This is most suitable for servers, I will not recomend it for network devices. I will publish a post on why i say so; very soon.
ReplyDeletenot very soon, I see
ReplyDeleteYou just saved me heaps of digging, thanks!
ReplyDeleteits nice script.i have been saved it.
ReplyDeleteVery nice, thanks.
ReplyDelete