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