buried more whitesapce
[torrus-plus.git] / src / doc / install.pod.in
blob1f3dd357abac44c018d9a4801b7868c9bafc65ef
1 #  install.pod - Torrus installation instructions
2 #  Copyright (C) 2002-2011  Stanislav Sinyagin
4 #  This program is free software; you can redistribute it and/or modify
5 #  it under the terms of the GNU General Public License as published by
6 #  the Free Software Foundation; either version 2 of the License, or
7 #  (at your option) any later version.
9 #  This program is distributed in the hope that it will be useful,
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #  GNU General Public License for more details.
14 #  You should have received a copy of the GNU General Public License
15 #  along with this program; if not, write to the Free Software
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
22 =head1 Torrus Installation Instructions
26 =head2 Required Software
28 =over 4
30 =item * Operating System
32 Torrus should easily run on any UNIX-like operation system, as long as the
33 required components are provided.
35 If the OS mounts F</var/run> directory to a temporary filesystem, C<piddir>
36 variable must point to a path on a persistent storage. Alternatively
37 C<piddir> can point to F</var/run> itself. The default path is
38 F</var/run/torrus>, and temporary filesystems do not preserve subdirectories
39 after a system reboot.
41 Note to B<VmWare> users: as recommended by Gord Philpott, Linux kernel for
42 guest machine needs to be compiled with the following feature enabled:
43 C<Character devices ---E<gt> Enhanced Real Time Clock Support>.
44 For other guest operating systems (e.g. FreeBSD), in order to let the
45 Torrus collector and monitor run properly, you need to add the following
46 lines to your F<torrus-siteconfig.pl>:
48   $Torrus::Scheduler::maxSleepTime = 15;
49   $Torrus::Scheduler::ignoreClockSkew = 1;
51 # B<Debian> package is maintained by Jurij Smakov and is available at
52 # E<lt>http://pkg-torrus.alioth.debian.orgE<gt>.
54 =item * Perl
56 Perl version C<5.8.1> or higher is required. B<Version C<5.8.0> is not
57 recommended> because of memory access bugs and unpredictable behaviour.
58 Perl interpreter should be in PATH environment variable when
59 running C<./configure>, otherwise use
61   ./configure PERL=/path/to/perl
63 Torrus also supports Perl multithreading in Device Discovery engine and
64 in the Collector. Minimum requirements are as follows: Perl version 5.8.8
65 or higher, C<threads> module version 1.41 or higher, C<threads::shared> module
66 version 1.03 or higher. Older versions had bugs that were leading to
67 severe memory leaks and instability. After installing Perl 5.8.8,
68 you need to upgrade the C<threads> and C<threads::shared> modules manually
69 from CPAN. If any of the requirements is not met, the installer will
70 automatically disable the threads support in Torrus.
72 =item * RRDtool
74 Round Robin Database Tool is available at:
75 E<lt>http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/E<gt>.
76 Both stable version C<1.0.x> and the development version C<1.1.x>
77 are supported.
79 As of this writing, rrdtool version C<1.1.x> is still in its development
80 stage, but it is quite ready for using in production environments.
81 There's a small glitch in legend text alignment, and it will
82 hopefully be fixed.
84 =item * libxml2
86 libxml2 is the XML parser library from Gnome
87 project E<lt>http://www.gnome.orgE<gt>,
88 available as a standalone package.
89 Versions C<2.4.23> and above were tested.
91 =item * Berkeley DB version 4.2.52 or later
93 There are two distinct packages with slightly conflicting names:
94 The Berkeley DB from Sleepycat Software E<lt>http://www.sleepycat.comE<gt>,
95 and C<BerkeleyDB> Perl module available from CPAN. We will always refer
96 the latter as I<BerkeleyDB Perl module>.
98 The Berkeley DB database engine is used for all data storage.
99 Versions C<4.2.52> and above are recommended.
100 Older versions of Berkeley DB had problems with database integrity
101 in concurrent usage. By default, it installs
102 into F</usr/local/BerkeleyDB.4.2/>.
104 Unfortunately, the BerkeleyDB Perl module cannot find the include and
105 library files in that directory. Thus either configure Berkeley DB
106 with the option C<--prefix=/usr/local>, or you need to edit
107 F<config.in> in BerkeleyDB Perl module distribution.
109 =item * HTTP Server
111 Torrus requires an HTTP server. It is compatible with the following
112 combinations:
114 =over 8
116 =item * lighttpd with FastCGI
118 =item * Apache with FastCGI
120 =item * Apache 1.3 with mod_perl 1.0
122 =item * Apache 2.x with mod_perl 2.0
124 =back
126 FastCGI is supported in Torrus version 1.0.9 or higher. It is the preferred
127 way of using Torrus, more stable than mod_perl.
129 B<Note:> Starting from Torrus version 1.0.9, C<libapreq2> is no longer
130 required.
132 See I<Torrus Web Interface Reference> for details on HTTP server configuration.
134 =item * Perl Modules
136 The Perl modules required are listed below. They are all available at
137 CPAN E<lt>http://www.cpan.orgE<gt>.
138 Some of them require other modules to be installed.
139 You can install all required modules with the following command,
140 executed from within the distribution directory:
142   perl -I `pwd`/setup_tools -MCPAN -e 'install Bundle::Torrus'
144 =over 8
146 =item * XML::LibXML
148 This is a Perl interface for libxml2, providing DOM standards compliant
149 interface. It is recommended that you use version C<1.54_3> or higher.
151 =item * BerkeleyDB perl module
153 Perl interface to the database software.
154 Version C<0.19> or higher is required.
156 =item * Template-Toolkit
158 This is a powerful set of tools for text template processing.
159 Torrus uses it for HTML files output.
160 See also the project homepage: E<lt>http://www.template-toolkit.orgE<gt>
162 =item * Proc::Daemon
164 Daemon invocation routines.
166 =item * Net::SNMP
168 SNMP queries and traps interface. Version C<4.0.3> or higher is required.
169 I<Note>: Torrus versions prior to 1.0.9 are incompatible with Net::SNMP
170 version 6.0.0. You may need to downgrate the module to 5.2.0.
172 =item * URI::Escape
174 Escape and unescape unsafe characters
176 =item * Apache (mod_perl version 1.0)
178 Mod_perl is a Perl runtime environment integrated into Apache HTTP server.
180 =item * Apache::Session
182 User session tracking helper
184 =item * Date::Parse and Date::Format
186 Module for parsing the user input for date and time.
188 =item * JSON
190 JSON data format support
192 =back
195 =item * HTTP Browser requirements
197 The HTTP browser must be compatible with I<HTML 4.01 Strict> and I<CSS2>
198 specifications. The tests were made with the following browsers:
199 IE 5.5, Opera 6.12B1/Solaris, Opera 7.03/Win2K, Netscape 7.02.
201 =back
203 =head2 Recommended Software
205 =over 4
207 =item * C<XML::XUpdate::LibXML> by Petr Pajas
209 This Perl module implements XUpdate specification
210 E<lt>http://www.xmldb.org/xupdate/E<gt>. See Torrus User Guide for details.
212 =item * XSH by Petr Pajas
214 Available at E<lt>http://xsh.sourceforge.netE<gt>.
215 This is a shell wrapper for a set of utilities for XML extraction, browsing,
216 and editing.
218 =item * libxslt from Gnome project
220 C<libxslt> is the XSLT stranslation library from Gnome
221 project E<lt>http://www.gnome.orgE<gt>, available as a standalone package.
222 It includes a binary executable, C<xsltproc>. See Torrus User Guide for
223 examples of its usage.
225 =back
229 =head2 Installation Procedure
231 Create the group C<torrus> and a user C<torrus>. The user should be a member of
232 this group.
234 Add your Apache daemon user to the group C<torrus>.
235 Other users that will run any of Torrus processes must be included in
236 this group.
238 For example, in Solaris (you may need to specify the GID and UID numbers
239 according to your local administration policy):
241   groupadd torrus
242   useradd -c 'Torrus Daemon' -d /usr/local/torrus -g torrus torrus
243   usermod -G www,torrus www
245 Further installation process is mostly as usual (watch out C<piddir> setting,
246 as described above):
248   ./configure
249   make
250   make install
252 The default directory layout is described below. Should you need to change it,
253 there is a number of variables and configuration options that you may use
254 as C<./configure> arguments. See C<./configure --help> for details.
255 Alternatively you can utilize the script C<./setup_tools/configure_fhs>,
256 which is designed to provide an FHS compliant setup. The script is equivalent
257 to executing
259   ./configure \
260    --prefix=/opt \
261    --mandir=/opt/share/man \
262    pkghome=/opt/torrus \
263    sitedir=/etc/opt/torrus
265 Do not try to change any paths by supplying them as C<make> variables,
266 this would most probably break the installation. The only C<make> variable
267 that is supported is C<DESTDIR>. It may be used for preparing the package for
268 further distribution. For example, the following command would install
269 all Torrus files as if F</tmp/stage> were the root of the filesystem:
271   make DESTDIR=/tmp/stage install
273 The presence of prerequisite Perl modules is checked during the execution
274 of C<./configure>. You can disable this by giving I<--enable-pkgonly> option.
276 The installer sets up the site configuration files, but only if
277 they don't already exist.
279 Plugin modules should be installed separately, after the Torrus software is
280 successfully installed. For each plugin, unpack the plugin distribution archive
281 to some directory, and execute
283   torrus install_plugin <UNPACKED_PLUGIN_DIR>
285 A number of directories is set up by default under the path C</var>,
286 and they must be writable by all Torrus processes, including the
287 Apache web server.
289 You can control these directories' access rights by setting the following
290 environment variables: I<var_user>, I<var_group>, I<var_mode>, like follows:
292   ./configure var_group=wwwrun
294 Default values for operating systems other than Cygwin are: I<var_user=torrus>,
295 I<var_group=torrus>, I<var_mode=775>. Setgid bit is set by default for these
296 directories.
298 If available, you may place these directories on a fast media, for example,
299 a robust disk array. Changing the C<varprefix> variable would be generally
300 enough, for example:
302   ./configure varprefix=/vol1/torrus_var
305 =head2 Logging
307 As of Torrus version 2.02, the collector and monitor daemons send their
308 logs to a local SYSLOG server in "local0" facility by default.
310 The SYSLOG facility can be altered in F<torrus-siteconfig.pl>:
312   $Torrus::Log::syslogFacility = 'local5';
314 Also the following two statements would revert to the old behavior (log
315 files written directly by the daemons). Please not that the daemons
316 would not rotate the logs on SIGHUP:
318   $Torrus::Collector::useSyslog = 0;
319   $Torrus::Monitor::useSyslog = 0;
322 =head2 Torrus directory layout
324   @pkghome@/
325         Home directory for Torrus distribution files
327   @cfgdefdir@/
328         torrus-config.pl and other configuration files
330   @pkgbindir@/
331         Command-line executables
333   @docdir@/
334         POD and TXT documentation files
336   @exmpdir@/
337         Miscelaneous example files
339   @perllibdir@/
340         Perl libraries
342   @pluginsdir@/
343         Plugins configuration
345   @scriptsdir@/
346         Scripts
348   @supdir@/
349         Supplementary files, DTDs, MIBs, color schemas, web plain files
351   @tmpldir@/
352         Renderer output templates
354   @distxmldir@/
355         Distrubution XML files
357   @sitedir@/
358         Site configurable files
360   @siteconfdir@/
361         Place for torrus-siteconfig.pl and other siteconfigs
363   @siteconfdir@/discovery/
364         Devdiscover input files
366   @tmpluserdir@/
367         User-defined Renderer output templates
369   @sitexmldir@/
370         User XML configuration files
372   @mandir@
373         Place for man pages. All articles have the prefix C<torrus_>
375   @logdir@/
376         Daemon logfiles
378   @piddir@
379         Daemon PID files
381   @cachedir@
382         Renderer cache
384   @dbhome@
385         Berkeley DB home
387   @seslockdir@
388   @sesstordir@
389         Web interface session files
391   @defrrddir@
392         Recommended directory for RRD files generated by collectors
394 B<Note:> RRFW used the path F</var/snmpcollector> as the default path for
395 storing the RRD files. According to FHS specification, the recommended
396 path for service data files is recommended to be a subdirectory of F</srv>.
397 The path F<@defrrddir@> is used as default by C<torrus genddx>
398 utility, and you can always change it in the command line or in your
399 DDX files.
402 =head2 Configuring Torrus
404 The datasources are configured with C<%Torrus::Global::treeConfig>
405 hash in F<torrus-siteconfig.pl>.
407 In this hash, the keys give the tree names. The values for each tree name
408 are pointers to hashes, with the following keys and values:
409 I<xmlfiles> points to an array of source XML file names;
410 I<run> points to a hash with the names of the daemons
411 that would be automatically launched for the tree;
412 I<desription> gives a short line describing the tree contents.
414 Two additional arrays: C<@Torrus::Global::xmlAlwaysIncludeFirst> and
415 C<@Torrus::Global::xmlAlwaysIncludeLast> give a list of source XML
416 files that are included in every tree, in the beginning or in the end of
417 the XML files list. By default, this array consists of two files:
418 F<defaults.xml> and F<site-global.xml>. The second one is resided in
419 the user-configurable directory, and you can use it to override any
420 default settings.
422 Example:
424   @Torrus::Global::xmlAlwaysIncludeFirst =
425       ('defaults.xml', 'site-global.xml');
427   %Torrus::Global::treeConfig = (
428     'tree_A' => {
429       'description' => 'The First Tree',
430       'xmlfiles' => [qw(a1.xml a2.xml a3.xml)],
431       'run' => { 'collector' => 1, 'monitor' => 1 } },
432     'tree_B' => {
433       'description' => 'The Second Tree',
434       'xmlfiles' => ['b1.xml', 'b2.xml'],
435       'run' => {} }
436    );
438 XML files are read additively within each tree, in the order
439 as they are listed. The XML compiler searches for the files in several
440 directories, listed in C<@Torrus::Global::xmlDirs>. By default, this list
441 conssists of two paths, one for Torrus distribution files, and the other
442 for user files.
444 Files generated by C<devdiscover> usually contain I<include> statements
445 which add the vendor-specific XML files to the compilation.
447 Below follows a short description of some XML files that come with
448 Torrus distribution. Only F<site-global.xml> is installed in the directory
449 for user-configurable files, all others are placed in the distribution
450 directory.
452 =over 4
454 =item * defaults.xml
456 Default parameters for the root of the datasources tree.
457 Default view definitions. B<Note:> this file is automatically
458 overwritten by C<make install>.
460 =item * site-global.xml
462 Parameters that you want to change or define for your site.
463 This file will be compiled for every tree after F<defaults.xml>,
464 and this is the place to override the defaults. The file that is supplied
465 with the Torrus distribution has some useful parameters that you may simply
466 uncomment.
467 B<Note:> this file is never overwritten by C<make install>.
469 =item * snmp-defs.xml
471 SNMP collector defaults. The file defines several templates
472 used for collecting SNMP data.
473 Do not change this file.
474 You may redefine the needed parameters in your site-specific files
475 and templates.
477 =item * vendor/E<lt>vendorE<gt>.E<lt>productE<gt>[.E<lt>subsystemE<gt>].xml
479 SNMP collector definitions and templates for various hardware vendors and
480 products. C<devdiscover> includes some of these files automatically in the
481 configuration.
483 =item * generic/*.xml
485 SNMP collector definitions and templates for vendor-independent MIBs. Most
486 files are named after corresponding RFC numbers.
488 =back
490 In addition, the distribution package contains several example files.
492 For more details about XML configuration, see I<Torrus User Guide>
493 and I<Torrus XML Configuration Guide>.
495 =head2 Site configuration options
497 In addition to I<%Torrus::Global::treeConfig>, you may wish to set
498 some other parameters in your site configuration file
499 (F<torrus-siteconfig.pl>).
501 See F<torrus-config.pl> for the complete list
502 of varaibes that you may override in your site config. Among them,
503 most interesting are:
505 =over 4
507 =item * C<$Torrus::Renderer::companyName>
509 The text that you specify here will appear in the top left corner
510 of all HTML pages.
512 =item * C<$Torrus::Renderer::companyURL>
514 The company name text will be clickable with the URL specified in
515 this variable.
517 =back
520 =head2 Apache HTTP server configuration
522 Torrus web interface is designed to run under mod_perl environment
523 (E<lt>http://perl.apache.orgE<gt>).
525 See the I<Torrus Web Interface Reference> document for detailed instructions on
526 Apache configuration.
529 =head2 Access Control Lists
531 By default, Torrus web interface requires user authentication.
532 You can disable this by changing C<$Torrus::CGI::authorizeUsers>
533 to zero in your F<torrus-siteconfig.pl>.
535 ACLs are controlled by C<acledit> utility. See I<Torrus Manual pages>
536 for detailed description. Example:
538   torrus acledit --addgroup=staff --permit=DisplayTree --for='*'
539   torrus acledit --addgroup=staff --permit=GlobalSearch --for='*'
540   torrus acledit --adduser=jsmith --password=mysecretpassword \
541     --cn="John Smith" --addtogroup=staff
542   torrus acledit --addgroup=admin \
543     --permit=DisplayTree --permit=DisplayAdmInfo --for='*'
546 =head2 Cron Job
548 In order to clean old HTTP session data, it is recommended to run
549 F<cleanup> script in a cron job, once per day:
551  #min hour mday month wday    who     command
552  5    3    *    *     *       root    @pkgbindir@/cleanup
555 =head2 Startup script
557 The Torrus distriubution provides a startup script which you can install in
558 the init scripts directory (/etc/init.d on most Unixes or /usr/local/etc/rc.d/
559 on FreeBSD). The script C<torrus> is created during the installation
560 process in the subdirectory <init.d> of the distribution directory.
562 The init script reads some parameters from F<@cfgdefdir@/initscript.conf>,
563 and F<@siteconfdir@/initscript.siteconf> if the latter exists.
564 By default, it makes the monitor daemons sleep for 20 minutes when
565 they are launched simultaneously with collector daemons.
568 =head2 Upgrade Procedure
570 Follow these instructions when upgrading from previous Torrus release.
572 In the previous distribution directory, look up the F<config.log> file.
573 It contains the configure options that you used in previous installation.
575 Unpack the new release distribution.
577 Run C<./configure> with the same options you used before.
579 Stop the collector and monitor processes
580 (usually by C</etc/init.d/torrus stop>).
582 Stop Apache process.
584 Run C<make install>.
586 Start the collector and monitor processes.
588 Start Apache process.
590 Also it is recommended to re-compile your XML configuration.
591 If you prefer not to do this, it's recommended that you clear the
592 Web interface cache both in your browser and in Torrus:
594   torrus clearcache
597 =head2 Plugins
599 As of Torrus version 2.01, plugins inherit a new release numbering
600 scheme: a plugin release version is a 3-component number, where the
601 first two numbers are the Torrus release version that is compatible with
602 this plugin.
605 =head2 Planning the disk space
607 In a typical Torrus setup, there are two disk space consuming entities:
608 the RRDtool data storage and the Berkeley DB database.
610 RRDtool data files (or RRD's) are used to store the values that are gathered
611 by the collector daemons. These are the most intensively updated files,
612 so the disk speed is important here. If possible, it is better to spread
613 the RRD files across several physical disks.
615 Berkeley DB database is used to keep all the configuratiuon data
616 for your datasource trees, and it also keeps some live status information.
617 It's intensively updated during XML compilation only.
618 During normal Torrus working cycle, there are only few updates, not
619 very critical in time. The database is read quite intensively during
620 collector initialization, but usually it's the CPU speed that causes
621 more delay.
623 For a typical Torrus installation with standard RRD creation parameters,
624 the rough estimation is as follows: the Berkeley DB database occupies
625 from 10 to 13 KB per collector datasource, and the RRD storage takes
626 approximately 80 to 85 KB per datasource.
628 For a medium-sized system, few hundred megabytes for the Berkeley DB database
629 and several gigabytes for RRD storage would be sufficient. Larger systems
630 require a thorough design and staging work. See I<Torrus Scalability Guide>
631 for more details.
633 =head2 Network performance tuning
635 In large installations, the SNMP collector experiences quite intensive
636 input traffic bursts. Thus the UDP socket receive buffers should
637 be adapted to sustain the load. By default, Torrus sets the UDP receiving
638 buffer size, SO_RCVBUF, to 131071 bytes. This should fit most of
639 installations. However, it's useful to check the network statistics
640 if there are any UDP buffer overflows. On most systems, the commands
641 C<netstat -s -p udp> or C<netstat -s> should show you these counters.
642 The maximum buffer size is usually limited by a system kernel variable,
643 and can be increased if needed. See C<$Torrus::Collector::SNMP::RxBuffer>
644 and its comments in F<torrus-config.pl> for more details.
647 =head1 Author
649 Copyright (c) 2002-2011 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>