# ocf:pacemaker:HealthSMART

`ocf:pacemaker:HealthSMART` is an OCF-compliant resource agent designed for use in Pacemaker-managed clusters to monitor the health of storage devices via SMART (Self-Monitoring, Analysis, and Reporting Technology) data. By continuously assessing key SMART attributes, this agent helps detect early signs of disk degradation or impending failure, allowing the cluster to trigger remedial actions—such as alerts, resource relocation, or even node fencing—to protect data integrity and maintain overall system availability.

## Purpose

* **Proactive Disk Health Monitoring:**\
  Leverages SMART metrics to continuously check the condition of storage devices, identifying potential issues (e.g., excessive reallocated sectors, high temperatures, or uncorrectable errors) before they lead to catastrophic failure.
* **Cluster Decision Support:**\
  Provides real-time health data that the cluster manager (Pacemaker) can use to determine if a node’s disk is under stress. If thresholds are exceeded, the agent can signal a failure, prompting automated recovery or load-balancing actions.
* **Prevention of Data Loss:**\
  Early detection of disk issues allows administrators to plan maintenance or replace failing hardware, thereby reducing the risk of data corruption and unplanned downtime.

## Standard Operations

As with other OCF resource agents, `ocf:pacemaker:HealthSMART` supports the typical operations:

* **start:**\
  Initializes SMART monitoring on the specified device(s).
* **stop:**\
  Terminates the monitoring process.
* **monitor:**\
  Periodically checks the device’s SMART data. If the device’s health is within acceptable thresholds, it returns a success status; if any critical SMART attribute exceeds its threshold, it returns an error status.
* **meta-data:**\
  Outputs an XML description of the resource agent—detailing supported parameters, default values, and operation definitions—to aid in configuration and integration with cluster management tools.

## Key Parameters

_Note: Exact parameters may vary by implementation. The following are illustrative examples:_

* **device:**\
  The path to the storage device (e.g., `/dev/sda`) that will be monitored.
* **check\_interval:**\
  The frequency (in seconds) at which the agent polls the device’s SMART data.
* **threshold\_reallocated:**\
  A numeric threshold for the count of reallocated sectors. Exceeding this value may indicate a failing disk.
* **threshold\_temperature:**\
  A temperature limit (in °C) above which the disk is considered at risk.
* **(Optional) Additional thresholds:**\
  Parameters for pending sectors, uncorrectable errors, or other SMART metrics may also be supported to fine-tune the health evaluation.

## Example Usage

A typical configuration using the `pcs` tool might look like this:

```bash
pcs resource create HealthSMART ocf:pacemaker:HealthSMART \
    device=/dev/sda check_interval=60 threshold_reallocated=10 threshold_temperature=50 \
    op monitor interval=60s
```

In this example:

* The resource `HealthSMART` monitors `/dev/sda`.
* SMART data is checked every 60 seconds.
* The disk is flagged if it has more than 10 reallocated sectors or if its temperature exceeds 50°C.
* The monitor operation runs at 60-second intervals to continuously verify disk health.

## Best Practices

* **Customize Thresholds:**\
  Adjust thresholds based on manufacturer specifications and historical performance data. This prevents false positives in environments with heavy workloads or high ambient temperatures.
* **Regular Testing:**\
  Validate the agent’s behavior in a non-production environment to ensure its alerts accurately reflect actual disk conditions.
* **Integrate with Broader Health Monitoring:**\
  Combine SMART monitoring with other system health checks (e.g., CPU, memory, and network utilization) for a comprehensive view of node status.
*   **Review Agent Metadata:**\
    Use the `meta-data` operation to understand all configurable parameters and default settings:

    ```bash
    crm ra metadata ocf:pacemaker:HealthSMART
    ```
* **Document Changes:**\
  Maintain records of threshold adjustments and monitoring intervals to facilitate troubleshooting and performance tuning.

## Conclusion

Although official documentation for `ocf:pacemaker:HealthSMART` is limited, its role in a Pacemaker cluster is clear: it acts as a safeguard against disk failures by monitoring SMART attributes and reporting anomalies. This proactive approach to disk health helps ensure that the cluster can take timely action to mitigate risks, maintain data integrity, and uphold high availability. If you plan to deploy this resource agent, testing and careful parameter tuning are essential to align its operation with your environment's specific needs.
