Create a file within $OV_REGISTRATION/C and insert the previous code listing. Once this is done, run ovw with the -verify switch, which checks for errors.[74] You may see errors or warnings about your new menu item but, if you're successful, you'll see an item that looks like the menu in Figure B-2.Application "Graph Menu" { Menubar <100> "Local_Graphs" _p { <100> "Network" _N f.menu "network_menu"; } Menu "network_menu" { <90> "5 Minute CPU" _M f.action "5mincpu"; <90> "Bits In and Out For All Up Interfaces" \ _B f.action "bit_for_all_up"; } Action "5mincpu" { Command "/opt/OV/local/scripts/Cisco_5min_cpu \ \"${OVwSelections}\""; MinSelected 1; MaxSelected 7; SelectionRule (isSNMPSupported || isSNMPProxied) ; } Action "bit_for_all_up" { Command "/opt/OV/local/scripts/Cisco_Line_Up_Bits \ \"${OVwSelections}\""; MinSelected 1; MaxSelected 3; SelectionRule (isSNMPSupported || isSNMPProxied) ; } }
[74]Do not leave any backup files within any of the directories, because NNM takes each file seriously. Backup or redundant files will produce warnings when you run ovw.
WARNING: NNM can be picky with registration files. If you can't see your menu, try the ovw -verify trick. If it reveals no errors, take some entries out and restart ovw. Keep doing this until your items appear. You should also break up your menu items into multiple files. Do not put all your menus and actions into one file. The more files you have, the easier it will be to diagnose and troubleshoot your new menu items.
A Menu looks and behaves like the menu bar (or menu) that contains it, with a few differences. Menus don't declare mnemonic characters or precedence; these are defined by the containing menu or menu bar. The menu-name is the linking name that appears after f.menu.Menubar <precedence> "menubar Label" _MnemonicChar { <precedence> "SubMenu Label" _MnemonicChar f.menu "menu-name" <precedence> "Action Name" _MnemonicChar f.action "action-name" }
Actions are called just like Menus. The action-name is the linking name of an action that gets called when selected from a previous item (either a Menu or a Menubar):Menu "menu-name" { <precedence> "SubMenu Label" _MnemonicChar f.menu "menu-name" <precedence> "Action Name" _MnemonicChar f.action "action-name" }
There are a few additional parameters in our Action declaration:Action "action-name" { Command "/opt/OV/local/scripts/Cisco_5min_cpu \"${OVwSelections}\""; MinSelected 1; MaxSelected 7; SelectionRule (isSNMPSupported || isSNMPProxied) ; }
[75]Check out $OV_FIELDS for more definitions of capability fields.
Copyright © 2002 O'Reilly & Associates. All rights reserved.