Build precise queries to find exactly what you need
Press ESC to close
@rstevens
Favorites0
Views
Projects0
If an email is delivered between 'find' seeing it and stating it, you get messy output. find has the '-ignore_readdir_race' switch to address this. @@ -132,10 +132,10 @@ done # Get values -deferred=`(test -d deferred && find deferred -type f ) | wc -l` -active=`(test -d active && find active -type f ) | wc -l` -corrupt=`(test -d corrupt && find corrupt -type f ) | wc -l` -hold=`( test -d hold && find hold -type f ) | wc -l` +deferred=`(test -d deferred && find deferred -ignore_readdir_race -type f ) | wc -l` +active=`(test -d active && find active -ignore_readdir_race -type f ) | wc -l` +corrupt=`(test -d corrupt && find corrupt -ignore_readdir_race -type f ) | wc -l` +hold=`( test -d hold && find hold -ignore_readdir_race -type f ) | wc -l` bounced=`cat /var/log/maillog | grep bounced | wc -l` }
Reviewed 8 years ago
I've had to make a bunch of hacks to this to keep it running over time. PROGPATH is wrong on some systems, the execute test does not look at the correct owner (since sudo is used), and a failed battery/capacity can result in the cache "permanently" disabled. @@ -188 +188,3 @@ -. $PROGPATH/utils.sh +[[ -x $PROGPATH/utils.sh ]] && . $PROGPATH/utils.sh +[[ -x /usr/lib/nagios/plugins/utils.sh ]] && . /usr/lib/nagios/plugins/utils.sh +[[ -x /usr/lib64/nagios/plugins/utils.sh ]] && . /usr/lib64/nagios/plugins/utils.sh @@ -291 +293 @@ -if [ ! -x $hpacucli ]; then +if [ ! -f $hpacucli ]; then @@ -296 +298 @@ - if [ -x $hpssacli ]; then + if [ -f $hpssacli ]; then @@ -410,0 +413 @@ + check=`echo "$check" | grep -v 'Cache Status: Permanently Disabled'`
Reviewed 7 years ago
I had my controller disable cache due to a battery failure, which I didn't care about cause my server doesn't store anything important. I just wanted to monitor the disk redundancy status for availability. I had to add two options: [-y] to ignore CACHE_MODULE_STATUS and [-z] to ignore STORAGE STATUS in 'HEALTH_AT_A_GLANCE'. @@ -189 +189,2 @@ - [ -i|--ignorelinkdown ] [ -x|--ignorebatterymissing ] [ -s|--sslv3 ] + [ -i|--ignorelinkdown ] [ -x|--ignorebatterymissing ] [ -y|--ignorecachestatus ] + [ -z|--ignorestoragestatus ] [ -s|--sslv3 ] @@ -277,0 +279,14 @@ + spec => 'ignorecachestatus|y', + help => + qq{-y, --ignorecachestatus + Ignore Smart Controller cache status.}, +); + +$p->add_arg( + spec => 'ignorestoragestatus|z', + help => + qq{-z, --ignorestoragestatus + Ignore Storage "at a glance" status (still checks disks).}, +); + +$p->add_arg( @@ -374,0 +390,2 @@ +my $ignorecachestatus = defined($p->opts->ignorecachestatus) ? 1 : 0; +my $ignorestoragestatus = defined($p->opts->ignorestoragestatus) ? 1 : 0; @@ -609,0 +627,3 @@ + if ($componentstate eq 'Degraded' && $ignorestoragestatus ) { + next + } @@ -747 +767 @@ - if($cachestatus && $cachestatus ne 'OK') { + if($cachestatus && $cachestatus ne 'OK' && ! $ignorecachestatus ) {