-
Type:
Change Request
-
Resolution: Unresolved
-
Priority:
Trivial
-
None
-
Affects Version/s: 6.0.48, 7.0.29, 7.4.13, 8.0.0beta2
-
Component/s: None
-
None
Problem
The official SMART by Zabbix agent 2 and SMART by Zabbix agent 2 active templates use global user macros for disk temperature thresholds:
{$SMART.TEMPERATURE.MAX.WARN}
{$SMART.TEMPERATURE.MAX.CRIT}
The temperature item and trigger prototypes are created per discovered disk and use {#NAME}, but the threshold references do not include an LLD-based user-macro context. Consequently, a host-level context override for a specific disk cannot be selected by the generated triggers; every discovered disk resolves the same non-context value.
This is expected behavior of the user-macro resolver rather than a defect in macro-context handling. The template must explicitly request a context for context-specific values to be resolved.
This improvement follows the analysis of ZBX-28024.
Proposed change
Update both official SMART templates to use the discovered disk name as the context for temperature threshold references:
{$SMART.TEMPERATURE.MAX.WARN:"\{#NAME}"}
{$SMART.TEMPERATURE.MAX.CRIT:"\{#NAME}"}
Five semantic references must be changed in each template:
- critical trigger expression;
- critical trigger event name;
- warning trigger expression;
- warning trigger event name;
- warning-to-critical trigger dependency expression.
The existing non-context macro definitions must remain unchanged and continue to provide the default fallback values:
{$SMART.TEMPERATURE.MAX.WARN} = 50
{$SMART.TEMPERATURE.MAX.CRIT} = 65
No change to the SMART agent 2 plugin, disk discovery payload, or temperature item prototype is required.
Expected behavior
An administrator should be able to keep the template defaults while defining different thresholds for selected disks, for example:
{$SMART.TEMPERATURE.MAX.WARN:"sda"} = 45
{$SMART.TEMPERATURE.MAX.CRIT:"sda"} = 55
{$SMART.TEMPERATURE.MAX.WARN:"nvme0n1"} = 70
{$SMART.TEMPERATURE.MAX.CRIT:"nvme0n1"} = 80
Triggers generated for sda and nvme0n1 should resolve their matching context values. A disk without a matching literal or regular-expression context should continue to resolve the non-context default.
The resolved threshold should also be displayed correctly in the generated event name.
Acceptance criteria
- Both passive and active SMART agent 2 templates use {#NAME} as the context in all five temperature-threshold references.
- A literal per-disk context override is selected for the matching discovered disk.
- A matching regular-expression context override is selected according to the existing user-macro context precedence rules.
- The non-context macro remains the fallback when no context matches.
- Critical and warning trigger expressions resolve the same threshold values as their corresponding event names.
- The warning-to-critical dependency resolves the contextual critical threshold consistently.
- Existing hosts that define only the non-context macros retain their current behavior.
- Template documentation explains that the context value is derived from {#NAME}.
- Documentation notes that changing {$SMART.DISK.DISCOVERY.TYPE} between name and id may change the value exposed as {#NAME} and therefore the context identifiers that administrators must configure.
- Automated template or integration coverage verifies two discovered disks with different thresholds and a third disk using the fallback.