torrus, RT#10574
[freeside.git] / torrus / configs / torrus-config.pl
1 #  Copyright (C) 2002  Stanislav Sinyagin
2 #
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.
7 #
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.
12 #
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.
16
17 # $Id: torrus-config.pl,v 1.1 2010-12-27 00:04:40 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
19
20
21 # DO NOT EDIT THIS FILE!
22
23 # Torrus local configuration.
24 # Put all your local settings into torrus-siteconfig.pl
25
26 use lib(@perllibdirs@);
27
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@';
42
43 @Torrus::Global::xmlDirs        = ('@distxmldir@', '@sitexmldir@');
44
45 $Torrus::Global::threadsEnabled  = '@perlithreads@';
46
47 $Torrus::DB::dbSub              = 'sub';
48
49 # How long we can wait till the configuration is ready, in seconds
50 $Torrus::Global::ConfigReadyTimeout = 1800;
51
52 # How often we check if the configuration is ready, in seconds
53 $Torrus::Global::ConfigReadyRetryPeriod = 30;
54
55 # How long the compiler waits till readers finish, in seconds
56 $Torrus::Global::ConfigReadersWaitTimeout = 180;
57
58 # How often compiler checks for readers to finish
59 $Torrus::Global::ConfigReadersWaitPeriod = 5;
60
61 # How much the timestamps can differ in one RRD file, in seconds
62 $Torrus::Global::RRDTimestampTolerance = 15;
63
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.
68 #
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.
72 #
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
77 #
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
81 #
82 $Torrus::Collector::SNMP::RxBuffer = 131071;
83
84 # The time period after which we give up to reach the host being unreachable
85 $Torrus::Collector::SNMP::unreachableTimeout = 21600; # 6 hours
86
87 # For unreachable host, we retry SNMP query not earlier than this
88 $Torrus::Collector::SNMP::unreachableRetryDelay = 600; # 10 min
89
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.
96 #
97 # Refresh SNMP maps every 5 to 7 hours
98 $Torrus::Collector::SNMP::mapsRefreshPeriod = 18000;
99 $Torrus::Collector::SNMP::mapsRefreshRandom = 0.40;
100
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;
104
105
106 # Wait 10min between refresh checkups
107 $Torrus::Collector::SNMP::mapsExpireCheckPeriod = 600;
108
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;
112
113 # When enabled, the collector starts a background thread that
114 # writes to RRD files
115 $Torrus::Collector::RRDStorage::useThreads = $Torrus::Global::threadsEnabled;
116
117 # How many unwritten updates are allowed to stay in the queue
118 $Torrus::Collector::RRDStorage::thrQueueLimit = 1000000;
119
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;
129
130
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;
136
137 # Sleep interval when scheduler initialization failed (i.e. configuration
138 # reading timeout)
139 $Torrus::Scheduler::failedInitSleep = 1800;
140
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;
144
145 # Set this to true when the system clock is not reliable, like in VmWare
146 $Torrus::Scheduler::ignoreClockSkew = 0;
147
148 # Exponential decay parameter (alpha) for Scheduler statistics averages:
149 #
150 # Xnew = alpha * Xmes + (1-alpha) * Xprev
151 # Xnew: new calculated average
152 # Xmes: measured value
153 # Xprev: old calculated average
154 #
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
161 #
162 $Torrus::Scheduler::statsExpDecayAlpha = 0.63;
163
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
166 # default: 2 weeks
167 $Torrus::Monitor::alarmTimeout = 1209600; 
168
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.
173 # for example:
174 # $Torrus::Renderer::styling{'default'}{'cssoverlay'} = '/mystyle.css';
175 #
176 %Torrus::Renderer::styling =
177     ( 'default' => {'stylesheet'   => 'torrus.css'},
178       'printer' => {'stylesheet'   => 'torrus-printer.css'},
179       'report'  => {'stylesheet'   => 'torrus-report.css'}
180       );
181
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';
187
188 # Top level URI
189 $Torrus::Renderer::rendererURL = '/torrus';
190
191 # Trailing slash is important!
192 $Torrus::Renderer::plainURL = '/torrus/plain/';
193
194 # The small piece of text in the corner of the HTML output.
195 $Torrus::Renderer::companyName = 'Your company name';
196
197 # The URL to use for that piece of text
198 $Torrus::Renderer::companyURL = 'http://torrus.sf.net';
199
200 # The URL of your company logo which will be displayed instead of
201 # companyName
202 # $Torrus::Renderer::companyLogo = 'http://domain.com/logo.png';
203
204 # Another piece of text on the right to the company name
205 $Torrus::Renderer::siteInfo = undef;
206
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';
210     
211 # The time format to print in HTML
212 $Torrus::Renderer::timeFormat = '%d-%m-%Y %H:%M';
213
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-._~/:';
217
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';
223
224 # We clean the renderer cache at least once a day
225 $Torrus::Renderer::cacheMaxAge = 86400;
226
227 # Some RRDtool versions may report errors on decorations
228 $Torrus::Renderer::ignoreDecorations = 0;
229
230 # This enables full Apache handler debugging
231 $Torrus::Renderer::globalDebug = 0;
232
233 # When true, Holt-Winters boundaries and failures are described in the
234 # graph legend
235 $Torrus::Renderer::hwGraphLegend = 0;
236
237 # When true, users may view service usage reports (requires SQL connection)
238 $Torrus::Renderer::displayReports = 0;
239
240 # Allow tree searching. The search DB should be built with buildsearchdb
241 $Torrus::Renderer::searchEnabled = 1;
242
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;
246
247
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' );
253
254 # Configurable part of Validator
255 @Torrus::Validator::loadLeafValidators =
256     ( 'Torrus::Collector::SNMP_Params',
257       'Torrus::Collector::CDef_Params' );
258
259 # Configurable part of AdmInfo renderer
260 @Torrus::Renderer::loadAdmInfo =
261     ( 'Torrus::Collector::SNMP_Params',
262       'Torrus::Collector::CDef_Params' );
263
264 # Parameters that are comma-separated values
265 @Torrus::ConfigTree::XMLCompiler::listparams = ();
266
267 # XML files to be compiled first for every tree
268 @Torrus::Global::xmlAlwaysIncludeFirst = ();
269
270 # XML files to be compiled after the tree files, but before the files
271 # included with <include> XML directive
272 @Torrus::Global::xmlAlwaysIncludeLast = ();
273
274 # Do we need Web user authentication/authorization ?
275 $Torrus::CGI::authorizeUsers = 1;
276
277 # User authentication method may be changed locally
278 $Torrus::ACL::userAuthModule = 'Torrus::ACL::AuthLocalMD5';
279
280 # Minimum allowed password length
281 $Torrus::ACL::minPasswordLength = 6;
282
283 # The login page
284 $Torrus::Renderer::LoginScreen::mimeType = 'text/html; charset=UTF-8';
285 $Torrus::Renderer::LoginScreen::template = 'default-login.html';
286
287 ####
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]',
292 # 'All/[subtype]'.
293 # For a simple setup, the default attributes are usually defined for
294 # 'Default' key.
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'}
300      );
301
302 ####
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');
306
307
308 # Other configuration available:
309
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;
313
314 # How often we retry to contact an unreachable external storage. Default: 10min
315 $Torrus::Collector::ExternalStorage::unavailableRetry = 600;
316
317 # Backend engine for External storage
318 $Torrus::Collector::ExternalStorage::backend = 'Torrus::Collector::ExtDBI';
319
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',
326      'value'       => 'value',
327      'intvl'       => 'intvl');
328
329 # Optional SQL connection subtype for Collector export
330 # $Torrus::Collector::ExtDBI::subtype
331
332
333 # SQL table configuration for Reports
334 $Torrus::SQL::Reports::tableName = 'reports';
335 %Torrus::SQL::Reports::columns =
336     ('id'          => 'id',
337      'rep_date'    => 'rep_date',
338      'rep_time'    => 'rep_time',
339      'reportname'  => 'reportname',
340      'iscomplete'  => 'iscomplete');
341
342 $Torrus::SQL::ReportFields::tableName = 'reportfields';
343 %Torrus::SQL::ReportFields::columns =
344     ('id'         => 'id',
345      'rep_id'     => 'rep_id',
346      'name'       => 'name',
347      'serviceid'  => 'serviceid',
348      'value'      => 'value',
349      'units'      => 'units');
350
351 %Torrus::ReportGenerator::modules =
352     ( 'MonthlyUsage' => 'Torrus::ReportGenerator::MonthlySrvUsage' );
353
354
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');
360
361 # Read plugin configurations
362 {
363     my $dir = '@plugtorruscfgdir@';
364     opendir(CFGDIR, $dir) or die("Cannot open directory $dir: $!");
365     my @files = grep { !/^\./ } readdir(CFGDIR);
366     closedir( CFGDIR );
367     foreach my $file ( @files )
368     {
369         require $dir . '/' . $file;
370     }
371 }
372
373     
374
375 require '@torrus_siteconfig_pl@';
376
377 1;