New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if --pool not provided, run on all pools #4

Closed
dlangille opened this Issue Aug 10, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@dlangille
Contributor

dlangille commented Aug 10, 2018

I have a suggestion, but not complete code.

If you have multiple pools, just one pool, or add pools later, it is more convenient to have a script which always keeps up.

Suggestion: if -p is not specified do something like this:

#/bin/sh

pools=`zpool list -H -o name`
for pool in ${pools}
do
  echo do a scrub check on that $pool
done

The above can be invoked inside the existing code.

Sample output:

[dan@slocum:~/src/check_zpool_scrub] $ sh ~/bin/zpools.sh
do a scrub check on that dev-ingress01
do a scrub check on that jester
do a scrub check on that system
do a scrub check on that tank_fast

Does this sound OK to you?

@Josef-Friedrich

This comment has been minimized.

Show comment
Hide comment
@Josef-Friedrich

Josef-Friedrich Aug 11, 2018

Owner

Sounds OK! PR?

Owner

Josef-Friedrich commented Aug 11, 2018

Sounds OK! PR?

@dlangille

This comment has been minimized.

Show comment
Hide comment
@dlangille

dlangille Aug 12, 2018

Contributor

After giving it some thought, it's as if I would use check_zpool_scrub as a separate script, and invoke it from a script which looks like the above. Let me ponder a bit longer.

Contributor

dlangille commented Aug 12, 2018

After giving it some thought, it's as if I would use check_zpool_scrub as a separate script, and invoke it from a script which looks like the above. Let me ponder a bit longer.

@dlangille

This comment has been minimized.

Show comment
Hide comment
@dlangille

dlangille Aug 14, 2018

Contributor

How about this?

check_zpool_scrub.txt

Contributor

dlangille commented Aug 14, 2018

How about this?

check_zpool_scrub.txt

@Josef-Friedrich

This comment has been minimized.

Show comment
Hide comment
@Josef-Friedrich

Josef-Friedrich Aug 14, 2018

Owner

Very nice!

#!/bin/sh

OUTPUT=""
STATE=0

# sort in reverse order, because we append in that order
pools=`zpool list -H -o name | sort -r`
for pool in ${pools}
do
  OUTPUT="$OUTPUT `check_zpool_scrub --pool=$pool --warning=777600 --critical=1209600`"
  LAST_STATE=$?
  if [ ${LAST_STATE} -gt ${STATE} ]
  then
    STATE=${LAST_STATE}
  fi

done

echo $OUTPUT
exit ${STATE}
Owner

Josef-Friedrich commented Aug 14, 2018

Very nice!

#!/bin/sh

OUTPUT=""
STATE=0

# sort in reverse order, because we append in that order
pools=`zpool list -H -o name | sort -r`
for pool in ${pools}
do
  OUTPUT="$OUTPUT `check_zpool_scrub --pool=$pool --warning=777600 --critical=1209600`"
  LAST_STATE=$?
  if [ ${LAST_STATE} -gt ${STATE} ]
  then
    STATE=${LAST_STATE}
  fi

done

echo $OUTPUT
exit ${STATE}

Josef-Friedrich added a commit that referenced this issue Aug 17, 2018

Prepare for #4
if --pool not provided, run on all pools
@Josef-Friedrich

This comment has been minimized.

Show comment
Hide comment
@Josef-Friedrich
Owner

Josef-Friedrich commented Aug 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment