1 # userguide.pod - Torrus user guide
2 # Copyright (C) 2003 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 # $Id: userguide.pod.in,v 1.1 2010-12-27 00:04:32 ivan Exp $
19 # Stanislav Sinyagin <ssinyagin@yahoo.com>
23 =head1 Torrus User Guide
26 =head2 Quick start guide
28 The steps below will explain you how to make the thing running.
30 B<Install Torrus>. Follow the I<Torrus Installation Instructions> document,
31 all prerequisits and necessary steps are described there.
33 B<What is where>. The executables reside in
34 F<@pkgbindir@/>. You normally don't need to access this
35 directory, because the commandline wrapper, C<torrus>, is installed
36 in a usual execution path (F<@bindir@>).
37 All site-specific behaviour is controlled by
38 configuration files in F<@siteconfdir@/>.
39 Usually you need to change F<torrus-siteconfig.pl> only. In this file, you
40 must list your XML configuration sources. The datasource trees configuration
41 is read out of XML files. They are searched in several directories,
42 normally F<@distxmldir@/> and F<@sitexmldir@/>. The first one contains
43 files that come with Torrus distribution, and the second one is for your local
44 site-specific XML files. Global site-specific XML configuration parameters
45 may be defined in F<site-global.xml>.
46 XML configuration is compiled into internal database representation
47 by C<torrus compilexml> command. The database itself is resided in
48 F<@dbhome@/>, and must be writable by your Apache server
49 (normally the installer takes care of it). It is safe to re-compile the
50 configuration while the Torrus daemons are running.
52 B<The datasource trees>. Torrus configuration consists of a number of I<trees>.
53 Each tree is independent from the others. A tree may run one Collector and
54 one Monitor process. Also the web interface access control lists
55 differentiate the user rights by datasource trees.
57 B<Inside the tree>. A tree defines the hierarchy of Torrus datasources.
58 The structure of the tree is solely defined by XML configuration files.
59 The tree consists of I<nodes>, each being either a I<subtree> or a I<leaf>.
60 Subtrees contain child subtrees and/or leaves. The leaf represents a
61 datasource: normally this is a numerical value that changes over time.
62 The leaf is the entity that may be presented as a graph.
63 There are leaves of special type: I<multigraph>.
64 They are not numerical values, and are designed for
65 drawing several values in one graph. Each node has I<path>, a
66 string that consists of slashes and node names, and uniquely identifies this
67 node. The path of a subtree always ends with slash, and the root of the tree
68 has the path consisting of a single slash.
70 B<Trees configuration>. The trees are defined in F<torrus-siteconfig.pl>.
71 See I<Torrus Installation Instructions> for a basic example of tree
74 B<Round-robin databases>. Currently only one type of data storage is
75 supported: Round-robin database (RRD) files. See I<RRDtool> manuals
76 for more details. Each leaf represents a datasource stored in an
77 RRD file. Of course, several leaves may refer to different datasources within
78 the same RRD file. Even more, more than one leaf may refer to the same
79 datasource within an RRD file. RRD files are created and updated either by
80 C<collector>, or by some other external programs.
82 B<Define the targets>. If you only want to collect SNMP counters
83 from some network devices' interfaces, there's a couple of tools
84 called C<torrus genddx> and C<torrus devdisover>.
85 The first one creates a basic discovery instructions file, and the second
86 one uses the discovery instructions to explore the SNMP device capabilities
87 and information: interface names, input/output counters,
88 CPU and memory usage, temperature sensors (for Cisco devices), and many
89 other vendor-specific statistics sources.
91 Torrus is much more than just an SNMP collector. So, when you decide
92 to use it in a more advanced way, you will have to read the whole bit of
93 this guide, and also I<Torrus XML Configuration Guide> and probably some
96 B<Build the hierarchy>. By default, C<torrus genddx> will put all your
97 devices into one hierarchy: C</Routers/E<lt>hostnameE<gt>/...>.
98 The subtree name, C<Routers>, may be changed with a command line option
99 of C<torrus genddx>. This program may also read the device names
100 (or IP addresses in case if you don't use DNS) from space-delimited text files.
103 --hostfile=myrouters.txt \
104 --domain=example.net \
105 --community=MySecretSNMPCommunity \
106 --out=myrouters.ddx \
107 --discout=myrouters.xml \
108 --subtree=/My_Routers \
109 --datadir=/data1/torrus/collector_rrd
112 --hostfile=myswitches.txt \
113 --domain=example.net \
114 --community=MySecretSNMPCommunity \
115 --out=myswitches.ddx \
116 --discout=myswitches.xml \
117 --subtree=/My_Switches \
118 --datadir=/data1/torrus/collector_rrd
120 torrus devdiscover --in=myrouters.ddx
122 torrus devdiscover --in=myswitches.ddx
124 In the example above, the routers' and switches' names are read from
125 F<myrouters.txt> and F<myswitches.txt> in the user's current directory.
126 They form a hierarchy with two subtrees: C</My_Routers/> and C</My_Switches/>.
127 C<genddx> creates the discovery instruction XML files into
128 F<myrouters.ddx> and F<myswitches.ddx> accordingly. By default,
129 you would find them in F<@sitedir@/discovery/>.
130 The result of C<devdiscover> is the Torrus configuration files:
131 F<myrouters.xml> and F<myswitches.xml>, placed into
132 F<@sitexmldir@/>. The C<collector> will place the
133 RRD files into F</data1/torrus/collector_rrd>. Make sure that this directory
134 exists, has enough free space, and is writable by C<torrus> user.
136 B<Note:> the C<genddx> utility is designed as a one-time helper, so
137 that you create your basic discovery instructions files from scratch.
138 Further on, the discovery files should be maintained separately.
140 Another useful utility is called C<ttproclist>. It can be used to generate
141 a DDX file from a template and a list of SNMP hosts. It is very useful if
142 you want to monitor many devices of similar type or function.
144 You can also define a I<bundle> file in your DDX file. C<Genddx> will
145 create it after all devices would discovered, and it will contain
146 E<lt>includeE<gt> statements for all XML files. This makes it practical to
147 use one XML file per SNMP host, and use the bundle file for inclusion
148 in the tree configuration.
150 B<Add your XML files to the tree configuration>. For each tree,
151 F<@siteconfdir@/torrus-siteconfig.pl> lists the XML files that have to be
152 compiled for it. In the example above, you would add F<myrouters.xml> and
153 F<myswitches.xml> into C<xmlfiles> array in the tree configuration.
155 See I<Torrus SNMP Discovery User Guide> for more details on how
156 C<genddx> and C<devdisover> interact and how you can customize
157 the discovery process.
159 B<Tip>: in most cases, your hierarchy division will be different.
160 It might be arranged by geographical locations, or by customer names.
161 There is a configuration statement that allows you to include other
162 XML files into configuration, thus giving you a big flexibility
163 in building the data hierarchies.
165 B<Compile the configuration>. After the XML configuration is prepared,
166 you need to execute the compiler:
168 torrus compile --tree=treename --verbose
170 For most of the processes that you run within Torrus, you need to specify
171 the tree name with C<--tree> option. Some proramms accept C<--all> option,
172 which causes them to process all existing trees.
173 With C<--verbose> option, the compiler tells you about the files being
174 processed, and about some other actions that may take quite a long time.
175 It will also tell you if there's any error in your configuration.
177 B<Build the search database>. The search database is updated by executing
178 the following command:
180 torrus bs --global --verbose
182 For users that are allowed to display all the trees, you can enable the
183 global search across all trees:
185 torrus acledit --addgroup=staff --permit=GlobalSearch --for='*'
187 B<Launch the collector>. Assuming that compilation went smoothly,
188 you may now launch the data collector:
190 torrus collector --tree=treename
192 Without additional options, the collector will fork as a daemon
193 process, and write only error messages in its log file,
194 F<@logdir@/collector.treename.log>.
196 There is a file that is created by C<./configure>, called F<init.d/torrus>.
197 You may place it into a directory where your system looks for startup scripts
198 (F</etc/init.d/> on Solaris and some Linuxes, F</usr/local/etc/rc.d/>
199 on FreeBSD). Probably you need to rename and edit the script before using.
200 Note that it also executes another daemon, C<monitor>.
202 The C<monitor> daemon is used for monitoring the thresholds in the
203 data files. For more details, see the I<Torrus XML configuration guide>,
204 in the section about monitor definitions.
206 B<Define the ACLs>. By default, user authentication is enabled in the web
207 interface. You can change this by setting
208 C<$Torrus::CGI::authorizeUsers = 0> in your F<torrus-siteconfig.pl>.
209 In order to get use of user authentication, you need to create I<groups>
210 and I<user> accounts. Each user belongs to one or more groups, and each group
211 has access to a set of datasource trees. See
212 I<Torrus Installation Instructions> for a basic example.
214 B<Browse with your browser>. Provided that you followed the
215 installation guide to the end, and your HTTP server is running,
216 your Torrus hierarchy must be visible with your favorite web browser.
219 =head2 Configuration guidelines
221 In complete detail, the XML configuration is described in
222 I<Torrus XML Configuration Guide>. The guidelines below will help
223 you to read that document.
225 B<Tree structure>. The tree structure is defined by the structure of
226 C<E<lt>subtreeE<gt>> and C<E<lt>leafE<gt>> XML elements. The rule is simple:
227 child XML elements of a C<E<lt>subtreeE<gt>> element define the child
228 nodes in the configuration tree.
230 B<Parameters>. Each node has a number of parameters. They are defined
231 by C<E<lt>paramE<gt>> XML element. Parameters are inherited:
232 the child node has all its parent's parameters, some of which may be
235 B<Additive configuration>. The whole XML configuration is additive.
236 It means that you may define your subtree several times across
237 your XML configuration, and the new parameters and child nodes will
238 be added to previously defined ones.
240 B<Templates>. Some pieces of configuration may be written as templates,
241 and then re-used in multiple places.
243 The C<configsnapshot> utility generates one large XML file back from
244 the compiled configuration. Its main purpose is backup of the configuration,
245 but it can also be used for studying the relationships between templates
248 =head2 Handling SNMP errors
250 During SNMP discovery process, some SNMP devices may not be reachable.
251 By default, C<devdiscover> reports the error, and does not write the output
252 XML file containing that device. It also skips writing the bundle files that
253 contain the output file affected.
255 When C<devdiscover> is executed with C<--forcebundle> option, the bundle
256 files are written, and the output files related to the unreachable
257 devices are skipped from the bundles. This ensures that we always get
258 a configuration that may compile and run the collector.
260 Another option, C<--fallback=DAYS>, if given together with C<--forcebundle>,
261 tells the discovery engine to reuse old XML files if the related SNMP devices
262 are not reachable and the files are not older than DAYS.
264 If an SNMP device is unreachable by the moment of the collector initialization,
265 the collector reports the error and waits for a period of time specified in
266 C<$Torrus::Collector::SNMP::unreachableRetryDelay>, which is 10 minutes by
267 default. It then tries to reach the device with the specified retry interval
268 during some period of time, defined in
269 C<$Torrus::Collector::SNMP::unreachableTimeout>, by default 6 hours.
270 If the device is not available within the specified timeout, it is excluded
271 from collection. It would be tried again on collector initialization
272 only (at the collector process start or after recompiling the configuration).
274 If a device is not reachable during the normal collector running cycle,
275 it is retried in every collector's cycle (usually every 5 minutes),
276 during the period defined in C<$Torrus::Collector::SNMP::unreachableTimeout>.
277 It will be then excluded from configuration after the timeout.
279 If a device hardware configuration changes after the C<devdiscover>
280 execution, the collector may not find some values in SNMP tables,
281 such as interface names in ifTable. It then excludes such datasources from
282 collection immediately.
287 =head2 Tips and tricks
290 =head3 Comments, descriptions, and legends
292 C<torrus devdiscover> will extract some useful information from
293 your SNMP devices, and place it in the XML configuration:
297 =item * Interface descriptions
299 The value of the SNMP variable C<ifAlias> (C<1.3.6.1.2.1.31.1.1.1.18>)
300 will be used as interface comment. In Cisco IOS, this is controlled by
301 C<description> interface configuration command.
303 =item * Location and contact
305 Two other SNMP values: C<sysLocation> (C<1.3.6.1.2.1.1.6.0>) and
306 C<sysContact> (C<1.3.6.1.2.1.1.4.0>) will be used in the legend text
307 for each device. In Cisco IOS, their values are controlled by
308 C<snmp-server location> and C<snmp-server contact> global configuration
314 =head3 Grouping the datasources alternatively
316 In most cases, you would want to have several different groupings of
319 For instance, the default C<devdiscover> gives only one level of freedom:
320 the subtree name above the host level. It's reasonable to use this name for
321 grouping by geographical location . Thus, the hierarchy
322 would be characterised as
323 C</[location]/[hostname]/[interface]/[counter]>.
325 Let's say you would like to have alternative grouping, such as:
329 =item * by customer connection:
331 Each customer is identified by name, and you'd like to see statistics
332 for all interfaces connected to a given customer;
336 Your network is designed to provide various services, and you'd like to
337 group your devices or interfaces by service;
339 =item * by customer and location:
341 For each customer, group the connection by geographical location.
345 Torrus provides three different ways for organising your datasources:
351 With C<E<lt>aliasE<gt>> statement, you can add symbolic names to your
352 nodes. If the new alias is defined as a reference to non-existing subtree,
353 the new subtrees are created. Alias is only a symbolic link: when you click
354 to the alias name in your browser, Torrus redirects it to the real datasource
355 in its normal subtree. See the example in I<Torrus XML Configuration Guide>.
357 =item * ds-type=rrd-file
359 You can create a leaf in some arbitrary place of your hierarchy that
360 points to an existing RRD file. This RRD file may be updated by
361 other datasource in your hierarchy. The advantage of such approach is
362 that this leaf may have its own I<legend> and I<comment> parameters,
363 alternative view parameters, etc.
365 <leaf name="FoobarIn">
366 <param name="ds-type" value="rrd-file" />
367 <param name="leaf-type" value="rrd-def" />
368 <param name="data-file" value="rtr01_Fa0_1.rrd" />
369 <param name="rrd-cf" value="AVERAGE" />
370 <param name="rrd-ds" value="locIfInBitsSec" />
371 <param name="comment"
372 value="Foobar input traffic"/>
373 <param name="graph-legend" value="Bits in" />
374 <param name="legend">
375 Switch name: rtr01; Interface: Fa0/1;
379 In the example above, this leaf is defined somewhere in the hierarchy.
380 It refers to the RRD file updated by Torrus SNMP collector.
381 For more examples, see the template I<read-cisco-interface-counters>
382 in F<vendor/cisco.ios.xml>.
386 Tokenset is an arbitrary collection of datasource leaves. It is characterised
387 by its name and description. There are two ways to add a leaf to a tokenset:
388 by the parameter I<tokenset-member>, or by defining a monitor action.
389 A tokenset is normally displayed in compact form: by default, 6-hour graphs
390 are put by two in a row.
395 =head3 Amending autogenerated XML files with XUpdate
397 Sometimes there is a need to modify the configuration generated by
398 C<devdiscover>. Modifying the generated XML files by hand would not be
399 a good option: it would need some manual work every time you update
400 your hardware setup. A better approach would be to have the tools
401 that would automate such configuration update.
403 One of the possibilities for such automation would be XSLT
404 E<lt>http://www.w3.org/TR/xsltE<gt>. But it's rather
405 complicated task to use XSLT for slight changes in XML files.
407 A good approach has been made by XUpdate Working Group
408 E<lt>http://www.xmldb.org/xupdate/E<gt>. Their Working Draft document
409 describes a language for XML editing commands. It allows to perform
410 small updates to an existing XML document, like insertion of elements,
411 updating of existing elements, or deleting. The only drawback is
412 that the specification hasn't been updated since September 2000,
413 and it contains some unclear statements, which make it difficult to
414 implement compatible applications. In addition, there has been
415 not enough efforts to adopt XUpdate as a W3C standard.
416 However, this is the only kind-of-a-standard language for such tasks as
417 XML editing commands.
419 Thanks to Petr Pajas, there is an XUpdate implementaytion in Perl.
420 C<XML::XUpdate::LibXML> module is available at CPAN, and it installs
421 a small commandline utility, C<xupdate>. In addition, Petr has created
422 a set of utilities integrated into a single shell wrapper:
423 E<lt>http://xsh.sourceforge.netE<gt>. It is very useful for many different
424 things, such as XPath expressions testing, and many others.
426 A typical XUpdate instructions file would looke like follows:
428 <?xml version="1.0"?>
429 <xupdate:modifications version="1.0"
430 xmlns:xupdate="http://www.xmldb.org/xupdate">
432 <!-- Insert additional creator-info after the last one -->
433 <xupdate:insert-after
434 select="/configuration/creator-info[not(following-sibling::creator-info)]">
436 This file was modified with XUpdate script setmonitor.xupdate.xml
438 </xupdate:insert-after>
440 <!-- For every ifError leaf, set the monitor -->
441 <xupdate:append select="//subtree[apply-template[@name='iftable-errors']]">
442 <xupdate:element name="subtree">
443 <xupdate:attribute name="name">ifErrors</xupdate:attribute>
444 <param name="monitor" value="check-iferrors"/>
448 </xupdate:modifications>
450 This example is part of Torrus distribution, and the file is named
451 F<examples/setmonitor.xupdate.xml>. Your commands to apply these XUpdate
452 instructions would be like
454 torrus devdiscover --in=routers.ddx --out=routers.xml
457 xupdate -j @exmpdir@/setmonitor.xupdate.xml \
458 routers.xml > routers1.xml
460 More XUpdate examples will be included in the future.
463 =head3 Extracting the configuration skeleton
465 Another aproach to amending the autogenerated confguration is as follows.
467 Torrus distribution has a special-purpose XSLT template,
468 F<extract-skeleton.xsl>, designed to strip all parameters and template
469 applications from a given XML configuration, and leave the tree structure
470 only. Given that F<routers.xml> is some autogenerated configuration,
473 xsltproc @scriptsdir@/xml/extract-skeleton.xsl routers.xml | \
474 xmllint --format --output routers-skeleton.xml -
476 You can add your changes to the new file, F<routers-skeleton.xml>, and add
477 it to your Torrus configuration. These changes may be performed manually
478 or by means of XUpdate technique described above.
481 =head3 Automating XML generation
483 It is quite common task that you want Torrus to monitor certain set of
484 devices, and C<devdiscover> does not (yet) support them. Of course,
485 it's quite a pain to maintain a manually written XML file, especially if
486 the there are more than one devices of the same type.
488 In such case you may benefit from the approach suggested by
491 Imagine you have 50 I<gizmos> which are able to speak SNMP and which you would
492 like to put into some Torrus tree structure. A good designer's approach would
493 be to keep the data and the presentation separately. In addition, changing
494 the presentation once would produce 50 changes accordingly.
495 To do that, let's create two files: F<gizmos.data> and F<gizmos.tmpl>.
496 The first one would contain data about our devices:
503 location => 'Javastrasse 2, 8604 Hegnau'
504 description => 'My gizmo @ Sun'
505 community => 'blabla',
514 location => 'Riedstrasse 120, 8604 Hegnau'
515 description => 'My gizmo @ Home'
516 community => 'blabla',
526 Then F<gizmos.tmpl> would contain the XML template that would produce
527 the Torrus configuration file:
530 <?xml version="1.0"?>
533 <subtree name="SNMP">
534 <subtree name="Gizmos">
535 [% FOREACH g = gizmos %]
536 <!-- ******************************************************* -->
537 <!-- [% g.name %] -->
538 <subtree name="[% g.color %]">
539 <alias>/ByName/[% g.name %]/</alias>
541 <param name="snmp-community" value="[% g.community %]" />
542 <param name="comment" value="[% g.description %]" />
543 <param name="snmp-host" value="[% g.name %]" />
544 <param name="legend">
545 Description: [% g.description %]
546 Location: [% g.location %]
549 [% FOREACH h=$g.hands %]
550 <leaf name="[% h.name %]Hand">
551 <!-- do something, my fantasy exhausted here -->
560 See F<xmlconfig/examples/servers.data> and F<xmlconfig/examples/servers.tmpl>
561 for a more useful example of the described approach.
563 At the end, you will generate the Torrus config with the C<tpage> utility,
564 which is the standard part of Template-Toolkit package:
566 tpage --define data=gizmos.data gizmos.tmpl > gizmos.xml
569 =head3 Several Torrus instances on one server
571 Sometimes it is necessary to have a separate instance of Torrus for testing
572 purposes on the same server as the production installation.
573 In the example below, a completely autonomous installation of Torrus is
574 installed in F</usr/testtorrus> directory on a FreeBSD system.
578 =item * Directory structure
580 All files are located in subdirectories of F</usr/testtorrus>. No other
581 directories are affected. This ensures that deinstallation would be easy
584 Four subdirectories are created:
588 =item * F</usr/testtorrus/apache>
590 This directory contains Apache HTTP daemon configuration and logs. Create 3
591 subdirectories here: F<etc>, F<htdocs>, and F<var>.
593 =item * F</usr/testtorrus/home>
595 This is the installation directory of Torrus.
597 =item * F</usr/testtorrus/etc>
599 Directory for configuration files.
601 =item * F</usr/testtorrus/var>
603 Directory for logs, database and PID files.
605 =item * F</usr/testtorrus/collector_rrd>
607 Collector will store RRD files here.
609 =item * F</usr/testtorrus/src>
611 Distribution files will be stored and unpacked here.
616 =item * Installation procedure
618 cd /usr/testtorrus/src
619 gzip -dc torrus-1.0.0.tar.gz | tar xvf -
621 ./configure pkghome=/usr/testtorrus/home \
622 sitedir=/usr/testtorrus/etc \
623 logdir=/usr/testtorrus/var/log \
624 piddir=/usr/testtorrus/var/run \
625 varprefix=/usr/testtorrus/var \
626 wrapperdir=/usr/testtorrus
629 =item * Devdiscover configuration
631 Use devdiscover as usual. Place your discovery instruction files in
632 F</usr/testtorrus/etc/discovery/>, and make sure that
633 C<data-dir> is set to F</usr/testtorrus/collector_rrd>.
635 =item * Apache configuration
637 We reuse the same binaries and libraries as the main installation of Apache,
638 but the daemon is launched with our special configuration.
639 We assume that Apache is pre-configured for mod_perl. SSL support is not
640 included in this example, but it's quite straightforward to implement
643 Create a copy of F<httpd.conf> and place it in F</usr/testtorrus/apache/etc>.
644 With a text editor, replace the configutration options with the values
647 # Leave server root as it was in the original config. Apache uses
648 # it for modules loading
649 ServerRoot "/usr/local"
651 # make sure that everything that apache writes
652 # goes into our directories
653 PidFile /usr/testtorrus/apache/var/httpd.pid
654 ScoreBoardFile /usr/testtorrus/apache/var/httpd.scoreboard
656 # Optional: limit the memory and CPU impact
662 # We open our HTTP service on TCP port 8123. Choose other
663 # port if this one is occupied
666 # Not really necessary, but you might want to use it someday
667 DocumentRoot "/usr/testtorrus/apache/htdocs"
669 # Find the Directory options for the old htdocs, and
670 # replace the path if you changed DocumentRoot above
671 <Directory "/usr/testtorrus/apache/htdocs">
672 ... some default stuff here ...
675 # Make sure the logs are written where we expect them to.
676 ErrorLog /usr/testtorrus/apache/var/httpd-error.log
677 CustomLog /usr/testtorrus/apache/var/httpd-access.log combined
679 # TCP port number as above
680 NameVirtualHost *:8123
682 # Quite standard virtual server configuration. Replace fake
683 # domain names with your real ones.
685 ServerAdmin root@myserver.com
686 DocumentRoot /usr/testtorrus/home/web
687 ServerName torrus.myserver.com
688 CustomLog /usr/testtorrus/apache/var/torrus.myserver.com.log "combined"
689 PerlModule Apache::PerlRun
690 PerlRequire "/usr/testtorrus/home/conf_defaults/webmux.pl"
691 Alias /plain/ "/usr/testtorrus/home/sup/webplain"
693 SetHandler perl-script
694 PerlHandler Torrus::ApacheHandler
697 SetHandler default-handler
702 =item * Apache startup script
704 Save the following script as F</usr/testtorrus/apache/testtorrus.sh>:
709 /usr/local/sbin/httpd -f /usr/testtorrus/apache/etc/httpd.conf && \
710 echo 'apache started'
713 [ -r /usr/testtorrus/apache/var/httpd.pid ] && \
714 kill `cat /usr/testtorrus/apache/var/httpd.pid` && \
715 echo 'apache stopped'
718 echo "Usage: `basename $0` {start|stop}" >&2
726 =head3 Changing the default short graph
728 The default small graph in overviews and tokenset listings shows last 6 hours
729 of data. It might be more convenient for you to graph last 24 hours,
730 or even longer. To do so, you only need to change one parameter,
731 C<rrgraph-views>. You may change it on the top of the datasource tree, or
732 even only for some parts of the tree.
734 In F<defaults.xml>, there's a view defiition called C<last24h-small>. It is
735 exactly the same size as the 6-hours' C<short> view, but it shows 24-hour
736 graph. Somewhere in Torrus configuration, you may have:
739 <param name="rrgraph-views">
740 last24h-small,last24h,lastweek,lastmonth,lastyear
744 The best place for this would be F<site-global.xml>.
747 =head3 Watching the collector failures
749 There is a script in Torrus distribution in F<examples/rrdup_notify.sh>,
750 which provides a simple way of telling if the collector runs right: it checks
751 the modification time of RRD files, and if any file is older than given
752 threshold, it sends an e-mail warning.
754 Copy the script file to some place in your system and edit it so that it fits
755 your requirements: you might want to change the maximum age
756 parameter (default is 1 hour), the notification e-mail address, and the
757 directory paths where to look for RRD files. Then I<chmod> it so that it's
758 executable, and add it to I<crontab>. Depending on your operation requirements,
759 it might run every hour, or few times a day, or even at business hours only.
761 The script writes the number of aged files in the e-mail subject, and lists
762 the file names in the body. In case of relatively large installation,
763 you might want to amend the script, in order to avoid too large email messages.
766 =head3 Viewing external RRD files
768 Some external program may create its own RRD files, and you
769 may want to display and monitor them in Torrus.
771 Also some collector-generated RRDs may become outdated -- for example, after
772 a module is removed from a router, and the interface counters not
773 being updated any more.
775 The easiest way to use such files would be to utilize the
776 C<torrus rrddir2xml> command. It generates the XML configuration file
777 that represents all RRD files found in a given directory. It can also
778 scan the directory recursively.
780 See also few examples in Torrus distribution. There are some
781 templates for use with Smokeping, OpenNMS, and Flowscan.
784 =head2 Torrus usage scenarios
787 =head3 Scenario 1. Netflow Traffic Analyser
789 Cisco routers are capable of exporting the traffic statistics
790 data in I<Netflow> UDP packets.
792 A I<cflowd> or I<flow-tools> daemon collects Netflow packets into flow files.
794 I<FlowScan> software analyses the flow files and stores the
795 statistics into numerous RRD files.
797 Torrus is used to monitor the thresholds and diplay the graphs
801 =head3 Scenario 2. Backbone Traffic Statistics
803 I<CiscoWorks2000> or I<NMSTOOLS> software is used to provide
804 the list of all devices in the network.
806 Torrus's C<devdiscover> buids the XML configuration to monitor the
807 router interfaces, CPU and memory usage, and temperature sensors.
809 Data importing scripts generate configuration for alternative
810 grouping of the datasources: by location; by customer connection;
811 by device type; by service type; etc...
814 =head2 Troubleshooting guidelines
816 =head3 SNMP Error: Received tooBig(1)
818 For some devices, the collector may issue the following error messages:
820 [27-May-2004 10:15:17*] SNMP Error for XX.XX.XX.XX:161:public: Received
821 tooBig(1) error-status at error-index 0
823 For better performance, SNMP collector sends several SNMP requests in one
824 UDP datagram. The SNMP agent then tries to send the reply to all requests
825 in a single datagram, and this error indicates the failure. In most cases,
826 this is caused by the agent software limitations or bugs.
828 The number of requests per datagram is controlled by the parameter
829 C<snmp-oids-per-pdu>, and it may be set in the discovery input XML or
830 in Torrus configuration XML. The default value is 40, and setting it to 10
833 =head3 Database lock troubleshooting
835 It may happen sometimes, that a process accessing Torrus database
836 terminates incorrectly, and the database becomes blocked.
837 A typical symptom of this is that the command
838 C<torrus compilexml --all --verbose>
839 does not print anything and stays running forever, occupying zero
842 The nice, and the preferred way to solve the problem is
843 to use C<db_recover> utility from BerkeleyDB package.
844 The brutal way is just to remove the databases and re-compile
845 all the configuration. I<Note:> The ACL database is not automatically
846 backed up, and you need to take care of its backup before deleting
847 the contents of the database.
849 ## The nice way uses BerkeleyDB db_recover
850 ## (might be located in /usr/local/BerkeleyDB.4.1/bin/)
851 /etc/init.d/apache stop
852 /etc/init.d/torrus stop
853 db_recover -h @dbhome@
854 torrus compilexml --verbose --all
855 /etc/init.d/torrus start
856 /etc/init.d/apache start
859 /etc/init.d/apache stop
860 /etc/init.d/torrus stop
863 torrus compilexml --verbose
864 /etc/init.d/torrus start
865 /etc/init.d/apache start
869 Copyright (c) 2002-2007 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>