diff --git a/CHANGELOG.md b/CHANGELOG.md index 65d7e71..f1165af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Phase 1 (NVIDIA through SNMP extend), first version 0.1.0. Not yet run on GPU ha ### Added +- GPU Operator realm and Operations page with current observations and personal acknowledgments. Existing administrators inherit Operator access; operators inherit monitoring access without configuration rights. + - Install, upgrade, disable, and uninstall through Cacti's Plugins page, refused with a message on PHP below 8.2. - GPU Nodes (GPU Admin), GPU Inventory and GPU Health (GPU View), each limited to devices the user may see. - GPU identity records keyed by vendor and UUID, with replacement detection, confirmed moves between nodes, absence after a configurable number of collections, and JSON export. diff --git a/README.md b/README.md index e1f1d3f..9077526 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,35 @@ + +[English](README.md) | [简体中文](docs/i18n/zh-CN/README.md) | [हिन्दी](docs/i18n/hi-IN/README.md) | [Español (España)](docs/i18n/es-ES/README.md) | [Español (Latinoamérica)](docs/i18n/es-419/README.md) | [العربية](docs/i18n/ar-SA/README.md) + + # plugin_gpu -A Cacti 1.2 plugin that brings per-GPU utilization, memory, temperature, power, ECC errors, XID errors, and throttling reasons from NVIDIA and AMD tools into Cacti. Each GPU becomes an index of a data query on its node's device, so GPU graphs sit next to the node's other graphs under Cacti's permissions, and Thold and Maint can alert on and suppress them. +A Cacti 1.2 plugin that brings per-GPU utilization, memory, temperature, power, ECC errors, and throttling reasons from NVIDIA tools into Cacti. AMD support and XID error collection are planned, not implemented. Each GPU becomes an index of a data query on its node's device, so GPU graphs sit next to the node's other graphs under Cacti's permissions, and Thold and Maint can alert on and suppress them. > **Status: in development, not released.** Milestone 4 makes phase 1 (NVIDIA through SNMP extend) code complete: collection, identity, graphs, throttle and ECC signals, Thold and Maint alerting, the health page, and the operator documentation. It has been run only against a real `snmpd` with a fake `nvidia-smi` printing synthetic output, never on GPU hardware. Still open before a release: pilots on real hardware ([docs/pilot-plan.md](docs/pilot-plan.md), #54), an external security review ([docs/security-review.md](docs/security-review.md)), fixtures captured from real tools (#14), and scale measured on production-sized hardware ([docs/performance.md](docs/performance.md)). XID errors wait on decision #8. Do not run it in production. +## Access roles + +| Realm | Access | +| --- | --- | +| GPU View | Existing monitoring pages. | +| GPU Operator | Monitoring plus the Operations page and personal triage acknowledgments. | +| GPU Admin | Operator access plus the existing configuration and administrative actions. | + +After copying upgrade files, open the Plugins page as an administrator to register +the new realm. Assign the Operator realm explicitly under **Configuration > Users** or user groups. +Upgrades retain the existing View and Admin realm IDs and grants. Admin access +inherits Operator access, and Operator access inherits View access on each request; +this does not add stored grants to users or groups. Plugin settings also require +GPU Admin access in addition to Cacti's Settings permission. + +Cacti device permissions still limit the rows and actions available to each user; unmapped objects require an administrator. +Credentials, configuration, mapping, deletion and other administrative changes +remain in the administrative pages. Acknowledgments last only in the current +user's session, for at most one hour and only while the same observation remains +fresh. New or changed observations invalidate them. They never mark a failed +measurement healthy or suppress alerts. + ## Why GPU nodes are usually already in Cacti for CPU, memory, and interfaces. GPU health is a separate question that the node's SNMP data does not answer: a card can be thermally throttled, accumulate ECC errors, or report an XID fault while the node itself looks healthy. Vendor tools report it (`nvidia-smi`, DCGM, `amd-smi`), but their output lives outside Cacti's graphs, permissions, and alerting. @@ -24,7 +50,7 @@ Out of scope: any command that changes a GPU or node (clocks, power limits, rese ## What milestone 4 adds - **Throttle reasons as alert values.** The clock event mask is decoded into one 0 or 1 indicator per reason; an unknown mask gives unknown indicators, never zeros, and bits without an indicator stay in the raw mask, which GPU Health shows. -- **ECC as alert values** ([docs/metrics.md](docs/metrics.md)). New corrected and uncorrected errors since the previous sample are computed by the plugin from two consecutive totals and stored as gauges: unknown for a first sample, a missed read, or a driver reload, so a reset never reads as zero or as a negative count. Retired single-bit and double-bit page counts and the ECC mode are read too. Two more graphs per GPU, ten in all, so Cacti stores them. XID is not collected: no source fits the fixed `nvidia-smi` commands (#8). +- **ECC as alert values** ([docs/metrics.md](docs/metrics.md)). New corrected and uncorrected errors since the previous sample are computed by the plugin from two consecutive totals and stored as gauges: unknown for a first sample, a missed read, or a driver reload, so a reset never reads as zero or as a negative count. Retired single-bit and double-bit page counts and the ECC mode are read too. Two additional ECC graphs per GPU let Cacti store them; with Power Percent, there are eleven graphs in all. XID is not collected: no source fits the fixed `nvidia-smi` commands (#8). - **Thold and Maint** ([docs/alerting.md](docs/alerting.md)). Shipped Thold templates for temperature, power against its limit, the throttle indicators, new uncorrected ECC errors, pending page retirement, and sample age. Every value is a gauge, because Thold 1.8.2 fails on an unknown counter. An end-to-end test with unchanged Thold 1.8.2 and Maint 1.3 shows each threshold fire and restore, across an ECC reset, and Maint suppress it. - **GPU Health** (GPU View). Per node: freshness, how the last collection ended, Maint state, backend, tool and driver versions, and GPU counts; per GPU: presence, sample age, ECC state, and the raw mask. It reads stored records only. - **Permissions.** The permission suite covers every page file and action, revocation on the next request, and refusals that disclose nothing. @@ -37,7 +63,7 @@ Out of scope: any command that changes a GPU or node (clocks, power limits, rese - **Collection through SNMP extend** ([ADR 0008](docs/decisions/0008-collect-through-snmp-extend.md)). The node's administrator adds two fixed `extend` lines to `snmpd.conf` ([docs/node-setup.md](docs/node-setup.md)); the plugin reads NET-SNMP-EXTEND-MIB through Cacti's SNMP functions with the device's own credentials, SNMPv3 recommended. It runs nothing on the Cacti server or the node. - **Strict parsing.** Fields are read by position, each line names its GPU by UUID, and a nonzero exit status, a timeout, truncated output, a line with the wrong field count, or merged error text fails the whole collection: values become `U`, no GPU is marked absent, and GPU Nodes shows why. - **A collector after each poller cycle.** It reads each enabled node's agent, updates the identity records, and caches the latest sample. The script server input reads only that cache, so a Cacti poll never waits on a GPU node. -- **Cacti objects** ([ADR 0010](docs/decisions/0010-attach-to-existing-node-devices.md)). The templates and the *GPU - Devices* data query ship as XML and are imported on install and upgrade. Saving a node attaches the data query to its existing device with reindex method None; GPU Nodes can create a device only when the node has none. Each GPU is an index keyed by vendor and UUID, with one data source shared by its Utilization, Memory, Temperature, Power, Clocks, Throttle, ECC Errors, and Sample Age graphs. Every model field is drawn by some graph, because Cacti stores only the fields a graph uses. The plugin reindexes after every GPU change, keeps a reindex Cacti skipped while the device was Down or disabled and runs it once the device is Up, and creates graphs for new GPUs. +- **Cacti objects** ([ADR 0010](docs/decisions/0010-attach-to-existing-node-devices.md)). The templates and the *GPU - Devices* data query ship as XML and are imported on install and upgrade. Saving a node attaches the data query to its existing device with reindex method None; GPU Nodes can create a device only when the node has none. Each GPU is an index keyed by vendor and UUID, with one data source shared by its Utilization, Memory, Temperature, Power, Power Percent, Clocks, Throttle, ECC Errors, New ECC Errors, Retired Pages, and Sample Age graphs. Every model field is drawn by some graph, because Cacti stores only the fields a graph uses. The plugin reindexes after every GPU change, keeps a reindex Cacti skipped while the device was Down or disabled and runs it once the device is Up, and creates graphs for new GPUs. - **History stays with the card.** An absent GPU stays an index, so its graphs show a gap and resume in the same RRD file when it returns. A replacement card in the same slot gets its own data source. **Remove from Data Query** on the node's page takes an absent GPU out of the listing; its RRD files and graphs are kept until you delete them. - **Device permissions on GPU Nodes.** A GPU Admin sees, changes, exports, and moves only nodes and GPUs on devices they may see in Cacti; a GPU move needs both nodes. A node whose device was deleted can only be disabled. - **The common metric model** ([ADR 0009](docs/decisions/0009-common-metric-core-with-vendor-extensions.md), [docs/metrics.md](docs/metrics.md)). Memory is in bytes, the clock event mask is decoded into `thr_*` indicators, and `age` is the age of the GPU's own sample time, or `U` when unknown. @@ -48,7 +74,7 @@ The installing (web server) user must be able to write `/resource/script_ - **A guarded install.** On PHP below 8.2, install and enable are refused with a message naming the required version, and the rest of Cacti keeps working. `setup.php` and the page scripts parse on PHP 8.0. - **Lifecycle.** Install, upgrade, disable, and uninstall through Cacti's Plugins page. Upgrades are ordered, finish after an interruption, and change the recorded version only after they succeed. Uninstall keeps the plugin's tables unless you clear *Keep Plugin Tables on Uninstall*; it never touches a Cacti device, data source, graph, or RRD file. -- **Two realms.** *GPU Admin* opens **GPU Nodes**, where you register Cacti devices as GPU nodes, confirm or reject GPU moves between nodes, and export every record as JSON. *GPU View* opens **GPU Inventory**, which lists GPUs only on devices the viewer may see. Both pages are under Management, and every change is a POST checked by csrf-magic. +- **Separate realms.** *GPU Admin* opens **GPU Nodes**, where you register Cacti devices as GPU nodes, confirm or reject GPU moves between nodes, and export every record as JSON. *GPU View* opens **GPU Inventory**, which lists GPUs only on devices the viewer may see. Both pages are under Management, and every change is a POST checked by csrf-magic. - **GPU identity records.** Each GPU is keyed by vendor and UUID. Index, PCI bus ID, name, driver, and the reporting tool are attributes that change in place. A new UUID in a known slot is flagged as a possible replacement and starts its own history; a GPU seen at another node moves only when an operator confirms; a GPU missing from successful collections is marked absent after a configurable count and never deleted. Only NVIDIA whole-GPU UUIDs are accepted for now; MIG instances wait on decision #13, and AMD on research #19. The rules are exercised by fixture sequences, since no collector feeds them yet. - **Tests and CI.** Unit and source-rule suites with no GPU or database, lifecycle and page-permission checks against Cacti 1.2.31 and current 1.2.x on PHP 8.2 to 8.5, a PHP 8.1 refusal job, a PHP 8.0 lint of the entry points, PHPStan at level 9, and REUSE. The harness is provisional until #12 is decided. @@ -58,7 +84,7 @@ These steps install the current code to try it; [docs/operations.md](docs/operat 1. Copy the repository to `plugins/gpu` under your Cacti directory. The directory must be named `gpu`. 2. In Cacti, open **Configuration > Plugins**, then install and enable **GPU**. -3. Give users the *GPU View* or *GPU Admin* realm under **Configuration > Users**. The installing user gets both. +3. Give users the *GPU View*, *GPU Operator*, or *GPU Admin* realm under **Configuration > Users**, according to their role. The installing user receives View and Admin; Admin includes Operator access. 4. Set up each GPU node's SNMP agent as described in [docs/node-setup.md](docs/node-setup.md), then add the node under **Management > GPU Nodes**. 5. For alerts, import the shipped Thold templates as [docs/alerting.md](docs/alerting.md) describes. 6. Optionally adjust **Configuration > Settings > GPU**: *Mark Absent After* (default 3 successful collections, from 1 to 100), *Stale After* (how old a sample may be before its values print `U`), and *Keep Plugin Tables on Uninstall* (default on). diff --git a/docs/PLAN.md b/docs/PLAN.md index 362deb9..37e7b10 100644 --- a/docs/PLAN.md +++ b/docs/PLAN.md @@ -350,7 +350,7 @@ Plugin code is object-oriented wherever Cacti's plugin contract allows it. Cacti - Classes live in `lib/*.php` under the `Somethingwithproof\Gpu` namespace (provisional until the repository home and name are decided in #11; `Cacti\Gpu` if the plugin moves to the Cacti organization), one class per file, loaded by a small `spl_autoload_register()` loader registered only after the PHP version check. No Composer runtime dependency. Files stay at depth 2 or less because the gettext build and the POT check scan with `find . -maxdepth 2`. - Settings use the `config_settings` hook. Logging uses `cacti_log()` with a `GPU` tag. Forms rely on csrf-magic. - Strings use the `gpu` text domain with a `locales/` directory and a POT file. -- Realms: "GPU View" and "GPU Admin", each a list of page files. +- Realms: "GPU View", "GPU Operator" and "GPU Admin", each a list of page files. **Classes.** Milestone 2 settled the first set; the rest of the table is planned. diff --git a/docs/i18n/ar-SA/README.md b/docs/i18n/ar-SA/README.md new file mode 100644 index 0000000..14aac4a --- /dev/null +++ b/docs/i18n/ar-SA/README.md @@ -0,0 +1,146 @@ + + + +[English](../../../README.md) | [简体中文](../zh-CN/README.md) | [हिन्दी](../hi-IN/README.md) | [Español (España)](../es-ES/README.md) | [Español (Latinoamérica)](../es-419/README.md) | [العربية](README.md) + + + +# plugin_gpu + +ملحق لـ Cacti 1.2 يجلب استخدام كل GPU وذاكرته وحرارته وقدرته وأخطاء ECC وأسباب خفض الأداء من أدوات NVIDIA إلى Cacti. دعم AMD وجمع أخطاء XID مخططان، ولم يُنفذا بعد. يصبح كل GPU فهرسًا لاستعلام بيانات على جهاز عقدته، فتظهر رسومه بجوار رسوم العقدة الأخرى ضمن صلاحيات Cacti، ويمكن لـ Thold وMaint إطلاق التنبيهات وكتمها. + +> **الحالة: قيد التطوير، لم يصدر بعد.** يكمل المعلم 4 شيفرة المرحلة 1 (NVIDIA عبر SNMP extend): الجمع والهوية والرسوم وإشارات خفض التردد وECC وتنبيه Thold وMaint وصفحة الصحة ووثائق المشغّل. لم يُشغّل إلا مع `snmpd` حقيقي و`nvidia-smi` محاكى يطبع خرجًا اصطناعيًا، ولم يُشغّل قط على عتاد GPU. ما يزال مطلوبًا قبل الإصدار: تجارب على عتاد حقيقي ([docs/pilot-plan.md](../../pilot-plan.md)، #54)، ومراجعة أمنية خارجية ([docs/security-review.md](../../security-review.md))، وعينات ملتقطة من أدوات حقيقية (#14)، وقياس الحجم على عتاد بحجم الإنتاج ([docs/performance.md](docs/performance.md)). تنتظر أخطاء XID القرار #8. لا تستخدمه في الإنتاج. + + +## أدوار الوصول + +| المجال | الوصول | +| --- | --- | +| GPU View | صفحات المراقبة الحالية. | +| GPU Operator | المراقبة إضافةً إلى صفحة العمليات وإقرارات الفرز الشخصية. | +| GPU Admin | وصول Operator إضافةً إلى الإعداد والإجراءات الإدارية الحالية. | + +بعد نسخ ملفات الترقية، افتح صفحة الملحقات كمسؤول لتسجيل المجال الجديد. عيّن مجال Operator صراحةً ضمن **الإعداد > المستخدمون** أو مجموعات المستخدمين. تحتفظ الترقيات بمعرّفات مجالي View وAdmin ومنحهما الحاليين. يرث Admin وصول Operator، ويرث Operator وصول View في كل طلب؛ ولا يضيف ذلك منحًا مخزنة للمستخدمين أو المجموعات. تتطلب إعدادات الملحق وصول GPU Admin إضافةً إلى صلاحية Settings في Cacti. + +تظل صلاحيات أجهزة Cacti تحدّ الصفوف والإجراءات المتاحة لكل مستخدم؛ وتتطلب الكائنات غير المربوطة مسؤولًا. تبقى بيانات الاعتماد والإعداد والربط والحذف والتغييرات الإدارية الأخرى في الصفحات الإدارية. تستمر الإقرارات في جلسة المستخدم الحالي فقط، لمدة ساعة كحد أقصى وطالما بقيت الملاحظة نفسها حديثة. تبطلها الملاحظات الجديدة أو المتغيرة. لا تجعل القياس الفاشل سليمًا ولا تكبت التنبيهات مطلقًا. + + +## الدافع + +تكون عقد GPU عادةً موجودة بالفعل في Cacti لمراقبة CPU والذاكرة والواجهات. صحة GPU مسألة أخرى لا تجيب عنها بيانات SNMP للعقدة: قد تُخفض سرعة بطاقة بسبب الحرارة أو تتراكم أخطاء ECC أو يُبلّغ عطل XID بينما تبدو العقدة نفسها سليمة. تبلّغ أدوات الشركات ذلك (`nvidia-smi` وDCGM و`amd-smi`)، لكن خرجها خارج رسوم Cacti وصلاحياته وتنبيهاته. + +يسد الملحق هذه الفجوة بتحويل خرج أدوات الشركات إلى مصادر بيانات Cacti، بمفاتيح تعتمد هوية كل GPU لا موضعها، كي لا تربط إعادة تشغيل تغيّر ترتيب GPU تاريخ بطاقة بأخرى. يعيد استخدام رسوم Cacti وصلاحياته ومجمّعاته البعيدة وThold وMaint بدل بناء نسخ موازية منها. + + +## النطاق المخطط + +| المرحلة | النطاق | المعالم | +|---|---|---| +| 0، البحث | خرج أدوات الشركات وإشارات XID وخفض التردد وهوية GPU والامتيازات وقرار مسار الجمع | [M1](https://github.com/somethingwithproof/plugin_gpu/milestone/1) | +| 1، nvidia | جمع `nvidia-smi`، وجرد حسب UUID، ورسوم، وإشارات خفض التردد وECC وXID، وThold وMaint، وصفحة الصحة | [M2](https://github.com/somethingwithproof/plugin_gpu/milestone/2)، [M3](https://github.com/somethingwithproof/plugin_gpu/milestone/3)، [M4](https://github.com/somethingwithproof/plugin_gpu/milestone/4) | +| 2، الواجهات الخلفية | واجهة DCGM وواجهة `amd-smi` | [M5](https://github.com/somethingwithproof/plugin_gpu/milestone/5) | +| 3، MIG والبعيد | مثيلات MIG ومجمّعات بيانات Cacti البعيدة | [M6](https://github.com/somethingwithproof/plugin_gpu/milestone/6) | + +خارج النطاق: أي أمر يغيّر GPU أو العقدة (الساعات وحدود الطاقة وإعادة الضبط وتخطيط MIG)، ومحرك تنبيه خاص بالملحق، وخدمة خلفية أو بروتوكول شبكي مخصص، ومحاسبة المجدول أو المهام. راجع الخطة لقائمة البحث المتبقية. + + +## ما يضيفه المعلم 4 + +- **أسباب خفض التردد كقيم تنبيه.** يُفك قناع أحداث الساعة إلى مؤشر 0 أو 1 لكل سبب؛ يعطي القناع المجهول مؤشرات مجهولة لا أصفارًا، وتبقى البتات بلا مؤشر في القناع الخام الذي تعرضه صحة GPU. +- **ECC كقيم تنبيه** ([docs/metrics.md](docs/metrics.md)). يحسب الملحق الأخطاء المصحّحة وغير المصحّحة الجديدة منذ العينة السابقة من مجموعين متتاليين، ويخزنها كقيم gauge: مجهولة لأول عينة أو قراءة مفقودة أو إعادة تحميل برنامج التشغيل، فلا تظهر إعادة الضبط كصفر أو عدد سالب. تُقرأ أيضًا أعداد الصفحات المحالة إلى التقاعد بعد أخطاء أحادية وثنائية البت ووضع ECC. يتيح رسمان إضافيان لأخطاء ECC لكل GPU تخزينها في Cacti؛ ومع رسم نسبة الطاقة يصبح الإجمالي أحد عشر رسمًا. لا يُجمع XID: لا مصدر يناسب أوامر `nvidia-smi` الثابتة (#8). +- **Thold وMaint** ([docs/alerting.md](docs/alerting.md)). قوالب Thold مرفقة للحرارة والطاقة نسبةً إلى حدها ومؤشرات خفض التردد وأخطاء ECC غير المصحّحة الجديدة وانتظار تقاعد الصفحات وعمر العينة. كل قيمة gauge لأن Thold 1.8.2 يفشل مع عداد مجهول. يبيّن اختبار شامل مع Thold 1.8.2 وMaint 1.3 دون تعديل تشغيل كل عتبة واستعادتها عبر إعادة ضبط ECC وكبتها بواسطة Maint. +- **صحة GPU** (GPU View). لكل عقدة: الحداثة ونتيجة آخر جمع وحالة Maint وإصدارات الواجهة الخلفية والأداة وبرنامج التشغيل وأعداد GPU؛ ولكل GPU: الوجود وعمر العينة وحالة ECC والقناع الخام. تقرأ السجلات المخزنة فقط. +- **الصلاحيات.** تغطي مجموعة اختبارات الصلاحيات كل ملف صفحة وإجراء، وسحب الصلاحية في الطلب التالي، ورفضًا لا يكشف أي معلومات. +- **تأهيل الفشل والاستعادة.** تُعطّل تشغيلات شاملة مبرمجة الوكيل وبيانات الاعتماد والأداة وخرجها واتصال قاعدة البيانات وكتابة RRD، وتستعيد قاعدة البيانات من تفريغ، بما فيه تفريغ أقدم من ملفات RRD؛ ولا ترث GPU جديدة ملف RRD لأخرى مطلقًا ([docs/backup.md](docs/backup.md)). +- **الحجم** ([docs/performance.md](docs/performance.md)). يقيس اختبار الحجم أزمنة الجمع وإدخال خادم السكربت وإنشاء كائنات Cacti ودورة المستطلع وصفحة الصحة لعدد GPU محدد؛ يشغله CI عند 100 GPU. لم تُسجل قياسات 1,000 و8,000 GPU بعد، لذا لا يُعلن عدد GPU مدعوم. +- **وثائق المشغّل** ([docs/operations.md](docs/operations.md)): التثبيت والترقية والإزالة وأقل الامتيازات والقيم غير المتاحة واستكشاف الأخطاء. التغييرات في [CHANGELOG.md](../../../CHANGELOG.md). + + +## ما يضيفه المعلم 3 + +- **الجمع عبر SNMP extend** ([ADR 0008](../../decisions/0008-collect-through-snmp-extend.md)). يضيف مسؤول العقدة سطري `extend` ثابتين إلى `snmpd.conf` ([docs/node-setup.md](docs/node-setup.md))؛ ويقرأ الملحق NET-SNMP-EXTEND-MIB عبر دوال SNMP في Cacti ببيانات اعتماد الجهاز نفسه؛ ويوصى بـSNMPv3. لا يشغّل شيئًا على خادم Cacti أو العقدة. +- **تحليل صارم.** تُقرأ الحقول حسب الموضع وتسمّي كل سطر GPU بواسطة UUID؛ وتفشل عملية الجمع كاملةً عند حالة خروج غير صفرية أو انتهاء مهلة أو خرج مبتور أو عدد حقول خاطئ أو نص خطأ مدمج: تصبح القيم `U`، ولا تُعلّم GPU غائبة، وتعرض عقد GPU السبب. +- **مجمّع بعد كل دورة مستطلع.** يقرأ وكيل كل عقدة مفعّلة ويحدّث سجلات الهوية ويخزّن آخر عينة مؤقتًا. يقرأ إدخال خادم السكربت هذه الذاكرة فقط، فلا ينتظر استطلاع Cacti عقدة GPU مطلقًا. +- **كائنات Cacti** ([ADR 0010](../../decisions/0010-attach-to-existing-node-devices.md)). تُرفق القوالب واستعلام *GPU - Devices* كـXML وتُستورد عند التثبيت والترقية. يربط حفظ العقدة الاستعلام بجهازها الحالي بطريقة إعادة فهرسة None؛ ولا تستطيع عقد GPU إنشاء جهاز إلا إذا لم تملك العقدة جهازًا. كل GPU فهرس بمفتاح الشركة وUUID، مع مصدر بيانات واحد تشترك فيه رسوم الاستخدام والذاكرة والحرارة والطاقة ونسبة الطاقة والساعات وخفض التردد وأخطاء ECC وأخطاء ECC الجديدة والصفحات المتقاعدة وعمر العينة. يُرسم كل حقل نموذج في رسم ما، لأن Cacti لا يخزّن إلا حقولًا تستخدمها الرسوم. يعيد الملحق الفهرسة بعد كل تغيير GPU، ويحتفظ بإعادة فهرسة تخطاها Cacti حين كان الجهاز متوقفًا أو معطّلًا وينفذها عندما ينشط، وينشئ رسوم GPU الجديدة. +- **يبقى التاريخ مع البطاقة.** تظل GPU الغائبة فهرسًا، فتظهر فجوة في رسومها وتستأنف في ملف RRD نفسه عند عودتها. تحصل البطاقة البديلة في الفتحة نفسها على مصدرها الخاص. يزيل **إزالة من استعلام البيانات** على صفحة العقدة GPU الغائبة من القائمة؛ تبقى ملفات RRD ورسومها حتى تحذفها. +- **صلاحيات الأجهزة في عقد GPU.** لا يرى GPU Admin ولا يغيّر ولا يصدّر ولا ينقل إلا عقد وGPU أجهزة يجوز له رؤيتها في Cacti؛ ويتطلب نقل GPU كلا العقدتين. العقدة التي حُذف جهازها لا يمكن إلا تعطيلها. +- **نموذج المقاييس المشترك** ([ADR 0009](../../decisions/0009-common-metric-core-with-vendor-extensions.md)، [docs/metrics.md](docs/metrics.md)). الذاكرة بالبايت، ويُفك قناع أحداث الساعة إلى مؤشرات `thr_*`، و`age` عمر وقت العينة الخاصة بـGPU، أو `U` عند الجهل به. + +يجب أن يستطيع مستخدم التثبيت (خادم الويب) الكتابة إلى `/resource/script_server/` حيث يضع الملحق XML استعلام البيانات؛ وإلا يتوقف التثبيت والترقية برسالة ويعيدان المحاولة لاحقًا. لا تزيل الإزالة القوالب وXML إلا عند تحديد *إزالة كائنات Cacti الخاصة بالملحق عند الإزالة*، ولا تحذف ملفات RRD أو الأجهزة أو الرسوم أو مصادر البيانات مطلقًا ([docs/operations.md](docs/operations.md#uninstall)). لا تُجمع عقد المجمّعات البعيدة حتى المرحلة 3. + + +## ما يقدمه المعلم 2 + +- **تثبيت محمي.** على PHP أقل من 8.2 يُرفض التثبيت والتفعيل برسالة تحدد الإصدار المطلوب ويستمر باقي Cacti بالعمل. يمكن تحليل `setup.php` وسكربتات الصفحات على PHP 8.0. +- **دورة الحياة.** التثبيت والترقية والتعطيل والإزالة عبر صفحة ملحقات Cacti. الترقيات مرتبة وتكتمل بعد الانقطاع ولا تغيّر الإصدار المسجل إلا عند نجاحها. تحتفظ الإزالة بجداول الملحق ما لم تُلغِ *الاحتفاظ بجداول الملحق عند الإزالة*؛ ولا تمس جهاز Cacti أو مصدر بيانات أو رسمًا أو ملف RRD مطلقًا. +- **مجالات منفصلة.** يفتح *GPU Admin* صفحة **عقد GPU** لتسجيل أجهزة Cacti كعقد GPU وتأكيد نقل GPU بين العقد أو رفضه وتصدير كل سجل كـJSON. يفتح *GPU View* **جرد GPU** الذي يسرد GPU على أجهزة يمكن للمشاهد رؤيتها فقط. الصفحتان تحت الإدارة، وكل تغيير طلب POST يفحصه csrf-magic. +- **سجلات هوية GPU.** مفتاح كل GPU هو الشركة وUUID. الفهرس ومعرّف ناقل PCI والاسم وبرنامج التشغيل وأداة الإبلاغ سمات تتغير في موضعها. يُعلّم UUID جديد في فتحة معروفة كبديل محتمل ويبدأ تاريخه الخاص؛ ولا تُنقل GPU مرصودة على عقدة أخرى إلا بتأكيد المشغّل؛ وتُعلّم GPU المفقودة من جمع ناجح غائبة بعد عدد قابل للضبط ولا تُحذف مطلقًا. لا تُقبل حاليًا إلا UUID لوحدات NVIDIA الكاملة؛ تنتظر مثيلات MIG القرار #13، وAMD البحث #19. تُختبر القواعد بتسلسلات عينات، إذ لا يوجد مجمّع يغذيها بعد. +- **الاختبارات وCI.** مجموعات وحدة وقواعد مصدر دون GPU أو قاعدة بيانات، وفحوص دورة الحياة وصلاحيات الصفحات على Cacti 1.2.31 و1.2.x الحالي مع PHP 8.2 إلى 8.5، ومهمة رفض PHP 8.1، وفحص صياغة نقاط الدخول على PHP 8.0، وPHPStan بالمستوى 9 وREUSE. بيئة الاختبار مؤقتة حتى يُحسم #12. + + +### التثبيت للتقييم + +تثبّت الخطوات التالية الشيفرة الحالية لتجربتها؛ الدليل الكامل في [docs/operations.md](docs/operations.md). تتطلب Cacti 1.2.31 أو أحدث على PHP 8.2 أو أحدث. + +1. انسخ المستودع إلى `plugins/gpu` تحت دليل Cacti. يجب أن يُسمّى الدليل `gpu`. +2. في Cacti، افتح **الإعداد > الملحقات** ثم ثبّت **GPU** وفعّله. +3. امنح المستخدمين نطاق *GPU View* أو *GPU Operator* أو *GPU Admin* ضمن **الإعدادات > المستخدمون** بحسب دورهم. يحصل مستخدم التثبيت على View وAdmin؛ ويشمل Admin وصول Operator. +4. اضبط وكيل SNMP لكل عقدة كما في [docs/node-setup.md](docs/node-setup.md)، ثم أضفها ضمن **الإدارة > عقد GPU**. +5. للتنبيهات، استورد قوالب Thold المرفقة كما في [docs/alerting.md](docs/alerting.md). +6. اختياريًا اضبط **الإعداد > الإعدادات > GPU**: *تعليم الغياب بعد* (افتراضيًا 3 عمليات جمع ناجحة، من 1 إلى 100)، و*التقادم بعد* (عمر العينة قبل عرض القيم `U`)، و*الاحتفاظ بجداول الملحق عند الإزالة* (مفعّل افتراضيًا). + + +## كيف تصل المقاييس إلى Cacti + +اختار القرار [#7](https://github.com/somethingwithproof/plugin_gpu/issues/7) SNMP `extend` ([ADR 0008](../../decisions/0008-collect-through-snmp-extend.md)): يشغّل وكيل العقدة أمر `nvidia-smi` ثابتًا ويقرأ الملحق النتيجة فقط. تقارن الخطة الخيارات تحت [مسارات الجمع](../../PLAN.md#collection-paths). + + +## أهداف التوافق + +| المكوّن | الهدف | +|---|---| +| Cacti | 1.2.31 أو أحدث، دون ترقيعات للنواة | +| PHP | 8.2 أو أحدث؛ يبقى `setup.php` قابلًا للتحليل على 8.0 كي يُرفض وقت التشغيل غير المدعوم بدل تعطيل واجهة Cacti | +| NVIDIA | خطوط برامج التشغيل والأدوات يحددها البحث [#26](https://github.com/somethingwithproof/plugin_gpu/issues/26)؛ فُحصت معرّفات حقول DCGM عند v3.3.9 وv4.7.0 | +| AMD | `amd-smi` على إصدارات ROCm يحددها البحث [#26](https://github.com/somethingwithproof/plugin_gpu/issues/26) | +| Thold وMaint | Thold 1.8.2 وMaint 1.3 دون تعديل، باختبار شامل ([docs/alerting.md](docs/alerting.md)) | + + +## التصميم + +- [docs/PLAN.md](../../PLAN.md) الخطة الكاملة: المعمارية والحقائق المعتمدة من المشاريع الأصلية (بمصادرها) ونموذج الهوية وحدود الأمان وحسابات الأداء والاختبار والمخاطر. +- يحوي [docs/decisions/](../../decisions) سجلات القرارات المعمارية المتخذة. +- يربط [docs/REQUIREMENTS.md](../../REQUIREMENTS.md) كل معرّف متطلب بقضيته. + +```mermaid +flowchart LR + NODE[GPU node: snmpd extend running nvidia-smi] -->|SNMP reads, v3 recommended| C[Collector] + C --> CACHE[(Plugin cache keyed by GPU UUID)] + CACHE --> SS[Script server data query input] + SS --> RRD[(Cacti RRD files, one data source per GPU)] + SS -->|poller_output| T[Thold and Maint] + RRD --> G[Cacti graphs and permissions] +``` + + +## كيفية تتبع العمل + +- تتبع **المعالم** معالم الخطة. لكل منها قضية ملحمية تسرد قضاياها الفرعية وأدلة الإكمال. +- تُصنّف **القضايا** بالوسوم: `type: requirement` و`type: research` و`type: decision` و`type: epic`. تذكر قضايا المتطلبات متطلبات مرقمة قابلة للاختبار (`REQ-AREA-NNN`) ومعايير قبول. +- تحمل **الوسوم** أيضًا `area:` و`phase:` و`priority:` و`status:`. راجع [CONTRIBUTING.md](../../../CONTRIBUTING.md#labels). +- تعرض [لوحة المشروع](https://github.com/users/somethingwithproof/projects/9) جميع القضايا عبر المعالم. + + +## المساهمة + +اقرأ [CONTRIBUTING.md](../../../CONTRIBUTING.md). تتطلب الالتزامات توقيع DCO. نقاش التصميم في القضايا؛ تحمل القرارات المفتوحة الوسم `type: decision`. الخرج الملتقط من أدوات GPU حقيقية أكثر مساهمة فائدة للمعلم 1؛ أزل أسماء المضيفين والأرقام التسلسلية وUUID أولًا. + + +## الأمان + +أبلغ عن الثغرات بصورة خاصة؛ راجع [SECURITY.md](../../../SECURITY.md). + + +## الترخيص + +رخصة GNU العمومية العامة v2.0، وهي رخصة Cacti وملحقاته نفسها. راجع [LICENSE](../../../LICENSE). diff --git a/docs/i18n/ar-SA/docs/alerting.md b/docs/i18n/ar-SA/docs/alerting.md new file mode 100644 index 0000000..600b8e9 --- /dev/null +++ b/docs/i18n/ar-SA/docs/alerting.md @@ -0,0 +1,61 @@ + + + +# التنبيه باستخدام Thold وMaint + +لا يملك الملحق محرك تنبيه ولا يرسل إشعارات خاصة به (REQ-ALERT-005، [ADR 0002](../../../decisions/0002-alert-through-cacti-data-sources.md)). كل قيمة GPU عنصر في مصدر بيانات GPU، لذا ينبه Thold بشأنها مثل أي مصدر بيانات آخر في Cacti، ويكبت Maint تلك التنبيهات لجهاز العقدة. لا يُعدّل أي من الملحقين. + +اختُبر مع Thold v1.8.2 (`1eb406bd0f81f3204358cce7bd43c8bb5adc8e4a`) وMaint v1.3 (`cd62de9cc323a4f5a8ac80a8d9dda3c7fa16c470`)، مثبّتين دون تعديل، على Cacti 1.2.31 وفرع 1.2.x الحالي (`tests/bin/alert-flow.php`، ويُشغّل في CI). + + +## إعداد العتبات المرفقة + +1. ثبّت Thold وفعّله، وكذلك Maint إذا كنت تستخدم نوافذ صيانة. +2. في **الإدارة > قوالب العتبات**، اختر **استيراد** واستورد `plugins/gpu/templates/gpu_thold_templates.xml`. +3. في **القوالب > قوالب الأجهزة > GPU Node**، أضف كل قالب عتبة *GPU - ...* ضمن *قوالب العتبات المرتبطة*. +4. فعّل إعداد *إنشاء العتبات تلقائيًا* في Thold، ليُنشئ العتبات عندما يُنشئ الملحق رسوم كل GPU. هذا هو المسار الذي يستخدمه الاختبار الشامل. +5. الأجهزة التي كانت تستخدم قالب GPU Node قبل الخطوة 3 لم ترتبط بعد: أضف القوالب ضمن *قوالب العتبات المرتبطة* في صفحة كل جهاز، ثم حدد الأجهزة في **الإدارة > الأجهزة** ونفّذ إجراء **تطبيق العتبات**. + +ينشئ Thold عتبة لكل قالب لمصدر بيانات كل GPU. قوائم الإشعارات والبريد وإعدادات التكرار تخص Thold؛ اضبطها في القوالب أو العتبات. + + +## القوالب المرفقة + +| القالب | العنصر | يحدث التجاوز عند | بعد | +|---|---|---|---| +| GPU - Temperature High | `temp_gpu` | أعلى من 85 °C | استطلاعين | +| GPU - Power Above Limit | `power_pct` | أعلى من 100 بالمئة من حد الطاقة الحالي | استطلاعين | +| GPU - Software Thermal Slowdown | `thr_sw_thermal` | 1 | استطلاع واحد | +| GPU - Hardware Thermal Slowdown | `thr_hw_thermal` | 1 | استطلاع واحد | +| GPU - Hardware Power Brake | `thr_hw_power_brake` | 1 | استطلاع واحد | +| GPU - Hardware Slowdown | `thr_hw_slowdown` | 1 | استطلاع واحد | +| GPU - New Uncorrected ECC Errors | `ecc_uncorr_new` | أي خطأ جديد منذ العينة السابقة | استطلاع واحد | +| GPU - Page Retirement Pending | `retired_pending` | 1 | استطلاع واحد | +| GPU - Sample Too Old | `age` | أعلى من 900 ثانية | استطلاع واحد | + +القيم نقاط بداية وليست حدود الشركة المصنّعة؛ اضبطها لكل طراز GPU. لا توجد قوالب للحالات التالية عمدًا: + +- **حد الطاقة البرمجي** (`thr_sw_power_cap`): تُقيّد GPU عند الحمل الكامل عادةً بهذا الحد. +- **Idle وبتات القناع الأخرى** التي لا تملك مؤشرًا: حالة Idle طبيعية، وتعدّها وثائق nvidia-smi، مع Application Clocks Setting، متقادمة (REQ-THR-002). +- **مجاميع ECC المتطايرة** (`ecc_corr` و`ecc_uncorr`): تعود إلى 0 عند تحميل برنامج التشغيل، لذا تزول العتبة بعد إعادة التشغيل دون إصلاح السبب. استخدم `ecc_uncorr_new` للتنبيه بدلًا منها. +- **أخطاء ECC المصحّحة الجديدة**: الأخطاء المصحّحة العرضية طبيعية ولا يُعرف معدل افتراضي؛ أضف عتبة إذا كان لأسطولك معدل محدد. + +تُنشأ قائمة القوالب من `lib/TholdTemplateXml.php`، ويفشل اختبار وحدة إذا اختلف الملف المرفق عنها. + + +## قواعد عتبات GPU + +- **المدد.** اضبط كل مشغّل فشل على فترة جمع واحدة على الأقل (REQ-ALERT-004). يعدّ المشغّل استطلاعات Cacti، ويجمع الملحق كل عقدة مرة في دورة المستطلع، لذا يمثل الاستطلاع فترة واحدة. استطلاع Cacti والجمع غير متزامنين: قد تُقرأ قيمة مرتين أو تُتخطى، لذا يمكن لمشغّل الاستطلاع الواحد العمل من عينة واحدة، ولا يُرى العطل الأقصر من الفترة. +- **القيم المجهولة.** لا تتجاوز `U` أي عتبة مطلقًا (REQ-ALERT-002): GPU بلا ECC، أو جمع فاشل، أو عينة قديمة، يعطي `U` ولا ينبه Thold بشأنها. ولا تُبقي التنبيه قائمًا أيضًا: يعدّ Thold 1.8.2 القيمة غير الرقمية غير متجاوزة، فتستعيد العتبة المنبهة حالتها وترسل إشعار الاستعادة عندما تتحول قيمتها إلى `U`. لذلك تعني الاستعادة بينما قيم GPU مجهولة أن الملحق فقد القيمة، لا أن العطل زال؛ يوضح `age` الفرق لأنه يبقى رقميًا متى وُجدت عينة ويستمر في الزيادة، وتنبه عتبة *GPU - Sample Too Old* بشأنه. +- **GAUGE فقط.** كل عنصر مصدر بيانات من نوع GAUGE. يرمي Thold 1.8.2 خطأ PHP `TypeError` عندما يقرأ مصدر DERIVE أو COUNTER ذو عتبة القيمة `U`، ثم يعطّل Cacti Thold للجميع. لذا يحسب الملحق أخطاء ECC الجديدة بنفسه من عينتين متتاليتين لنفس GPU، ويخزن الناتج كقيمة gauge: مجهولة للعينة الأولى وبعد قراءة مفقودة وبعد إعادة ضبط. لا تغيّر عنصر مصدر بيانات GPU إلى COUNTER أو DERIVE. +- **الصيانة.** يكبت جدول Maint على جهاز العقدة عتبات GPU الخاصة به (REQ-ALERT-003): لا يعدّ Thold التجاوز ولا يرسل إشعاره أثناء الصيانة، وتظل ملفات RRD تسجّل القيم. تعرض صفحة صحة GPU ما إذا كان Maint يضع كل عقدة تحت الصيانة. + + +## ما يثبته الاختبار الشامل + +يستورد `tests/bin/alert-flow.php` القوالب المرفقة باستيراد Thold نفسه، ويربطها بقالب GPU Node، ويترك Thold ينشئ العتبات عند إنشاء الملحق الرسوم. يُحسب مصدر البيانات `power_pct` من قيمتي `power` و`power_limit` للعينة الحالية دون تقريب إلى عدد صحيح. تنتج القراءات المفقودة والحدود غير الموجبة قيمة مجهولة لا تتجاوز العتبة. ثم يغيّر الاختبار خرج `nvidia-smi` المحاكى خلف `snmpd` حقيقي، ويجمع عبر SNMPv3، ويشغّل مستطلع Cacti وفحص Thold، ويقرأ سجل Thold: + +- تؤدي GPU حارة ومبطّأة عتاديًا، بأخطاء غير مصححة جديدة وصفحات تنتظر الإحالة إلى التقاعد، إلى تشغيل كل عتبة؛ ولا تعمل عتبة الحرارة إلا عند الاستطلاع الثاني، وتستعيد كل عتبة حالتها عند عودة القيمة؛ +- تخفض إعادة تحميل برنامج التشغيل مجموع ECC إلى 0: تكون قيمة الأخطاء الجديدة `U`، ولا يحدث تجاوز، ويظل Thold مفعّلًا؛ ويشغّل خطآن جديدان بعد إعادة الضبط العتبة مجددًا ثم تستعيد حالتها؛ +- يجعل فشل الأداة كل القيم الأخرى `U`، فلا يحدث تجاوز وتستعيد عتبة تباطؤ العتاد المنبهة حالتها، بينما ينبه `age` ويستعيد حالته عندما تعود العينات؛ +- أثناء جدول Maint لا يُعدّ التجاوز ولا يُبلّغ عنه، مع استمرار ملف RRD في تسجيله؛ وبعد انتهاء الجدول يُعدّ ويُبلّغ عنه مجددًا. diff --git a/docs/i18n/ar-SA/docs/backup.md b/docs/i18n/ar-SA/docs/backup.md new file mode 100644 index 0000000..e3ef746 --- /dev/null +++ b/docs/i18n/ar-SA/docs/backup.md @@ -0,0 +1,45 @@ + + + +# النسخ الاحتياطي والاستعادة + +يوجد تاريخ GPU في موضعين يجب نسخهما معًا: سجلات قاعدة البيانات التي تحدد وحدة GPU التابعة لكل مصدر بيانات، والتاريخ نفسه في ملفات RRD (REQ-BACKUP-001). + + +## ما يجب نسخه احتياطيًا + +| المحتوى | الموقع | السبب | +|---|---|---| +| قاعدة بيانات Cacti كاملة | تشمل جداول `plugin_gpu_*` وصفوف `settings` المسماة `gpu_*` | العقد وسجلات GPU حسب UUID وأحدث العينات ومصادر البيانات والرسوم وذاكرة الاستعلامات التي تربط كل GPU بملف RRD | +| دليل RRD | افتراضيًا `/rra` | التاريخ | +| إعدادات الإضافة | صفوف `gpu_*` في جدول `settings` ضمن نسخة قاعدة البيانات | *Mark Absent After* و*Stale After* و*Keep Plugin Tables on Uninstall* وإصدار المخطط | +| أسطر extend في `snmpd.conf` لكل عقدة | على العقدة | ليست من مسؤولية Cacti للاستعادة؛ انسخها من [node-setup.md](node-setup.md) | + +خذ نسخة قاعدة البيانات ونسخة RRD في الوقت نفسه، مع إيقاف المستطلِع أو بين دوراته، كي لا تكون إحداهما أحدث. لإنشاء نسخة متسقة من قاعدة بيانات عاملة: + +``` +mysqldump --single-transaction --routines cacti > cacti.sql +``` + + +## الاستعادة + +1. أوقف مستطلِع Cacti، سواء مهمة cron أو الخدمة. +2. استعد قاعدة البيانات: `mysql cacti < cacti.sql`. +3. استعد دليل RRD من النسخة الاحتياطية نفسها. +4. شغّل المستطلِع. يفحص الجمع التالي كل GPU حسب UUID مقابل سجلاتها، فتحتفظ بمصدر البيانات وملف RRD وتستمر قيمها فيهما. + + +## قاعدة بيانات أقدم من دليل RRD + +إذا استُعيدت قاعدة البيانات فقط، أو كانت النسخة أقدم من ملفات RRD، يعيد Cacti توزيع معرّفات مصادر البيانات الموجودة وقت النسخ. ويسمي ملفات RRD بمعرّف المصدر. قد تحصل GPU تظهر لأول مرة بعد الاستعادة على مصدر ذي اسم ملف موجود أصلًا على القرص ويحوي تاريخ GPU أخرى. + +تمنع الإضافة ذلك (REQ-BACKUP-003): عند إنشاء مصدر بيانات لـ GPU ووجود ملف RRD في مساره، تعيد تسميته باللاحقة `.gpu-orphan-