# Path: canaryd/subprocess.py
# def ensure_command_tuple(command):
# def decode_output(output):
# def get_command_output(command, *args, **kwargs):


import sys
from canaryd.subprocess import CalledProcessError, get_command_output

    except CalledProcessError as e:
        smart_data = e.output

        # If the device doesn't support SMART not much we can do about it!
        if 'Operation not supported by device' in smart_data:
            continue

        for i in SMART_RETURN_BITS:
            bit = e.returncode & i
            if bit and i in SMART_RETURN_BITS:
                return_bit = SMART_RETURN_BITS[i]

                if return_bit is False:
                    raise

                if return_bit is True:
                    continue

                criticals.append('Disk {0} error: {1}'.format(disk, return_bit))
                break

    for line in smart_data.splitlines():
        # First check SMART's overall status
        if line.startswith('SMART overall-health self-assessment test result'):
            bits = line.split()
            test_result = bits[-1]

            if test_result != 'PASSED':
                criticals.append((

# Path: canaryd/subprocess.py
# def ensure_command_tuple(command):
# def decode_output(output):
# def get_command_output(command, *args, **kwargs):


# Path: canaryd/scripts/disk_health.py
import sys
from canaryd.subprocess import CalledProcessError, get_command_output


    except CalledProcessError as e:
        smart_data = e.output

        # If the device doesn't support SMART not much we can do about it!
        if 'Operation not supported by device' in smart_data:
            continue

        for i in SMART_RETURN_BITS:
            bit = e.returncode & i
            if bit and i in SMART_RETURN_BITS:
                return_bit = SMART_RETURN_BITS[i]

                if return_bit is False:
                    raise

                if return_bit is True:
                    continue

                criticals.append('Disk {0} error: {1}'.format(disk, return_bit))
                break

    for line in smart_data.splitlines():
        # First check SMART's overall status
        if line.startswith('SMART overall-health self-assessment test result'):
            bits = line.split()
            test_result = bits[-1]

            if test_result != 'PASSED':
                criticals.append((

                    'Disk {0} has failed test, status: {1}'