Subversion Repositories sysadmin_scripts

Rev

Rev 66 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 66 Rev 136
Line 1... Line 1...
1
v2.0.0
1
v3.0.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
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:
7
system, this can be installed with the command:
8
 
8
 
9
apt-get libyaml-tiny-perl snmp
9
apt-get libyaml-tiny-perl snmp
10
 
10
 
11
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
12
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). As of v3.0.1
-
 
13
this can be modified with the 'ttl' entry in the configuration, ie 'ttl: 4d' will remove an entry if it has not been seen for
-
 
14
4 days.
13
 
15
 
14
Since the data is stored in a YAML file, a second script, mapSwitchesShow.pl was created to convert to a tab delimited text
16
Since the data is stored in a YAML file, a second script, mapSwitchesCSV .pl was created to convert to a tab delimited text
15
file for human viewing and/or script processing.
17
file for human viewing and/or script processing.
16
 
18
 
-
 
19
There is also a script, csv2html which will convert the csv file (actually, tsv) to an HTML table embedded in a static web
-
 
20
page, optionally with some titles and a css file.
-
 
21
 
-
 
22
All three executables (mapSwitches, mapSwitchesCSV.pl, csv2html) respond to --help with a brief description
-
 
23
 
17
Files:
24
Files:
18
 
25
 
19
mapSwitches.pl - the main file which connects to each device in config, gathers data, and updates persistent storage
26
mapSwitches - the main file which connects to each device in config, gathers data, and updates persistent storage
20
mapSwitchesCSV.pl - converts stored data into a CSV (default is tab delimited)
27
mapSwitchesCSV.pl - converts stored data into a CSV (default is tab delimited)
21
mapswitches.cron - sample cron file to gather information hourly and generate a CSV once a day
28
mapswitches.cron - sample cron file to gather information hourly and generate a CSV once a day
-
 
29
mapswitches.css - sample csv file
-
 
30
csv2html - reads a tsv/csv file and emits a static web page with data shown in tabular format
22
 
31
 
23
The following files are not required for the system to run
32
The following files are not required for the system to run
24
mapSwitches.config.yaml.sample - sample configuration file
33
mapSwitches.config.yaml.sample - sample configuration file
25
README - This file
34
README - This file
26
makeConfig.pl.sample - generate configuration file from hash. Easier for perl programmers
35
makeConfig.pl.sample - generate configuration file from hash. Easier for perl programmers
27
mapSwitches.config.yaml.sample - sample configuration file
-
 
28
pingall.pl - utility to ping all available ports on a /24 network. Used to artificially refresh arp table
36
pingall.pl - utility to ping all available ports on a /24 network. Used to artificially refresh arp table
29
 
37
 
30
The configuration file MUST be created before running the script. It can be manually created
38
The configuration file MUST be created before running the script. It can be manually created
31
(rename mapSwitches.config.yaml.sample to mapSwitches.config.yaml and edit) or generated makeConfig.pl.sample
39
(rename mapSwitches.config.yaml.sample to mapSwitches.config.yaml and edit) or generated makeConfig.pl.sample
32
(edit hash, then run)
40
(edit hash, then run)