This is a sample of “ThisSite.pm” for Switchmap when using my other add-ons.
package ThisSite; # # This package defines site-specific constants used by the SwitchMap # programs. # # Set $GetSwitchListFromHpOpenView to 1 (true) if you have HP OpenView # Network Node Manager (NNM) running on a machine at your site, and # you want SwitchMap to get the list of your switches from OpenView. # This is a good thing to do if you can, because as you add/remove # switches from your network, SwitchMap automatically adjusts. If you # leave $GetSwitchListFromHpOpenView set to 0 (false), SwitchMap will # use the static @LocalSwitches array defined below. $GetSwitchListFromHpOpenView = 0; # Set $GetMacIpAddrFromHpOpenView to 1 (true) if you have HP OpenView # Network Node Manager (NNM) running on a machine at your site, and # you want SwitchMap to get the MAC-to-IP mapping tables from # OpenView. This is a good thing to do if you have OpenView and you # have OpenView configured to manage all your hosts on all your # networks. Otherwise, leave $GetMacIpAddrFromHpOpenView set to 0 # (false) and SwitchMap will get the data from the MacList file (see # the README file for an explanation of the MacList file) $GetMacIpAddrFromHpOpenView = 0; # Set $GetSnmpCommunitiesFromHpOpenView to 1 (true) if you have HP # OpenView Network Node Manager (NNM) running on a machine at your # site, and you want SwitchMap to get SNMP community strings from # OpenView. If you have OpenView and you have configured OpenView # with SNMP community strings, setting this variable to true lets you # avoid maintaining 2 lists of SNMP community strings. Otherwise, # leave $GetSnmpCommunitiesFromHpOpenView set to 0 (false) and see the # comment that describes the $Community variable below. $GetSnmpCommunitiesFromHpOpenView = 0; # If you have HP OpenView Network Node Manager at this site (any of # the previous 3 variables are set to true), then this program will # get information from NNM. To do so, this program needs to know the # DNS name of the machine that is running HP OpenView NNM. If the # SwitchMap programs are running on the same machine as HP OpenView # NNM, set $OpenViewHost to 'localhost'. If HP Openview NNM is # running on another machine, put the name here, and this program will # ssh to the machine. For this to work, you have to have ssh access # to the machine defined by $OpenViewHost such that the user that runs # the SwitchMap scripts is able to ssh to $OpenViewHost without # supplying a password. If the previous 3 variables are set to 0 # above, then it doesn't matter what value $OpenViewHost has. $OpenViewHost = 'nnm.your.domain'; # If you have HP OpenView Network Node Manager at this site and NNM is # running on another host, then this is the ssh key to use to get the # switch lists and MAC data and the SNMP community strings file. # SwitchMap will use this string as the argument of the "-i" option # when SwitchMap does ssh or scp commands to get data from the remote # host. $SshKeyOption = ''; # If you do not have HP OpenView Network Node Manager at this site # ($Has_HP_OpenView = 0 above), then you'll need to run GetArp.pl # periodically to get IP and MAC data from your CSSes/routers. The # @routers array list the devices that the GetArp program will query. @routers = ('router1' , 'router2'); # File protection to be applied to all output files. This value is # used in "chmod" calls, and is usually specified in octal (in Perl, # scalar integers specified with a leading zero are octal, not # decimal). The default given here is fine for most sites. $FileProtectionModes = 0644; # 0644 = "-rw-r-r--" # @LocalSwitches provides a static list of switches when you have # $GetSwitchListFromHpOpenView set to 0. If you have # $GetSwitchListFromHpOpenView set to 1, SwitchMap ignores the # contents of @LocalSwitches. This list is used by ScanSwitch.pl # and SwitchMap.pl. @LocalSwitches = ('switch1' , 'switch2'); @LocalSwitchesFilter = ('switch1,Gi5/2:Gi5/1:Gi1/13:Gi1/36:Gi1/35:Gi1/14:Gi1/47:Gi1/48:Gi1/1:Gi1/2:Gi4/5:Gi4/14:Gi4/8:Gi4/6:Gi3/10:Gi3/8:Gi4/11:Gi4/13:Fa9/18:Fa9/17:Gi3/16:Gi4/10:Gi4/9:Gi4/15:Gi3/12:Gi4/4:Gi3/13:Gi3/15:Gi3/9:Gi4/16', 'switch2,Gi5/2:Gi5/1:Gi1/14:Gi1/13:Gi1/35:Gi1/36:Gi1/2:Gi1/1:Gi1/47:Gi1/48:Gi3/3:Gi4/8:Gi4/6:Gi4/3:Gi3/8:Gi3/7:Gi3/6:Gi3/4:Gi3/15:Gi4/10:Gi4/9:Gi4/15:Gi3/12:Gi4/4:Gi3/13:Gi3/16:Gi3/9:Gi4/16' ); # If you have HP OpenView and you've set $GetSwitchListFromHpOpenView # to 1, it may match some switches that you don't want to appear in # the port lists. For example, at my site we have a network connection # to a Catalyst that we monitor with HP OpenView even though we # don't have administrative control of the switch. So when SwitchMap # finds all the Catlaysts known to HP OpenView, it finds the switch # along with all our other switches. By putting that switch in the # @SkipTheseSwitches list, we can make SwitchMap skip that switch. @SkipTheseSwitches = ('ithaka-router'); # If you use the same community string for all your switches, leave # $CmstrFile as an empty string and set the $Community variable found # below. If you use different community strings on different # switches, set $CmstrFile to the full pathname of a file that defines # the strings. The format of the file is intentionally identical to # that of the netmon.cmstr file used by HP OpenView NNM, so that sites # that have NNM can simply use their existing NNM file. The file must # contain one community string per line, in double quotes. Duplicates # are ignored, as are lines that start with '#'. On each line of the # file, everything after the second double-quote character is ignored. # If you have HP OpenView, set $CmstrFile to the full path name of the # netmon.cmstr file, including the 'netmon.cmstr' at the end, and this # program will try to open the file on the HP OpenView machine defined # by $OpenViewHost above. Specify the real full path name, without # using any environment variables like OV_CONF. If you don't have HP # OpenView, set $CmstrFile to the full pathname of a file. For each # switch, this program will try the community strings defined in the # file, one after the other. $CmstrFile = ''; # If you use the same SNMP community string in all your switches, set # $Community to that value. If your switches have different community # strings, set the $CmstrFile variable above. When that variable is # set to a non-empty value, SwitchMap ignores the value of the # $Community variable. Note: the SwitchMap programs do only "get" # SNMP requests - no SNMP "set" requests are done. $Community = 'SOME_COMMUNITY'; # Your DNS domain. A typical switch in our network is "abc.ucar.edu", # so we set this to '.ucar.edu'. $DnsDomain = 'abc.com'; # The $WorkingDirectory variable is the full path to the working # directory (where the code is). This is where the program finds some # Perl modules. $WorkingDirectory = '.'; # The $CgiDir variable is the directory that the FindOffice.pl # program was copied to when the SwitchMap program was installed. # Specify the directory relative to the root directory configured into # the web server. The web server has to be configured to allow # scripts that live in this directory to be executed. On my Linux # system running an Apache web server, the CGI directory is # /usr/web/nets/cgi/, so I edited the /etc/apache file and added a # line that says # # ScriptAlias /nets/cgi /usr/web/nets/cgi/ # $CgiDir = '/srv/www/cgi-bin'; # Set $HasFinder to 1 if the "finder.py" CGI program is installed on # your web server. Setting it to 1 will cause SwitchMap to include a # link to the page when it creates the portlists index page. The # "finder.py" program accepts an IP or MAC address from the user and # dynamically walks through network devices to find a given address. # It then displays the switch information related to the address # (switch, port, port label). The program is not portable to sites # other than NCAR, so you're not likely to have it, so you should # probably leave $HasFinder set to 0. $HasFinder = 0; # Set HasConfRooms to 1 if you have a static webpage named # conference-rooms.html that describes your site's conference rooms. # Setting it to 1 will cause SwitchMap to include a link to the page # when it creates the portlists index page. NCAR has such a page. # You're not likely to have it, so you should probably leave # $HasConfRooms set to 0. $HasConfRooms = 0; # The $WebPageTrailer variable contains a site-specific trailer on # each web page. $WebPageTrailer = <<wpt; Address comments or questions about this Web page to SOMEADMIN\@$DnsDomain.
WPT # The $ExtraHelpText string contains extra site-specific text that is # written to the help file. The help file explains how the search # function is used. At my site, I initialize this variable with text # that explains how we use the "name" fields in Cisco switches at our # site. You can safely leave this empty. $ExtraHelpText = ''; # The number of days past which a port is considered "unused". $UnusedAfter = 60; # days # The campus name $Campus = "HQ"; # # EVERYTHING BELOW THIS IS USED FOR ARCHIVESETUP.PL and jimmenu # # If you want to archive the output that switchmap generates then # set this to 1, otherwise set it to 0. $Archive = 1; # If you decide to archive the output that switchmap generates then # choose how many archives you want. By default archive is expected # to run once every hour to keep a very accurate list of hosts. # The default number is 23 because using the 24 hour clock you start # counting at 00 hundred hours and end at 23 hundred hours. $ArchiveQuantity = 23; # Point this to your cgi-bin directory that is # used for switchmap we want to know the absolute # location of the cgi directory $Webaccess_cgifile = '../../../cgi-bin/FindOfficeHQ.pl'; $Absoluteloc_cgifile = "$CgiDir/FindOfficeHQ.pl"; # Point this to your switchmap web directory # directory. (ex. /var/www/html/switchmap) $Webdir = '/srv/www/htdocs/switchmap/HQ'; # # Stuff below here is strictly for Jimmenu # # If you want to see a detailed menu for each archive that is created # then set this to 1. The Desktop/Server Distribution has the detailed # menu enabled. To enable the detailed menu for archives set this to 1. # # NOTE: When setting this to 1, if you do 24 hours worth of archives, # the menu will take about 2-3 seconds per page to load since it # is loaded each time the page is changed. # # Sample menu in ascii below # # Switchmap | HQ - Phoenix, AZ # |_ Desktop/Server Distribution # |_ Archive # |_12 AM # |_ Search the portlist # |_ Switches # |_ Modules # |_ Ports # | |_ Unused Ports # | |_ Emergency Ports # | |_ Gigabit Ports per Vlan # |_ Vlans # |_ Statistics # # |_12 AM # $ArchiveMenuDetail = 1; # This is pointing to the location of which # jimmenu is installed. If your switchmap # web directory is "/var/www/html/switchmap", # then define below as /switchmap. $Webaccess_webdir_root = '/switchmap'; $Webaccess_webdir = '/switchmap/HQ'; 1;