@daemonitor/plugins 1.1.9 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -204,11 +204,10 @@ async function snmpWalkIndexed(t, oid, timeout = 10000) {
|
|
|
204
204
|
async function collectQnap(t) {
|
|
205
205
|
const tempWarn = t.tempWarnC ?? 70;
|
|
206
206
|
const volWarn = t.volumeWarnPct ?? 90;
|
|
207
|
-
const [model, cpuTemp, sysTemp,
|
|
207
|
+
const [model, cpuTemp, sysTemp, cpuLoads, storDescrs, memTotal, memFree, fanSpeeds] = await Promise.all([
|
|
208
208
|
snmpGet(t, QNAP.model),
|
|
209
209
|
snmpGet(t, QNAP.cpuTemp),
|
|
210
210
|
snmpGet(t, QNAP.sysTemp),
|
|
211
|
-
snmpGet(t, QNAP.hdNumber),
|
|
212
211
|
snmpWalk(t, "1.3.6.1.2.1.25.3.3.1.2"), // hrProcessorLoad (per core)
|
|
213
212
|
snmpWalkIndexed(t, "1.3.6.1.2.1.25.2.3.1.3"), // hrStorageDescr
|
|
214
213
|
snmpGet(t, QNAP.memTotal),
|
|
@@ -227,26 +226,36 @@ async function collectQnap(t) {
|
|
|
227
226
|
? Math.round(((memTotalMB - memFreeMB) / memTotalMB) * 100) : undefined;
|
|
228
227
|
// Fans — each entry looks like "1835 RPM".
|
|
229
228
|
const fans = fanSpeeds.map((f) => parseNum(f)).filter((n) => n != null && n > 0);
|
|
230
|
-
// Disks —
|
|
231
|
-
//
|
|
232
|
-
//
|
|
233
|
-
//
|
|
234
|
-
// "
|
|
235
|
-
|
|
229
|
+
// Disks — walk each column of the disk table ONCE (6 small walks) rather than
|
|
230
|
+
// 6 gets × N bays. QNAP's SNMP agent is flaky under concurrent-get bursts and
|
|
231
|
+
// silently drops rows (partial reads that hid disks); a per-column walk is a
|
|
232
|
+
// single session each — far gentler and returns every populated row atomically.
|
|
233
|
+
// Presence keys on MODEL/CAPACITY ("--" = empty bay), so a FAILING disk
|
|
234
|
+
// (unreadable temp, negative status) is still reported, not mistaken for empty.
|
|
235
|
+
const DT = "1.3.6.1.4.1.24681.1.2.11.1."; // disk table columns: 2=descr 3=temp 4=status 5=model 6=capacity 7=smart
|
|
236
|
+
const [wStatus, wTemp, wSmart, wDescr, wModel, wCap] = await Promise.all([
|
|
237
|
+
snmpWalkIndexed(t, DT + "4"), snmpWalkIndexed(t, DT + "3"), snmpWalkIndexed(t, DT + "7"),
|
|
238
|
+
snmpWalkIndexed(t, DT + "2"), snmpWalkIndexed(t, DT + "5"), snmpWalkIndexed(t, DT + "6"),
|
|
239
|
+
]);
|
|
240
|
+
const col = (rows) => {
|
|
241
|
+
const m = {};
|
|
242
|
+
for (const r of rows)
|
|
243
|
+
m[r.idx] = r.val;
|
|
244
|
+
return m;
|
|
245
|
+
};
|
|
246
|
+
const cSt = col(wStatus), cTp = col(wTemp), cSm = col(wSmart), cDs = col(wDescr), cMd = col(wModel), cCap = col(wCap);
|
|
247
|
+
const slots = (Object.keys(cMd).length ? Object.keys(cMd) : Object.keys(cDs))
|
|
248
|
+
.sort((a, b) => Number(a) - Number(b));
|
|
236
249
|
const disks = [];
|
|
237
|
-
for (
|
|
238
|
-
const [
|
|
239
|
-
|
|
240
|
-
snmpGet(t, QNAP.hdDescr + i), snmpGet(t, QNAP.hdModel + i), snmpGet(t, QNAP.hdCapacity + i),
|
|
241
|
-
]);
|
|
242
|
-
const model = md && md !== "--" ? md : undefined;
|
|
243
|
-
const capacity = cap && cap !== "--" ? cap : undefined;
|
|
250
|
+
for (const i of slots) {
|
|
251
|
+
const model = cMd[i] && cMd[i] !== "--" ? cMd[i] : undefined;
|
|
252
|
+
const capacity = cCap[i] && cCap[i] !== "--" ? cCap[i] : undefined;
|
|
244
253
|
// Only a truly empty bay (no model AND no capacity) is skipped.
|
|
245
254
|
if (!model && !capacity)
|
|
246
255
|
continue;
|
|
247
|
-
const status =
|
|
248
|
-
const tempC = parseC(
|
|
249
|
-
disks.push({ slot: i, descr:
|
|
256
|
+
const status = cSt[i] != null ? Number(cSt[i]) : undefined;
|
|
257
|
+
const tempC = parseC(cTp[i] || null);
|
|
258
|
+
disks.push({ slot: Number(i), descr: cDs[i] || undefined, model, capacity, tempC, status, smart: cSm[i] && cSm[i] !== "--" ? cSm[i] : undefined });
|
|
250
259
|
}
|
|
251
260
|
// A present disk is bad only on a real error status, an explicitly-bad SMART
|
|
252
261
|
// verdict, or overheating — not a blank "--" or an empty bay.
|