KitsNet Operations:Monitoring:MegaRAID Physical Drive IO Monitoring: Difference between revisions

Peter A. Smode (talk | contribs)
Created page with "= KitsNet Wort MegaRAID Physical Drive I/O Monitoring = '''Design and implementation guide''' · Revision 0.1 · 27 November 2026 · Proposed for construction {| class="wikitable" ! Page placement !! Service !! Target systems !! Validation state |- | Child of KitsNet Operations:Monitoring:Zabbix || Physical storage monitoring || <code>wort</code> (Agent 2) and <code>zaya</code> (Zabbix server and frontend) || Controller telemetry and discovery inputs verified. Temp..."
Tag: 2017 source edit
 
Peter A. Smode (talk | contribs)
No edit summary
Tag: 2017 source edit
Line 1: Line 1:
= KitsNet Wort MegaRAID Physical Drive I/O Monitoring =


'''Design and implementation guide''' · Revision 0.1 · 27 November 2026 · Proposed for construction
'''Design and implementation guide''' · Revision 0.1 · 27 November 2026 · Proposed for construction

Revision as of 11:59, 27 November 2026

Design and implementation guide · Revision 0.1 · 27 November 2026 · Proposed for construction

Page placement Service Target systems Validation state
Child of KitsNet Operations:Monitoring:Zabbix Physical storage monitoring wort (Agent 2) and zaya (Zabbix server and frontend) Controller telemetry and discovery inputs verified. Template, collector service, graphs and dashboard are proposed.

1 Purpose and operator view[edit | edit source]

An operator investigating a slow virtual disk needs to identify the physical disk involved, find its bay and parent virtual drive, and compare it with its peers. The proposed design polls controller 0 every five seconds, discovers its physical disks automatically, creates a graph set for each disk and shows all current disks on one host dashboard. The primary index is the physical drive's worldwide name (WWN). A replacement in the same bay receives a new history. A drive moved to another bay on the same host retains its history.

For example, Backups is MegaRAID virtual drive c0/v0. One member is WD serial WD-WCC7K4XNNX9H, WWN 50014ee2bcd3d6eb, enclosure 21, slot 14. The parent appears in Linux as /dev/sdb. Its partition supplies VG T3b and LV T3b/uv054-disk2. The operator should be able to start with any of these identifiers and find the physical disk. The counters measure work at that disk. Attributing that work to an individual guest or Linux LV requires counters at the corresponding higher layer.

2 Verified platform and sampling budget[edit | edit source]

Component Verified on 27 November 2026 Implementation consequence
Wort Broadcom/Avago MegaRAID SAS 9361-8i, controller 0, firmware package 24.21.0-0132. Twelve SATA HDDs and one CacheCade SATA SSD. Native per-drive counters are available on the installed firmware.
Legacy StorCLI /usr/local/sbin/storcli64, version 1.23.02. Its MegaCLI-compatible -DpmStat -Dsply interface returned live data. Pin this absolute path for DPM reads. The Zabbix service account successfully used non-interactive sudo for both reads with -NoLog.
Inventory StorCLI /opt/MegaRAID/storcli/storcli64, version 007.2612. Its JSON reports include physical identities and explicit virtual-drive membership. Its DPM query returned “DPM Feature is not supported” even with the legacy DPM setting ON. Use this binary for inventory. A generic controller capability flag is insufficient to confirm the DPM query path.
Monitoring Agent 2 on Wort and server/frontend on Zaya run 7.0.32. Wort's active endpoint is zabbix.lan.kitsnet.us. Target Zabbix 7.0 templates, dependent discovery, graph prototypes and template dashboards.
Test state DPM was restored to OFF. Disk reports can return retained values in this state. A valid sample requires both reports to say Performance Monitor: ON. Keep the existing SMART health checks.

The five-second test read ext and ra in sequence as zabbix. All 12 polls returned all 13 drives. Each pair took 39–45 ms elapsed and averaged 37 ms of CPU time, equivalent to 0.74% of one core or about 0.05% of the 16-CPU host. The backup volume sustained 111.8 MiB/s, compared with 111.6 MiB/s during 15-second polling. Average read latency was 1.74 and 1.58 ms respectively. The short test establishes feasibility during the observed backup workload. Sustained application tail latency and database retention cost require commissioning measurements.

The proposed collector also checks physical identities on either side of the two reads. Three four-command trials, with DPM OFF and retained reports, took 92–100 ms each including process startup. Budget and benchmark the complete collector with DPM ON during construction. The 37 ms CPU result covers the two live DPM reads only.

3 Collection and discovery architecture[edit | edit source]

Wort, five-second path                         Zaya, Zabbix 7.0
PDList → extended counters → running averages → PDList
    confirm identity, validate DPM, form intervals
    Agent 2 master kitsnet.megaraid.dpm ───────→ dependent metric prototypes
                                                        │
Wort, five-minute inventory                             ├── per-drive graph prototypes
    StorCLI physical + virtual JSON, LVM reports        └── template dashboard on Wort
    validate and atomically publish inventory
    Agent 2 master kitsnet.megaraid.inventory ─→ server-side LLD JavaScript
                                                └→ metadata and parent references

Only the two master items request data from Agent 2. Each DPM report covers all drives. The server or its assigned proxy runs low-level discovery (LLD), extracts values and instantiates prototypes. The slow inventory worker runs independently so an inventory scan cannot hold the five-second check open. One template link to the existing Wort host is sufficient.

3.1 Controller commands and privilege boundary[edit | edit source]

As an operator on Wort, enable DPM once at commissioning and verify the readback. Record the previous setting first. Monitoring reads have no reason to call the setter.

sudo -n /usr/local/sbin/storcli64 /c0 show dpm
sudo -n /usr/local/sbin/storcli64 /c0 set dpm=on
sudo -n /usr/local/sbin/storcli64 /c0 show dpm

The steady five-second path uses these calls in order. -NoLog suppresses the per-invocation CLI logfile.

sudo -n /usr/local/sbin/storcli64 -PDList -a0 -NoLog
sudo -n /usr/local/sbin/storcli64 -DpmStat -Dsply ext -a0 -NoLog
sudo -n /usr/local/sbin/storcli64 -DpmStat -Dsply ra  -a0 -NoLog
sudo -n /usr/local/sbin/storcli64 -PDList -a0 -NoLog

The inventory worker uses the following fixed read commands. Check the embedded Command Status.Status for Success and Controller for 0 before using Response Data. Check the legacy reports for Exit Code: 0x00 as well as the process exit status.

sudo -n /opt/MegaRAID/storcli/storcli64 /c0/eall/sall show all J
sudo -n /opt/MegaRAID/storcli/storcli64 /c0/vall show all J
sudo -n /opt/MegaRAID/storcli/storcli64 /c0 show eventloginfo J
lsblk --json --paths --output NAME,KNAME,PKNAME,TYPE,MAJ:MIN,WWN
sudo -n /usr/sbin/pvs --segments --reportformat json -o pv_name,vg_name,lv_name,lv_uuid
sudo -n /usr/sbin/lvs -a --segments --reportformat json -o vg_name,lv_name,lv_uuid,lv_path,segtype,devices

Use fixed argument lists, a fixed locale, an execution deadline and root-owned executable paths. An inventory systemd service may run these read commands as root and publish a group-readable file for Agent 2. For the fast path, permit only the exact read commands needed by zabbix if additional access is required. Revalidate under the running service's SELinux context during commissioning.

4 Drive identity and volume attribution[edit | edit source]

Field Rule Use in Zabbix
Physical key Normalize a valid 16-hex-digit ATA WWN to lowercase and prefix w_. If a disk genuinely lacks a WWN, use s_ plus the SHA-256 digest of the trimmed model, a NUL byte and the trimmed serial. Reject placeholder or duplicate identities. Immutable item-key argument on this host. Full WWN, serial and model remain searchable.
Controller address Preserve controller number, enclosure, slot and DID as separate values. Join both DPM reports to a confirmed physical identity using all available address fields. Bay, DID and parent names are labels. A moved disk can acquire new labels while keeping its item key.
Direct RAID parents For every /c0/vN, join its PDs for VD N list to the physical inventory by enclosure:slot and DID. Check DG against the DG/VD record. Preserve every match and the OS drive name when present. Display c0/vN Name. A parent-ID tag uses delimited tokens, e.g. |c0/v0|, for exact membership searches using “contains”.
CacheCade The SSD is a direct member of c0/v1 CacheCade_0. Cached VDs are consumers of that cache. Show the cache VD as its parent. A consumer list, if displayed, is a separate relationship.
Spare, unconfigured or unreported disk Keep each identifiable, inventory-visible disk in discovery. Allow an empty parent array for a spare/unassigned disk. Record the controller state and whether DPM reports a row. Display the role and a data-availability status. A missing row is unknown. A reported zero is a valid value.
Linux LVM Join each parent VD's OS disk to its partition/PV by Linux device identity. Collect the set of distinct LV UUIDs with extents on those PVs. Keep the full PV/VG/LV list in a text item for the physical disk. Avoid truncating a large VG into a tag or graph title.

For LVM, resolve device aliases by major:minor, identify partition parents from lsblk and group pvs rows by PV. Ignore free segments with empty LV names. For stacked LVs, resolve lvs segment dependencies recursively through component LVs to PVs, with a visited set. Retain direct and dependent roles in the metadata. Present an incomplete map as such if an unfamiliar segment type cannot be resolved. A Linux LV that spans RAID volumes can appear under multiple parents. Some parent VDs have no Linux LV. Linux names such as /dev/sdb are current observations and can change on boot.

4.1 Acceptance inventory from Wort[edit | edit source]

The build must discover these records from the controller. This table is a point-in-time comparison for the first import. It must never become a configured list of devices.

Bay DID Physical WWN Serial Direct RAID parent Linux disk / VG
21:13 17 5000c500ebb8561f WX11ZDP9 c0/v5 T1.1 /dev/sde / T1
21:14 14 50014ee2bcd3d6eb WD-WCC7K4XNNX9H c0/v0 Backups /dev/sdb / T3b
21:15 16 5001b448bc70bc7f 214101A000F1 c0/v1 CacheCade_0 Controller cache
21:16 12 5000cca095c3d53a VBG8ED1R c0/v4 T3.1 /dev/sdd / T3
21:17 20 5000c500e82d443a WRE0QHAB c0/v3 T1.0 /dev/sdc / T1
21:18 18 50014ee2bab34493 WD-WCC7K1JJ1DYX c0/v0 Backups /dev/sdb / T3b
21:19 15 50014ee216fddd9f WD-WX32D95FVCAC c0/v0 Backups /dev/sdb / T3b
21:21 19 50014ee2100846f2 WD-WCC7K3SJT2L8 c0/v0 Backups /dev/sdb / T3b
21:22 27 5000cca095dbba95 VBHYZZKF c0/v2 T3.0 /dev/sda / T3
22:16 25 5000cca095c3d2b9 VBG8DRBR c0/v4 T3.1 /dev/sdd / T3
22:17 24 5000c500ebb8d227 WX11ZSRK c0/v5 T1.1 /dev/sde / T1
22:18 23 5000c500e82d43dc WRE0PZBD c0/v3 T1.0 /dev/sdc / T1
22:19 26 5000cca095dba2c3 VBHYTMVF c0/v2 T3.0 /dev/sda / T3

5 Agent-side implementation specification[edit | edit source]

5.1 Inventory and replacement handling[edit | edit source]

  1. Run a boot-triggered and then five-minute inventory timer. Read the controller event-log sequence before and after both StorCLI inventory calls. When the sequence changes mid-scan, retry from the beginning with a bounded retry count. The verified JSON field is Newest Sequence Number. Also record the reboot sequence.
  2. Require a complete, internally consistent PD/VD inventory. Compare the physical summary keys with detailed records, validate unique identities and locations, and verify the member references. Publish by atomic rename on the same filesystem to /run/kitsnet-megaraid/inventory.json. Preserve the last good map on an error and expose the error and inventory age separately.
  3. On a five-second sample, read -PDList before and after ext/ra. Parse enclosure, slot, DID, WWN and drive sequence number. Compare the two observations and the cached identity. Quarantine changed, unknown or conflicting locations for that interval. Coalesce an inventory refresh request on an unknown or changed address. The periodic timer provides an independent retry.
  4. For a WWN-less drive, qualify a serial/model fallback using matching identity reads on both sides of the DPM sample (for SATA members, smartctl -j -i -d megaraid,DID /dev/bus/0). Cache the durable identity at discovery. A transiently missing WWN on a previously identified disk is an identity conflict. Suppress that disk's sample until it is resolved. The fallback's extra cost belongs in commissioning.
  5. Invalidate counter baselines on controller or agent restarts, changes to the physical identity map, and DPM disable/enable events. Never give a newly arrived drive the previous occupant's last reading. Reconfiguration of logical drives can change parent labels by the next successful inventory refresh.

5.2 Reference inventory normalizer[edit | edit source]

The following Python 3.9 function is the RAID part of the inventory producer. Pass it the checked Response Data objects for /c0/eall/sall and /c0/vall. It ran against Wort's reports and returned all 13 physical identities. The service wrapper adds capture time, LVM references, identity guard metadata and error reporting before publishing.

import hashlib
import re

def disk_key(wwn, model, serial):
    wwn = wwn.lower().removeprefix("0x")
    if re.fullmatch(r"[0-9a-f]{16}", wwn) and wwn not in {"0" * 16, "f" * 16}:
        return "w_" + wwn
    if not model or not serial or serial.upper() in {"N/A", "UNKNOWN", "NONE", "-"}:
        raise ValueError("missing durable disk identity")
    digest = hashlib.sha256((model + "\0" + serial).encode("utf-8")).hexdigest()
    return "s_" + digest

def inventory(pd_report, vd_report, controller="c0"):
    # Arguments are the checked Response Data objects for one controller.
    drives, by_location = {}, {}
    bays, dids, seen_paths = set(), set(), set()
    expected_paths = {k for k in pd_report if re.fullmatch(r"Drive /c\d+/e\d+/s\d+", k)}
    for label, detail in pd_report.items():
        match = re.fullmatch(r"Drive (/c\d+/e(\d+)/s(\d+)) - Detailed Information", label)
        if not match:
            continue
        path, eid, slot = match.groups()
        row = pd_report["Drive " + path][0]
        attrs = detail["Drive " + path + " Device attributes"]
        bay = eid + ":" + slot
        if path.split("/")[1] != controller or row["EID:Slt"] != bay:
            raise ValueError("inconsistent controller or bay")
        did = str(row["DID"])
        model = attrs["Model Number"].strip()
        serial = attrs["SN"].strip()
        wwn = str(attrs.get("WWN", "")).strip().lower().removeprefix("0x")
        key = disk_key(wwn, model, serial)
        loc = (bay, did)
        if key in drives or bay in bays or did in dids:
            raise ValueError("duplicate disk identity or address")
        bays.add(bay)
        dids.add(did)
        seen_paths.add("Drive " + path)
        size = re.fullmatch(r"(\d+)\s*B", attrs["Logical Sector Size"].strip())
        if not size or int(size[1]) < 1:
            raise ValueError("unknown logical sector size")
        drives[key] = dict(id=key, wwn=wwn if key.startswith("w_") else "",
                           serial=serial, model=model, controller=controller,
                           bay=bay, did=did, sector_bytes=int(size[1]),
                           dg=str(row["DG"]), state=row["State"], media=row["Med"],
                           parents=[])
        by_location[loc] = key

    for label, rows in vd_report.items():
        match = re.fullmatch(r"/" + re.escape(controller) + r"/v(\d+)", label)
        if not match:
            continue
        vd = match[1]
        row = rows[0]
        dg, reported_vd = row["DG/VD"].split("/")
        if vd != reported_vd:
            raise ValueError("inconsistent virtual drive identity")
        parent = dict(id=controller + "/v" + vd, name=row["Name"] or "VD" + vd,
                      raid=row["TYPE"], os=vd_report["VD" + vd + " Properties"]
                      .get("OS Drive Name", "N/A"))
        for member in vd_report["PDs for VD " + vd]:
            loc = (member["EID:Slt"], str(member["DID"]))
            drive = drives[by_location[loc]]
            if drive["dg"] != dg:
                raise ValueError("membership changed during inventory")
            if parent["id"] not in [p["id"] for p in drive["parents"]]:
                drive["parents"].append(parent)

    for drive in drives.values():
        drive["parents"].sort(key=lambda p: int(p["id"].split("/v")[1]))
        if drive["state"] == "Onln" and drive["dg"].isdigit() and not drive["parents"]:
            raise ValueError("online member has no virtual-drive mapping")
    if not drives or seen_paths != expected_paths:
        raise ValueError("empty or incomplete controller inventory")
    return dict(schema=1, complete=True, drives=drives)

5.3 Five-second sample and rate calculation[edit | edit source]

Parse ext by enclosure/slot/DID section. Its seven numeric columns, in order, are sectors read, sectors written, sectors written with Force Unit Access (FUA), read commands, write commands, write-FUA commands and flush commands. Parse each ra row as enclosure, slot, DID, aggregate IOPS, queue depth, transfer rate (MB/s) and response time (ms). Validate field counts, numeric ranges and unique addresses in each report. The two reports are successive controller snapshots; their values can represent different averaging intervals.

For each disk, keep the last accepted extended counters, current physical key, sequence, sector size and an acquisition timestamp from the host monotonic clock. Publish the counter baseline atomically, once per successful sample, under a nonblocking single-writer lock. Allow less than five seconds for all fast-path commands combined. On overlap, report a collection failure and preserve the baseline. Keep probes run manually for tests from modifying the production baseline.

elapsed_seconds = current.monotonic_time - previous.monotonic_time
read_iops       = change(read_commands) / elapsed_seconds
write_iops      = change(write_commands) / elapsed_seconds
read_Bps        = change(read_sectors) * sector_bytes / elapsed_seconds
write_Bps       = change(write_sectors) * sector_bytes / elapsed_seconds
response_ms     = running_average.response_time_ms
queue_depth     = running_average.queue_depth

Use the logical sector size of the physical member. The 13 verified members report 512 bytes. Preserve the separate FUA and flush counters in the master record. Label the two write rates as the native Write column. Validate the firmware's treatment of FUA before adding it to a combined write total. Read/write IOPS and bytes/s are interval rates. Response time and queue depth are firmware running averages. Wort reports up to 100 commands for this average, so a lightly used disk can represent a different time window.

An initial sample establishes a baseline. After a reboot, DPM transition, ambiguous identity, counter decrease/wrap, collector state loss, or interval longer than twice the configured poll period, clear the affected baseline and wait for two contiguous samples. Publish a gap for affected rates. On a failed command, DPM OFF, stale inventory beyond 15 minutes, or a missing disk row, record availability explicitly and omit invalid numbers. A genuine idle drive with unchanged, valid counters has zero rates. Retained data read while DPM is OFF is stale even when the CLI exits successfully.

5.4 JSON contracts and Agent 2 keys[edit | edit source]

The inventory envelope contains schema, complete, collected_at (Unix seconds), drives keyed by physical identity, and a separate LVM coverage status. Each drive adds an lvm array with PV, VG, LV name, LV UUID and relation. An empty array with complete coverage means “no mapped LV”. The inventory reader indicates failure if the cache is stale or corrupt. The LLD rule below consumes only a complete RAID inventory. Failure to resolve LVM updates the LVM status independently.

The example below shows one drive in a five-second master payload. The numbers illustrate the field types. In production expected counts eligible DPM members and reported counts validated members. Missing drives appear in status_by_id even when their metric record is absent.

{
  "schema": 1, "sampled_at": 1795796160, "ok": 1, "dpm_on": 1,
  "expected": 13, "reported": 13, "poll_ms": 96, "inventory_age_s": 42,
  "status_by_id": {"w_50014ee2bcd3d6eb": 1},
  "drives": {"w_50014ee2bcd3d6eb": {
    "read_iops": 62.2, "write_iops": 0, "read_Bps": 29320192,
    "write_Bps": 0, "response_ms": 1.613, "queue_depth": 0,
    "read_sectors": 1336328, "write_sectors": 0, "write_fua_sectors": 0,
    "read_ops": 1399, "write_ops": 0, "write_fua_ops": 0, "flush_ops": 0
  }}
}

Use two fixed Agent 2 user parameters. The proposed helper runs as zabbix. Its inventory mode reads the atomically published file, verifies freshness and outputs the envelope. Its sample mode performs the guarded DPM read. On DPM OFF return ok=0, dpm_on=0 and no numeric disk data. When the DPM state itself cannot be read, omit dpm_on, return ok=0 and a short diagnostic. For known eligible disks, return availability 0 on a global failure. Emit only JSON on standard output.

UserParameter=kitsnet.megaraid.inventory,/usr/local/libexec/kitsnet-megaraid inventory
UserParameter=kitsnet.megaraid.dpm,/usr/local/libexec/kitsnet-megaraid sample

6 Zabbix server implementation[edit | edit source]

Create template KitsNet MegaRAID physical drives by agent 2 in the same local template group as the existing KitsNet monitoring templates. Link it to the existing Wort host. Verify the Agent 2 active hostname matches that host's technical name. Keep all IDs, enclosure addresses and logical volume names out of template constants.

6.1 Master items, discovery and life cycle[edit | edit source]

Object Type / key Interval or master Information type and settings
Physical-drive inventory Zabbix agent (active) / kitsnet.megaraid.inventory 1m, cached inventory refreshed every 5m Text. Master history 0; the discovery rule, LVM items and inventory health use the incoming value.
Physical-drive DPM sample Zabbix agent (active) / kitsnet.megaraid.dpm 5s Text. Master history 0. The collector deadline must fit the agent/server item timeout. Expose a separate diagnostic text item if the master fails.
Discover MegaRAID physical drives Dependent discovery rule / kitsnet.megaraid.pd.discovery Inventory master JavaScript below, then Discard unchanged with heartbeat 1h. Disable lost resources after 1h, delete after 30d, subject to KitsNet retention policy.

A drive added just after an inventory scan should normally appear within about six minutes (five-minute scan plus one-minute master polling), plus server scheduling and agent active-check refresh where applicable. The new rates start on the next two valid samples. An inventory failure must fail discovery preprocessing; returning an empty successful list would mark every existing disk lost. Keep daily housekeeping and history-retention policies in mind when retiring disks.

6.2 Server-side discovery code[edit | edit source]

Paste this into the JavaScript preprocessing step of the dependent LLD rule. It runs in the Zabbix server or proxy preprocessing engine and returns a root array of native LLD macro objects. Sorting by physical key gives stable results for the heartbeat step. The code handles multiple RAID parents and unassigned members.

var root = JSON.parse(value);
if (root.schema !== 1 || root.complete !== true ||
        !root.drives || typeof root.drives !== 'object' || Array.isArray(root.drives)) {
    throw 'Incomplete physical-drive inventory';
}
var ids = Object.keys(root.drives).sort();
if (!ids.length) {
    throw 'Empty physical-drive inventory';
}
var rows = [];
for (var i = 0; i < ids.length; i++) {
    var key = ids[i];
    var d = root.drives[key];
    if (!/^(w_[a-f0-9]{16}|s_[a-f0-9]{64})$/.test(key) ||
            d.id !== key || !d.controller || !d.bay || !Array.isArray(d.parents)) {
        throw 'Invalid physical-drive identity or mapping';
    }
    var labels = [];
    var refs = [];
    for (var j = 0; j < d.parents.length; j++) {
        var parent = d.parents[j];
        if (!parent.id || !parent.name) {
            throw 'Incomplete virtual-drive reference';
        }
        labels.push(parent.id + ' ' + parent.name);
        refs.push(parent.id);
    }
    rows.push({
        '{#PDKEY}': key, '{#WWN}': d.wwn, '{#SERIAL}': d.serial,
        '{#DISPLAY}': d.serial || d.wwn, '{#MODEL}': d.model,
        '{#CTRL}': d.controller, '{#BAY}': d.bay, '{#DID}': String(d.did),
        '{#MEDIA}': d.media, '{#DG}': d.dg,
        '{#PARENTS}': labels.length ? labels.join(', ') : 'Unassigned (' + d.state + ')',
        '{#PARENTIDS}': refs.length ? '|' + refs.join('|') + '|' : '|'
    });
}
return JSON.stringify(rows);

6.3 Item prototypes and tags[edit | edit source]

Create the following item prototypes under the discovery rule. All are Dependent item. Use key prefix kitsnet.megaraid.pd. and append [{#PDKEY}]. For example, the full read-IOPS key is kitsnet.megaraid.pd.read_iops[{#PDKEY}]. A key's stable argument is the physical identity. Names and tags can change as discovery observes new locations and parent names.

For a fast numeric item the extraction path is $.drives['{#PDKEY}'].FIELD. Replace FIELD with the field in the table. Set JSONPath Custom on fail → Discard value for missing metrics. Rate calculation already took place against the collector's monotonic clock. Applying Change per second again would differentiate a rate a second time.

Key suffix / field Source master and preprocessing Value type / unit Purpose
read_iops, write_iops DPM / per-drive JSONPath Numeric (float), ops/s Two distinct items for read and write command rates.
read_Bps, write_Bps DPM / per-drive JSONPath Numeric (float), Bps Two distinct items for read and write bytes per second.
response_ms DPM / per-drive JSONPath Numeric (float), ms Controller running-average response time.
queue_depth DPM / per-drive JSONPath Numeric (float), no unit Controller running-average queue depth.
available DPM / $.status_by_id['{#PDKEY}'] Numeric (unsigned), value map 1 Reporting / 0 Unavailable Keep missing, disabled or stale data distinct from an idle disk. Use discard unchanged with a 1m heartbeat after extracting the status.
metadata Inventory / $.drives['{#PDKEY}'] Text, discard unchanged with a 1d heartbeat Full identity, bay, model, serial, sector size, direct RAID parents, Linux mappings and their coverage.

Name a read-IOPS item PD {#BAY} {#DISPLAY} / {#PARENTS} / Read IOPS. Use the corresponding metric label for the other prototypes. Apply the tags component=megaraid-pd, pd={#PDKEY}, serial={#SERIAL}, wwn={#WWN}, controller={#CTRL}, bay={#BAY}, parent_vd={#PARENTIDS}, media={#MEDIA} and a fixed metric tag for each type. Use metric=response_ms and metric=available exactly as specified for the dashboard. Search parent_vd with Contains and the token |c0/v0| to get all four backup members. For an unusually large parent list, keep the complete references in metadata and constrain the summary label/tag to Zabbix field limits.

Create controller-level dependent items on the DPM master for ok, dpm_on, expected, reported, poll_ms and inventory_age_s. Give these keys the prefix kitsnet.megaraid.collector. and use $.FIELD. Use numeric (unsigned) for status and counts, numeric (float) for durations; units ms or s as applicable. Add a diagnostic string and slow inventory/LVM coverage health. A per-disk available=0 on a known spare can be expected; flag missing reports for eligible online members.

Configure a controller collection problem on 30 seconds without a fresh ok item or persistent ok=0. For example, use nodata(/KitsNet MegaRAID physical drives by agent 2/kitsnet.megaraid.collector.ok,30s)=1 or max(/KitsNet MegaRAID physical drives by agent 2/kitsnet.megaraid.collector.ok,30s)=0. Alert on stale inventory over 15 minutes and on sustained eligible member count mismatch. Give per-drive availability triggers a dependency on the controller collection problem to avoid 13 duplicate events. Keep latency warning thresholds unset until normal ranges have been observed for the HDD and SSD workloads.

6.4 Reverse lookup from a Linux logical volume[edit | edit source]

Publish an lvs object in the slow inventory envelope. Build it from each drive's resolved lvm array. Use the LV UUID as the dictionary key and store vg, name, uuid, sorted unique physical keys, direct VD IDs and a last-resolved timestamp. For example, the index entry for T3b/uv054-disk2 should contain c0/v0 and all four Backups member WWNs. Resolve multiply mapped or stacked LVs before deduplicating. This permits a lookup by LV name in Latest data without tagging hundreds of physical metrics with that name.

Add a second dependent discovery rule, kitsnet.megaraid.lv.discovery, using the same inventory master. Apply the following JavaScript and Discard unchanged with heartbeat 1h. Publish lvm_complete=true only after the LVM map validates. An unavailable LVM scan should preserve the last known associations while physical-drive discovery continues.

var inv = JSON.parse(value);
if (inv.schema !== 1 || inv.complete !== true || inv.lvm_complete !== true ||
        !inv.lvs || typeof inv.lvs !== 'object' || Array.isArray(inv.lvs)) {
    throw 'Incomplete Linux LV index';
}
return JSON.stringify(Object.keys(inv.lvs).sort().map(function (uuid) {
    var lv = inv.lvs[uuid];
    if (!/^[A-Za-z0-9-]+$/.test(uuid) || lv.uuid !== uuid || !lv.vg || !lv.name) {
        throw 'Invalid Linux LV identity';
    }
    return {'{#LVUUID}': uuid, '{#VG}': lv.vg, '{#LVNAME}': lv.name};
}));

Under this rule, create the dependent text item prototype kitsnet.megaraid.lv.members[{#LVUUID}], named LV {#VG}/{#LVNAME} / physical drives. Its master is the inventory item. Use JSONPath $.lvs['{#LVUUID}'], retain on change with a daily heartbeat, and tag the item with vg, lv and lv_uuid. The reverse index adds zero controller queries.

6.5 History and sampling cost[edit | edit source]

At 13 drives, six performance metrics produce 78 numeric items, 15.6 new performance values/s and 1,347,840 values/day. Status, metadata and collector health are additional. Proposed starting retention is 7d of numeric history and 365d of hourly trends, subject to the Zaya database policy. Seven days is about 9.4 million performance samples before database compression or housekeeping. Preserve full resolution only where it serves diagnosis. Use 0 history on both raw master items and omit trends for text. Confirm global housekeeping overrides and database growth on Zaya before expanding retention.

7 Per-drive graphs and single-screen dashboard[edit | edit source]

Create graph prototypes inside the same discovery rule as the item prototypes. Use one graph per unit so latency remains legible during a high-throughput read. Include {#BAY} {#DISPLAY} / {#PARENTS} in each graph name. Include {#PDKEY} in the detailed graph name or description wherever the frontend supports it; the constituent item keys always carry it. Use a zero minimum and an automatic maximum. Read lines use blue (2563EB) and write lines use orange (D97706) throughout.

Graph prototype Item prototypes on left Y axis What to compare
PD {#BAY} {#DISPLAY} / {#PARENTS} / Operations read_iops, write_iops Read/write workload across mirrors or parity members.
PD {#BAY} {#DISPLAY} / {#PARENTS} / Throughput read_Bps, write_Bps Transfer rate at the physical disk.
PD {#BAY} {#DISPLAY} / {#PARENTS} / Response time response_ms Drill into the drive whose response time increased.
PD {#BAY} {#DISPLAY} / {#PARENTS} / Queue depth queue_depth Check for outstanding work at the same time.

Create the template dashboard MegaRAID physical drives. Link the template to Wort once. Open the inherited dashboard from Monitoring → Hosts → Wort → Dashboards. Use the dashboard time picker (default last 15 minutes). Select the graph prototype object when configuring each graph widget. Selecting an individual discovered graph would pin the dashboard to a single physical disk.

Dashboard page Native widgets and configuration Acceptance on Wort
All physical drives (default) A compact header shows collector state and reported/expected counts. Below it, two Honeycomb widgets share the remaining viewport, one for response time and one for reporting status. Each uses the template host context, item pattern PD *, item tag component=megaraid-pd and exactly one metric tag (response_ms or available). Primary label uses {ITEM.NAME}, secondary label uses the value. Use an explicit value map or labelled colors for availability. All 13 drive cells in the status view and all 13 reporting latency cells in one 1920×1080 kiosk viewport at 100% zoom, without scrolling, paging or a hidden-cell ellipsis. Status remains visible if a latency value ages out.
IOPS by drive One full-width Graph prototype widget, source Graph prototype, select the Operations prototype, set 4 columns × 4 rows, dashboard time period, legend hidden for the overview. Thirteen individually labelled mini-graphs on a single screen. Four members map to Backups and the cache SSD is labelled CacheCade_0.
Throughput by drive, Response time by drive, Queue depth by drive Three additional pages with one full-width 4 × 4 graph-prototype widget each, selecting the respective prototype. Use matching order and time period. Operators can compare siblings over the same time window or open the individual discovered graph at full size, with its legend.

Discovery populates both widget types automatically. The graph pages have 16 slots at the initial layout and Zabbix automatically pages the 17th graph. The default honeycombs reflow as the disk count grows; their capacity depends on widget dimensions and the frontend's 32-pixel minimum cell size. Validate that the overview fits the intended display after major expansion. Set a frontend refresh interval offered by 7.0, such as 10 seconds. The five-second agent sampling interval remains independent of browser refresh. For missing data, use the status panel and freshness trigger alongside the last displayed latency.

8 Construction, commissioning and recovery[edit | edit source]

8.1 Build sequence[edit | edit source]

  1. Package the collector, inventory worker, systemd service/timer and fixed Agent 2 include. Suggested names are /usr/local/libexec/kitsnet-megaraid, kitsnet-megaraid-inventory.service, kitsnet-megaraid-inventory.timer and /etc/zabbix/zabbix_agent2.d/kitsnet-megaraid.conf. Keep immutable code root-owned, cached inventory group-readable to zabbix and mutable baseline files in a separate directory writable by the collector.
  2. Create the 7.0 template in the Zabbix frontend in the order master items, health items, discovery rule, item prototypes, graph prototypes, dashboard, triggers. Use the JavaScript and table settings above. Export the complete template as Zabbix 7.0 YAML, including the template dashboard and prototype references. Preserve export UUIDs when revising it. Import first on a test host or test server; review the import diff before linking production.
  3. Enable and inspect the inventory service. Confirm all 13 physical keys, six parent VDs and the LVM relationship for T3b/uv054-disk2. Compare physical identities with the acceptance table. Reconcile by WWN if firmware or local enumeration has changed.
  4. Record the initial DPM setting, enable collection as an administrator, then verify Agent 2 permissions using its service account. Keep DPM setters outside the polling key. Validate both text keys and their JSON, then enable the five-second master. Sample test commands are shown below; during construction provide a non-mutating test mode or a separate baseline directory for manual checks.
  5. Allow discovery and two contiguous valid samples. Open Monitoring → Latest data, filter the physical key or parent tag, inspect one disk's graph set, and verify the host dashboard at the intended display resolution. Record template revision, command versions, expected count, retention policy and operators' acceptance in this page's revision history.
systemctl status kitsnet-megaraid-inventory.timer
sudo -u zabbix /usr/sbin/zabbix_agent2 -t kitsnet.megaraid.inventory
sudo -u zabbix /usr/sbin/zabbix_agent2 -t kitsnet.megaraid.dpm
sudo -n /usr/local/sbin/storcli64 -DpmStat -Dsply hist '-physdrv[21:14]' -a0 -NoLog

8.2 Acceptance tests[edit | edit source]

Test Expected result
Inventory and LLD Exactly 13 unique physical-key rows, 13 discovered metadata items, 78 performance items and 52 graphs (four per drive). Four HDD keys map to c0/v0 Backups. One SSD maps to c0/v1 CacheCade_0. The explicit WWN/serial pairs match the inventory.
Counters and units For two samples from an active backup disk, recompute read IOPS and bytes/s from raw deltas and elapsed seconds. Compare with the stored item values within rounding. Include 4 KiB sectors in fixtures, plus FUA and flush activity. RA response time is in ms.
Automatic additions In a fixture or test host add a 14th physical identity and a parent. One discovery cycle creates its metrics, tags and four graphs and adds it to the dashboard. Hardware changes on Wort are unnecessary for this test.
Move, swap and shared membership Move one WWN to a new bay and change its DID: keys and history persist. Replace the disk in its old bay with a new WWN: new history starts after the new baseline. A drive with two parent VDs appears once with both parent IDs. A spare appears with its role and empty parent list.
Lost/stale inventory Inject a bad JSON response, duplicate WWN, contradictory DID or incomplete VD membership. Last good inventory survives, affected data is withheld, and global discovery does not delete drives. LVM-only failure marks LVM coverage incomplete.
DPM OFF or reset Retained CLI output produces an unavailable status and gaps. On re-enable, counter wrap or collector restart, the first valid sample seeds a fresh baseline; no spike is emitted.
Dashboard and delivery At 1920×1080 all installed disks appear on the overview and IOPS graphs page. Check availability for an idle disk and a missing-report fixture. Confirm one Agent 2 fast request every five seconds and no per-drive shell executions for the WWN-equipped fleet.
Operational overhead Across a representative backup window and a busy VM workload, record guarded collector elapsed/CPU time, missed five-second intervals, Zabbix queue delay, DB history growth, and host/application latency including p95/p99 where available. Compare DPM OFF, ON with no polling and ON at 5s. Investigate material workload changes before acceptance.

8.3 Troubleshooting and rollback[edit | edit source]

  • The modern StorCLI reports DPM unsupported. Check the executable path. The successful combination on Wort is legacy StorCLI with -DpmStat -Dsply. Firmware updates are a separate maintenance decision.
  • The CLI returns figures that no longer move. Check the DPM header, expected/reported count, inventory age and sample timestamp. Compare counter deltas on an active member. A successful exit alone is insufficient.
  • A bay is associated with the wrong identity or volume. Inspect fresh PD/VD inventory and the two identity guards. Force an inventory refresh. Keep the affected disk unavailable until the join is unambiguous; historical records retain the old physical key.
  • Rollback. Disable the two master items or unlink the template while retaining history according to site policy. Stop the proposed inventory timer and remove the Agent 2 include through the normal change process. Restore the recorded DPM state; if the original state was OFF, run sudo -n /usr/local/sbin/storcli64 /c0 set dpm=off and verify /c0 show dpm. Verify controller and VD health and continued SMART health monitoring. Review history retention before any “unlink and clear” operation.

9 Document control[edit | edit source]

Revision Date Record
0.1 27 November 2026 Design for review. Live controller, inventory normalization and host polling measurements verified. Record the template export revision, production acceptance date and measured retention cost when the build is commissioned.

10 References[edit | edit source]