1 # Copyright (C) 2002 Stanislav Sinyagin
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 # $Id: torrus-config.pl,v 1.1 2010-12-27 00:04:40 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
21 # DO NOT EDIT THIS FILE!
23 # Torrus local configuration.
24 # Put all your local settings into torrus-siteconfig.pl
26 use lib(@perllibdirs@);
28 $Torrus::Global::version = '@VERSION@';
29 $Torrus::Global::cfgDefsDir = '@cfgdefdir@';
30 $Torrus::Global::cfgSiteDir = '@siteconfdir@';
31 $Torrus::Global::pkgbindir = '@pkgbindir@';
32 $Torrus::Global::dbHome = '@dbhome@';
33 $Torrus::Global::templateDirs = ['@tmpldir@', '@tmpluserdir@'];
34 $Torrus::Global::stylingDir = '@styldir@';
35 $Torrus::Global::cacheDir = '@cachedir@';
36 $Torrus::Global::pidDir = '@piddir@';
37 $Torrus::Global::logDir = '@logdir@';
38 $Torrus::Global::reportsDir = '@reportsdir@';
39 $Torrus::Global::sesStoreDir = '@sesstordir@';
40 $Torrus::Global::sesLockDir = '@seslockdir@';
41 $Torrus::Global::webPlainDir = '@webplaindir@';
43 @Torrus::Global::xmlDirs = ('@distxmldir@', '@sitexmldir@');
45 $Torrus::Global::threadsEnabled = '@perlithreads@';
47 $Torrus::DB::dbSub = 'sub';
49 # How long we can wait till the configuration is ready, in seconds
50 $Torrus::Global::ConfigReadyTimeout = 1800;
52 # How often we check if the configuration is ready, in seconds
53 $Torrus::Global::ConfigReadyRetryPeriod = 30;
55 # How long the compiler waits till readers finish, in seconds
56 $Torrus::Global::ConfigReadersWaitTimeout = 180;
58 # How often compiler checks for readers to finish
59 $Torrus::Global::ConfigReadersWaitPeriod = 5;
61 # How much the timestamps can differ in one RRD file, in seconds
62 $Torrus::Global::RRDTimestampTolerance = 15;
64 # SO_RCVBUF, the receiving buffer size of the SNMP collector socket.
65 # Should be large enough to sustain the traffic bursts, and should be
66 # within limits incurred by local OS and kernel settings.
67 # Check your system manuals and the results of network statistics.
69 # On Solaris, the maximum buffer size is 256k, and it is configurable
70 # via "/usr/sbin/ndd /dev/udp udp_max_buf <value>",
71 # and the statistics are shown in udpInOverflows of "netstat -s -P ip" output.
73 # On FreeBSD, the statistics can be obtained via "netstat -s -p udp".
74 # The maximum socket buffer can be changed via
75 # "sysctl kern.ipc.maxsockbuf=<value>", and default is 256k.
76 # On startup, the OS reads these settings from /etc/sysctl.conf
78 # On Linux (FC2), the default limit is 131071, and it can be changed
79 # by "sysctl -w net.core.rmem_max=<value>". On startup, the OS reads these
80 # settings from /etc/sysctl.conf
82 $Torrus::Collector::SNMP::RxBuffer = 131071;
84 # The time period after which we give up to reach the host being unreachable
85 $Torrus::Collector::SNMP::unreachableTimeout = 21600; # 6 hours
87 # For unreachable host, we retry SNMP query not earlier than this
88 $Torrus::Collector::SNMP::unreachableRetryDelay = 600; # 10 min
90 # Variables that define the SNMP map refreshing.
91 # The maps (e.g. ifDescr=>ifIndex mapping) are stored in the collector
92 # process and are not automatically refreshed after recompiling.
93 # They refresh only when the SNMP agent is rebooted or at periodic intervals
94 # defined below. For SNMPv1 agents, periodic refreshing is disabled
95 # because of performance impact.
97 # Refresh SNMP maps every 5 to 7 hours
98 $Torrus::Collector::SNMP::mapsRefreshPeriod = 18000;
99 $Torrus::Collector::SNMP::mapsRefreshRandom = 0.40;
101 # After configuration re-compiling, update the maps.
102 # Do it randomly and spread the load evenly between 0 and 30 minutes.
103 $Torrus::Collector::SNMP::mapsUpdateInterval = 1800;
106 # Wait 10min between refresh checkups
107 $Torrus::Collector::SNMP::mapsExpireCheckPeriod = 600;
109 # There is a strange bug that with more than 400 sessions per SNMP
110 # dispatcher some requests are not sent at all
111 $Torrus::Collector::SNMP::maxSessionsPerDispatcher = 100;
113 # When enabled, the collector starts a background thread that
114 # writes to RRD files
115 $Torrus::Collector::RRDStorage::useThreads = $Torrus::Global::threadsEnabled;
117 # How many unwritten updates are allowed to stay in the queue
118 $Torrus::Collector::RRDStorage::thrQueueLimit = 1000000;
120 # The following errors are caused by changes in the device configurations,
121 # when the collector tries to store data in a RRD file, but the
122 # structure of the file is no longer suitable:
123 # Datasource exists in RRD file, but is not updated
124 # Datasource being updated does not exist
125 # Set this variable to true if you want these RRD files automatically moved.
126 # The current date is appended to the filename, and the file
127 # is moved to another directory or renamed.
128 $Torrus::Collector::RRDStorage::moveConflictRRD = 0;
131 # The path where conflicted RRD files would be moved. This directory
132 # should exist, be writable by Torrus daemon user, and in most OSes
133 # it must reside in the same filesystem as the original files.
134 # When undefined, the files are renamed within their original directory.
135 $Torrus::Collector::RRDStorage::conflictRRDPath = undef;
137 # Sleep interval when scheduler initialization failed (i.e. configuration
139 $Torrus::Scheduler::failedInitSleep = 1800;
141 # When positive, the scheduler will sleep in small intervals.
142 # Use this when the system clock is not reliable, like in VmWare
143 $Torrus::Scheduler::maxSleepTime = 0;
145 # Set this to true when the system clock is not reliable, like in VmWare
146 $Torrus::Scheduler::ignoreClockSkew = 0;
148 # Exponential decay parameter (alpha) for Scheduler statistics averages:
150 # Xnew = alpha * Xmes + (1-alpha) * Xprev
151 # Xnew: new calculated average
152 # Xmes: measured value
153 # Xprev: old calculated average
155 # Alpha defines how many previous measurements composite the average:
156 # alpha = 1.0 - exp( log(1-TotalWeight)/NPoints )
157 # TotalWeight: the weight of NPoints measurements
158 # NPoints: number of measurements
159 # 0.63 corresponds to TotalWeight=0.95 and NPoints=3 (95% of average is from
160 # last three datapoints
162 $Torrus::Scheduler::statsExpDecayAlpha = 0.63;
164 # Monitor alarms may become orphaned if the configuration changes
165 # in the middle of an event. Events older than this time are cleaned up
167 $Torrus::Monitor::alarmTimeout = 1209600;
169 # The default CSS stylesheet and other details for HTML output.
170 # These settings may optionally be overwritten by the styling profile below.
171 # Additional CSS overlay may be specified with 'cssoverlay' property,
172 # It should point to an absolute URL.
174 # $Torrus::Renderer::styling{'default'}{'cssoverlay'} = '/mystyle.css';
176 %Torrus::Renderer::styling =
177 ( 'default' => {'stylesheet' => 'torrus.css'},
178 'printer' => {'stylesheet' => 'torrus-printer.css'},
179 'report' => {'stylesheet' => 'torrus-report.css'}
182 # Color schema for RRDtool graph. It can be extended by setting
183 # $Torrus::Renderer::stylingProfileOverlay. The overlay should
184 # be an absolute file name. You can use $Torrus::Global::cfgSiteDir
185 # to refer to the site configs path.
186 $Torrus::Renderer::stylingProfile = 'torrus-schema';
189 $Torrus::Renderer::rendererURL = '/torrus';
191 # Trailing slash is important!
192 $Torrus::Renderer::plainURL = '/torrus/plain/';
194 # The small piece of text in the corner of the HTML output.
195 $Torrus::Renderer::companyName = 'Your company name';
197 # The URL to use for that piece of text
198 $Torrus::Renderer::companyURL = 'http://torrus.sf.net';
200 # The URL of your company logo which will be displayed instead of
202 # $Torrus::Renderer::companyLogo = 'http://domain.com/logo.png';
204 # Another piece of text on the right to the company name
205 $Torrus::Renderer::siteInfo = undef;
207 # URL to be shown on the login page for lost password
208 # You have to implement that yourself
209 # $Torrus::Renderer::lostPasswordURL = 'http://domain.com/lostpw.cgi';
211 # The time format to print in HTML
212 $Torrus::Renderer::timeFormat = '%d-%m-%Y %H:%M';
214 # Exception characters for URI::Escape
215 # By default, slash (/) is escaped, and we don't really want it
216 $Torrus::Renderer::uriEscapeExceptions = '^A-Za-z0-9-._~/:';
218 # The page that lets you choose the tree from the list
219 $Torrus::Renderer::Chooser::mimeType = 'text/html; charset=UTF-8';
220 $Torrus::Renderer::Chooser::expires = '300';
221 $Torrus::Renderer::Chooser::template = 'default-chooser.html';
222 $Torrus::Renderer::Chooser::searchTemplate = 'globalsearch.html';
224 # We clean the renderer cache at least once a day
225 $Torrus::Renderer::cacheMaxAge = 86400;
227 # Some RRDtool versions may report errors on decorations
228 $Torrus::Renderer::ignoreDecorations = 0;
230 # This enables full Apache handler debugging
231 $Torrus::Renderer::globalDebug = 0;
233 # When true, Holt-Winters boundaries and failures are described in the
235 $Torrus::Renderer::hwGraphLegend = 0;
237 # When true, users may view service usage reports (requires SQL connection)
238 $Torrus::Renderer::displayReports = 0;
240 # Allow tree searching. The search DB should be built with buildsearchdb
241 $Torrus::Renderer::searchEnabled = 1;
243 # Allow global searching across the trees. If the user authentication
244 # is enabled, the user should have rights DisplayTree and GlobalSearch for '*'
245 $Torrus::Renderer::globalSearchEnabled = 1;
248 # Modules that Collector will use for collecting and storing data.
249 @Torrus::Collector::loadModules =
250 ( 'Torrus::Collector::SNMP',
251 'Torrus::Collector::CDef',
252 'Torrus::Collector::RRDStorage' );
254 # Configurable part of Validator
255 @Torrus::Validator::loadLeafValidators =
256 ( 'Torrus::Collector::SNMP_Params',
257 'Torrus::Collector::CDef_Params' );
259 # Configurable part of AdmInfo renderer
260 @Torrus::Renderer::loadAdmInfo =
261 ( 'Torrus::Collector::SNMP_Params',
262 'Torrus::Collector::CDef_Params' );
264 # Parameters that are comma-separated values
265 @Torrus::ConfigTree::XMLCompiler::listparams = ();
267 # XML files to be compiled first for every tree
268 @Torrus::Global::xmlAlwaysIncludeFirst = ();
270 # XML files to be compiled after the tree files, but before the files
271 # included with <include> XML directive
272 @Torrus::Global::xmlAlwaysIncludeLast = ();
274 # Do we need Web user authentication/authorization ?
275 $Torrus::CGI::authorizeUsers = 1;
277 # User authentication method may be changed locally
278 $Torrus::ACL::userAuthModule = 'Torrus::ACL::AuthLocalMD5';
280 # Minimum allowed password length
281 $Torrus::ACL::minPasswordLength = 6;
284 $Torrus::Renderer::LoginScreen::mimeType = 'text/html; charset=UTF-8';
285 $Torrus::Renderer::LoginScreen::template = 'default-login.html';
288 #### SQL connections configuration
289 # For a given Perl class and an optional subtype,
290 # the connection attributes are derived in the following order:
291 # 'Default', 'Default/[subtype]', '[Class]', '[Class]/[subtype]',
293 # For a simple setup, the default attributes are usually defined for
295 # The key attributes are: 'dsn', 'username', and 'password'.
296 %Torrus::SQL::connections =
297 ('Default' => {'dsn' => 'DBI:mysql:database=torrus;host=localhost',
298 'username' => 'torrus',
299 'password' => 'torrus'}
303 #### ExternalStorage collector module initialization.
304 # In order to enable External storage, add these lines to torrus-siteconfig.pl:
305 # push(@Torrus::Collector::loadModules, 'Torrus::Collector::ExternalStorage');
308 # Other configuration available:
310 # Maximum age for backlog in case of unavailable storage.
311 # We stop recording new data when maxage is reached. Default: 24h
312 $Torrus::Collector::ExternalStorage::backlogMaxAge = 86400;
314 # How often we retry to contact an unreachable external storage. Default: 10min
315 $Torrus::Collector::ExternalStorage::unavailableRetry = 600;
317 # Backend engine for External storage
318 $Torrus::Collector::ExternalStorage::backend = 'Torrus::Collector::ExtDBI';
320 # SQL table configuration for collector's external storage
321 $Torrus::SQL::SrvExport::tableName = 'srvexport';
322 %Torrus::SQL::SrvExport::columns =
323 ('srv_date' => 'srv_date',
324 'srv_time' => 'srv_time',
325 'serviceid' => 'serviceid',
329 # Optional SQL connection subtype for Collector export
330 # $Torrus::Collector::ExtDBI::subtype
333 # SQL table configuration for Reports
334 $Torrus::SQL::Reports::tableName = 'reports';
335 %Torrus::SQL::Reports::columns =
337 'rep_date' => 'rep_date',
338 'rep_time' => 'rep_time',
339 'reportname' => 'reportname',
340 'iscomplete' => 'iscomplete');
342 $Torrus::SQL::ReportFields::tableName = 'reportfields';
343 %Torrus::SQL::ReportFields::columns =
345 'rep_id' => 'rep_id',
347 'serviceid' => 'serviceid',
351 %Torrus::ReportGenerator::modules =
352 ( 'MonthlyUsage' => 'Torrus::ReportGenerator::MonthlySrvUsage' );
355 %Torrus::ReportOutput::HTML::templates =
356 ( 'index' => 'report-index.html',
357 'serviceid' => 'report-serviceid.html',
358 'monthly' => 'report-monthly.html',
359 'yearly' => 'report-yearly.html');
361 # Read plugin configurations
363 my $dir = '@plugtorruscfgdir@';
364 opendir(CFGDIR, $dir) or die("Cannot open directory $dir: $!");
365 my @files = grep { !/^\./ } readdir(CFGDIR);
367 foreach my $file ( @files )
369 require $dir . '/' . $file;
375 require '@torrus_siteconfig_pl@';