I reach the last testing step in the windows installation instructions and the
test fails. I have a feeling this is to do with the path configuration. The
paths are as follows.
Package path: c:\inetpub\wwwroot\switchmap
Website Home Directory: c:\inetpub\wwwroot
Destination Directory: c:\intepub\switchmap
When I browse to http://localhost/switchmap/index.html
I get a 404 error which seems to be correct since no such file exists in
c:\inetpub\wwwroot\switchmap. Are these paths correct?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Below are the variables from thissite.pm and contents of the web directory and
destination directory. The website home directory is the default:
c:\inetpub\wwwroot. Browsing to http://localhost/switchmap/index.html
yields a 404 because no such file exists in c:\inetpub\wwwroot\switchmap. I
see that there is an index.php. I also notice the index.html file generated in
c:\inetpub\switchmap. Is the install document accurate?
I'm having the feeling that $DestinationDirectory should be set to
c:\inetpub\wwwroot\switchmap instead of c:\inetpub\switchmap. Should there be
two seperate folders or a single folder?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems to work if I set the home directory to c:\inetpub\switchmap. All
except the search page, which it expects to be in the same folder as
index.html.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I sent a query to Nick Hills, the author of the Windows instructions. I don't
have a Windows machine, so I can't help with this. I suggest you hack as
needed to get it to work. Good luck :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Allow me to try and understand this another way. Looking at thissite.pm, I
conclude that your documentroot is /usr/web and the url to browse the site is http://localhost/nets/internal/portlists/index.html.Are all switchmap files contained in
/usr/web/nets/internal/portlists?
The windows instructions clearly suggest that the switchmap package and the
output files be placed in different directories. Keeping in mind that the
documentroot is /usr/web and the package files reside in
/usr/web/nets/internal/portlists, it is as if the variables would be set as
follows.
I'd like to apologize for some of the outdated documentation in SwitchMap.
Better documentation might've prevented the problems you've had. I just
updated the documentation in the main SwitchMap.pl file, and appended it here
for your convenience. The Windows installation document prebably somewhat
inaccurate, for which I'm much more to blame than Nick Hills, who wrote it.
I've made changes to SwitchMap since Nick wrote that document.
Hope this clarifies what goes where and why:
These are the various files that this script needs, reads or writes:
A. Source code files, found in the directory with this file. Files
in this directory don't change once SwitchMap has been installed and
configured.
SwitchMap.pl (this script), which is run in a cron job, usually
every day.
ScanSwitch.pl, a Perl script which is run in a cron job, usually
every hour.
GetArp.pl, a Perl script which is run in a cron job, usually
every hour.
OuiCodes.txt, a text file containing the manufacturer codes that
are found in MAC addresses. OuiCodes.txt is read by this script.
It is generated by UpdateOuiCodes.pl.
UpdateOuiCodes.pl, a Perl script that generates the OuiCodes.txt
file. UpdateOuiCodes.pl is run rarely, because the OuiCodes.txt
file rarely changes. Users shouldn't need to run it at all. It's
included in the distrbution for completeness. See comments in
UpdateOuiCodes.pl for details.
B. State files, found in the directory named by the variable named
$StateFileDirectory, defined in your ThisSite.pm configuration file.
State files are separated from source code files and output files
because they are ogically distinct from source code files and output
files. They include SNMP community strings, which should be protected,
unlike source code files. On my Unix system, I set $StateFileDirectory
to '/var/local/switchmap'.
MacList, a text file containing IP addresses for every MAC
address known to every switch. This file is updated every time
GetArp.pl runs.
"idlesince" files, one for each switch. These files live in
the directory named by the $StateFileDirectory variable in your
ThisSite.pm configuration file. Idlesince files are updated every
time ScanSwitch.pl runs. They are read by SwitchMap.pl. These
files contain, on each line, a port name and Unix timestamp of the
most recent time that each port was found to be idle, or 0 if a
port was active the last time ScanSwitch.pl was run. Thus, the
port has been "idle since" the given time.
Communities.txt, or a similarly named file, the full name of
which is defined by the variable named $CmstrFile in your
ThisSite.pm configuration file. This file is a list of SNMP
community strings to try when getting information from switches.
"community" files, one per switch. These files live in the
directory named by the $StateFileDirectory variable in your
ThisSite.pm configuration file. These files exist to make
switchMap run a bit faster by remembering which of a set of
possible community strings worked the last time SwitchMap ran.
With these files, SwitchMap can avoid trying community strings
that dan't work, and waiting for requests to time out before
trying another string.
C. Output files, which the SwitchMap.pl script writes to the directory
named by the variable named $DestinationDirectory, defined in your
ThisSite.pm configuration file. Unlike the directories that hold
source code or state files, the output directory is accessible by your
web server - the files are readable by web users. By keeping these
files separate from source files, security is improved - a hacker is
able to breach your security by finding a way to modify the SwitchMap
programs. By keeping output files separate from state files, you don't
have to worry that your SNMP community strings might be somehow
accessible via a browser.
HTML files in the "switches", "ports" and "vlans" subdirectories.
THe HTML files are the Web pages that are the point of all this :-)
CSV files in the "csv" subdirectory. These are for people who want
access to the raw data gathered by SwitchMap, in a form that is
easy to parse by programs.
Please let me know how it goes.
-- Pete
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry its taken me a while to pick up on this thread.
As Pete explains above the state files were seperated from the source files
some versions back. Since they could possibly contain sensitive strings (ie
community names) the quickest windows solution i came up with was to locate
them above the wwwroot folder.
I think the document has become a little outdated, and having read through the
changes in the current version, and revisiting the Windows Documentation, i
think the $DestinationDirectory variable should read
c:\inetpub\wwwroot\switchmap as you suggested.
As another method you could locate the statefiles in a sub folder of the home
folder, and use NTFS permissions to secure them from display in the browser,
but this may require you to create and run the switchmap scripts as another
user.
Time to update the documentation again... :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I reach the last testing step in the windows installation instructions and the
test fails. I have a feeling this is to do with the path configuration. The
paths are as follows.
Package path: c:\inetpub\wwwroot\switchmap
Website Home Directory: c:\inetpub\wwwroot
Destination Directory: c:\intepub\switchmap
When I browse to
http://localhost/switchmap/index.html
I get a 404 error which seems to be correct since no such file exists in
c:\inetpub\wwwroot\switchmap. Are these paths correct?
Your Destination Directory has "intepub" instead of
"inetpub". Is that a typo in your message or a typo in your config
files?
That would be a typo.
Below are the variables from thissite.pm and contents of the web directory and
destination directory. The website home directory is the default:
c:\inetpub\wwwroot. Browsing to
http://localhost/switchmap/index.html
yields a 404 because no such file exists in c:\inetpub\wwwroot\switchmap. I
see that there is an index.php. I also notice the index.html file generated in
c:\inetpub\switchmap. Is the install document accurate?
C:\Inetpub\wwwroot\switchmap>findstr /b ^\$ thissite.pm
$GetSwitchListFromHpOpenView = 0;
$GetMacIpAddrFromHpOpenView = 0;
$GetSnmpCommunitiesFromHpOpenView = 0;
$OpenViewHost = 'nnm.your.domain';
$SshKeyOption = '';
$CmstrFile = '';
$Community = 'lantopo';
$DnsDomain = '.na.sdxcorp.net';
$DestinationDirectory = 'c:\inetpub\switchmap';
$DestinationDirectoryRoot = '';
$StateFileDirectory = 'c:\inetpub\switchmap\statefiles';
$CgiDir = '/cgi-bin/';
$HasFinder = 0;
$HasConfRooms = 0;
$WebPageTrailer = '';
$ExtraHelpText = '';
$UnusedAfter = 60; # days
$UseSysNames = 0;
C:\Inetpub\wwwroot\switchmap>
C:\Inetpub\wwwroot\switchmap>dir/w
Volume in drive C has no label.
Volume Serial Number is 1CF0-CE8D
Directory of C:\Inetpub\wwwroot\switchmap
CHANGELOG CISCO-ENTITY-VENDORTYPE-OID-MIB.my
CISCO-PRODUCTS-MIB.my CISCO-STACK-MIB.my
CiscoConstants.pm Constants.pm
error-log.shtml EtherChannel.pm
FindOffice.pl GetArp.pl
GetIsPortTrunking.pm index.php
MacIpTables.pm ModuleList.pm
OuiCodes.pm OuiCodes.txt
PetesUtils.pm PopulateEtherChannels.pm
PopulatePorts.pm Port.pm
Portically.pm README
ScanSwitch.pl SearchPortlists.html
SnmpCommunities.pm Stats.pm
Switch.pm switchmap
switchmap-daemon SwitchMap.css
SwitchMap.pl SwitchUtils.pm
ThisSite.pm UpdateOuiCodes.pl
VerifyPortLabels.pm Vlan.pm
Windows-Installation.pdf WriteCsvDirectory.pm
WriteGigePerVlansDirectory.pm WriteModulesFile.pm
WriteNcarFiles.pm WritePoePortsFile.pm
WritePortsDirectory.pm WriteSwitchesDirectory.pm
WriteTextDirectory.pm WriteUnusedDirectory.pm
WriteVlansDirectory.pm
47 File(s) 11,338,665 bytes
2 Dir(s) 73,496,793,088 bytes free
C:\Inetpub\wwwroot\switchmap>
C:\Inetpub\switchmap>dir/w
Volume in drive C has no label.
Volume Serial Number is 1CF0-CE8D
Directory of C:\Inetpub\switchmap
helpsearch.html index.html modulesbyswitch.html
SwitchMap.css switchstats.html
5 File(s) 10,630 bytes
8 Dir(s) 73,496,793,088 bytes free
C:\Inetpub\switchmap>
I'm having the feeling that $DestinationDirectory should be set to
c:\inetpub\wwwroot\switchmap instead of c:\inetpub\switchmap. Should there be
two seperate folders or a single folder?
It seems to work if I set the home directory to c:\inetpub\switchmap. All
except the search page, which it expects to be in the same folder as
index.html.
I sent a query to Nick Hills, the author of the Windows instructions. I don't
have a Windows machine, so I can't help with this. I suggest you hack as
needed to get it to work. Good luck :-)
Allow me to try and understand this another way. Looking at thissite.pm, I
conclude that your documentroot is /usr/web and the url to browse the site is
http://localhost/nets/internal/portlists/index.html. Are all switchmap files contained in
/usr/web/nets/internal/portlists?
The windows instructions clearly suggest that the switchmap package and the
output files be placed in different directories. Keeping in mind that the
documentroot is /usr/web and the package files reside in
/usr/web/nets/internal/portlists, it is as if the variables would be set as
follows.
$DestinationDirectory = '/usr/nets/internal/portlists';
$DestinationDirectoryRoot = '../nets/internal/portlists';
Disregard for now plz and thx for the assistance.
Dennis,
Ok, I'll assume you've got it working.
I'd like to apologize for some of the outdated documentation in SwitchMap.
Better documentation might've prevented the problems you've had. I just
updated the documentation in the main SwitchMap.pl file, and appended it here
for your convenience. The Windows installation document prebably somewhat
inaccurate, for which I'm much more to blame than Nick Hills, who wrote it.
I've made changes to SwitchMap since Nick wrote that document.
Hope this clarifies what goes where and why:
These are the various files that this script needs, reads or writes:
A. Source code files, found in the directory with this file. Files
in this directory don't change once SwitchMap has been installed and
configured.
SwitchMap.pl (this script), which is run in a cron job, usually
every day.
ScanSwitch.pl, a Perl script which is run in a cron job, usually
every hour.
GetArp.pl, a Perl script which is run in a cron job, usually
every hour.
OuiCodes.txt, a text file containing the manufacturer codes that
are found in MAC addresses. OuiCodes.txt is read by this script.
It is generated by UpdateOuiCodes.pl.
file. UpdateOuiCodes.pl is run rarely, because the OuiCodes.txt
file rarely changes. Users shouldn't need to run it at all. It's
included in the distrbution for completeness. See comments in
UpdateOuiCodes.pl for details.
B. State files, found in the directory named by the variable named
$StateFileDirectory, defined in your ThisSite.pm configuration file.
State files are separated from source code files and output files
because they are ogically distinct from source code files and output
files. They include SNMP community strings, which should be protected,
unlike source code files. On my Unix system, I set $StateFileDirectory
to '/var/local/switchmap'.
address known to every switch. This file is updated every time
GetArp.pl runs.
the directory named by the $StateFileDirectory variable in your
ThisSite.pm configuration file. Idlesince files are updated every
time ScanSwitch.pl runs. They are read by SwitchMap.pl. These
files contain, on each line, a port name and Unix timestamp of the
most recent time that each port was found to be idle, or 0 if a
port was active the last time ScanSwitch.pl was run. Thus, the
port has been "idle since" the given time.
which is defined by the variable named $CmstrFile in your
ThisSite.pm configuration file. This file is a list of SNMP
community strings to try when getting information from switches.
directory named by the $StateFileDirectory variable in your
ThisSite.pm configuration file. These files exist to make
switchMap run a bit faster by remembering which of a set of
possible community strings worked the last time SwitchMap ran.
With these files, SwitchMap can avoid trying community strings
that dan't work, and waiting for requests to time out before
trying another string.
C. Output files, which the SwitchMap.pl script writes to the directory
named by the variable named $DestinationDirectory, defined in your
ThisSite.pm configuration file. Unlike the directories that hold
source code or state files, the output directory is accessible by your
web server - the files are readable by web users. By keeping these
files separate from source files, security is improved - a hacker is
able to breach your security by finding a way to modify the SwitchMap
programs. By keeping output files separate from state files, you don't
have to worry that your SNMP community strings might be somehow
accessible via a browser.
HTML files in the "switches", "ports" and "vlans" subdirectories.
THe HTML files are the Web pages that are the point of all this :-)
CSV files in the "csv" subdirectory. These are for people who want
access to the raw data gathered by SwitchMap, in a form that is
easy to parse by programs.
Please let me know how it goes.
-- Pete
Hi Dennis,
Sorry its taken me a while to pick up on this thread.
As Pete explains above the state files were seperated from the source files
some versions back. Since they could possibly contain sensitive strings (ie
community names) the quickest windows solution i came up with was to locate
them above the wwwroot folder.
I think the document has become a little outdated, and having read through the
changes in the current version, and revisiting the Windows Documentation, i
think the $DestinationDirectory variable should read
c:\inetpub\wwwroot\switchmap as you suggested.
As another method you could locate the statefiles in a sub folder of the home
folder, and use NTFS permissions to secure them from display in the browser,
but this may require you to create and run the switchmap scripts as another
user.
Time to update the documentation again... :)