From e6525ce59e543186e6c2a642b0892ebdb28b6cc5 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 19 Apr 2018 08:18:23 -0700 Subject: [PATCH] Introduce a level param, and use it to turn on checks that shouldn't need to be done anymore, due to foreign keys --- scripts/zmaudit.pl.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index f672a86b3..80d675f05 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -63,6 +63,7 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; my $report = 0; my $interactive = 0; my $continuous = 0; +my $level = 1; my $monitor_id = 0; my $version; my $force = 0; @@ -74,6 +75,7 @@ GetOptions( continuous =>\$continuous, force =>\$force, interactive =>\$interactive, + level =>\$level, 'monitor_id=i' =>\$monitor_id, report =>\$report, 'storage_id=i' =>\$storage_id, @@ -485,7 +487,9 @@ MAIN: while( $loop ) { redo MAIN; } +if ( $level > 1 ) { # Remove orphaned events (with no monitor) +# Shouldn't be possible anymore with FOREIGN KEYS in place $cleaned = 0; Debug("Checking for Orphaned Events"); my $selectOrphanedEventsSql = 'SELECT Events.Id, Events.Name @@ -507,6 +511,7 @@ MAIN: while( $loop ) { } } redo MAIN if $cleaned; +} # end if level > 1 # Remove empty events (with no frames) $cleaned = 0; @@ -552,6 +557,7 @@ MAIN: while( $loop ) { } redo MAIN if $cleaned; +if ( $level > 1 ) { # Remove orphaned stats records $cleaned = 0; Debug("Checking for Orphaned Stats"); @@ -570,6 +576,7 @@ MAIN: while( $loop ) { } } redo MAIN if ( $cleaned ); +} # New audit to close any events that were left open for longer than MIN_AGE seconds my $selectUnclosedEventsSql =