#5475 "Rule form: pick the host, then its part; metrics that part reports; a link to groups; a preview of the metric", from the operator's review of the New rule page: hosts and their parts shared one long picker. - Host agent rules pick a Host, then a Part: "The whole host", then its mounts, CPU cores, disks, interfaces and sensors under a heading each, cores in number order. A part that reports nothing a rule can watch (an interface's traffic) isn't offered. - The Metric list holds what the picked resource reports, in catalog order. - Under it, a preview: the reading now, and the last 24 h low to high with an hourly sparkline drawn from zero (UI ruling 8), read from one series. - The group picker links to Ansible > Inventory to make a group, in a new tab, and re-reads the groups when the tab comes back into view. - Picking a host or part swaps the pickers alone (/alerts/api/rule_target); picking a metric swaps the preview (/alerts/api/metric_preview). - A rule's own resource and metric stay on offer after they go quiet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
918 B
HTML
19 lines
918 B
HTML
{# alerts/_metric_preview.html — what the chosen metric reads (#5475), so a
|
||
threshold is set against real numbers: now, and the last day's hourly
|
||
averages with the lowest and highest reading. A rule covering hosts
|
||
previews on the host picked above it, or none. #}
|
||
{% if preview %}
|
||
<div class="metric-preview">
|
||
<span>Now <strong>{{ metric_value(metric, preview.now) }}</strong>
|
||
<span class="tone-dim" title="{{ preview.at|when }}">{{ preview.at|ago }}</span></span>
|
||
{% if preview.series|length > 1 %}
|
||
<span class="metric-preview-day">
|
||
<span class="tone-dim">last 24 h</span> {{ metric_value(metric, preview.low) }} – {{ metric_value(metric, preview.high) }}
|
||
<span class="metric-preview-spark" aria-hidden="true">{{ preview.spark|safe }}</span>
|
||
</span>
|
||
{% endif %}
|
||
</div>
|
||
{% elif metric and resource %}
|
||
<p class="field-hint">No reading of this yet from {{ resource }}.</p>
|
||
{% endif %}
|