Hello, I've already posted in the tips&trick (http://www.zenoss.com/community/wiki/tips-and-tricks/ZendmdPlayingWithInterfaces/) section a few hints how to disable and enable monitoring of interface for a set of devices - especially if you have devices with a lot of interfaces since it would take some time to select each and every interface and enable/disable the monitor for it. As you can see in the screenshot I added another column in the interface list and modified the dropdown menu accrodingly.
(http://img85.imageshack.us/my.php?image=zenossmonitoringwn2.png) To the extra column you need to modify Products/ZenModel/skins/zenmodel/deviceOsDetail.pt Code: @@ -70,7 +70,8 @@ tableName,'description','Descr')"/> <th class="tableheader" align="center" width="30">O</th> <th class="tableheader" align="center" width="30">A</th> - <th class="tableheader" align="center" width="60">Lock</th> + <th class="tableheader" align="center" width="30">M</th> + <th class="tableheader" align="center" width="60">Lock</th> </tr> <tr tal:condition="not:batch"> <th class="tableheader" align="left"> @@ -123,6 +124,12 @@ here.os.getStatusImgSrc(3))" /> </td> <td class="tablevalues" align="center"> + <img border="0" + tal:attributes="src python:test(intf.monitor==True, + here.os.getStatusImgSrc(0), + here.os.getStatusImgSrc(3))" /> + </td> + <td class="tablevalues" align="center"> <img tal:condition="intf/isLockedFromDeletion" border="0" src="locked-delete-icon.png"> <img tal:condition="intf/isLockedFromUpdates" I tried to modify the drop down menu via Products/ZenModel/data/menus.xml but this did not change the actual menu. You can add menu buttons via zenoss->settings->Menus. There you select IpInterface from the drop down box and add two more items. Like in the following screenshot. (http://img145.imageshack.us/my.php?image=zenossmonitoringmenuhn3.png) Make sure to use the same action names etc. Then you need to modifiy Products/ZenModel/OperatingSystem.py: Code: @@ -185,6 +185,30 @@ REQUEST['message'] = 'IpInterfaces deleted' return self.callZenScreen(REQUEST) + def enableIpInterfacesMonitoring(self, componentNames=[], REQUEST=None): + """Enable Monitoring for selected Interfaces""" + if not componentNames: return self() + if type(componentNames) in types.StringTypes: componentNames = (componentNames,) + for componentName in componentNames: + for interface in self.interfaces(): + if interface.getInterfaceName() == componentName: + interface.monitor = True + if REQUEST: + REQUEST['message'] = 'Monitoring activated' + return self.callZenScreen(REQUEST) + + def disableIpInterfacesMonitoring(self, componentNames=[], REQUEST=None): + """Enable Monitoring for selected Interfaces""" + if not componentNames: return self() + if type(componentNames) in types.StringTypes: componentNames = (componentNames,) + for componentName in componentNames: + for interface in self.interfaces(): + if interface.getInterfaceName() == componentName: + interface.monitor = False + if REQUEST: + REQUEST['message'] = 'Monitoring deactivated' + return self.callZenScreen(REQUEST) + def unlockIpInterfaces(self, componentNames=[], REQUEST=None): """Unlock IpInterfaces""" self.unlockDeviceComponents(self.interfaces, componentNames, REQUEST) Finally add the following files to this directory Products/ZenWidgets/skins/zenui/: dialog_disableIpInterfacesMonitoring.pt Code: <h2>Disable Monitoring...</h2> <br/><br/> <p> Are you sure you want to disable monitoring for these IpInterfaces?<br/> </p> <br/> <div id="dialog_buttons"> <input type="submit" name="disableIpInterfacesMonitoring:method" value="OK" tal:attributes="onclick string:return $$('dialog').submit_form( '${here/os/absolute_url_path}')" /> <input id="dialog_cancel" type="button" value="Cancel" onclick="$('dialog').hide()"/> </div> dialog_enableIpInterfacesMonitoring.pt: Code: <h2>Enable Monitoring...</h2> <br/><br/> <p> Are you sure you want to enable monitoring for these IpInterfaces?<br/> </p> <br/> <div id="dialog_buttons"> <input type="submit" name="enableIpInterfacesMonitoring:method" value="OK" tal:attributes="onclick string:return $$('dialog').submit_form( '${here/os/absolute_url_path}')" /> <input id="dialog_cancel" type="button" value="Cancel" onclick="$('dialog').hide()"/> </div> Comments, questions, suggestions? -------------------- m2f -------------------- Read this topic online here: http://community.zenoss.com/forums/viewtopic.php?p=17623#17623 -------------------- m2f -------------------- _______________________________________________ zenoss-users mailing list [email protected] http://lists.zenoss.org/mailman/listinfo/zenoss-users
