1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 14:16:00 +00:00

Add configuration option for the logs setup

This commit is contained in:
Neraud 2017-07-08 10:36:46 +02:00
parent 3a17b22edf
commit a1f7808b9e
4 changed files with 29 additions and 55 deletions

View file

@ -1,5 +1,6 @@
#!/usr/bin/perl -w
use strict;
use JSON qw(decode_json);
#
# byprojects_inout_bandwidth
#
@ -33,26 +34,19 @@ use strict;
# Configuration
# [byprojects_*]
# env.logtail_path /usr/local/bin/logtail
# env.site.prod [{"path":"/home/prod/log/access.log"}]
# env.site.dev [{"path":"/var/log/httpd/ssl-dev-access.log"}, {"path":"/home/dev/log/access*.log"}]
# env.site.test [{"path":"/var/log/access.log","regex":"\"[A-Z]+ /test/"}, {"path":"/home/test/log/access.log"}]
my $server = 'Nginx';
my $statepath = $ENV{MUNIN_PLUGSTATE};
my $logtail = $ENV{logtail_path} || '/usr/local/bin/logtail';
my %logs = (
'prod' => [
{'path' => '/home/prod/log/access.log'}
],
'dev' => [
{'path' => '/var/log/httpd/ssl-dev-access.log'},
{'path' => '/home/dev/log/access.log'}
],
'test' => [
{'path' => '/var/log/access.log', 'regex' => '"[A-Z]+ /test/'},
{'path' => '/home/test/log/access.log'}
],
);
my @loglist = grep {$_ =~ /site\./} keys(%ENV);
my %envLogs = %ENV{@loglist};
my %logs;
while(my($k, $v) = each %envLogs) { @logs{substr($k, 5)} = decode_json($v); }
###########