| Line 1... | 
            Line 1... | 
          
          
            | 1 | 
            v1.0
  | 
            1 | 
            v1.1
  | 
          
          
            | 2 | 
             
  | 
            2 | 
             
  | 
          
          
            | 3 | 
            This script polls network switch ports to see which MAC addresses are assigned to them, then polls the arp table
  | 
            3 | 
            This script polls network switch ports to see which MAC addresses are assigned to them, then polls the arp table
  | 
          
          
            | 4 | 
            on one or more routers to determine the IP address. It then uses reverse DNS to look up the name of the device
  | 
            4 | 
            on one or more routers to determine the IP address. It then uses reverse DNS to look up the name of the device
  | 
          
          
            | 5 | 
             
  | 
            5 | 
             
  | 
          
          
            | - | 
               | 
            6 | 
            The script requires snmp to be installed (no MIB files required), and uses the perl module YAML::Tiny. On a Debian based
  | 
          
          
            | - | 
               | 
            7 | 
            system, this can be installed with the command:
  | 
          
          
            | - | 
               | 
            8 | 
             
  | 
          
          
            | - | 
               | 
            9 | 
            apt-get libyaml-tiny-perl snmp
  | 
          
          
            | - | 
               | 
            10 | 
             
  | 
          
          
            | 6 | 
            The results are saved in a YAML file and used to initialize the internal structures if it exists, so when a device
  | 
            11 | 
            The results are saved in a YAML file and used to initialize the internal structures if it exists, so when a device
  | 
          
          
            | 7 | 
            goes off the network, the information that it was there remains available (and the date/time it was last seen).
  | 
            12 | 
            goes off the network, the information that it was there remains available (and the date/time it was last seen).
  | 
          
          
            | 8 | 
             
  | 
            13 | 
             
  | 
          
          
            | 9 | 
            Since the data is stored in a YAML file, a second script, mapSwitchesShow.pl was created to convert to a tab delimited text
  | 
            14 | 
            Since the data is stored in a YAML file, a second script, mapSwitchesShow.pl was created to convert to a tab delimited text
  | 
          
          
            | 10 | 
            file for human viewing and/or script processing.
  | 
            15 | 
            file for human viewing and/or script processing.
  | 
          
          
            | 11 | 
             
  | 
            16 | 
             
  | 
          
          
            | 12 | 
            Files:
  | 
            17 | 
            Files:
  | 
          
          
            | 13 | 
             
  | 
            18 | 
             
  | 
          
          
            | 14 | 
            mapSwitches.pl - the main file which connects to each device in config, gathers data, and updates persistent storage
  | 
            19 | 
            mapSwitches.pl - the main file which connects to each device in config, gathers data, and updates persistent storage
  | 
          
          
            | 15 | 
            mapSwitchesShow.pl - converts stored data into a CSV (tab delimited)
  | 
            20 | 
            mapSwitchesCSV.pl - converts stored data into a CSV (default is tab delimited)
  | 
          
          
            | 16 | 
            mapswitches.cron - sample cron file to gather information hourly and generate a CSV once a day
  | 
            21 | 
            mapswitches.cron - sample cron file to gather information hourly and generate a CSV once a day
  | 
          
          
            | 17 | 
             
  | 
            22 | 
             
  | 
          
          
            | 18 | 
            The following files are not required for the system to run
  | 
            23 | 
            The following files are not required for the system to run
  | 
          
          
            | 19 | 
            mapSwitches.config.yaml.sample - sample configuration file
  | 
            24 | 
            mapSwitches.config.yaml.sample - sample configuration file
  | 
          
          
            | 20 | 
            README - This file
  | 
            25 | 
            README - This file
  | 
          
          
            | Line 28... | 
            Line 33... | 
          
          
            | 28 | 
             
  | 
            33 | 
             
  | 
          
          
            | 29 | 
            The following file is created on first run.
  | 
            34 | 
            The following file is created on first run.
  | 
          
          
            | 30 | 
            mapSwitches.yaml
  | 
            35 | 
            mapSwitches.yaml
  | 
          
          
            | 31 | 
            This is the persistent storage. It can be safely deleted at any time to reinitialize the system.
  | 
            36 | 
            This is the persistent storage. It can be safely deleted at any time to reinitialize the system.
  | 
          
          
            | 32 | 
             
  | 
            37 | 
             
  | 
          
          
            | 33 | 
            The script requires snmp to be installed (no MIB files required), and uses the perl module YAML::Tiny. On a Debian based
  | 
            - | 
               | 
          
          
            | 34 | 
            system, this can be installed with the command:
  | 
            - | 
               | 
          
          
            | 35 | 
             
  | 
            - | 
               | 
          
          
            | 36 | 
            apt-get libyaml-tiny-perl snmp
  | 
            - | 
               | 
          
          
            | 37 | 
             
  | 
            - | 
               | 
          
          
            | 38 | 
            We generally set this to be run hourly, and we then generate a tab delimited text file once a day. See the sample cron file
  | 
            38 | 
            We generally set this to be run hourly, and we then generate a tab delimited text file once a day. See the sample cron file
  | 
          
          
            | 39 | 
            for how we do it.
  | 
            39 | 
            for how we do it.
  | 
          
          
            | 40 | 
             
  | 
            40 | 
             
  | 
          
          
            | 41 | 
            Script does not need any special permissions so can be run as any user.
  | 
            41 | 
            Script does not need any special permissions so can be run as any user.
  | 
          
          
            | 42 | 
             
  | 
            42 | 
             
  | 
          
          
            | - | 
               | 
            43 | 
            mapSwitchesCSV.pl accepts two positional parameters. The first is the delimiter for the output, the second is a character to
  | 
          
          
            | - | 
               | 
            44 | 
            encapsulate the columns. Default is a tab for delimiter and no encapsulation.
  | 
          
          
            | - | 
               | 
            45 | 
             
  | 
          
          
            | 43 | 
            Tested under Devuan Jessie, connecting to HP Procurve and OpnSense router
  | 
            46 | 
            Tested under Devuan Jessie, connecting to HP Procurve and OpnSense router
  |