Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions plugins-scripts/Nagios/CheckLogfiles.pm
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ sub init {
my $params = shift;
my($sec, $min, $hour, $mday, $mon, $year) = (localtime)[0, 1, 2, 3, 4, 5];
$year += 1900; $mon += 1;
$self->{commandlineargs} = $params->{commandlineargs} || [];
$self->{tracefile} = $self->system_tempdir().'/check_logfiles.trace';
$self->{trace} = -e $self->{tracefile} ? 1 : 0;
$self->{verbose} = $params->{verbose} || 0;
Expand Down Expand Up @@ -84,6 +85,9 @@ sub init {
maxmemsize => 0, rotatewait => 0, htmlencode => 0,
outputhitcount => 1, rununique => 0, preview => 1,
});
if ($params->{configdir}) {
$self->{configdir} = $params->{configdir};
}
if ($params->{cfgfile}) {
if (ref($params->{cfgfile}) eq "ARRAY") {
# multiple cfgfiles found in a config dir
Expand Down Expand Up @@ -1448,6 +1452,9 @@ sub construct_pidfile {
$self->{pidfilebase} = $self->{tag};
$self->{pidfilebase} .= $self->{logfile};
}
if (exists $self->{configdir}) {
$self->{pidfilebase} = "check_lockfiles_" . join( "_", @{$self->{commandlineargs}} ) ;
}
$self->{pidfilebase} =~ s/\//_/g;
$self->{pidfilebase} =~ s/\\/_/g;
$self->{pidfilebase} =~ s/:/_/g;
Expand Down
4 changes: 4 additions & 0 deletions plugins-scripts/check_logfiles.pl
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ sub print_usage {
EOTXT
}

my @originalArguments = @ARGV;

%commandline = ();
my @params = (
"timeout|t=i",
Expand Down Expand Up @@ -358,6 +360,8 @@ sub print_usage {

if (my $cl = Nagios::CheckLogfiles->new({
cfgfile => $commandline{config} ? $commandline{config} : undef,
configdir => $commandline{configdir} ? $commandline{configdir} : undef,
commandlineargs => \@originalArguments,
searches => [
map {
if (exists $commandline{type} && $commandline{type} eq 'rotating::uniform') {
Expand Down