Last active
June 11, 2017 09:11
-
-
Save Sam-Martin/ffd8f32c28571ef9891255040db38c7b to your computer and use it in GitHub Desktop.
DataDog zpool status check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import check_output | |
from datadog import statsd | |
from datadog.api.constants import CheckStatus | |
import re | |
zpool_status = check_output(["/sbin/zpool", "status"]) | |
pattern = re.compile('state: ONLINE') | |
if pattern.search(zpool_status) : | |
print "OK" | |
status = CheckStatus.OK | |
else: | |
print "NOT OK!" | |
status = CheckStatus.CRITICAL | |
statsd.service_check(check_name='zpool.status',status=status,message='Look at the status dummy') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment