2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #777 from sumpfralle/travis-remove-file_tail_multi

[apache_logparser] carefully import missing File::Tail::Multi (fixes Travis checks)
This commit is contained in:
sumpfralle 2016-11-25 02:37:26 +01:00 committed by GitHub
commit 9057a61fa6
2 changed files with 5 additions and 7 deletions

View File

@ -24,7 +24,6 @@ install:
- cpanm --notest Device::SerialPort
- cpanm --notest FCGI::Client
- cpanm --notest File::ReadBackwards
- cpanm --notest File::Tail::Multi
- cpanm --notest Graphics::ColorObject
- cpanm --notest IPC::Run3
- cpanm --notest IPC::ShareLite
@ -55,6 +54,7 @@ install:
# - Sys::Virt version matching the test system's libvirt-dev
- cpanm --notest DANBERR/Sys-Virt-0.9.8.tar.gz
# Modules used by plugins, but missing on cpan
# - File::Tail::Multi
# - Sun::Solaris::Kstat
# - VMware::VIRuntime
# - MythTV

View File

@ -27,9 +27,6 @@ $statefile file to save last log position for tail
$nsec tail and write to shared mem every n seconds
$debug dump tallied data every n seconds, print every log line parsed
$scan_interval rescan for new log files every n minutes
$type log file type:
common: CLF + vhost + time + (other fields)
combined: combined + time + (other fields)
=cut
# config
@ -38,14 +35,15 @@ my $files = "*access_log";
my $site = "(.*)-access_log";
my $statefile = "/tmp/logstate";
`touch $statefile` unless (-f $statefile);
local $type="combined";
local $nsec=7;
local $debug=0;
my $scan_interval=5; # minutes
# perl modules
use File::Tail::Multi;
# "File:Tail:Multi" disappeared from CPAN (somewhen in 2016) - thus it needs
# to be imported carefully (for travis checks).
eval 'use File::Tail::Multi; 1;' or die 'Please install File::Tail::Multi';
use Storable qw(freeze thaw);
use List::Util qw(min max);
use IPC::ShareLite ':lock';
@ -167,7 +165,7 @@ while (1) {
$old{$vpm}{'max_bytes'}=max($old{$vpm}{'max_bytes'},$temp{$vpm}{'max_bytes'}) || 0;
# reset local counters
foreach my $check qw(requests bytes time max_bytes avg_bytes max_time avg_time) {
foreach my $check (qw(requests bytes time max_bytes avg_bytes max_time avg_time)) {
$temp{$vpm}{$check}=0;
}