diff --git a/README.md b/README.md index 4f99ec2..5aaf43b 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_cloud A Cacti 1.2 plugin that brings resources and metrics from public cloud providers into Cacti as ordinary devices, data sources, and graphs. Cloud workloads then sit next to the network that carries them, under Cacti's permissions, and Thold and Maint can alert on and suppress them. One plugin covers every provider, with a driver per provider: DigitalOcean, AWS, Google Cloud, and Azure first. > **Status: milestone 3 (DigitalOcean and Cacti objects), in review.** The milestone adds the DigitalOcean driver, Cacti templates, a scope device per account with a data query per resource type, the script server input, and a request estimate on New Graphs and the health page. Initial checks against a live DigitalOcean account are recorded in [provider facts](docs/research/provider-facts.md). Do not run it in production. +## Access roles + +| Realm | Access | +| --- | --- | +| Cloud View | Existing monitoring pages. | +| Cloud Operator | Monitoring plus the Operations page and personal triage acknowledgments. | +| Cloud 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 +Cloud 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. Operators can verify the stored credential for an account whose Cacti device they may access. +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 Each cloud provider has its own monitoring console. Run alongside Cacti, they leave three gaps: @@ -38,7 +64,7 @@ Out of scope: changing cloud resources, creating or mirroring provider alarms, b - **A guarded install.** On PHP below 8.2, or without ext-openssl, install and enable are refused with a message, and the rest of Cacti keeps working. - **Lifecycle.** Install, upgrade, and uninstall through Cacti's Plugins page. Upgrades are ordered and survive interruption. Uninstall keeps the plugin's tables unless you clear *Keep Plugin Tables on Uninstall*. -- **Two realms.** *Cloud Admin* opens **Cloud Accounts**; *Cloud View* opens **Cloud Health**. Both pages are under Management. +- **Separate realms.** *Cloud Admin* opens **Cloud Accounts**; *Cloud View* opens **Cloud Health**. Both pages are under Management. - **Accounts and credentials.** Add, edit, verify, and delete accounts. A credential is either encrypted in the database with a key file kept outside it (AES-256-GCM), or read from a file on the poller. Credentials are write-only in the UI and are redacted from logs. - **The collector.** It starts from each poller run, one instance per poller, within a time budget. It takes a lease per account, runs discovery on its own interval, and reads metrics only for the plugin's own active data sources. - **Health.** Per-account collection, discovery, resource, and freshness state, plus warnings for an unusable vault key, unsafe credential files, and intervals the poller cannot honour. diff --git a/cloud_operator.php b/cloud_operator.php new file mode 100644 index 0000000..e7615b5 --- /dev/null +++ b/cloud_operator.php @@ -0,0 +1,115 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_cloud, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_cloud + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +use Somethingwithproof\Cloud\OperatorPage; + +chdir('../../'); +include('./include/auth.php'); +include_once('./plugins/cloud/setup.php'); + +if (!cloud_page_start()) { + exit; +} +require_once('./plugins/cloud/include/operator.php'); + +$user = (int) ($_SESSION['sess_user_id'] ?? 0); +$allowed = $user > 0 && api_plugin_user_realm_auth('cloud_operator.php'); + +if (!$allowed) { + http_response_code(403); + exit; +} +$actions = ['verify' => __('Verify stored credential', 'cloud')]; +$action = (string) get_nfilter_request_var('action'); +$session = $_SESSION['cloud_triage'] ?? []; +$session = is_array($session) ? $session : []; + +try { + // Re-read on POST too: stale forms never retain revoked device access. + $rows = cloud_operator_rows(); + $now = time(); + + if ($action !== '' && $action !== 'default') { + $method = $_SERVER['REQUEST_METHOD'] ?? ''; + $status = OperatorPage::actionStatus($allowed, $action, $method, $method === 'POST' && csrf_check(false), array_merge(['acknowledge'], array_keys($actions))); + + if ($status !== 200) { + http_response_code($status); + + if ($status === 405) { + header('Allow: POST'); + } + exit; + } + $id = (string) get_nfilter_request_var('id'); + $row = null; + + foreach ($rows as $candidate) { + if ($candidate['id'] === $id) { + $row = $candidate; + + break; + } + } + + if ($row === null) { + http_response_code(403); + exit; + } + $fingerprint = (string) get_nfilter_request_var('fingerprint'); + + if (!hash_equals(OperatorPage::fingerprint($row), $fingerprint)) { + http_response_code(409); + exit; + } + + if ($action === 'acknowledge') { + if (!OperatorPage::acknowledge($session, $row, $fingerprint, $user, $now)) { + http_response_code(409); + exit; + } + $_SESSION['cloud_triage'] = $session; + } else { + // Bound repeated requests from a browser without changing collector budgets. + $key = (string) $user; + $last = $_SESSION['cloud_operation'] ?? []; + + if (($last['key'] ?? '') === $key && $now - ($last['at'] ?? 0) < 60) { + http_response_code(429); + header('Retry-After: 60'); + exit; + } + $_SESSION['cloud_operation'] = ['key' => $key, 'at' => $now]; + cloud_operator_verify((int) $row['id'], $user); + } + cacti_log('Operator ' . $action . ' by user ' . $user . ' on object ' . hash('sha256', $id), false, 'CLOUD'); + header('Location: cloud_operator.php'); + exit; + } + top_header(); + print '

' . html_escape(__('Monitoring view', 'cloud')) . '

'; + OperatorPage::render($rows, $session, $user, $now, $actions); + bottom_footer(); +} catch (Throwable $error) { + cacti_log('Operator page failed (' . get_class($error) . ')', false, 'CLOUD'); + http_response_code(503); + top_header(); + print '

' . html_escape(__('Observations could not be read. Ask an administrator to check the plugin log.', 'cloud')) . '

'; + bottom_footer(); +} diff --git a/docs/PLAN.md b/docs/PLAN.md index 05d7087..7eb8fe7 100644 --- a/docs/PLAN.md +++ b/docs/PLAN.md @@ -278,7 +278,7 @@ Short-lived tokens are cached per collector run. When a provider limits how ofte | Boundary | Control | |---|---| -| Browser to Cacti | Cacti session, csrf-magic, two plugin realms (Cloud View, Cloud Admin), device and graph permissions, prepared queries, contextual escaping | +| Browser to Cacti | Cacti session, csrf-magic, three plugin realms (Cloud View, Cloud Operator, Cloud Admin), device and graph permissions, prepared queries, contextual escaping | | Cacti to stored credentials | Vault encryption with a key file outside the database, file checks on credential and key files, secrets never returned to the browser or logged, redaction of known secrets and `Authorization` values from every error | | Cacti to provider APIs | Outbound allowlist built from fixed per-provider host tables and validated scope fields; HTTPS with verification; no redirects; size and time limits; operation allowlist ([ADR 0002](decisions/0002-read-only-with-operation-allowlist.md)) | | Cacti to instance metadata | Reachable only for an account whose credential source is instance identity, only at the provider's documented address, and only for the token path | diff --git a/docs/i18n/ar-SA/README.md b/docs/i18n/ar-SA/README.md new file mode 100644 index 0000000..2aeb067 --- /dev/null +++ b/docs/i18n/ar-SA/README.md @@ -0,0 +1,145 @@ + + + +[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_cloud + +إضافة لـ Cacti 1.2 تجلب موارد مزوّدي السحابة العامة ومقاييسهم إلى Cacti كأجهزة ومصادر بيانات ورسوم بيانية عادية. تظهر أعباء العمل السحابية بجانب الشبكة التي تنقلها، ضمن أذونات Cacti، ويمكن لـ Thold وMaint التنبيه بشأنها وكتم تنبيهاتها. تغطي إضافة واحدة جميع المزوّدين، مع برنامج تشغيل لكل مزوّد: DigitalOcean وAWS وGoogle Cloud وAzure أولًا. + +> **الحالة: المعلم 3 (DigitalOcean وكائنات Cacti)، قيد المراجعة.** يضيف هذا المعلم برنامج تشغيل DigitalOcean، وقوالب Cacti، وجهاز نطاق لكل حساب مع استعلام بيانات لكل نوع مورد، ومدخل خادم البرامج النصية، وتقدير الطلبات في صفحة الرسوم الجديدة وصفحة الصحة. سُجّلت الفحوص الأولية مع حساب DigitalOcean حقيقي في [حقائق المزوّدين](../../research/provider-facts.md). لا تشغّله في بيئة الإنتاج. + + +## أدوار الوصول + +| نطاق الأذونات | الوصول | +| --- | --- | +| Cloud View | صفحات المراقبة الحالية. | +| Cloud Operator | المراقبة وصفحة العمليات والإقرارات الشخصية للتحقيق. | +| Cloud Admin | وصول المشغّل مع إجراءات الإعداد والإدارة الحالية. | + +بعد نسخ ملفات الترقية، افتح صفحة الإضافات كمسؤول لتسجيل نطاق الأذونات الجديد. عيّن نطاق Operator صراحةً ضمن **Configuration > Users** أو مجموعات المستخدمين. تحتفظ الترقيات بمعرّفات نطاقَي View وAdmin الحاليين ومنح الوصول إليهما. يرث وصول Admin وصول Operator، ويرث Operator وصول View في كل طلب؛ ولا يضيف ذلك منحًا مخزّنة للمستخدمين أو المجموعات. تتطلب إعدادات الإضافة أيضًا وصول Cloud Admin إضافةً إلى إذن Settings في Cacti. + +لا تزال أذونات أجهزة Cacti تحدّ الصفوف والإجراءات المتاحة لكل مستخدم؛ تتطلب الكائنات غير المرتبطة مسؤولًا. يمكن للمشغّلين التحقق من بيانات الاعتماد المخزّنة لحساب يحق لهم الوصول إلى جهاز Cacti الخاص به. تبقى بيانات الاعتماد والإعدادات والربط والحذف وسائر التغييرات الإدارية في صفحات الإدارة. تدوم الإقرارات في جلسة المستخدم الحالي فقط، لمدة أقصاها ساعة واحدة وفقط ما دامت الملاحظة نفسها حديثة. تُبطلها الملاحظات الجديدة أو المتغيّرة. لا تعتبر مطلقًا قياسًا فاشلًا سليمًا ولا تكتم التنبيهات. + + +## الدافع + +لكل مزوّد سحابي وحدة مراقبة خاصة به. عند تشغيلها بجانب Cacti، تبقى ثلاث فجوات: + +- **تحكم منفصل في الوصول.** يتطلب عرض مقاييس السحابة لمستخدم Cacti منحه حساب دخول إلى السحابة. +- **غياب سياق الشبكة.** تُرسم الوصلات المحلية في Cacti؛ وتُرسم أعباء العمل خلفها في وحدة كل مزوّد. +- **تنبيهات منفصلة.** يعمل Thold وMaint على مصادر بيانات Cacti وأجهزته، لذا تُضبط تنبيهات المزوّدين وتُكتم بشكل منفصل لكل مزوّد. + +تقرأ الإضافة واجهة مراقبة كل مزوّد على مستطلع Cacti، وتخزّن أحدث نقاط البيانات مؤقتًا، وتقدّمها إلى خادم البرامج النصية في Cacti. يكتب مستطلع Cacti ملفات RRD، لذا تعمل الرسوم والأذونات وThold وMaint وboost كما تعمل مع أي بيانات في Cacti. + + +## التزامات التصميم + +- **للقراءة فقط.** لا يستطيع كل برنامج تشغيل بناء إلا عمليات المزوّد الموجودة في قائمة السماح الخاصة به؛ لا تغيّر الإضافة أي مورد سحابي مطلقًا. ([ADR 0002](../../decisions/0002-read-only-with-operation-allowlist.md)) +- **PHP فقط، دون SDK.** تُنفّذ عمليات التوقيع وتبادل الرموز بـ PHP باستخدام الامتدادات التي يتطلبها Cacti أصلًا. لا توجد تبعيات Composer وقت التشغيل. ([ADR 0003](../../decisions/0003-php-only-without-sdks.md)) +- **التكلفة قبل الجمع.** لا تقرأ الإضافة إلا المقاييس التي لها مصدر بيانات في Cacti، وتعرض عدد الطلبات المتوقع وتكلفتها بالسعر المعلن قبل إنشاء الرسوم، وتفرض حدًا شهريًا. ([ADR 0005](../../decisions/0005-collect-only-what-is-graphed.md)) +- **لا بيانات اعتماد بنص صريح في قاعدة البيانات.** تأتي بيانات الاعتماد من خزنة مشفّرة بمفتاح في ملف خارج قاعدة البيانات، أو من ملف بيانات اعتماد، أو من هوية المثيل لدى المزوّد. ([ADR 0007](../../decisions/0007-credentials-outside-the-database-in-the-clear.md)) + + +## النطاق والحالة + +| المرحلة | النطاق | المعالم | الحالة | +|---|---|---|---| +| 0، البحث | تأكيد حقائق المزوّدين، كتالوجات المقاييس، نموذج التكلفة والمعدل، متجهات اختبار التوقيع، وتجربة النقل | [M1](https://github.com/somethingwithproof/plugin_cloud/milestone/1) | مكتملة باستثناء الفحوص التي تتطلب حساب مزوّد حقيقيًا | +| 1، الأساس وDigitalOcean | الحسابات، خزنة بيانات الاعتماد، النقل، الجامع، ذاكرة الملاحظات المؤقتة، كائنات Cacti، صفحة الصحة، وDroplets وموازنات الحمل في DigitalOcean | [M2](https://github.com/somethingwithproof/plugin_cloud/milestone/2), [M3](https://github.com/somethingwithproof/plugin_cloud/milestone/3), [M4](https://github.com/somethingwithproof/plugin_cloud/milestone/4) | اكتمل M2 ([#81](https://github.com/somethingwithproof/plugin_cloud/pull/81))؛ دُمج برنامج التشغيل والقوالب وأجهزة النطاق في M3؛ تقديرات الطلبات والأذونات وفحوص الأداء قيد المراجعة؛ لم يبدأ M4 | +| 2، AWS | Signature Version 4 و`AssumeRole` وأدوار المثيل وCloudWatch `GetMetricData` والجرد الإقليمي | [M5](https://github.com/somethingwithproof/plugin_cloud/milestone/5) | لم تبدأ | +| 3، Google Cloud | JWT لحساب الخدمة، خادم البيانات الوصفية، Cloud Monitoring `timeSeries.list` | [M6](https://github.com/somethingwithproof/plugin_cloud/milestone/6) | لم تبدأ | +| 4، Azure | بيانات اعتماد عميل Entra، الهوية المُدارة، Resource Graph، `metrics:getBatch` | [M7](https://github.com/somethingwithproof/plugin_cloud/milestone/7) | لم تبدأ | +| 5، أدوات الجمع البعيدة | الحسابات على جامعات البيانات البعيدة في Cacti | [M8](https://github.com/somethingwithproof/plugin_cloud/milestone/8) | لم تبدأ | + +خارج النطاق: تغيير الموارد السحابية، إنشاء تنبيهات المزوّدين أو نسخها، تقارير الفوترة، السجلات والتتبعات، ومحرك تنبيهات خاص بالإضافة. المزوّدون الإضافيون (Hetzner Cloud وAkamai Cloud وOracle Cloud وغيرهم) موضوعات بحث. + + +## ما يقدّمه المعلم 2 + +- **تثبيت محمي بفحوص.** عند استخدام PHP أقدم من 8.2 أو دون ext-openssl، يُرفض التثبيت والتفعيل مع رسالة، ويستمر باقي Cacti في العمل. +- **دورة الحياة.** التثبيت والترقية وإلغاء التثبيت عبر صفحة إضافات Cacti. الترقيات مرتّبة وتتحمل الانقطاع. يحتفظ إلغاء التثبيت بجداول الإضافة إلا إذا ألغيت تحديد *Keep Plugin Tables on Uninstall*. +- **نطاقات منفصلة.** يفتح *Cloud Admin* صفحة **Cloud Accounts**؛ ويفتح *Cloud View* صفحة **Cloud Health**. كلاهما ضمن Management. +- **الحسابات وبيانات الاعتماد.** إضافة الحسابات وتعديلها والتحقق منها وحذفها. تُشفّر بيانات الاعتماد إما في قاعدة البيانات بمفتاح في ملف خارجها (AES-256-GCM)، أو تُقرأ من ملف على المستطلع. لا تُعرض بيانات الاعتماد للقراءة في الواجهة، وتُحجب من السجلات. +- **الجامع.** يبدأ من كل تشغيل للمستطلع، بمثيل واحد لكل مستطلع، ضمن ميزانية زمنية. يحصل على حجز مؤقت لكل حساب، ويشغّل الاكتشاف بفاصله الخاص، ولا يقرأ إلا مقاييس مصادر البيانات النشطة التي تملكها الإضافة. +- **الصحة.** حالة الجمع والاكتشاف والموارد والحداثة لكل حساب، مع تحذيرات بشأن مفتاح خزنة غير صالح، وملفات اعتماد غير آمنة، وفواصل لا يستطيع المستطلع الالتزام بها. + + +## التثبيت والإعداد + +تثبّت هذه الخطوات شيفرة المعلم 2 للتقييم. تتطلب Cacti 1.2.31 أو أحدث على PHP 8.2 أو أحدث. + +1. انسخ المستودع إلى `plugins/cloud` تحت دليل Cacti. يجب أن يكون اسم الدليل `cloud`. +2. أنشئ مفتاح الخزنة خارج جذر الويب. ضعه في دليل لا يكتب فيه إلا root ومستخدم Cacti، واجعل الملف مقروءًا فقط للمستخدم الذي يشغّل خادم الويب والمستطلع. لا تنشئ الإضافة هذا الملف ولا تكتب فيه مطلقًا: + + ```sh + sudo install -d -m 0750 -o root -g cacti /etc/cacti + head -c 32 /dev/urandom | sudo tee /etc/cacti/cloud-vault.key > /dev/null + sudo chown cacti:cacti /etc/cacti/cloud-vault.key + sudo chmod 0600 /etc/cacti/cloud-vault.key + ``` + + استبدل `cacti` بالمستخدم الذي يشغّل خادم الويب والمستطلع. يحتوي الملف على 32 بايت خام أو 64 محرفًا ست عشريًا. انسخه احتياطيًا مع قاعدة البيانات؛ بدونه يجب إدخال بيانات الاعتماد المخزّنة مجددًا. +3. في Cacti، افتح **Configuration > Plugins**، ثم ثبّت *Cloud* وفعّله. +4. ضمن **Configuration > Settings > Cloud**، اضبط *Vault Key File* إن استخدمت مسارًا آخر. يجب أن تبقى *Collector Time Budget* (افتراضيًا 240 ثانية) أقل من فاصل المستطلع. +5. امنح *Cloud Admin* أو *Cloud View* للمستخدمين والمجموعات ضمن **Configuration > Users**. يمنح التثبيت النطاقين للمسؤول. +6. أضف الحسابات ضمن **Management > Cloud Accounts**، ثم تحقق من التحذيرات في **Management > Cloud Health**. + + +## أهداف التوافق + +| المكوّن | الهدف | +|---|---| +| Cacti | 1.2.31 أو أحدث، دون ترقيعات للنواة | +| PHP | 8.2 أو أحدث؛ يبقى `setup.php` قابلًا للتحليل على 8.0 حتى تتلقى بيئة التشغيل غير المدعومة رفضًا بدلًا من تعطّل واجهة Cacti | +| امتدادات PHP | لا شيء فوق ما يتطلبه Cacti 1.2.31 | +| Thold وMaint | لا تغييرات مطلوبة | + + +## التصميم + +- يتضمن [docs/performance.md](docs/performance.md) قياسات أداة الجمع وصفحة السلامة، مع العتاد والإعدادات المستخدمة. +- [docs/PLAN.md](../../PLAN.md) هو الخطة الكاملة: البنية، وحقائق المزوّدين وCacti التي تعتمد عليها مع المصادر، وعقد برامج التشغيل، وحساب التكلفة، وحدود الأمان، والاختبارات والمخاطر. +- يحتفظ [docs/decisions/](../../decisions) بسجلات قرارات البنية للاختيارات المتخذة. +- يربط [docs/REQUIREMENTS.md](../../REQUIREMENTS.md) كل معرّف متطلب بمسألته. + +```mermaid +flowchart LR + API[Provider monitoring APIs] -->|HTTPS, read only| C[Collector on the account's Cacti poller] + C --> O[(Observation cache)] + O --> SS[Script server data sources] + SS --> RRD[(Cacti RRD files)] + 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:` و`provider:` و`phase:` و`priority:` و`status:`. راجع [CONTRIBUTING.md](../../../CONTRIBUTING.md#labels). +- تعرض [لوحة المشروع](https://github.com/users/somethingwithproof/projects/7) جميع المسائل عبر المعالم. + + +## التطوير + +يفحص التكامل المستمر صياغة نقاط الدخول على PHP 8.0، ويشغّل اختبارات الوحدات والتكامل وPHPStan بالمستوى 9، ويثبّت الإضافة على PHP من 8.2 إلى 8.5 مع Cacti 1.2.31 وفرع 1.2.x. ويتحقق أيضًا من رفض PHP 8.1 دون تعطيل Cacti. تستخدم الاختبارات Pest من بيئة اختبارات الإضافات في نواة Cacti. هذا الاختيار مؤقت حتى يُحسم [#12](https://github.com/somethingwithproof/plugin_cloud/issues/12). يسرد [.github/workflows/plugin-ci-workflow.yml](../../../.github/workflows/plugin-ci-workflow.yml) كل الخطوات. شغّل `sh tests/lint-workflows.sh` و`sh locales/build_gettext.sh --check` محليًا قبل الدفع. + + +## المساهمة + +اقرأ [CONTRIBUTING.md](../../../CONTRIBUTING.md). تحتاج الإيداعات إلى توقيع DCO. تجري مناقشات التصميم في المسائل؛ تحمل القرارات المفتوحة وسم `type: decision`. + + +## الأمان + +أبلغ عن الثغرات بشكل خاص؛ راجع [SECURITY.md](../../../SECURITY.md). + + +## الترخيص + +رخصة GNU العامة الإصدار 2.0، وهي رخصة Cacti وإضافاته نفسها. راجع [LICENSE](../../../LICENSE). diff --git a/docs/i18n/ar-SA/docs/performance.md b/docs/i18n/ar-SA/docs/performance.md new file mode 100644 index 0000000..a329eb5 --- /dev/null +++ b/docs/i18n/ar-SA/docs/performance.md @@ -0,0 +1,70 @@ + + + +# الأداء + +قياسات للمسألة [#47](https://github.com/somethingwithproof/plugin_cloud/issues/47)، أُخذت بتاريخ 2026-11-15 باستخدام [`tests/bin/perf.php`](../../../../tests/bin/perf.php). تشغّل CI البرنامج نفسه في كل مهمة Cacti وPHP. لا تُفشل المهمة إلا إذا لم تكتمل 1,000 سلسلة خلال فاصل استطلاع واحد، وتطبع الأزمنة دون مقارنتها لأن عتاد بيئات التشغيل يختلف. + +**النتيجة.** مع خادم محلي لبيانات الاختبار ودون تأخير مضاف، تقرأ جولة جمع 1,000 سلسلة في نحو 3 ثوانٍ، أي نحو 3 ms من عمل الملحق وTLS لكل طلب. تعرض صفحة السلامة 10,000 سلسلة مخزنة مؤقتًا خلال 0.08 ثانية. بإضافة 100 ms من تأخير مزود محاكى لكل طلب، تستغرق الجولة نفسها 106 ثوانٍ. يحدد تأخير المزود ما إذا كانت 1,000 سلسلة تكتمل في فاصل استطلاع واحد. + + +## ما الذي يُشغّل + +يستخدم البرنامج أداة الجمع الفعلية وبرنامج تشغيل DigitalOcean والنقل المحمي (قائمة العمليات المسموحة) ونقل المقابس، مع التحقق من TLS بسلطة تصديق اختبارية. يُعاد توجيه المضيف وحده بعد فحص العملية، لتصل الطلبات إلى [`tests/bin/perf-server.php`](../../../../tests/bin/perf-server.php) بدل `api.digitalocean.com`. يعيد الخادم بيانات الاختبار المسجلة بعد نقل طوابعها الزمنية إلى الوقت الحالي، ويرسل ترويسات حدود المعدل التي يقرؤها برنامج التشغيل. + +| الحالة | الإعداد | القياس | +|---|---|---| +| الجمع | 4 حسابات، لكل منها 50 Droplet، و5 سلاسل لكل Droplet (CPU وأربع لعرض النطاق): 1,000 سلسلة | جولة جمع واحدة على أداة الاستطلاع 1 (REQ-PERF-001) | +| الميزانية | حساب واحد، 200 Droplet، و5 سلاسل لكل منها: 1,000 سلسلة | الجولة نفسها، حيث توقف ميزانية الطلبات الحساب | +| الصفحة | 10 حسابات، لكل منها 200 Droplet، و5 سلاسل مخزنة مؤقتًا لكل Droplet: 10,000 سلسلة | `cloud_health.php` عبر HTTP بصفتك مسؤولًا مسجل الدخول، ووسيط خمس عمليات تحميل بعد التهيئة الأولية (REQ-PERF-002) | + +تستخدم حالة الجمع أربعة حسابات لأن رمز DigitalOcean الواحد يسمح بـ250 طلبًا في الدقيقة. مع حصة طلبات 100 بالمئة، هذا أقصى ما يقرؤه حساب في الجولة (`RequestBudget::perRun`). توضح حالة الميزانية الحد: يقرأ الحساب 250 سلسلة، ويعلّم الـ750 الباقية كغير مقروءة بالسبب `budget`، وتعرض صفحة السلامة ذلك. + + +## العتاد والإعدادات (REQ-PERF-003) + +| | | +|---|---| +| المضيف | Apple M3 Max، 14 نواة، 36 GiB | +| بيئة التشغيل | آلة OrbStack Linux افتراضية، aarch64، و14 CPU، و15.7 GiB، وصورة Docker `cloud-ci:8.2` | +| PHP | 8.2.35، وCLI لأداة الجمع وخادم الويب المدمج للصفحة | +| قاعدة البيانات | MariaDB 11.8.9، في الآلة الافتراضية نفسها | +| Cacti | 1.2.31 والفرع 1.2.x (1.2.32) | +| فاصل الاستطلاع | 300 ثانية | +| الحسابات | فاصل الجمع 300 ثانية، حصة الطلبات 100 بالمئة، والاكتشاف غير مستحق أثناء الجولة | +| ميزانية وقت الجمع | فاصل الاستطلاع ناقص 10 ثوانٍ (290)؛ إعداد الملحق الافتراضي 240 | + + +## النتائج + +ثلاث جولات على كل إصدار Cacti دون تأخير مضاف: + +| الحالة | Cacti 1.2.31 | Cacti 1.2.x | +|---|---|---| +| الجمع، 1,000 سلسلة في 4 حسابات | 2.83 و3.00 و3.17 ثانية؛ قراءة 1,000 عبر 1,000 طلب | 3.42 و2.59 و2.61 ثانية؛ قراءة 1,000 عبر 1,000 طلب | +| الميزانية، 1,000 سلسلة في حساب واحد | 1.20 و1.32 و1.10 ثانية؛ قراءة 250 وبقاء 750 بالسبب `budget` | 1.24 و1.72 و1.10 ثانية؛ قراءة 250 وبقاء 750 بالسبب `budget` | +| صفحة السلامة، 10,000 سلسلة | الوسيط 0.08 ثانية، والأبطأ 0.08 ثانية، في الجولات الثلاث | الوسيط 0.08 ثانية، والأبطأ لا يتجاوز 0.09 ثانية | + +مع `perf.php 100` الذي يضيف 100 ms قبل كل استجابة اختبار، استغرقت حالة الجمع 106.26 ثانية على Cacti 1.2.31 وقرأت السلاسل الـ1,000 كلها. استغرقت حالة الميزانية 27.02 ثانية. + +فُحصت نتيجة الصفحة بمحتواها أيضًا، وليس سرعتها وحدها. أظهر كل حساب من الحسابات العشرة 1,000 سلسلة حالية وتقديرًا قدره 12,000 طلب في الساعة (1,000 سلسلة كل 300 ثانية). + + +## قراءة النتائج + +- **يتناسب وقت التشغيل مع تأخير المزود.** تقرأ أداة الجمع سلسلة واحدة لكل طلب، وطلبًا واحدًا في كل مرة. تستغرق الجولة نحو عدد الطلبات × (التأخير + 3 ms). بميزانية الوقت الافتراضية 240 ثانية، تكتمل 1,000 سلسلة ما دام متوسط زمن الذهاب والعودة أقل من نحو 237 ms. فوق ذلك تتوقف الأداة عن بدء حسابات جديدة عند بلوغ الميزانية وتجمع الحسابات غير المقروءة في الجولة التالية. قاس أول [فحص فعلي](../../../research/provider-facts.md#live-checks) (#16) وسيط ذهاب وعودة 384 ms (من 301 إلى 799 ms) من اتصال منزلي. بهذا التأخير تحتاج 1,000 سلسلة إلى نحو 390 ثانية، فتقرأ الميزانية الافتراضية نحو 620 في الجولة ويُرحّل الباقي. يُتوقع تأخير أقل لأداة استطلاع في مركز بيانات قريب من DigitalOcean؛ لذا قِس من أداتك قبل التخطيط لأكثر من نحو 600 سلسلة على أداة واحدة. +- **حد DigitalOcean لكل رمز.** عند الحصة الافتراضية 50 بالمئة يقرأ الحساب 125 سلسلة في الجولة. تحتاج البيئات الأكبر إلى حسابات أكثر، لكل منها رمزه، ويوضح تقدير صفحة السلامة مدى اقتراب كل حساب من حصته. +- **تبقى كلفة الصفحة منخفضة عند 10,000 سلسلة.** لا تقرأ إلا الصفوف المخزنة مؤقتًا ولا تستدعي مزودًا، لذا تنمو كلفتها مع جداول الملحق وليس مع تأخير المزود. +- **لم يُقَس هنا:** تحديث RRD بواسطة أداة استطلاع Cacti وboost وSpine وأدوات الجمع البعيدة وقاعدة بيانات على مضيف منفصل. يضيف كل منها كلفة خارج الملحق. + + +## التشغيل + +على قاعدة بيانات قابلة للتخلص منها، مع تثبيت الملحق وتمكينه وإتاحة Cacti عبر عنوان URL: + +```sh +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ 100 +``` + +يضيف الوسيط الثاني العدد المحدد من المللي ثانية إلى كل استجابة اختبار. يحذف البرنامج جميع حسابات الملحق وموارده وسلاسله وملاحظاته، ويعيد ضبط كلمة مرور المسؤول؛ فلا تشغّله مطلقًا على قاعدة بيانات تريد الاحتفاظ بها. diff --git a/docs/i18n/es-419/README.md b/docs/i18n/es-419/README.md new file mode 100644 index 0000000..f522eeb --- /dev/null +++ b/docs/i18n/es-419/README.md @@ -0,0 +1,145 @@ + + + +[English](../../../README.md) | [简体中文](../zh-CN/README.md) | [हिन्दी](../hi-IN/README.md) | [Español (España)](../es-ES/README.md) | [Español (Latinoamérica)](README.md) | [العربية](../ar-SA/README.md) + + + +# plugin_cloud + +Un complemento de Cacti 1.2 que incorpora los recursos y las métricas de proveedores de nube pública a Cacti como dispositivos, fuentes de datos y gráficos ordinarios. Así, las cargas de trabajo en la nube aparecen junto a la red que las transporta, bajo los permisos de Cacti, y Thold y Maint pueden generar y suprimir sus alertas. Un único complemento abarca todos los proveedores, con un controlador por proveedor: primero DigitalOcean, AWS, Google Cloud y Azure. + +> **Estado: hito 3 (DigitalOcean y objetos de Cacti), en revisión.** Este hito añade el controlador de DigitalOcean, plantillas de Cacti, un dispositivo de ámbito por cuenta con una consulta de datos por tipo de recurso, la entrada del servidor de scripts y una estimación de solicitudes en Nuevos gráficos y en la página de salud. Las primeras comprobaciones con una cuenta real de DigitalOcean están registradas en [datos de los proveedores](../../research/provider-facts.md). No lo ejecute en producción. + + +## Roles de acceso + +| Ámbito de permisos | Acceso | +| --- | --- | +| Cloud View | Páginas de supervisión existentes. | +| Cloud Operator | Supervisión, página de operaciones y acuses de recibo personales para la investigación. | +| Cloud Admin | Acceso de operador más las acciones de configuración y administración existentes. | + +Tras copiar los archivos de actualización, abra la página de complementos como administrador para registrar el nuevo ámbito. Asigne explícitamente el ámbito Operator en **Configuration > Users** o en los grupos de usuarios. Las actualizaciones conservan los identificadores y las concesiones de los ámbitos View y Admin existentes. El acceso Admin hereda el acceso Operator, y Operator hereda View en cada solicitud; esto no añade concesiones almacenadas a usuarios ni grupos. Los ajustes del complemento también requieren acceso Cloud Admin, además del permiso Settings de Cacti. + +Los permisos de dispositivos de Cacti siguen limitando las filas y acciones disponibles para cada usuario; los objetos sin asignar requieren un administrador. Los operadores pueden verificar la credencial almacenada de una cuenta a cuyo dispositivo de Cacti tengan acceso. Las credenciales, la configuración, la asignación, la eliminación y los demás cambios administrativos permanecen en las páginas de administración. Los acuses de recibo duran únicamente durante la sesión del usuario actual, como máximo una hora y solo mientras la misma observación siga vigente. Las observaciones nuevas o modificadas los invalidan. Nunca convierten una medición fallida en saludable ni suprimen alertas. + + +## Motivo + +Cada proveedor de nube tiene su propia consola de supervisión. Al usarlas junto a Cacti quedan tres carencias: + +- **Control de acceso separado.** Mostrar métricas de nube a un usuario de Cacti exige darle acceso a la nube. +- **Sin contexto de red.** Los enlaces locales se representan en Cacti; las cargas de trabajo que hay detrás se representan en la consola de cada proveedor. +- **Alertas separadas.** Thold y Maint trabajan con fuentes de datos y dispositivos de Cacti, por lo que las alarmas de los proveedores se configuran y suprimen por separado, una vez por proveedor. + +El complemento lee la API de supervisión de cada proveedor desde un sondeador de Cacti, almacena en caché los puntos de datos más recientes y los sirve al servidor de scripts de Cacti. El sondeador de Cacti escribe los archivos RRD, de modo que los gráficos, los permisos, Thold, Maint y boost funcionan como con cualquier otro dato de Cacti. + + +## Compromisos de diseño + +- **Solo lectura.** Cada controlador solo puede construir las operaciones del proveedor incluidas en su lista de permitidas; el complemento nunca modifica un recurso de nube. ([ADR 0002](../../decisions/0002-read-only-with-operation-allowlist.md)) +- **Solo PHP, sin SDK.** La firma y el intercambio de tokens están implementados en PHP con las extensiones que Cacti ya requiere. No hay dependencias de Composer en tiempo de ejecución. ([ADR 0003](../../decisions/0003-php-only-without-sdks.md)) +- **Costo antes de recopilar.** El complemento solo lee métricas que tengan una fuente de datos de Cacti, muestra el número esperado de solicitudes y su costo a precio de catálogo antes de crear gráficos, y aplica un límite mensual. ([ADR 0005](../../decisions/0005-collect-only-what-is-graphed.md)) +- **Sin credenciales en texto claro en la base de datos.** Las credenciales proceden de una bóveda cifrada cuya clave está en un archivo externo a la base de datos, de un archivo de credenciales o de la identidad de instancia del proveedor. ([ADR 0007](../../decisions/0007-credentials-outside-the-database-in-the-clear.md)) + + +## Alcance y estado + +| Fase | Alcance | Hitos | Estado | +|---|---|---|---| +| 0, investigación | Confirmación de datos de proveedores, catálogos de métricas, modelo de costos y tasas, vectores de prueba de firma y prueba de transporte | [M1](https://github.com/somethingwithproof/plugin_cloud/milestone/1) | Terminada, salvo las comprobaciones que requieren una cuenta real de proveedor | +| 1, núcleo y DigitalOcean | Cuentas, bóveda de credenciales, transporte, recopilador, caché de observaciones, objetos de Cacti, página de salud, Droplets y balanceadores de carga de DigitalOcean | [M2](https://github.com/somethingwithproof/plugin_cloud/milestone/2), [M3](https://github.com/somethingwithproof/plugin_cloud/milestone/3), [M4](https://github.com/somethingwithproof/plugin_cloud/milestone/4) | M2 terminado ([#81](https://github.com/somethingwithproof/plugin_cloud/pull/81)); controlador, plantillas y dispositivos de ámbito de M3 integrados; estimaciones de solicitudes, permisos y pruebas de rendimiento en revisión; M4 sin iniciar | +| 2, AWS | Signature Version 4, `AssumeRole`, roles de instancia, CloudWatch `GetMetricData`, inventario regional | [M5](https://github.com/somethingwithproof/plugin_cloud/milestone/5) | Sin iniciar | +| 3, Google Cloud | JWT de cuenta de servicio, servidor de metadatos, Cloud Monitoring `timeSeries.list` | [M6](https://github.com/somethingwithproof/plugin_cloud/milestone/6) | Sin iniciar | +| 4, Azure | Credenciales de cliente de Entra, identidad administrada, Resource Graph, `metrics:getBatch` | [M7](https://github.com/somethingwithproof/plugin_cloud/milestone/7) | Sin iniciar | +| 5, recopiladores remotos | Cuentas en recopiladores de datos remotos de Cacti | [M8](https://github.com/somethingwithproof/plugin_cloud/milestone/8) | Sin iniciar | + +Quedan fuera del alcance: modificar recursos de nube, crear o replicar alarmas de proveedores, informes de facturación, registros y trazas, y un motor de alertas propio del complemento. Los proveedores adicionales (Hetzner Cloud, Akamai Cloud, Oracle Cloud y otros) son cuestiones de investigación. + + +## Qué incluye el hito 2 + +- **Instalación protegida.** Con PHP anterior a 8.2 o sin ext-openssl, se rechazan la instalación y la activación con un mensaje, y el resto de Cacti sigue funcionando. +- **Ciclo de vida.** Instalación, actualización y desinstalación desde la página de complementos de Cacti. Las actualizaciones siguen un orden y sobreviven a interrupciones. La desinstalación conserva las tablas del complemento salvo que desmarque *Keep Plugin Tables on Uninstall*. +- **Ámbitos separados.** *Cloud Admin* abre **Cloud Accounts**; *Cloud View* abre **Cloud Health**. Ambas páginas están en Management. +- **Cuentas y credenciales.** Añadir, editar, verificar y eliminar cuentas. Las credenciales se cifran en la base de datos con un archivo de clave externo (AES-256-GCM), o se leen desde un archivo en el sondeador. En la interfaz solo pueden escribirse y se ocultan en los registros. +- **El recopilador.** Se inicia en cada ejecución del sondeador, una instancia por sondeador, dentro de un presupuesto de tiempo. Adquiere una concesión temporal por cuenta, ejecuta el descubrimiento con su propio intervalo y solo lee métricas de las fuentes de datos activas que pertenecen al complemento. +- **Salud.** Estado de recopilación, descubrimiento, recursos y vigencia por cuenta, junto con advertencias sobre claves de bóveda inutilizables, archivos de credenciales inseguros e intervalos que el sondeador no puede cumplir. + + +## Instalación y configuración + +Estos pasos instalan el código del hito 2 para evaluarlo. Requieren Cacti 1.2.31 o posterior sobre PHP 8.2 o posterior. + +1. Copie el repositorio a `plugins/cloud` dentro de su directorio de Cacti. El directorio debe llamarse `cloud`. +2. Cree la clave de la bóveda fuera de la raíz web. Colóquela en un directorio en el que solo root y el usuario de Cacti puedan escribir, y haga que el archivo solo pueda leerlo el usuario que ejecuta el servidor web y el sondeador. El complemento nunca crea ni escribe este archivo: + + ```sh + sudo install -d -m 0750 -o root -g cacti /etc/cacti + head -c 32 /dev/urandom | sudo tee /etc/cacti/cloud-vault.key > /dev/null + sudo chown cacti:cacti /etc/cacti/cloud-vault.key + sudo chmod 0600 /etc/cacti/cloud-vault.key + ``` + + Sustituya `cacti` por el usuario que ejecuta el servidor web y el sondeador. El archivo contiene 32 bytes sin procesar o 64 caracteres hexadecimales. Haga una copia de seguridad junto con la base de datos; sin él tendrá que volver a introducir las credenciales almacenadas. +3. En Cacti, abra **Configuration > Plugins** e instale y active *Cloud*. +4. En **Configuration > Settings > Cloud**, configure *Vault Key File* si ha utilizado otra ruta. *Collector Time Budget* (240 segundos de forma predeterminada) debe ser menor que el intervalo del sondeador. +5. Conceda *Cloud Admin* o *Cloud View* a usuarios y grupos en **Configuration > Users**. La instalación concede ambos ámbitos al administrador. +6. Añada cuentas en **Management > Cloud Accounts** y compruebe si hay advertencias en **Management > Cloud Health**. + + +## Objetivos de compatibilidad + +| Componente | Objetivo | +|---|---| +| Cacti | 1.2.31 o posterior, sin parches del núcleo | +| PHP | 8.2 o posterior; `setup.php` sigue siendo analizable en 8.0 para que un entorno no compatible reciba un rechazo en vez de romper la interfaz de Cacti | +| Extensiones de PHP | Ninguna aparte de las que exige Cacti 1.2.31 | +| Thold, Maint | No requieren cambios | + + +## Diseño + +- [docs/performance.md](docs/performance.md) contiene las mediciones del recolector y de la página de salud, con el hardware y los ajustes utilizados. +- [docs/PLAN.md](../../PLAN.md) contiene el plan completo: arquitectura, los datos de los proveedores y de Cacti de los que depende (con fuentes), el contrato de los controladores, los cálculos de costos, los límites de seguridad, las pruebas y los riesgos. +- [docs/decisions/](../../decisions) contiene las decisiones de arquitectura ya tomadas. +- [docs/REQUIREMENTS.md](../../REQUIREMENTS.md) relaciona cada identificador de requisito con su incidencia. + +```mermaid +flowchart LR + API[Provider monitoring APIs] -->|HTTPS, read only| C[Collector on the account's Cacti poller] + C --> O[(Observation cache)] + O --> SS[Script server data sources] + SS --> RRD[(Cacti RRD files)] + SS -->|poller_output| T[Thold and Maint] + RRD --> G[Cacti graphs and permissions] +``` + + +## Seguimiento del trabajo + +- Los **hitos** siguen los hitos del plan. Cada uno tiene una incidencia épica que enumera sus subincidencias y las pruebas de finalización. +- Las **incidencias** se clasifican por etiqueta: `type: requirement`, `type: research`, `type: decision`, `type: epic`. Las incidencias de requisitos especifican requisitos numerados y verificables (`REQ-AREA-NNN`) y criterios de aceptación. +- Las **etiquetas** también incluyen `area:`, `provider:`, `phase:`, `priority:` y `status:`. Consulte [CONTRIBUTING.md](../../../CONTRIBUTING.md#labels). +- El [tablero del proyecto](https://github.com/users/somethingwithproof/projects/7) muestra todas las incidencias de los distintos hitos. + + +## Desarrollo + +La integración continua comprueba la sintaxis de los puntos de entrada con PHP 8.0, ejecuta pruebas unitarias y de integración y PHPStan de nivel 9, e instala el complemento con PHP 8.2 a 8.5 sobre Cacti 1.2.31 y la rama 1.2.x. También comprueba que se rechace PHP 8.1 sin romper Cacti. Las pruebas usan Pest del entorno de pruebas de complementos del núcleo de Cacti. Esta elección es provisional hasta que se resuelva [#12](https://github.com/somethingwithproof/plugin_cloud/issues/12). [.github/workflows/plugin-ci-workflow.yml](../../../.github/workflows/plugin-ci-workflow.yml) enumera todos los pasos. Ejecute `sh tests/lint-workflows.sh` y `sh locales/build_gettext.sh --check` localmente antes de enviar cambios. + + +## Contribuciones + +Lea [CONTRIBUTING.md](../../../CONTRIBUTING.md). Los commits necesitan una firma DCO. El diseño se debate en incidencias; las decisiones abiertas llevan la etiqueta `type: decision`. + + +## Seguridad + +Comunique las vulnerabilidades de forma privada; consulte [SECURITY.md](../../../SECURITY.md). + + +## Licencia + +Licencia Pública General de GNU v2.0, la misma que Cacti y sus complementos. Consulte [LICENSE](../../../LICENSE). diff --git a/docs/i18n/es-419/docs/performance.md b/docs/i18n/es-419/docs/performance.md new file mode 100644 index 0000000..e286830 --- /dev/null +++ b/docs/i18n/es-419/docs/performance.md @@ -0,0 +1,70 @@ + + + +# Rendimiento + +Mediciones de [#47](https://github.com/somethingwithproof/plugin_cloud/issues/47), realizadas el 2026-11-15 con [`tests/bin/perf.php`](../../../../tests/bin/perf.php). CI ejecuta el mismo script en cada trabajo de Cacti y PHP. Solo hace fallar el trabajo cuando 1.000 series no terminan dentro de un intervalo del sondeador, e imprime los tiempos sin compararlos porque el hardware de los ejecutores varía. + +**Resultado.** Con un servidor local de datos de prueba y sin latencia agregada, una ejecución del recolector lee 1.000 series en unos 3 segundos: aproximadamente 3 ms de trabajo del complemento y TLS por solicitud. La página de salud representa 10.000 series en caché en 0,08 segundos. Con 100 ms de latencia de proveedor simulada por solicitud, la misma ejecución tarda 106 segundos. La latencia del proveedor determina si 1.000 series caben en un intervalo del sondeador. + + +## Qué se ejecuta + +El script utiliza el recolector real, el controlador DigitalOcean, el transporte protegido (lista de operaciones permitidas) y el transporte por sockets, con TLS verificado mediante una CA de pruebas. Solo se reescribe el host, después de comprobar la operación, para que las solicitudes lleguen a [`tests/bin/perf-server.php`](../../../../tests/bin/perf-server.php) en vez de a `api.digitalocean.com`. Ese servidor reproduce los datos de prueba grabados, desplazando sus marcas de tiempo al momento actual, y envía las cabeceras de límite de solicitudes que lee el controlador. + +| Caso | Configuración | Mide | +|---|---|---| +| Recopilación | 4 cuentas, 50 Droplets cada una, 5 series por Droplet (CPU y cuatro de ancho de banda): 1.000 series | Una ejecución del recolector en el sondeador 1 (REQ-PERF-001) | +| Presupuesto | 1 cuenta, 200 Droplets, 5 series cada uno: 1.000 series | La misma ejecución, donde el presupuesto de solicitudes detiene la cuenta | +| Página | 10 cuentas, 200 Droplets cada una, 5 series en caché por Droplet: 10.000 series | `cloud_health.php` por HTTP como administrador autenticado; mediana de cinco cargas tras un calentamiento (REQ-PERF-002) | + +La recopilación usa cuatro cuentas porque un token de DigitalOcean permite 250 solicitudes por minuto. Con una cuota del 100 %, ese es el máximo que lee una cuenta en una ejecución (`RequestBudget::perRun`). El caso de presupuesto muestra el límite: la cuenta lee 250 series, marca las otras 750 como no leídas con motivo `budget`, y la página de salud lo indica. + + +## Hardware y ajustes (REQ-PERF-003) + +| | | +|---|---| +| Equipo anfitrión | Apple M3 Max, 14 núcleos, 36 GiB | +| Entorno de ejecución | VM Linux de OrbStack, aarch64, 14 CPU, 15,7 GiB, imagen Docker `cloud-ci:8.2` | +| PHP | 8.2.35, CLI para el recolector, servidor web integrado para la página | +| Base de datos | MariaDB 11.8.9, en la misma VM | +| Cacti | 1.2.31 y la rama 1.2.x (1.2.32) | +| Intervalo del sondeador | 300 segundos | +| Cuentas | Intervalo de recopilación 300 segundos, cuota de solicitudes 100 %, descubrimiento no pendiente durante la ejecución | +| Presupuesto temporal del recolector | Intervalo del sondeador menos 10 segundos (290); el ajuste predeterminado del complemento es 240 | + + +## Resultados + +Tres ejecuciones en cada versión de Cacti, sin latencia agregada: + +| Caso | Cacti 1.2.31 | Cacti 1.2.x | +|---|---|---| +| Recopilación, 1.000 series en 4 cuentas | 2,83, 3,00, 3,17 s; 1.000 leídas con 1.000 solicitudes | 3,42, 2,59, 2,61 s; 1.000 leídas con 1.000 solicitudes | +| Presupuesto, 1.000 series en 1 cuenta | 1,20, 1,32, 1,10 s; 250 leídas, 750 pendientes con motivo `budget` | 1,24, 1,72, 1,10 s; 250 leídas, 750 pendientes con motivo `budget` | +| Página de salud, 10.000 series | Mediana 0,08 s, máximo 0,08 s, en las tres ejecuciones | Mediana 0,08 s, máximo de hasta 0,09 s | + +Con `perf.php 100`, que agrega 100 ms antes de cada respuesta de prueba, el caso de recopilación tardó 106,26 segundos en Cacti 1.2.31 y leyó las 1.000 series. El caso de presupuesto tardó 27,02 segundos. + +Se comprobó el contenido de la página, además de su velocidad. Cada una de las 10 cuentas mostraba 1.000 series actuales y una estimación de 12.000 solicitudes por hora (1.000 series cada 300 segundos). + + +## Interpretación de los resultados + +- **El tiempo de ejecución crece con la latencia del proveedor.** El recolector lee una serie por solicitud, de una en una. Una ejecución tarda aproximadamente solicitudes × (latencia + 3 ms). Con el presupuesto predeterminado de 240 segundos, caben 1.000 series mientras el viaje de ida y vuelta medio esté por debajo de unos 237 ms. Por encima, el recolector deja de iniciar cuentas nuevas al agotar el presupuesto y las cuentas no leídas se recopilan en la siguiente ejecución. La primera [comprobación real](../../../research/provider-facts.md#live-checks) (#16) midió una mediana de 384 ms (de 301 a 799 ms) desde una conexión doméstica. Con esa latencia, 1.000 series tardan unos 390 segundos, por lo que el presupuesto predeterminado lee unas 620 por ejecución y aplaza el resto. Un sondeador en un centro de datos cercano a DigitalOcean debería tener menos latencia; mida desde su propio sondeador antes de planificar más de unas 600 series en uno solo. +- **El límite de DigitalOcean es por token.** Con la cuota predeterminada del 50 %, una cuenta lee 125 series por ejecución. Los entornos mayores necesitan más cuentas, cada una con su token, y la estimación de la página de salud indica lo cerca que está cada cuenta de su cuota. +- **La página mantiene un costo bajo con 10.000 series.** Solo lee filas en caché y nunca llama a un proveedor, por lo que su costo crece con las tablas del complemento, no con la latencia del proveedor. +- **No se han medido aquí:** actualizaciones RRD del sondeador de Cacti, boost, Spine, recolectores remotos y una base de datos en otro equipo. Cada uno agrega costos externos al complemento. + + +## Ejecución + +En una base de datos desechable, con el complemento instalado y activado y Cacti servido en una URL: + +```sh +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ 100 +``` + +El segundo argumento agrega ese número de milisegundos de latencia a cada respuesta de prueba. El script elimina todas las cuentas, recursos, series y observaciones del complemento y restablece la contraseña del administrador; nunca lo ejecute contra una base de datos que desee conservar. diff --git a/docs/i18n/es-ES/README.md b/docs/i18n/es-ES/README.md new file mode 100644 index 0000000..f147db7 --- /dev/null +++ b/docs/i18n/es-ES/README.md @@ -0,0 +1,145 @@ + + + +[English](../../../README.md) | [简体中文](../zh-CN/README.md) | [हिन्दी](../hi-IN/README.md) | [Español (España)](README.md) | [Español (Latinoamérica)](../es-419/README.md) | [العربية](../ar-SA/README.md) + + + +# plugin_cloud + +Un complemento de Cacti 1.2 que incorpora los recursos y las métricas de proveedores de nube pública a Cacti como dispositivos, fuentes de datos y gráficos ordinarios. Así, las cargas de trabajo en la nube aparecen junto a la red que las transporta, bajo los permisos de Cacti, y Thold y Maint pueden generar y suprimir sus alertas. Un único complemento abarca todos los proveedores, con un controlador por proveedor: primero DigitalOcean, AWS, Google Cloud y Azure. + +> **Estado: hito 3 (DigitalOcean y objetos de Cacti), en revisión.** Este hito añade el controlador de DigitalOcean, plantillas de Cacti, un dispositivo de ámbito por cuenta con una consulta de datos por tipo de recurso, la entrada del servidor de scripts y una estimación de solicitudes en Nuevos gráficos y en la página de salud. Las primeras comprobaciones con una cuenta real de DigitalOcean están registradas en [datos de los proveedores](../../research/provider-facts.md). No lo ejecute en producción. + + +## Roles de acceso + +| Ámbito de permisos | Acceso | +| --- | --- | +| Cloud View | Páginas de supervisión existentes. | +| Cloud Operator | Supervisión, página de operaciones y acuses de recibo personales para la investigación. | +| Cloud Admin | Acceso de operador más las acciones de configuración y administración existentes. | + +Tras copiar los ficheros de actualización, abra la página de complementos como administrador para registrar el nuevo ámbito. Asigne explícitamente el ámbito Operator en **Configuration > Users** o en los grupos de usuarios. Las actualizaciones conservan los identificadores y las concesiones de los ámbitos View y Admin existentes. El acceso Admin hereda el acceso Operator, y Operator hereda View en cada solicitud; esto no añade concesiones almacenadas a usuarios ni grupos. Los ajustes del complemento también requieren acceso Cloud Admin, además del permiso Settings de Cacti. + +Los permisos de dispositivos de Cacti siguen limitando las filas y acciones disponibles para cada usuario; los objetos sin asignar requieren un administrador. Los operadores pueden verificar la credencial almacenada de una cuenta a cuyo dispositivo de Cacti tengan acceso. Las credenciales, la configuración, la asignación, la eliminación y los demás cambios administrativos permanecen en las páginas de administración. Los acuses de recibo duran únicamente durante la sesión del usuario actual, como máximo una hora y solo mientras la misma observación siga vigente. Las observaciones nuevas o modificadas los invalidan. Nunca convierten una medición fallida en saludable ni suprimen alertas. + + +## Motivo + +Cada proveedor de nube tiene su propia consola de supervisión. Al usarlas junto a Cacti quedan tres carencias: + +- **Control de acceso separado.** Mostrar métricas de nube a un usuario de Cacti exige darle acceso a la nube. +- **Sin contexto de red.** Los enlaces locales se representan en Cacti; las cargas de trabajo que hay detrás se representan en la consola de cada proveedor. +- **Alertas separadas.** Thold y Maint trabajan con fuentes de datos y dispositivos de Cacti, por lo que las alarmas de los proveedores se configuran y suprimen por separado, una vez por proveedor. + +El complemento lee la API de supervisión de cada proveedor desde un sondeador de Cacti, almacena en caché los puntos de datos más recientes y los sirve al servidor de scripts de Cacti. El sondeador de Cacti escribe los ficheros RRD, de modo que los gráficos, los permisos, Thold, Maint y boost funcionan como con cualquier otro dato de Cacti. + + +## Compromisos de diseño + +- **Solo lectura.** Cada controlador solo puede construir las operaciones del proveedor incluidas en su lista de permitidas; el complemento nunca modifica un recurso de nube. ([ADR 0002](../../decisions/0002-read-only-with-operation-allowlist.md)) +- **Solo PHP, sin SDK.** La firma y el intercambio de tokens están implementados en PHP con las extensiones que Cacti ya requiere. No hay dependencias de Composer en tiempo de ejecución. ([ADR 0003](../../decisions/0003-php-only-without-sdks.md)) +- **Coste antes de recopilar.** El complemento solo lee métricas que tengan una fuente de datos de Cacti, muestra el número esperado de solicitudes y su coste a precio de catálogo antes de crear gráficos, y aplica un límite mensual. ([ADR 0005](../../decisions/0005-collect-only-what-is-graphed.md)) +- **Sin credenciales en texto claro en la base de datos.** Las credenciales proceden de una bóveda cifrada cuya clave está en un fichero externo a la base de datos, de un fichero de credenciales o de la identidad de instancia del proveedor. ([ADR 0007](../../decisions/0007-credentials-outside-the-database-in-the-clear.md)) + + +## Alcance y estado + +| Fase | Alcance | Hitos | Estado | +|---|---|---|---| +| 0, investigación | Confirmación de datos de proveedores, catálogos de métricas, modelo de costes y tasas, vectores de prueba de firma y prueba de transporte | [M1](https://github.com/somethingwithproof/plugin_cloud/milestone/1) | Terminada, salvo las comprobaciones que requieren una cuenta real de proveedor | +| 1, núcleo y DigitalOcean | Cuentas, bóveda de credenciales, transporte, recopilador, caché de observaciones, objetos de Cacti, página de salud, Droplets y equilibradores de carga de DigitalOcean | [M2](https://github.com/somethingwithproof/plugin_cloud/milestone/2), [M3](https://github.com/somethingwithproof/plugin_cloud/milestone/3), [M4](https://github.com/somethingwithproof/plugin_cloud/milestone/4) | M2 terminado ([#81](https://github.com/somethingwithproof/plugin_cloud/pull/81)); controlador, plantillas y dispositivos de ámbito de M3 integrados; estimaciones de solicitudes, permisos y pruebas de rendimiento en revisión; M4 sin iniciar | +| 2, AWS | Signature Version 4, `AssumeRole`, roles de instancia, CloudWatch `GetMetricData`, inventario regional | [M5](https://github.com/somethingwithproof/plugin_cloud/milestone/5) | Sin iniciar | +| 3, Google Cloud | JWT de cuenta de servicio, servidor de metadatos, Cloud Monitoring `timeSeries.list` | [M6](https://github.com/somethingwithproof/plugin_cloud/milestone/6) | Sin iniciar | +| 4, Azure | Credenciales de cliente de Entra, identidad administrada, Resource Graph, `metrics:getBatch` | [M7](https://github.com/somethingwithproof/plugin_cloud/milestone/7) | Sin iniciar | +| 5, recopiladores remotos | Cuentas en recopiladores de datos remotos de Cacti | [M8](https://github.com/somethingwithproof/plugin_cloud/milestone/8) | Sin iniciar | + +Quedan fuera del alcance: modificar recursos de nube, crear o replicar alarmas de proveedores, informes de facturación, registros y trazas, y un motor de alertas propio del complemento. Los proveedores adicionales (Hetzner Cloud, Akamai Cloud, Oracle Cloud y otros) son cuestiones de investigación. + + +## Qué incluye el hito 2 + +- **Instalación protegida.** Con PHP anterior a 8.2 o sin ext-openssl, se rechazan la instalación y la activación con un mensaje, y el resto de Cacti sigue funcionando. +- **Ciclo de vida.** Instalación, actualización y desinstalación desde la página de complementos de Cacti. Las actualizaciones siguen un orden y sobreviven a interrupciones. La desinstalación conserva las tablas del complemento salvo que desmarque *Keep Plugin Tables on Uninstall*. +- **Ámbitos separados.** *Cloud Admin* abre **Cloud Accounts**; *Cloud View* abre **Cloud Health**. Ambas páginas están en Management. +- **Cuentas y credenciales.** Añadir, editar, verificar y eliminar cuentas. Las credenciales se cifran en la base de datos con un fichero de clave externo (AES-256-GCM), o se leen desde un fichero en el sondeador. En la interfaz solo pueden escribirse y se ocultan en los registros. +- **El recopilador.** Se inicia en cada ejecución del sondeador, una instancia por sondeador, dentro de un presupuesto de tiempo. Adquiere una concesión temporal por cuenta, ejecuta el descubrimiento con su propio intervalo y solo lee métricas de las fuentes de datos activas que pertenecen al complemento. +- **Salud.** Estado de recopilación, descubrimiento, recursos y vigencia por cuenta, junto con advertencias sobre claves de bóveda inutilizables, ficheros de credenciales inseguros e intervalos que el sondeador no puede cumplir. + + +## Instalación y configuración + +Estos pasos instalan el código del hito 2 para evaluarlo. Requieren Cacti 1.2.31 o posterior sobre PHP 8.2 o posterior. + +1. Copie el repositorio a `plugins/cloud` dentro de su directorio de Cacti. El directorio debe llamarse `cloud`. +2. Cree la clave de la bóveda fuera de la raíz web. Colóquela en un directorio en el que solo root y el usuario de Cacti puedan escribir, y haga que el fichero solo pueda leerlo el usuario que ejecuta el servidor web y el sondeador. El complemento nunca crea ni escribe este fichero: + + ```sh + sudo install -d -m 0750 -o root -g cacti /etc/cacti + head -c 32 /dev/urandom | sudo tee /etc/cacti/cloud-vault.key > /dev/null + sudo chown cacti:cacti /etc/cacti/cloud-vault.key + sudo chmod 0600 /etc/cacti/cloud-vault.key + ``` + + Sustituya `cacti` por el usuario que ejecuta el servidor web y el sondeador. El fichero contiene 32 bytes sin procesar o 64 caracteres hexadecimales. Haga una copia de seguridad junto con la base de datos; sin él tendrá que volver a introducir las credenciales almacenadas. +3. En Cacti, abra **Configuration > Plugins** e instale y active *Cloud*. +4. En **Configuration > Settings > Cloud**, configure *Vault Key File* si ha utilizado otra ruta. *Collector Time Budget* (240 segundos de forma predeterminada) debe ser menor que el intervalo del sondeador. +5. Conceda *Cloud Admin* o *Cloud View* a usuarios y grupos en **Configuration > Users**. La instalación concede ambos ámbitos al administrador. +6. Añada cuentas en **Management > Cloud Accounts** y compruebe si hay advertencias en **Management > Cloud Health**. + + +## Objetivos de compatibilidad + +| Componente | Objetivo | +|---|---| +| Cacti | 1.2.31 o posterior, sin parches del núcleo | +| PHP | 8.2 o posterior; `setup.php` sigue siendo analizable en 8.0 para que un entorno no compatible reciba un rechazo en vez de romper la interfaz de Cacti | +| Extensiones de PHP | Ninguna aparte de las que exige Cacti 1.2.31 | +| Thold, Maint | No requieren cambios | + + +## Diseño + +- [docs/performance.md](docs/performance.md) contiene las mediciones del recolector y de la página de salud, con el hardware y los ajustes utilizados. +- [docs/PLAN.md](../../PLAN.md) contiene el plan completo: arquitectura, los datos de los proveedores y de Cacti de los que depende (con fuentes), el contrato de los controladores, los cálculos de costes, los límites de seguridad, las pruebas y los riesgos. +- [docs/decisions/](../../decisions) contiene las decisiones de arquitectura ya tomadas. +- [docs/REQUIREMENTS.md](../../REQUIREMENTS.md) relaciona cada identificador de requisito con su incidencia. + +```mermaid +flowchart LR + API[Provider monitoring APIs] -->|HTTPS, read only| C[Collector on the account's Cacti poller] + C --> O[(Observation cache)] + O --> SS[Script server data sources] + SS --> RRD[(Cacti RRD files)] + SS -->|poller_output| T[Thold and Maint] + RRD --> G[Cacti graphs and permissions] +``` + + +## Seguimiento del trabajo + +- Los **hitos** siguen los hitos del plan. Cada uno tiene una incidencia épica que enumera sus subincidencias y las pruebas de finalización. +- Las **incidencias** se clasifican por etiqueta: `type: requirement`, `type: research`, `type: decision`, `type: epic`. Las incidencias de requisitos especifican requisitos numerados y verificables (`REQ-AREA-NNN`) y criterios de aceptación. +- Las **etiquetas** también incluyen `area:`, `provider:`, `phase:`, `priority:` y `status:`. Consulte [CONTRIBUTING.md](../../../CONTRIBUTING.md#labels). +- El [tablero del proyecto](https://github.com/users/somethingwithproof/projects/7) muestra todas las incidencias de los distintos hitos. + + +## Desarrollo + +La integración continua comprueba la sintaxis de los puntos de entrada con PHP 8.0, ejecuta pruebas unitarias y de integración y PHPStan de nivel 9, e instala el complemento con PHP 8.2 a 8.5 sobre Cacti 1.2.31 y la rama 1.2.x. También comprueba que se rechace PHP 8.1 sin romper Cacti. Las pruebas usan Pest del entorno de pruebas de complementos del núcleo de Cacti. Esta elección es provisional hasta que se resuelva [#12](https://github.com/somethingwithproof/plugin_cloud/issues/12). [.github/workflows/plugin-ci-workflow.yml](../../../.github/workflows/plugin-ci-workflow.yml) enumera todos los pasos. Ejecute `sh tests/lint-workflows.sh` y `sh locales/build_gettext.sh --check` localmente antes de enviar cambios. + + +## Contribuciones + +Lea [CONTRIBUTING.md](../../../CONTRIBUTING.md). Los commits necesitan una firma DCO. El diseño se debate en incidencias; las decisiones abiertas llevan la etiqueta `type: decision`. + + +## Seguridad + +Comunique las vulnerabilidades de forma privada; consulte [SECURITY.md](../../../SECURITY.md). + + +## Licencia + +Licencia Pública General de GNU v2.0, la misma que Cacti y sus complementos. Consulte [LICENSE](../../../LICENSE). diff --git a/docs/i18n/es-ES/docs/performance.md b/docs/i18n/es-ES/docs/performance.md new file mode 100644 index 0000000..81c5561 --- /dev/null +++ b/docs/i18n/es-ES/docs/performance.md @@ -0,0 +1,70 @@ + + + +# Rendimiento + +Mediciones de [#47](https://github.com/somethingwithproof/plugin_cloud/issues/47), realizadas el 2026-11-15 con [`tests/bin/perf.php`](../../../../tests/bin/perf.php). CI ejecuta el mismo script en cada trabajo de Cacti y PHP. Solo hace fallar el trabajo cuando 1.000 series no terminan dentro de un intervalo del sondeador, e imprime los tiempos sin compararlos porque el hardware de los ejecutores varía. + +**Resultado.** Con un servidor local de datos de prueba y sin latencia añadida, una ejecución del recolector lee 1.000 series en unos 3 segundos: aproximadamente 3 ms de trabajo del complemento y TLS por solicitud. La página de salud representa 10.000 series en caché en 0,08 segundos. Con 100 ms de latencia de proveedor simulada por solicitud, la misma ejecución tarda 106 segundos. La latencia del proveedor determina si 1.000 series caben en un intervalo del sondeador. + + +## Qué se ejecuta + +El script utiliza el recolector real, el controlador DigitalOcean, el transporte protegido (lista de operaciones permitidas) y el transporte por sockets, con TLS verificado mediante una CA de pruebas. Solo se reescribe el host, después de comprobar la operación, para que las solicitudes lleguen a [`tests/bin/perf-server.php`](../../../../tests/bin/perf-server.php) en vez de a `api.digitalocean.com`. Ese servidor reproduce los datos de prueba grabados, desplazando sus marcas de tiempo al momento actual, y envía las cabeceras de límite de solicitudes que lee el controlador. + +| Caso | Configuración | Mide | +|---|---|---| +| Recopilación | 4 cuentas, 50 Droplets cada una, 5 series por Droplet (CPU y cuatro de ancho de banda): 1.000 series | Una ejecución del recolector en el sondeador 1 (REQ-PERF-001) | +| Presupuesto | 1 cuenta, 200 Droplets, 5 series cada uno: 1.000 series | La misma ejecución, donde el presupuesto de solicitudes detiene la cuenta | +| Página | 10 cuentas, 200 Droplets cada una, 5 series en caché por Droplet: 10.000 series | `cloud_health.php` por HTTP como administrador autenticado; mediana de cinco cargas tras un calentamiento (REQ-PERF-002) | + +La recopilación usa cuatro cuentas porque un token de DigitalOcean permite 250 solicitudes por minuto. Con una cuota del 100 %, ese es el máximo que lee una cuenta en una ejecución (`RequestBudget::perRun`). El caso de presupuesto muestra el límite: la cuenta lee 250 series, marca las otras 750 como no leídas con motivo `budget`, y la página de salud lo indica. + + +## Hardware y ajustes (REQ-PERF-003) + +| | | +|---|---| +| Equipo anfitrión | Apple M3 Max, 14 núcleos, 36 GiB | +| Entorno de ejecución | VM Linux de OrbStack, aarch64, 14 CPU, 15,7 GiB, imagen Docker `cloud-ci:8.2` | +| PHP | 8.2.35, CLI para el recolector, servidor web integrado para la página | +| Base de datos | MariaDB 11.8.9, en la misma VM | +| Cacti | 1.2.31 y la rama 1.2.x (1.2.32) | +| Intervalo del sondeador | 300 segundos | +| Cuentas | Intervalo de recopilación 300 segundos, cuota de solicitudes 100 %, descubrimiento no pendiente durante la ejecución | +| Presupuesto temporal del recolector | Intervalo del sondeador menos 10 segundos (290); el ajuste predeterminado del complemento es 240 | + + +## Resultados + +Tres ejecuciones en cada versión de Cacti, sin latencia añadida: + +| Caso | Cacti 1.2.31 | Cacti 1.2.x | +|---|---|---| +| Recopilación, 1.000 series en 4 cuentas | 2,83, 3,00, 3,17 s; 1.000 leídas con 1.000 solicitudes | 3,42, 2,59, 2,61 s; 1.000 leídas con 1.000 solicitudes | +| Presupuesto, 1.000 series en 1 cuenta | 1,20, 1,32, 1,10 s; 250 leídas, 750 pendientes con motivo `budget` | 1,24, 1,72, 1,10 s; 250 leídas, 750 pendientes con motivo `budget` | +| Página de salud, 10.000 series | Mediana 0,08 s, máximo 0,08 s, en las tres ejecuciones | Mediana 0,08 s, máximo de hasta 0,09 s | + +Con `perf.php 100`, que añade 100 ms antes de cada respuesta de prueba, el caso de recopilación tardó 106,26 segundos en Cacti 1.2.31 y leyó las 1.000 series. El caso de presupuesto tardó 27,02 segundos. + +Se comprobó el contenido de la página, además de su velocidad. Cada una de las 10 cuentas mostraba 1.000 series actuales y una estimación de 12.000 solicitudes por hora (1.000 series cada 300 segundos). + + +## Interpretación de los resultados + +- **El tiempo de ejecución crece con la latencia del proveedor.** El recolector lee una serie por solicitud, de una en una. Una ejecución tarda aproximadamente solicitudes × (latencia + 3 ms). Con el presupuesto predeterminado de 240 segundos, caben 1.000 series mientras el viaje de ida y vuelta medio esté por debajo de unos 237 ms. Por encima, el recolector deja de iniciar cuentas nuevas al agotar el presupuesto y las cuentas no leídas se recopilan en la siguiente ejecución. La primera [comprobación real](../../../research/provider-facts.md#live-checks) (#16) midió una mediana de 384 ms (de 301 a 799 ms) desde una conexión doméstica. Con esa latencia, 1.000 series tardan unos 390 segundos, por lo que el presupuesto predeterminado lee unas 620 por ejecución y aplaza el resto. Un sondeador en un centro de datos cercano a DigitalOcean debería tener menos latencia; mida desde su propio sondeador antes de planificar más de unas 600 series en uno solo. +- **El límite de DigitalOcean es por token.** Con la cuota predeterminada del 50 %, una cuenta lee 125 series por ejecución. Los entornos mayores necesitan más cuentas, cada una con su token, y la estimación de la página de salud indica lo cerca que está cada cuenta de su cuota. +- **La página mantiene un coste bajo con 10.000 series.** Solo lee filas en caché y nunca llama a un proveedor, por lo que su coste crece con las tablas del complemento, no con la latencia del proveedor. +- **No se han medido aquí:** actualizaciones RRD del sondeador de Cacti, boost, Spine, recolectores remotos y una base de datos en otro equipo. Cada uno añade costes externos al complemento. + + +## Ejecución + +En una base de datos desechable, con el complemento instalado y activado y Cacti servido en una URL: + +```sh +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ 100 +``` + +El segundo argumento añade ese número de milisegundos de latencia a cada respuesta de prueba. El script elimina todas las cuentas, recursos, series y observaciones del complemento y restablece la contraseña del administrador; nunca lo ejecute contra una base de datos que desee conservar. diff --git a/docs/i18n/hi-IN/README.md b/docs/i18n/hi-IN/README.md new file mode 100644 index 0000000..bc0d0a6 --- /dev/null +++ b/docs/i18n/hi-IN/README.md @@ -0,0 +1,145 @@ + + + +[English](../../../README.md) | [简体中文](../zh-CN/README.md) | [हिन्दी](README.md) | [Español (España)](../es-ES/README.md) | [Español (Latinoamérica)](../es-419/README.md) | [العربية](../ar-SA/README.md) + + + +# plugin_cloud + +यह Cacti 1.2 प्लगइन सार्वजनिक क्लाउड प्रदाताओं के संसाधनों और मेट्रिक को सामान्य डिवाइस, डेटा स्रोत और ग्राफ़ के रूप में Cacti में लाता है। इससे क्लाउड कार्यभार उन्हें वहन करने वाले नेटवर्क के साथ, Cacti की अनुमतियों के अंतर्गत दिखाई देते हैं, और Thold तथा Maint उन पर अलर्ट दे सकते हैं या दबा सकते हैं। हर प्रदाता के लिए अलग ड्राइवर के साथ एक प्लगइन सभी प्रदाताओं को समेटता है: पहले DigitalOcean, AWS, Google Cloud और Azure। + +> **स्थिति: माइलस्टोन 3 (DigitalOcean और Cacti ऑब्जेक्ट), समीक्षा में।** यह माइलस्टोन DigitalOcean ड्राइवर, Cacti टेम्पलेट, प्रत्येक खाते के लिए एक स्कोप डिवाइस और प्रत्येक संसाधन प्रकार के लिए डेटा क्वेरी, स्क्रिप्ट सर्वर इनपुट तथा New Graphs और स्वास्थ्य पृष्ठ पर अनुरोध अनुमान जोड़ता है। वास्तविक DigitalOcean खाते पर शुरुआती जाँचें [प्रदाता संबंधी तथ्यों](../../research/provider-facts.md) में दर्ज हैं। इसे उत्पादन में न चलाएँ। + + +## पहुँच भूमिकाएँ + +| अनुमति क्षेत्र | पहुँच | +| --- | --- | +| Cloud View | मौजूदा निगरानी पृष्ठ। | +| Cloud Operator | निगरानी, Operations पृष्ठ और जाँच के लिए व्यक्तिगत पावती। | +| Cloud Admin | ऑपरेटर पहुँच तथा मौजूदा कॉन्फ़िगरेशन और प्रशासनिक कार्रवाइयाँ। | + +अपग्रेड फ़ाइलें कॉपी करने के बाद नया अनुमति क्षेत्र पंजीकृत करने के लिए प्रशासक के रूप में Plugins पृष्ठ खोलें। **Configuration > Users** या उपयोगकर्ता समूहों में Operator क्षेत्र स्पष्ट रूप से दें। अपग्रेड मौजूदा View और Admin क्षेत्र के ID और अनुमतियाँ बनाए रखते हैं। हर अनुरोध में Admin पहुँच को Operator पहुँच और Operator को View पहुँच विरासत में मिलती है; इससे उपयोगकर्ताओं या समूहों की संग्रहीत अनुमतियाँ नहीं जुड़तीं। प्लगइन सेटिंग्स के लिए Cacti की Settings अनुमति के साथ Cloud Admin पहुँच भी आवश्यक है। + +Cacti डिवाइस अनुमतियाँ अब भी प्रत्येक उपयोगकर्ता की उपलब्ध पंक्तियों और कार्रवाइयों को सीमित करती हैं; बिना मैप किए ऑब्जेक्ट के लिए प्रशासक चाहिए। ऑपरेटर उस खाते का संग्रहीत क्रेडेंशियल सत्यापित कर सकते हैं जिसके Cacti डिवाइस तक उनकी पहुँच है। क्रेडेंशियल, कॉन्फ़िगरेशन, मैपिंग, हटाना और अन्य प्रशासनिक बदलाव प्रशासनिक पृष्ठों पर ही रहते हैं। पावती केवल वर्तमान उपयोगकर्ता के सत्र में, अधिकतम एक घंटे तक और केवल जब तक वही अवलोकन ताज़ा है, बनी रहती है। नए या बदले अवलोकन उसे अमान्य करते हैं। यह कभी विफल मापन को स्वस्थ नहीं बनाती या अलर्ट नहीं दबाती। + + +## उद्देश्य + +हर क्लाउड प्रदाता की अपनी निगरानी कंसोल है। Cacti के साथ चलाने पर उनमें तीन कमियाँ रहती हैं: + +- **अलग पहुँच नियंत्रण।** Cacti उपयोगकर्ता को क्लाउड मेट्रिक दिखाने के लिए उसे क्लाउड लॉगिन देना पड़ता है। +- **नेटवर्क संदर्भ नहीं।** स्थानीय लिंक Cacti में ग्राफ़ होते हैं; उनके पीछे के कार्यभार हर प्रदाता की कंसोल में ग्राफ़ होते हैं। +- **अलग अलर्ट व्यवस्था।** Thold और Maint Cacti डेटा स्रोतों और डिवाइसों पर काम करते हैं, इसलिए प्रदाता अलार्म हर प्रदाता के लिए अलग कॉन्फ़िगर और दबाए जाते हैं। + +प्लगइन Cacti पोलर पर हर प्रदाता की निगरानी API पढ़ता है, नवीनतम डेटा बिंदु कैश करता है और उन्हें Cacti स्क्रिप्ट सर्वर को देता है। Cacti पोलर RRD फ़ाइलें लिखता है, इसलिए ग्राफ़, अनुमतियाँ, Thold, Maint और boost किसी भी Cacti डेटा की तरह काम करते हैं। + + +## डिज़ाइन की प्रतिबद्धताएँ + +- **केवल-पठन।** हर ड्राइवर केवल अपनी अनुमति-सूची में दिए प्रदाता ऑपरेशन बना सकता है; प्लगइन कभी क्लाउड संसाधन नहीं बदलता। ([ADR 0002](../../decisions/0002-read-only-with-operation-allowlist.md)) +- **केवल PHP, कोई SDK नहीं।** हस्ताक्षर और टोकन विनिमय PHP में उन एक्सटेंशन से लागू हैं जो Cacti पहले से माँगता है। कोई Composer रनटाइम निर्भरता नहीं है। ([ADR 0003](../../decisions/0003-php-only-without-sdks.md)) +- **संग्रह से पहले लागत।** प्लगइन केवल उन मेट्रिक को पढ़ता है जिनका Cacti डेटा स्रोत है, ग्राफ़ बनाने से पहले अपेक्षित अनुरोध संख्या और सूची-मूल्य लागत दिखाता है तथा मासिक सीमा लागू करता है। ([ADR 0005](../../decisions/0005-collect-only-what-is-graphed.md)) +- **डेटाबेस में सादे पाठ के क्रेडेंशियल नहीं।** क्रेडेंशियल एन्क्रिप्टेड वॉल्ट से आते हैं जिसकी कुंजी डेटाबेस के बाहर फ़ाइल में है, या क्रेडेंशियल फ़ाइल से, या प्रदाता की इंस्टेंस पहचान से। ([ADR 0007](../../decisions/0007-credentials-outside-the-database-in-the-clear.md)) + + +## दायरा और स्थिति + +| चरण | दायरा | माइलस्टोन | स्थिति | +|---|---|---|---| +| 0, शोध | प्रदाता तथ्य पुष्टि, मेट्रिक कैटलॉग, लागत और दर मॉडल, हस्ताक्षर परीक्षण वेक्टर, परिवहन प्रोटोटाइप | [M1](https://github.com/somethingwithproof/plugin_cloud/milestone/1) | वास्तविक प्रदाता खाता माँगने वाली जाँचों को छोड़कर पूरा | +| 1, कोर और DigitalOcean | खाते, क्रेडेंशियल वॉल्ट, परिवहन, संग्राहक, अवलोकन कैश, Cacti ऑब्जेक्ट, स्वास्थ्य पृष्ठ, DigitalOcean Droplet और लोड बैलेंसर | [M2](https://github.com/somethingwithproof/plugin_cloud/milestone/2), [M3](https://github.com/somethingwithproof/plugin_cloud/milestone/3), [M4](https://github.com/somethingwithproof/plugin_cloud/milestone/4) | M2 पूरा ([#81](https://github.com/somethingwithproof/plugin_cloud/pull/81)); M3 ड्राइवर, टेम्पलेट और स्कोप डिवाइस मर्ज; अनुरोध अनुमान, अनुमतियाँ और प्रदर्शन जाँच समीक्षा में; M4 शुरू नहीं | +| 2, AWS | Signature Version 4, `AssumeRole`, इंस्टेंस भूमिकाएँ, CloudWatch `GetMetricData`, क्षेत्रीय इन्वेंट्री | [M5](https://github.com/somethingwithproof/plugin_cloud/milestone/5) | शुरू नहीं | +| 3, Google Cloud | सेवा खाता JWT, मेटाडेटा सर्वर, Cloud Monitoring `timeSeries.list` | [M6](https://github.com/somethingwithproof/plugin_cloud/milestone/6) | शुरू नहीं | +| 4, Azure | Entra क्लाइंट क्रेडेंशियल, प्रबंधित पहचान, Resource Graph, `metrics:getBatch` | [M7](https://github.com/somethingwithproof/plugin_cloud/milestone/7) | शुरू नहीं | +| 5, रिमोट संग्राहक | Cacti रिमोट डेटा संग्राहकों पर खाते | [M8](https://github.com/somethingwithproof/plugin_cloud/milestone/8) | शुरू नहीं | + +दायरे से बाहर: क्लाउड संसाधन बदलना, प्रदाता अलार्म बनाना या प्रतिबिंबित करना, बिलिंग रिपोर्ट, लॉग और ट्रेस तथा प्लगइन का अपना अलर्ट इंजन। अतिरिक्त प्रदाता (Hetzner Cloud, Akamai Cloud, Oracle Cloud और अन्य) शोध के विषय हैं। + + +## माइलस्टोन 2 में क्या मिलता है + +- **सुरक्षित स्थापना जाँच।** PHP 8.2 से नीचे या ext-openssl के बिना स्थापना और सक्षम करना संदेश के साथ अस्वीकार होता है, और बाकी Cacti काम करता रहता है। +- **जीवनचक्र।** Cacti के Plugins पृष्ठ से इंस्टॉल, अपग्रेड और अनइंस्टॉल करें। अपग्रेड क्रमबद्ध हैं और रुकावट सहते हैं। *Keep Plugin Tables on Uninstall* को अचयनित न करने तक अनइंस्टॉल प्लगइन तालिकाएँ रखता है। +- **अलग अनुमति क्षेत्र।** *Cloud Admin* से **Cloud Accounts**, और *Cloud View* से **Cloud Health** खुलता है। दोनों पृष्ठ Management में हैं। +- **खाते और क्रेडेंशियल।** खाते जोड़ें, संपादित करें, सत्यापित करें और हटाएँ। क्रेडेंशियल या तो बाहर रखी कुंजी फ़ाइल से डेटाबेस में एन्क्रिप्ट होता है (AES-256-GCM), या पोलर की फ़ाइल से पढ़ा जाता है। UI में क्रेडेंशियल केवल लिखे जा सकते हैं और लॉग में छिपाए जाते हैं। +- **संग्राहक।** यह हर पोलर निष्पादन पर, प्रति पोलर एक इंस्टेंस के रूप में और समय बजट में शुरू होता है। यह प्रति खाते लीज़ लेता है, अपने अंतराल पर खोज चलाता है और केवल प्लगइन के अपने सक्रिय डेटा स्रोतों के मेट्रिक पढ़ता है। +- **स्वास्थ्य।** प्रति-खाता संग्रह, खोज, संसाधन और ताज़गी की स्थिति, साथ में अनुपयोगी वॉल्ट कुंजी, असुरक्षित क्रेडेंशियल फ़ाइल और पोलर के पूरा न कर सकने वाले अंतराल की चेतावनियाँ। + + +## इंस्टॉल और कॉन्फ़िगर करना + +ये चरण मूल्यांकन के लिए माइलस्टोन 2 कोड इंस्टॉल करते हैं। इन्हें PHP 8.2 या नए पर Cacti 1.2.31 या नया चाहिए। + +1. रिपॉज़िटरी को Cacti डायरेक्टरी के अंतर्गत `plugins/cloud` में कॉपी करें। डायरेक्टरी का नाम `cloud` होना चाहिए। +2. वॉल्ट कुंजी वेब रूट के बाहर बनाएँ। इसे ऐसी डायरेक्टरी में रखें जहाँ केवल root और Cacti उपयोगकर्ता लिख सकें, और फ़ाइल केवल वेब सर्वर तथा पोलर चलाने वाले उपयोगकर्ता के पढ़ने योग्य बनाएँ। प्लगइन यह फ़ाइल कभी बनाता या लिखता नहीं है: + + ```sh + sudo install -d -m 0750 -o root -g cacti /etc/cacti + head -c 32 /dev/urandom | sudo tee /etc/cacti/cloud-vault.key > /dev/null + sudo chown cacti:cacti /etc/cacti/cloud-vault.key + sudo chmod 0600 /etc/cacti/cloud-vault.key + ``` + + `cacti` को वेब सर्वर और पोलर चलाने वाले उपयोगकर्ता से बदलें। फ़ाइल में 32 मूल बाइट या 64 हेक्साडेसिमल वर्ण होते हैं। डेटाबेस के साथ बैकअप लें; इसके बिना संग्रहीत क्रेडेंशियल दोबारा दर्ज करने होंगे। +3. Cacti में **Configuration > Plugins** खोलें, फिर *Cloud* इंस्टॉल और सक्षम करें। +4. **Configuration > Settings > Cloud** में, अलग पथ उपयोग किया हो तो *Vault Key File* सेट करें। *Collector Time Budget* (डिफ़ॉल्ट 240 सेकंड) पोलर अंतराल से कम होना चाहिए। +5. **Configuration > Users** में उपयोगकर्ताओं और समूहों को *Cloud Admin* या *Cloud View* दें। इंस्टॉल करने पर प्रशासक को दोनों क्षेत्र मिलते हैं। +6. **Management > Cloud Accounts** में खाते जोड़ें, फिर **Management > Cloud Health** पर चेतावनियाँ जाँचें। + + +## संगतता लक्ष्य + +| घटक | लक्ष्य | +|---|---| +| Cacti | 1.2.31 या नया, कोर पैच के बिना | +| PHP | 8.2 या नया; `setup.php` 8.0 पर पार्स हो सकता है, ताकि असमर्थित रनटाइम पर Cacti UI टूटने के बजाय अस्वीकृति मिले | +| PHP एक्सटेंशन | Cacti 1.2.31 की आवश्यकताओं के अतिरिक्त कोई नहीं | +| Thold, Maint | बदलाव आवश्यक नहीं | + + +## डिज़ाइन + +- [docs/performance.md](docs/performance.md) में उपयोग किए हार्डवेयर और सेटिंग के साथ संग्राहक और स्वास्थ्य पृष्ठ के मापन हैं। +- [docs/PLAN.md](../../PLAN.md) पूरा प्लान है: आर्किटेक्चर, उस पर निर्भर प्रदाता और Cacti तथ्य (स्रोतों सहित), ड्राइवर अनुबंध, लागत गणना, सुरक्षा सीमाएँ, परीक्षण और जोखिम। +- [docs/decisions/](../../decisions) में पहले लिए गए विकल्पों के आर्किटेक्चर निर्णय रिकॉर्ड हैं। +- [docs/REQUIREMENTS.md](../../REQUIREMENTS.md) प्रत्येक आवश्यकता ID को उसके मुद्दे से जोड़ता है। + +```mermaid +flowchart LR + API[Provider monitoring APIs] -->|HTTPS, read only| C[Collector on the account's Cacti poller] + C --> O[(Observation cache)] + O --> SS[Script server data sources] + SS --> RRD[(Cacti RRD files)] + 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:`, `provider:`, `phase:`, `priority:` और `status:` भी होते हैं। [CONTRIBUTING.md](../../../CONTRIBUTING.md#labels) देखें। +- [प्रोजेक्ट बोर्ड](https://github.com/users/somethingwithproof/projects/7) सभी माइलस्टोन के मुद्दे दिखाता है। + + +## विकास + +CI PHP 8.0 पर प्रवेश बिंदुओं की लिंट जाँच करता है, यूनिट तथा एकीकरण परीक्षण और PHPStan स्तर 9 चलाता है, तथा Cacti 1.2.31 और 1.2.x शाखा के विरुद्ध PHP 8.2 से 8.5 पर प्लगइन इंस्टॉल करता है। यह यह भी जाँचता है कि PHP 8.1 अस्वीकार हो और Cacti न टूटे। परीक्षण Cacti कोर के प्लगइन परीक्षण हार्नेस का Pest उपयोग करते हैं। [#12](https://github.com/somethingwithproof/plugin_cloud/issues/12) का निर्णय होने तक यह चयन अस्थायी है। [.github/workflows/plugin-ci-workflow.yml](../../../.github/workflows/plugin-ci-workflow.yml) हर चरण सूचीबद्ध करता है। पुश से पहले स्थानीय रूप से `sh tests/lint-workflows.sh` और `sh locales/build_gettext.sh --check` चलाएँ। + + +## योगदान + +[CONTRIBUTING.md](../../../CONTRIBUTING.md) पढ़ें। कमिट में DCO साइन-ऑफ़ चाहिए। डिज़ाइन चर्चा मुद्दों में होती है; खुले निर्णयों पर `type: decision` लेबल है। + + +## सुरक्षा + +कमज़ोरियाँ निजी रूप से रिपोर्ट करें; [SECURITY.md](../../../SECURITY.md) देखें। + + +## लाइसेंस + +GNU General Public License v2.0, वही लाइसेंस जो Cacti और उसके प्लगइन उपयोग करते हैं। [LICENSE](../../../LICENSE) देखें। diff --git a/docs/i18n/hi-IN/docs/performance.md b/docs/i18n/hi-IN/docs/performance.md new file mode 100644 index 0000000..8f5cf02 --- /dev/null +++ b/docs/i18n/hi-IN/docs/performance.md @@ -0,0 +1,70 @@ + + + +# प्रदर्शन + +[#47](https://github.com/somethingwithproof/plugin_cloud/issues/47) के लिए 2026-11-15 को [`tests/bin/perf.php`](../../../../tests/bin/perf.php) से लिए गए मापन। CI हर Cacti और PHP कार्य में यही script चलाता है। कार्य केवल तब विफल होता है जब 1,000 सीरीज़ एक पोलर अंतराल में पूरी न हों; रनर हार्डवेयर अलग होने के कारण समय केवल छापा जाता है, तुलना नहीं होती। + +**परिणाम।** स्थानीय परीक्षण डेटा सर्वर और बिना अतिरिक्त विलंब के, एक संग्राहक रन लगभग 3 सेकंड में 1,000 सीरीज़ पढ़ता है। यह प्रति अनुरोध प्लगइन और TLS के लगभग 3 ms काम के बराबर है। स्वास्थ्य पृष्ठ 10,000 कैश की गई सीरीज़ 0.08 सेकंड में दिखाता है। प्रति अनुरोध प्रदाता का 100 ms अनुकरणित विलंब जोड़ने पर वही रन 106 सेकंड लेता है। प्रदाता का विलंब तय करता है कि 1,000 सीरीज़ एक पोलर अंतराल में पूरी होंगी या नहीं। + + +## क्या चलता है + +Script वास्तविक संग्राहक, DigitalOcean driver, सुरक्षित transport (संचालन अनुमति सूची) और socket transport उपयोग करता है; TLS परीक्षण CA से सत्यापित होता है। संचालन जाँच के बाद केवल host बदला जाता है, जिससे अनुरोध `api.digitalocean.com` के बजाय [`tests/bin/perf-server.php`](../../../../tests/bin/perf-server.php) तक पहुँचें। वह सर्वर रिकॉर्ड किया परीक्षण डेटा दोहराता है, timestamps को वर्तमान समय तक खिसकाता है और driver द्वारा पढ़े जाने वाले rate-limit headers भेजता है। + +| मामला | व्यवस्था | मापन | +|---|---|---| +| संग्रह | 4 खाते, हर खाते में 50 Droplets, प्रति Droplet 5 सीरीज़ (CPU और चार bandwidth): 1,000 सीरीज़ | पोलर 1 पर एक संग्राहक रन (REQ-PERF-001) | +| बजट | 1 खाता, 200 Droplets, प्रत्येक की 5 सीरीज़: 1,000 सीरीज़ | वही रन, जिसमें अनुरोध बजट खाते को रोकता है | +| पृष्ठ | 10 खाते, हर खाते में 200 Droplets, प्रति Droplet 5 कैश सीरीज़: 10,000 सीरीज़ | logged-in प्रशासक के रूप में HTTP पर `cloud_health.php`, warm-up के बाद पाँच लोड का मध्यक (REQ-PERF-002) | + +संग्रह मामला चार खाते उपयोग करता है क्योंकि एक DigitalOcean टोकन प्रति मिनट 250 अनुरोध अनुमति देता है। 100 प्रतिशत अनुरोध हिस्से पर यही एक रन में एक खाते का अधिकतम पठन है (`RequestBudget::perRun`)। बजट मामला सीमा दिखाता है: खाता 250 सीरीज़ पढ़ता है, शेष 750 को `budget` कारण से अपठित चिह्नित करता है और स्वास्थ्य पृष्ठ बताता है। + + +## हार्डवेयर और सेटिंग (REQ-PERF-003) + +| | | +|---|---| +| होस्ट | Apple M3 Max, 14 कोर, 36 GiB | +| रनटाइम | OrbStack Linux VM, aarch64, 14 CPU, 15.7 GiB, Docker image `cloud-ci:8.2` | +| PHP | 8.2.35, संग्राहक के लिए CLI, पृष्ठ के लिए built-in web server | +| डेटाबेस | MariaDB 11.8.9, वही VM | +| Cacti | 1.2.31 और 1.2.x branch (1.2.32) | +| पोलर अंतराल | 300 सेकंड | +| खाते | संग्रह अंतराल 300 सेकंड, अनुरोध हिस्सा 100 प्रतिशत, रन में discovery देय नहीं | +| संग्राहक समय बजट | पोलर अंतराल से 10 सेकंड कम (290); प्लगइन का डिफ़ॉल्ट 240 है | + + +## परिणाम + +हर Cacti संस्करण पर तीन रन, बिना अतिरिक्त विलंब: + +| मामला | Cacti 1.2.31 | Cacti 1.2.x | +|---|---|---| +| संग्रह, 4 खातों में 1,000 सीरीज़ | 2.83, 3.00, 3.17 सेकंड; 1,000 अनुरोधों में 1,000 पठन | 3.42, 2.59, 2.61 सेकंड; 1,000 अनुरोधों में 1,000 पठन | +| बजट, 1 खाते में 1,000 सीरीज़ | 1.20, 1.32, 1.10 सेकंड; 250 पठन, 750 `budget` कारण से शेष | 1.24, 1.72, 1.10 सेकंड; 250 पठन, 750 `budget` कारण से शेष | +| स्वास्थ्य पृष्ठ, 10,000 सीरीज़ | मध्यक 0.08 सेकंड, सबसे धीमा 0.08 सेकंड, तीनों रन में | मध्यक 0.08 सेकंड, सबसे धीमा अधिकतम 0.09 सेकंड | + +हर परीक्षण response से पहले 100 ms जोड़ने वाले `perf.php 100` के साथ, Cacti 1.2.31 पर संग्रह मामला 106.26 सेकंड में सभी 1,000 सीरीज़ पढ़ गया। बजट मामले ने 27.02 सेकंड लिए। + +पृष्ठ परिणाम की सामग्री भी जाँची गई, केवल गति नहीं। 10 में से हर खाते में 1,000 वर्तमान सीरीज़ और प्रति घंटा 12,000 अनुरोधों का अनुमान दिखा (हर 300 सेकंड में 1,000 सीरीज़)। + + +## परिणामों को समझना + +- **रन समय प्रदाता के विलंब के साथ बढ़ता है।** संग्राहक एक अनुरोध में एक सीरीज़ पढ़ता है और एक समय में एक अनुरोध करता है। रन लगभग अनुरोध × (विलंब + 3 ms) लेता है। डिफ़ॉल्ट 240 सेकंड बजट में 1,000 सीरीज़ तब पूरी होती हैं जब औसत आने-जाने का समय लगभग 237 ms से कम रहे। इससे ऊपर, बजट पर संग्राहक नए खाते शुरू करना बंद करता है और अपठित खाते अगले रन में पढ़े जाते हैं। पहली [वास्तविक जाँच](../../../research/provider-facts.md#live-checks) (#16) ने घरेलू कनेक्शन से मध्यक 384 ms (301 से 799 ms) मापा। उस विलंब पर 1,000 सीरीज़ लगभग 390 सेकंड लेती हैं, इसलिए डिफ़ॉल्ट बजट प्रति रन लगभग 620 पढ़ता है और बाकी आगे जाती हैं। DigitalOcean के पास डेटा केंद्र में पोलर को कम विलंब मिलना चाहिए; इसलिए एक पोलर पर लगभग 600 से अधिक सीरीज़ की योजना से पहले अपने पोलर से मापें। +- **DigitalOcean की सीमा प्रति टोकन है।** डिफ़ॉल्ट 50 प्रतिशत हिस्से पर एक खाता प्रति रन 125 सीरीज़ पढ़ता है। बड़े वातावरण को अधिक खाते चाहिए, हर खाते का अपना टोकन; स्वास्थ्य पृष्ठ का अनुमान बताता है कि प्रत्येक खाता अपने हिस्से के कितना निकट है। +- **10,000 सीरीज़ पर भी पृष्ठ का खर्च कम है।** यह केवल कैश पंक्तियाँ पढ़ता है और प्रदाता नहीं बुलाता, इसलिए लागत प्लगइन तालिकाओं के साथ बढ़ती है, प्रदाता के विलंब के साथ नहीं। +- **यहाँ नहीं मापा गया:** Cacti पोलर के RRD updates, boost, Spine, दूरस्थ संग्राहक और अलग होस्ट पर डेटाबेस। प्रत्येक प्लगइन से बाहर अतिरिक्त लागत जोड़ता है। + + +## चलाना + +अस्थायी, त्यागने योग्य डेटाबेस पर, प्लगइन इंस्टॉल और सक्षम हो तथा Cacti किसी URL पर उपलब्ध हो: + +```sh +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ 100 +``` + +दूसरा argument हर परीक्षण response में उतने मिलीसेकंड विलंब जोड़ता है। Script प्लगइन के सभी खाते, संसाधन, सीरीज़ और अवलोकन हटाता है और admin password रीसेट करता है; इसलिए जिसे रखना हो उस डेटाबेस पर कभी न चलाएँ। diff --git a/docs/i18n/manifest.json b/docs/i18n/manifest.json new file mode 100644 index 0000000..a82644c --- /dev/null +++ b/docs/i18n/manifest.json @@ -0,0 +1,13 @@ +{ + "locales": [ + "zh-CN", + "hi-IN", + "es-ES", + "es-419", + "ar-SA" + ], + "sources": [ + "README.md", + "docs/performance.md" + ] +} diff --git a/docs/i18n/zh-CN/README.md b/docs/i18n/zh-CN/README.md new file mode 100644 index 0000000..1d14272 --- /dev/null +++ b/docs/i18n/zh-CN/README.md @@ -0,0 +1,145 @@ + + + +[English](../../../README.md) | [简体中文](README.md) | [हिन्दी](../hi-IN/README.md) | [Español (España)](../es-ES/README.md) | [Español (Latinoamérica)](../es-419/README.md) | [العربية](../ar-SA/README.md) + + + +# plugin_cloud + +这是一个 Cacti 1.2 插件,将公有云提供商的资源和指标作为普通设备、数据源和图表引入 Cacti。云工作负载由此与承载它们的网络并列显示,受 Cacti 权限控制,并可由 Thold 和 Maint 触发或抑制告警。一个插件覆盖所有提供商,每个提供商使用独立驱动,首先支持 DigitalOcean、AWS、Google Cloud 和 Azure。 + +> **状态:里程碑 3(DigitalOcean 和 Cacti 对象),正在审核。** 此里程碑增加 DigitalOcean 驱动、Cacti 模板、每账户一个范围设备及每资源类型一个数据查询、脚本服务器输入,以及“新建图表”和健康页面上的请求估算。使用真实 DigitalOcean 账户的初步检查记录在[提供商事实](../../research/provider-facts.md)中。请勿用于生产环境。 + + +## 访问角色 + +| 权限域 | 访问权限 | +| --- | --- | +| Cloud View | 现有监控页面。 | +| Cloud Operator | 监控页面、运维页面和个人排查确认记录。 | +| Cloud Admin | 操作员访问权限以及现有配置和管理操作。 | + +复制升级文件后,请以管理员身份打开插件页面以注册新权限域。在 **Configuration > Users** 或用户组中明确分配 Operator 权限域。升级会保留现有 View 和 Admin 权限域的 ID 和授权。每次请求中,Admin 访问继承 Operator 访问,Operator 访问继承 View 访问;这不会向用户或组添加已存储的授权。插件设置除需要 Cacti 的 Settings 权限外,还需要 Cloud Admin 访问权限。 + +Cacti 设备权限仍限制各用户可用的行和操作;未映射对象需要管理员处理。操作员可验证其有权访问的 Cacti 设备所对应账户的已存储凭据。凭据、配置、映射、删除及其他管理变更仍位于管理页面。确认记录仅在当前用户会话内有效,最长一小时,且仅在同一观测结果仍新鲜时有效。新的或发生变化的观测会使其失效。确认记录绝不会将失败测量标记为健康,也不会抑制告警。 + + +## 原因 + +每个云提供商都有自己的监控控制台。与 Cacti 并行使用时,会留下三项缺口: + +- **独立的访问控制。** 要向 Cacti 用户展示云指标,就必须给予其云登录权限。 +- **缺少网络上下文。** 本地链路在 Cacti 中绘图,而链路背后的工作负载在各提供商的控制台中绘图。 +- **独立的告警。** Thold 和 Maint 使用 Cacti 数据源和设备,因此必须为每个提供商单独配置和抑制其告警。 + +插件在 Cacti 轮询器上读取各提供商的监控 API,缓存最新数据点,并将其提供给 Cacti 脚本服务器。Cacti 轮询器负责写入 RRD 文件,因此图表、权限、Thold、Maint 和 boost 的工作方式与其他 Cacti 数据相同。 + + +## 设计承诺 + +- **只读。** 每个驱动只能构建其允许列表中的提供商操作;插件绝不会更改云资源。([ADR 0002](../../decisions/0002-read-only-with-operation-allowlist.md)) +- **仅 PHP,无 SDK。** 使用 Cacti 已要求的 PHP 扩展实现签名和令牌交换。没有 Composer 运行时依赖。([ADR 0003](../../decisions/0003-php-only-without-sdks.md)) +- **采集前展示费用。** 插件仅读取具有 Cacti 数据源的指标,在创建图表前显示预计请求数和按标价计算的费用,并执行每月上限。([ADR 0005](../../decisions/0005-collect-only-what-is-graphed.md)) +- **数据库中不存储明文凭据。** 凭据来自加密凭据库(其密钥保存在数据库之外的文件中)、凭据文件或提供商的实例身份。([ADR 0007](../../decisions/0007-credentials-outside-the-database-in-the-clear.md)) + + +## 范围与状态 + +| 阶段 | 范围 | 里程碑 | 状态 | +|---|---|---|---| +| 0,研究 | 提供商事实确认、指标目录、费用和速率模型、签名测试向量、传输验证原型 | [M1](https://github.com/somethingwithproof/plugin_cloud/milestone/1) | 已完成,但需要真实提供商账户的检查除外 | +| 1,核心与 DigitalOcean | 账户、凭据库、传输、采集器、观测缓存、Cacti 对象、健康页面、DigitalOcean Droplet 和负载均衡器 | [M2](https://github.com/somethingwithproof/plugin_cloud/milestone/2), [M3](https://github.com/somethingwithproof/plugin_cloud/milestone/3), [M4](https://github.com/somethingwithproof/plugin_cloud/milestone/4) | M2 已完成([#81](https://github.com/somethingwithproof/plugin_cloud/pull/81));M3 驱动、模板及范围设备已合并;请求估算、权限及性能检查正在审核;M4 尚未开始 | +| 2,AWS | Signature Version 4、`AssumeRole`、实例角色、CloudWatch `GetMetricData`、区域清单 | [M5](https://github.com/somethingwithproof/plugin_cloud/milestone/5) | 尚未开始 | +| 3,Google Cloud | 服务账户 JWT、元数据服务器、Cloud Monitoring `timeSeries.list` | [M6](https://github.com/somethingwithproof/plugin_cloud/milestone/6) | 尚未开始 | +| 4,Azure | Entra 客户端凭据、托管身份、Resource Graph、`metrics:getBatch` | [M7](https://github.com/somethingwithproof/plugin_cloud/milestone/7) | 尚未开始 | +| 5,远程采集器 | Cacti 远程数据采集器上的账户 | [M8](https://github.com/somethingwithproof/plugin_cloud/milestone/8) | 尚未开始 | + +不在范围内:更改云资源、创建或镜像提供商告警、账单报表、日志和跟踪,以及插件自有的告警引擎。其他提供商(Hetzner Cloud、Akamai Cloud、Oracle Cloud 等)属于研究议题。 + + +## 里程碑 2 交付内容 + +- **带保护检查的安装。** PHP 低于 8.2 或缺少 ext-openssl 时,会拒绝安装和启用并给出提示,Cacti 的其他部分继续工作。 +- **生命周期。** 通过 Cacti 插件页面安装、升级和卸载。升级按顺序执行,并可从中断中恢复。除非取消 *Keep Plugin Tables on Uninstall*,否则卸载会保留插件表。 +- **独立权限域。** *Cloud Admin* 打开 **Cloud Accounts**;*Cloud View* 打开 **Cloud Health**。两个页面均位于 Management 下。 +- **账户和凭据。** 添加、编辑、验证和删除账户。凭据使用保存在数据库外的密钥文件在数据库内加密(AES-256-GCM),或从轮询器上的文件读取。界面中凭据只能写入,日志中会对其进行遮蔽。 +- **采集器。** 每次轮询器运行时启动,每个轮询器一个实例,并受时间预算约束。它为每个账户取得租约,以独立间隔执行发现,并仅读取插件自有的活动数据源对应的指标。 +- **健康状态。** 显示每账户的采集、发现、资源和新鲜度状态,并对不可用的凭据库密钥、不安全的凭据文件,以及轮询器无法满足的间隔发出警告。 + + +## 安装与配置 + +以下步骤安装里程碑 2 的代码以供评估。要求 Cacti 1.2.31 或更高版本,运行于 PHP 8.2 或更高版本。 + +1. 将仓库复制到 Cacti 目录下的 `plugins/cloud`。目录必须命名为 `cloud`。 +2. 在 Web 根目录之外创建凭据库密钥。将其放在仅 root 和 Cacti 用户可写的目录中,并使文件仅供运行 Web 服务器和轮询器的用户读取。插件绝不会创建或写入此文件: + + ```sh + sudo install -d -m 0750 -o root -g cacti /etc/cacti + head -c 32 /dev/urandom | sudo tee /etc/cacti/cloud-vault.key > /dev/null + sudo chown cacti:cacti /etc/cacti/cloud-vault.key + sudo chmod 0600 /etc/cacti/cloud-vault.key + ``` + + 将 `cacti` 替换为运行 Web 服务器和轮询器的用户。文件包含 32 个原始字节或 64 个十六进制字符。请将其与数据库一同备份;没有它,必须重新输入已存储的凭据。 +3. 在 Cacti 中打开 **Configuration > Plugins**,然后安装并启用 *Cloud*。 +4. 在 **Configuration > Settings > Cloud** 中,如果使用了其他路径,请设置 *Vault Key File*。*Collector Time Budget*(默认 240 秒)必须小于轮询器间隔。 +5. 在 **Configuration > Users** 中向用户和组授予 *Cloud Admin* 或 *Cloud View*。安装会向管理员授予这两个权限域。 +6. 在 **Management > Cloud Accounts** 下添加账户,然后在 **Management > Cloud Health** 中检查警告。 + + +## 兼容性目标 + +| 组件 | 目标 | +|---|---| +| Cacti | 1.2.31 或更高版本,不需要核心补丁 | +| PHP | 8.2 或更高版本;`setup.php` 在 8.0 上保持可解析,使不受支持的运行时收到拒绝提示,而不会破坏 Cacti 界面 | +| PHP 扩展 | 不需要超出 Cacti 1.2.31 要求的扩展 | +| Thold、Maint | 无需更改 | + + +## 设计 + +- [docs/performance.md](docs/performance.md) 提供采集器和健康页面的测量结果,以及所用硬件和设置。 +- [docs/PLAN.md](../../PLAN.md) 是完整计划:架构、依赖的提供商和 Cacti 事实(含来源)、驱动契约、费用计算、安全边界、测试及风险。 +- [docs/decisions/](../../decisions) 保存已作出选择的架构决策记录。 +- [docs/REQUIREMENTS.md](../../REQUIREMENTS.md) 将各需求 ID 映射到对应议题。 + +```mermaid +flowchart LR + API[Provider monitoring APIs] -->|HTTPS, read only| C[Collector on the account's Cacti poller] + C --> O[(Observation cache)] + O --> SS[Script server data sources] + SS --> RRD[(Cacti RRD files)] + 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:`、`provider:`、`phase:`、`priority:` 和 `status:`。参见 [CONTRIBUTING.md](../../../CONTRIBUTING.md#labels)。 +- [项目看板](https://github.com/users/somethingwithproof/projects/7) 显示各里程碑的全部议题。 + + +## 开发 + +CI 在 PHP 8.0 上检查入口文件语法,执行单元测试、集成测试和 PHPStan 级别 9 检查,并在 PHP 8.2 至 8.5 上针对 Cacti 1.2.31 和 1.2.x 分支安装插件。它还验证 PHP 8.1 会被拒绝且不会破坏 Cacti。测试使用 Cacti 核心插件测试环境中的 Pest。此选择是临时性的,等待 [#12](https://github.com/somethingwithproof/plugin_cloud/issues/12) 作出决定。[.github/workflows/plugin-ci-workflow.yml](../../../.github/workflows/plugin-ci-workflow.yml) 列出了所有步骤。推送前请在本地运行 `sh tests/lint-workflows.sh` 和 `sh locales/build_gettext.sh --check`。 + + +## 贡献 + +请阅读 [CONTRIBUTING.md](../../../CONTRIBUTING.md)。提交需要 DCO 签署。设计讨论通过议题进行;未决决策带有 `type: decision` 标签。 + + +## 安全 + +请私下报告漏洞;参见 [SECURITY.md](../../../SECURITY.md)。 + + +## 许可证 + +GNU 通用公共许可证 v2.0,与 Cacti 及其插件使用的许可证相同。参见 [LICENSE](../../../LICENSE)。 diff --git a/docs/i18n/zh-CN/docs/performance.md b/docs/i18n/zh-CN/docs/performance.md new file mode 100644 index 0000000..fe91d53 --- /dev/null +++ b/docs/i18n/zh-CN/docs/performance.md @@ -0,0 +1,70 @@ + + + +# 性能 + +这是为 [#47](https://github.com/somethingwithproof/plugin_cloud/issues/47) 于 2026-11-15 使用 [`tests/bin/perf.php`](../../../../tests/bin/perf.php) 进行的测量。CI 在每项 Cacti 和 PHP 作业运行相同脚本。仅当 1,000 个序列无法在一个轮询间隔内完成时才使作业失败;由于运行器硬件不同,只输出耗时,不进行耗时比较。 + +**结果。** 使用本地测试数据服务器且不增加延迟时,一次采集运行约 3 秒读取 1,000 个序列,即每次请求约 3 ms 的插件及 TLS 处理。健康页面在 0.08 秒内呈现 10,000 个缓存序列。每次请求加入 100 ms 的模拟提供商延迟后,同一运行耗时 106 秒。能否在一个轮询间隔内完成 1,000 个序列,取决于提供商延迟。 + + +## 运行内容 + +脚本使用真实采集器、DigitalOcean 驱动、受保护传输(操作允许列表)和套接字传输,并使用测试 CA 验证 TLS。仅在操作检查后重写主机,使请求到达 [`tests/bin/perf-server.php`](../../../../tests/bin/perf-server.php),而非 `api.digitalocean.com`。该服务器重放已记录的测试数据,将时间戳平移到当前时间,并发送驱动读取的速率限制头。 + +| 场景 | 设置 | 测量内容 | +|---|---|---| +| 采集 | 4 个账户,每账户 50 个 Droplet,每 Droplet 5 个序列(CPU 和四项带宽):共 1,000 个序列 | 轮询器 1 上的一次采集运行(REQ-PERF-001) | +| 预算 | 1 个账户,200 个 Droplet,每个 5 个序列:共 1,000 个序列 | 相同运行,但请求预算会停止该账户 | +| 页面 | 10 个账户,每账户 200 个 Droplet,每 Droplet 5 个缓存序列:共 10,000 个序列 | 以已登录管理员身份通过 HTTP 访问 `cloud_health.php`,预热后五次加载的中位数(REQ-PERF-002) | + +采集场景使用四个账户,因为每个 DigitalOcean 令牌允许每分钟 250 次请求。请求份额为 100% 时,这也是一个账户每次运行的最大读取量(`RequestBudget::perRun`)。预算场景体现此限制:账户读取 250 个序列,将其余 750 个标记为未读取,原因为 `budget`,健康页面会报告此情况。 + + +## 硬件与设置(REQ-PERF-003) + +| | | +|---|---| +| 主机 | Apple M3 Max,14 核,36 GiB | +| 运行环境 | OrbStack Linux 虚拟机,aarch64,14 CPU,15.7 GiB,Docker 镜像 `cloud-ci:8.2` | +| PHP | 8.2.35,采集器使用 CLI,页面使用内置 Web 服务器 | +| 数据库 | MariaDB 11.8.9,同一虚拟机 | +| Cacti | 1.2.31 和 1.2.x 分支(1.2.32) | +| 轮询间隔 | 300 秒 | +| 账户 | 采集间隔 300 秒,请求份额 100%,运行期间发现任务未到期 | +| 采集器时间预算 | 轮询间隔减 10 秒(290);插件默认设置为 240 | + + +## 结果 + +每个 Cacti 版本运行三次,不增加延迟: + +| 场景 | Cacti 1.2.31 | Cacti 1.2.x | +|---|---|---| +| 采集,4 个账户共 1,000 个序列 | 2.83、3.00、3.17 秒;1,000 次请求读取 1,000 个 | 3.42、2.59、2.61 秒;1,000 次请求读取 1,000 个 | +| 预算,1 个账户共 1,000 个序列 | 1.20、1.32、1.10 秒;读取 250 个,750 个因 `budget` 留待后续 | 1.24、1.72、1.10 秒;读取 250 个,750 个因 `budget` 留待后续 | +| 健康页面,10,000 个序列 | 三次运行的中位数均为 0.08 秒,最慢均为 0.08 秒 | 中位数 0.08 秒,最慢不超过 0.09 秒 | + +使用 `perf.php 100` 在每次测试响应前增加 100 ms 延迟时,Cacti 1.2.31 的采集场景耗时 106.26 秒,读取全部 1,000 个序列。预算场景耗时 27.02 秒。 + +页面结果也按内容验证,而非仅测速度。10 个账户各显示 1,000 个当前序列,以及每小时 12,000 次请求的估算(每 300 秒读取 1,000 个序列)。 + + +## 解读结果 + +- **运行时间随提供商延迟增长。** 采集器每请求读取一个序列,一次执行一个请求。耗时约为请求数 ×(延迟 + 3 ms)。在默认 240 秒预算下,平均往返时间低于约 237 ms 时可完成 1,000 个序列。超过该值时,采集器达到预算便不再开始新账户,未读取的账户将在下次运行采集。首次[实际检查](../../../research/provider-facts.md#live-checks)(#16)从家庭连接测得往返中位数 384 ms(301 至 799 ms)。此延迟下 1,000 个序列约需 390 秒,因此默认预算每次约读取 620 个,其余延后。靠近 DigitalOcean 的数据中心内的轮询器预计延迟更低;在规划单个轮询器超过约 600 个序列之前,请先从自己的轮询器测量。 +- **DigitalOcean 的限制按令牌计算。** 默认份额为 50% 时,一个账户每次读取 125 个序列。更大规模需要更多账户,各自使用独立令牌;健康页面的估算会显示每账户距其份额上限还有多少。 +- **10,000 个序列时页面开销仍低。** 页面仅读取缓存行,从不调用提供商,因此开销随插件表增长,而不随提供商延迟增长。 +- **此处未测量:** Cacti 轮询器的 RRD 更新、boost、Spine、远程采集器及位于独立主机的数据库。这些均会带来插件之外的额外开销。 + + +## 运行方法 + +使用可丢弃的数据库,已安装并启用插件,且可通过某个 URL 访问 Cacti: + +```sh +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ +CLOUD_TEST_DATABASE=disposable php plugins/cloud/tests/bin/perf.php http://127.0.0.1:8080/cacti/ 100 +``` + +第二个参数为每次测试响应增加对应毫秒数的延迟。脚本会删除插件的全部账户、资源、序列和观测,并重置管理员密码,因此绝不要在需保留的数据库上运行。 diff --git a/include/operator.php b/include/operator.php new file mode 100644 index 0000000..1367b6d --- /dev/null +++ b/include/operator.php @@ -0,0 +1,63 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_cloud, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_cloud + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +use Somethingwithproof\Cloud\HealthRepository; +use Somethingwithproof\Cloud\DeviceRepository; +use Somethingwithproof\Cloud\SystemClock; +use Somethingwithproof\Cloud\Verifier; +use Somethingwithproof\Cloud\Drivers; + +/** @return list */ +function cloud_operator_rows(): array { + $rows = []; + $accounts = cloud_accounts(); + $devices = new DeviceRepository(false, new SystemClock()); + $health = new HealthRepository(false); + + foreach ($accounts->all() as $account) { + $host = $devices->hostFor($account->id); + + if ($host === null || !is_device_allowed($host)) { + continue; + } + $h = $health->find($account->id); + $rows[] = [ + 'id' => (string) $account->id, + 'name' => $account->name, + 'state' => $account->enabled() ? $h->collection->value : 'disabled', + 'observed' => $h->runFinished, + 'interval' => $account->collectInterval, + 'detail' => ($h->error->value ?? '') . ' / ' . $account->verifyStatus->message() . ' ' . __('Check the account graphs and collection freshness. Verify tests the stored credential; it cannot replace it or change the provider configuration.', 'cloud') + ]; + } + + return $rows; +} + +/** Verification cannot replace the stored credential or edit the account. */ +function cloud_operator_verify(int $id, int $user): void { + $accounts = cloud_accounts(); + $account = $accounts->find($id); + + if ($account === null) { + throw new RuntimeException('Account unavailable'); + } + $status = (new Verifier(Drivers::production(), cloud_credentials(), $accounts))->verify($account, $user); + raise_message('cloud_operator_verify', $status->message(), MESSAGE_LEVEL_INFO); +} diff --git a/lib/OperatorPage.php b/lib/OperatorPage.php new file mode 100644 index 0000000..e5dabe1 --- /dev/null +++ b/lib/OperatorPage.php @@ -0,0 +1,133 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_cloud, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_cloud + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +namespace Somethingwithproof\Cloud; + +/** Personal triage of current observations. It never changes measured health. */ +final class OperatorPage { + /** @param list $actions */ + public static function actionStatus(bool $allowed, string $action, string $method, bool $csrf, array $actions): int { + if (!$allowed) { + return 403; + } + + if (!in_array($action, $actions, true)) { + return 400; + } + + if ($method !== 'POST') { + return 405; + } + + return $csrf ? 200 : 403; + } + + /** @param array{id: string, name: string, state: string, observed: int, interval: int, detail: string} $row */ + public static function fingerprint(array $row): string { + return hash('sha256', (string) json_encode($row)); + } + + /** @param array{id: string, name: string, state: string, observed: int, interval: int, detail: string} $row */ + public static function fresh(array $row, int $now): bool { + return $row['observed'] > 0 && $row['observed'] <= $now && $now - $row['observed'] <= max(60, $row['interval']) * 2; + } + + /** + * Session-only acknowledgments expire with the evidence or after one hour. + * Only rows reloaded within the current user's device scope may be supplied. + * @param array $session + * @param array{id: string, name: string, state: string, observed: int, interval: int, detail: string} $row + */ + public static function acknowledge(array &$session, array $row, string $fingerprint, int $user, int $now): bool { + if ($user <= 0 || !self::fresh($row, $now) || !hash_equals(self::fingerprint($row), $fingerprint)) { + return false; + } + $entries = isset($session['entries'], $session['user']) && $session['user'] === $user && is_array($session['entries']) ? $session['entries'] : []; + + foreach ($entries as $id => $entry) { + if (!is_array($entry) || !isset($entry['at']) || !is_int($entry['at']) || $entry['at'] > $now || $now - $entry['at'] > 3600) { + unset($entries[$id]); + } + } + unset($entries[$row['id']]); + $entries[$row['id']] = ['fingerprint' => $fingerprint, 'at' => $now]; + $session = ['user' => $user, 'entries' => array_slice($entries, -100, null, true)]; + + return true; + } + + /** + * @param array $session + * @param array{id: string, name: string, state: string, observed: int, interval: int, detail: string} $row + */ + public static function acknowledged(array $session, array $row, int $user, int $now): bool { + $entries = $session['entries'] ?? []; + $entry = is_array($entries) ? ($entries[$row['id']] ?? null) : null; + + return ($session['user'] ?? 0) === $user && is_array($entry) + && isset($entry['fingerprint'], $entry['at']) && is_string($entry['fingerprint']) && is_int($entry['at']) + && $entry['at'] <= $now && $now - $entry['at'] <= 3600 + && self::fresh($row, $now) && hash_equals(self::fingerprint($row), $entry['fingerprint']); + } + + /** @param array{id: string, name: string, state: string, observed: int, interval: int, detail: string} $row */ + public static function form(array $row, string $action, string $label): void { + form_start('cloud_operator.php'); + print ''; + print ''; + print ''; + print ''; + form_end(false); + } + + /** + * @param list $rows + * @param array $session + * @param array $actions + */ + public static function render(array $rows, array $session, int $user, int $now, array $actions): void { + print '

' . html_escape(__('Review the recorded observations below. Acknowledgments are personal to this session, expire when observations change, and never suppress alerts or change health.', 'cloud')) . '

'; + print '
'; + html_start_box(__('Cloud Operations', 'cloud'), '100%', '', '3', 'center', ''); + print '' . implode('', array_map('html_escape', [__('Object', 'cloud'), __('State', 'cloud'), __('Observed (UTC)', 'cloud'), __('Investigation', 'cloud'), __('Actions', 'cloud')])) . ''; + + foreach ($rows as $row) { + $fresh = self::fresh($row, $now); + $state = $row['state'] . ($fresh ? '' : ' / ' . __('Unknown or stale', 'cloud')); + print '' . html_escape($row['name']) . '' . html_escape($state) . '' . html_escape($row['observed'] > 0 ? gmdate('Y-m-d H:i:s', $row['observed']) : __('Never', 'cloud')) . '' . html_escape($row['detail']) . ''; + + if (self::acknowledged($session, $row, $user, $now)) { + print html_escape(__('Acknowledged; health unchanged.', 'cloud')); + } elseif ($fresh) { + self::form($row, 'acknowledge', __('Acknowledge', 'cloud')); + } + + foreach ($actions as $action => $label) { + self::form($row, $action, $label); + } + print ''; + } + + if ($rows === []) { + print '' . html_escape(__('No observations are available for devices you may access.', 'cloud')) . ''; + } + html_end_box(); + print '
'; + } +} diff --git a/lib/Pages.php b/lib/Pages.php index e8a4b5a..5063a13 100644 --- a/lib/Pages.php +++ b/lib/Pages.php @@ -28,6 +28,7 @@ * Cloud Admin pages (REQ-UI-002). */ final class Pages { + public const OPERATOR = ['cloud_operator.php']; public const VIEW = ['cloud_health.php']; public const ADMIN = ['cloud_accounts.php']; @@ -36,6 +37,7 @@ final class Pages { */ public static function realms(): array { return [ + ['name' => __('Cloud Operator', 'cloud'), 'files' => self::OPERATOR], ['name' => __('Cloud View', 'cloud'), 'files' => self::VIEW], ['name' => __('Cloud Admin', 'cloud'), 'files' => self::ADMIN], ]; @@ -45,7 +47,7 @@ public static function realms(): array { * @return list */ public static function files(): array { - return array_merge(self::VIEW, self::ADMIN); + return array_merge(self::VIEW, self::ADMIN, self::OPERATOR); } /** @@ -55,6 +57,7 @@ public static function files(): array { */ public static function menu(): array { return [ + 'cloud_operator.php' => __('Cloud Operations', 'cloud'), 'cloud_accounts.php' => __('Cloud Accounts', 'cloud'), 'cloud_health.php' => __('Cloud Health', 'cloud'), ]; diff --git a/lib/Schema.php b/lib/Schema.php index 4a8badd..5ab6eab 100644 --- a/lib/Schema.php +++ b/lib/Schema.php @@ -37,6 +37,7 @@ final class Schema { public const VERSION = 3; public const HOOKS = [ + 'auth_alternate_realms' => 'cloud_auth_alternate_realms', 'api_device_new' => 'cloud_device_saved', 'api_device_save' => 'cloud_device_save', 'config_arrays' => 'cloud_config_arrays', @@ -127,6 +128,10 @@ public function recordPluginVersion(string $version, string $author, string $hom ); } + public function pluginEnabled(): bool { + return (int) db_fetch_cell_prepared('SELECT status FROM plugin_config WHERE directory = ?', [self::PLUGIN], '', true, $this->connection) === 1; + } + public function hooksRegistered(): bool { $placeholders = implode(', ', array_fill(0, count(self::HOOKS), '?')); diff --git a/locales/LC_MESSAGES/ar-SA.mo b/locales/LC_MESSAGES/ar-SA.mo new file mode 100644 index 0000000..9f5602e Binary files /dev/null and b/locales/LC_MESSAGES/ar-SA.mo differ diff --git a/locales/LC_MESSAGES/es-419.mo b/locales/LC_MESSAGES/es-419.mo new file mode 100644 index 0000000..5708add Binary files /dev/null and b/locales/LC_MESSAGES/es-419.mo differ diff --git a/locales/LC_MESSAGES/es-ES.mo b/locales/LC_MESSAGES/es-ES.mo new file mode 100644 index 0000000..064b357 Binary files /dev/null and b/locales/LC_MESSAGES/es-ES.mo differ diff --git a/locales/LC_MESSAGES/hi-IN.mo b/locales/LC_MESSAGES/hi-IN.mo new file mode 100644 index 0000000..4f3a4cb Binary files /dev/null and b/locales/LC_MESSAGES/hi-IN.mo differ diff --git a/locales/LC_MESSAGES/zh-CN.mo b/locales/LC_MESSAGES/zh-CN.mo new file mode 100644 index 0000000..f2d9f23 Binary files /dev/null and b/locales/LC_MESSAGES/zh-CN.mo differ diff --git a/locales/build_gettext.sh b/locales/build_gettext.sh index d102b38..25941aa 100755 --- a/locales/build_gettext.sh +++ b/locales/build_gettext.sh @@ -96,6 +96,8 @@ if [ "${1:-}" = "--check" ]; then fi done + python3 tests/check_translations.py || rc=1 + [ $rc -eq 0 ] && echo "catalogs are complete and compiled" exit $rc fi diff --git a/locales/po/ar-SA.po b/locales/po/ar-SA.po new file mode 100644 index 0000000..0bcc00a --- /dev/null +++ b/locales/po/ar-SA.po @@ -0,0 +1,592 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: 2026 Thomas Vincent +# +msgid "" +msgstr "" +"Project-Id-Version: cloud 0.1.0-dev\n" +"Report-Msgid-Bugs-To: https://github.com/somethingwithproof/plugin_cloud/issues\n" +"PO-Revision-Date: 2026-11-17 00:00+0000\n" +"Last-Translator: Thomas Vincent \n" +"Language-Team: Thomas Vincent \n" +"Language: ar-SA\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5);\n" + +#: cloud_accounts.php +msgid "Name: another account already uses this name." +msgstr "الاسم: يستخدم حساب آخر هذا الاسم بالفعل." + +#: cloud_accounts.php +#, php-format +msgid "The account was saved, but the credential was not stored: %s" +msgstr "حُفظ الحساب، لكن لم تُخزّن بيانات الاعتماد: %s" + +#: cloud_accounts.php +msgid "The account was saved." +msgstr "حُفظ الحساب." + +#: cloud_accounts.php +msgid "The account could not be saved." +msgstr "تعذّر حفظ الحساب." + +#: cloud_accounts.php +msgid "The account and its collected data were deleted. Its Cacti devices and graphs were left in place." +msgstr "حُذف الحساب وبياناته المجمّعة. أُبقيت أجهزته ورسومه البيانية في Cacti." + +#: cloud_accounts.php +#, php-format +msgid "The Cacti device for %s is ready." +msgstr "جهاز Cacti الخاص بـ %s جاهز." + +#: cloud_accounts.php +msgid "The Cacti device was not created; see the Cacti log." +msgstr "لم يُنشأ جهاز Cacti؛ راجع سجل Cacti." + +#: cloud_operator.php +msgid "Verify stored credential" +msgstr "التحقق من بيانات الاعتماد المخزّنة" + +#: cloud_operator.php +msgid "Monitoring view" +msgstr "عرض المراقبة" + +#: cloud_operator.php +msgid "Observations could not be read. Ask an administrator to check the plugin log." +msgstr "تعذّرت قراءة الملاحظات. اطلب من مسؤول التحقق من سجل الإضافة." + +#: include/operator.php +msgid "Check the account graphs and collection freshness. Verify tests the stored credential; it cannot replace it or change the provider configuration." +msgstr "تحقق من رسوم الحساب وحداثة الجمع. يختبر التحقق بيانات الاعتماد المخزّنة؛ ولا يمكنه استبدالها أو تغيير إعدادات المزوّد." + +#: lib/AccountInput.php +msgid "Provider: choose one of the listed providers." +msgstr "المزوّد: اختر أحد المزوّدين المدرجين." + +#: lib/AccountInput.php +msgid "Name: enter 1 to 100 characters without control characters." +msgstr "الاسم: أدخل من 1 إلى 100 محرف دون محارف تحكم." + +#: lib/AccountInput.php +msgid "Poller: only the main poller can collect cloud accounts in this release." +msgstr "المستطلع: لا يمكن جمع بيانات الحسابات السحابية في هذا الإصدار إلا بواسطة المستطلع الرئيسي." + +#: lib/AccountInput.php +#, php-format +msgid "%s: the value does not have the form this provider uses." +msgstr "%s: القيمة ليست بالصيغة التي يستخدمها هذا المزوّد." + +#: lib/AccountInput.php +msgid "Credential Source: choose one this provider supports." +msgstr "مصدر بيانات الاعتماد: اختر مصدرًا يدعمه هذا المزوّد." + +#: lib/AccountInput.php +msgid "Credential File: enter an absolute path without control characters, at most 512 characters." +msgstr "ملف بيانات الاعتماد: أدخل مسارًا مطلقًا دون محارف تحكم، لا يتجاوز 512 محرفًا." + +#: lib/AccountInput.php +#, php-format +msgid "%s: enter whole seconds from %d to %d." +msgstr "%s: أدخل عددًا صحيحًا من الثواني من %d إلى %d." + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Collection Interval" +msgstr "فاصل الجمع" + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Discovery Interval" +msgstr "فاصل الاكتشاف" + +#: lib/AccountInput.php +msgid "Request Share: enter a whole percentage from 1 to 100." +msgstr "حصة الطلبات: أدخل نسبة مئوية صحيحة من 1 إلى 100." + +#: lib/AccountInput.php +msgid "Monthly Ceiling: enter an amount of zero or more, or leave it blank for none." +msgstr "الحد الشهري: أدخل مبلغًا يساوي الصفر أو أكبر، أو اتركه فارغًا لعدم وضع حد." + +#: lib/AccountInput.php +msgid "AWS Account ID" +msgstr "معرّف حساب AWS" + +#: lib/AccountInput.php +msgid "Regions" +msgstr "المناطق" + +#: lib/AccountInput.php +msgid "Project ID" +msgstr "معرّف المشروع" + +#: lib/AccountInput.php +msgid "Tenant ID" +msgstr "معرّف المستأجر" + +#: lib/AccountInput.php +msgid "Subscription ID" +msgstr "معرّف الاشتراك" + +#: lib/AccountsPage.php lib/Pages.php +msgid "Cloud Accounts" +msgstr "الحسابات السحابية" + +#: lib/AccountsPage.php +msgid "Name" +msgstr "الاسم" + +#: lib/AccountsPage.php +msgid "Provider" +msgstr "المزوّد" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Credential" +msgstr "بيانات الاعتماد" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "State" +msgstr "الحالة" + +#: lib/AccountsPage.php +msgid "Verify" +msgstr "تحقق" + +#: lib/AccountsPage.php +msgid "Device" +msgstr "الجهاز" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "Actions" +msgstr "الإجراءات" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "No cloud accounts yet." +msgstr "لا توجد حسابات سحابية بعد." + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Disabled" +msgstr "معطّل" + +#: lib/AccountsPage.php +msgid "Enabled" +msgstr "مفعّل" + +#: lib/AccountsPage.php +msgid "Delete" +msgstr "حذف" + +#: lib/AccountsPage.php +#, php-format +msgid "Cloud Account: %s" +msgstr "حساب سحابي: %s" + +#: lib/AccountsPage.php +msgid "New Cloud Account" +msgstr "حساب سحابي جديد" + +#: lib/AccountsPage.php +msgid "Credential Source" +msgstr "مصدر بيانات الاعتماد" + +#: lib/AccountsPage.php +msgid "Credential File" +msgstr "ملف بيانات الاعتماد" + +#: lib/AccountsPage.php +msgid "A credential is stored. Leave blank to keep it." +msgstr "توجد بيانات اعتماد مخزّنة. اترك الحقل فارغًا للاحتفاظ بها." + +#: lib/AccountsPage.php +msgid "Paste the token or key to store in the vault." +msgstr "ألصق الرمز أو المفتاح لتخزينه في الخزنة." + +#: lib/AccountsPage.php +msgid "Request Share" +msgstr "حصة الطلبات" + +#: lib/AccountsPage.php +msgid "Monthly Ceiling" +msgstr "الحد الشهري" + +#: lib/AccountsPage.php +msgid "Save" +msgstr "حفظ" + +#: lib/AccountsPage.php +msgid "Stored in the vault" +msgstr "مخزّنة في الخزنة" + +#: lib/AccountsPage.php +msgid "None stored" +msgstr "لا توجد بيانات مخزّنة" + +#: lib/AccountsPage.php +msgid "File on the poller" +msgstr "ملف على المستطلع" + +#: lib/AccountsPage.php +msgid "Instance identity" +msgstr "هوية المثيل" + +#: lib/AccountsPage.php +#, php-format +msgid "Device %d" +msgstr "الجهاز %d" + +#: lib/AccountsPage.php +msgid "Create Cacti Device" +msgstr "إنشاء جهاز Cacti" + +#: lib/CredentialSource.php +msgid "Stored in the plugin vault" +msgstr "مخزّنة في خزنة الإضافة" + +#: lib/CredentialSource.php +msgid "Credential file on the poller" +msgstr "ملف بيانات الاعتماد على المستطلع" + +#: lib/CredentialSource.php +msgid "Instance identity of the poller" +msgstr "هوية مثيل المستطلع" + +#: lib/EstimateView.php setup.php +msgid "Cloud Request Estimate" +msgstr "تقدير الطلبات السحابية" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Account" +msgstr "الحساب" + +#: lib/EstimateView.php +msgid "Selection" +msgstr "التحديد" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Resources" +msgstr "الموارد" + +#: lib/EstimateView.php +msgid "Requests per Hour, One Resource" +msgstr "طلبات في الساعة، لمورد واحد" + +#: lib/EstimateView.php +msgid "Requests per Month, One Resource" +msgstr "طلبات في الشهر، لمورد واحد" + +#: lib/EstimateView.php +msgid "Requests per Hour" +msgstr "طلبات في الساعة" + +#: lib/EstimateView.php +msgid "Requests per Month" +msgstr "طلبات في الشهر" + +#: lib/EstimateView.php +msgid "Cost per Month" +msgstr "التكلفة الشهرية" + +#: lib/EstimateView.php +msgid "No accounts to estimate." +msgstr "لا توجد حسابات لتقديرها." + +#: lib/EstimateView.php +msgid "Estimates use list prices and exclude discounts and shared free tiers." +msgstr "تستخدم التقديرات الأسعار المعلنة ولا تشمل الخصومات والحصص المجانية المشتركة." + +#: lib/EstimateView.php +#, php-format +msgid "%s prices from" +msgstr "أسعار %s من" + +#: lib/EstimateView.php +#, php-format +msgid "checked %s." +msgstr "تم التحقق في %s." + +#: lib/EstimateView.php +msgid "Collected now" +msgstr "ما يُجمع حاليًا" + +#: lib/EstimateView.php +msgid "Every graph on every resource" +msgstr "كل رسم بياني لكل مورد" + +#: lib/EstimateView.php +#, php-format +msgid "Request share: %s requests per hour, %s percent of the token limit. Collected now: %s. Every graph: %s." +msgstr "حصة الطلبات: %s طلب في الساعة، أي %s بالمئة من حد الرمز. ما يُجمع حاليًا: %s. كل رسم بياني: %s." + +#: lib/EstimateView.php +msgid "Collection is capped; the remaining series read U." +msgstr "بلغ الجمع الحد المحدد؛ وتُرجع السلاسل المتبقية U." + +#: lib/EstimateView.php +msgid "Metric estimate between discovery runs; discovery requests reduce the collection allowance." +msgstr "تقدير المقاييس بين عمليات الاكتشاف؛ تقلل طلبات الاكتشاف من الحصة المتاحة للجمع." + +#: lib/EstimateView.php +msgid "No charge documented" +msgstr "لا توجد رسوم موثّقة" + +#: lib/EstimateView.php +msgid "Droplet" +msgstr "Droplet" + +#: lib/EstimateView.php +msgid "Load Balancer" +msgstr "موازن الحمل" + +#: lib/HealthPage.php +msgid "Cloud Warnings" +msgstr "تحذيرات السحابة" + +#: lib/HealthPage.php +msgid "No warnings." +msgstr "لا توجد تحذيرات." + +#: lib/HealthPage.php +msgid "Cloud Collection" +msgstr "جمع بيانات السحابة" + +#: lib/HealthPage.php +msgid "Collection" +msgstr "الجمع" + +#: lib/HealthPage.php +msgid "Last Run" +msgstr "آخر تشغيل" + +#: lib/HealthPage.php +msgid "Series Read" +msgstr "السلاسل المقروءة" + +#: lib/HealthPage.php +msgid "Requests" +msgstr "الطلبات" + +#: lib/HealthPage.php +msgid "Discovery" +msgstr "الاكتشاف" + +#: lib/HealthPage.php +msgid "Data" +msgstr "البيانات" + +#: lib/HealthPage.php lib/OperatorPage.php +msgid "Never" +msgstr "لم يحدث" + +#: lib/HealthPage.php +#, php-format +msgid "retry in %d s" +msgstr "إعادة المحاولة بعد %d ثانية" + +#: lib/HealthPage.php +#, php-format +msgid "%d seconds ago" +msgstr "منذ %d ثانية" + +#: lib/HealthPage.php +#, php-format +msgid "%d minutes ago" +msgstr "منذ %d دقيقة" + +#: lib/HealthPage.php +#, php-format +msgid "%d hours ago" +msgstr "منذ %d ساعة" + +#: lib/HealthPage.php +#, php-format +msgid "%d days ago" +msgstr "منذ %d يوم" + +#: lib/HealthWarnings.php +#, php-format +msgid "The vault key file cannot be used: %s. Accounts that store credentials in the vault cannot be verified or collected here." +msgstr "لا يمكن استخدام ملف مفتاح الخزنة: %s. لا يمكن التحقق هنا من الحسابات التي تخزّن بيانات الاعتماد في الخزنة أو جمع بياناتها." + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the credential file cannot be used: %s." +msgstr "%s: لا يمكن استخدام ملف بيانات الاعتماد: %s." + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is shorter than the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s: فاصل الجمع البالغ %d ثانية أقصر من فاصل المستطلع البالغ %d ثانية، لذا تُجمع البيانات كل %d ثانية." + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is not a multiple of the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s: فاصل الجمع البالغ %d ثانية ليس من مضاعفات فاصل المستطلع البالغ %d ثانية، لذا تُجمع البيانات كل %d ثانية." + +#: lib/OperatorPage.php +msgid "Review the recorded observations below. Acknowledgments are personal to this session, expire when observations change, and never suppress alerts or change health." +msgstr "راجع الملاحظات المسجّلة أدناه. الإقرارات خاصة بك في هذه الجلسة، وتنتهي صلاحيتها عند تغيّر الملاحظات، ولا تكتم التنبيهات أو تغيّر الحالة الصحية مطلقًا." + +#: lib/OperatorPage.php lib/Pages.php +msgid "Cloud Operations" +msgstr "عمليات السحابة" + +#: lib/OperatorPage.php +msgid "Investigation" +msgstr "التحقيق" + +#: lib/OperatorPage.php +msgid "Object" +msgstr "العنصر" + +#: lib/OperatorPage.php +msgid "Observed (UTC)" +msgstr "وقت الملاحظة (UTC)" + +#: lib/OperatorPage.php +msgid "Unknown or stale" +msgstr "غير معروف أو قديم" + +#: lib/OperatorPage.php +msgid "Acknowledged; health unchanged." +msgstr "تم الإقرار؛ الحالة الصحية لم تتغيّر." + +#: lib/OperatorPage.php +msgid "Acknowledge" +msgstr "إقرار" + +#: lib/OperatorPage.php +msgid "No observations are available for devices you may access." +msgstr "لا تتوفر ملاحظات للأجهزة التي يحق لك الوصول إليها." + +#: lib/Pages.php +msgid "Cloud Operator" +msgstr "مشغّل السحابة" + +#: lib/Pages.php +msgid "Cloud View" +msgstr "عرض السحابة" + +#: lib/Pages.php +msgid "Cloud Admin" +msgstr "مسؤول السحابة" + +#: lib/Pages.php +msgid "Cloud Health" +msgstr "صحة السحابة" + +#: lib/Provider.php +msgid "DigitalOcean" +msgstr "DigitalOcean" + +#: lib/Provider.php +msgid "Amazon Web Services" +msgstr "Amazon Web Services" + +#: lib/Provider.php +msgid "Google Cloud" +msgstr "Google Cloud" + +#: lib/Provider.php +msgid "Microsoft Azure" +msgstr "Microsoft Azure" + +#: lib/Settings.php +msgid "Credential Vault" +msgstr "خزنة بيانات الاعتماد" + +#: lib/Settings.php +msgid "Vault Key File" +msgstr "ملف مفتاح الخزنة" + +#: lib/Settings.php +msgid "Absolute path to the 32-byte key that encrypts stored credentials. Create it yourself, outside the web root, readable only by the web server and poller user, in a directory that only root and that user can write (the same applies to credential files); the plugin never creates or writes it. Back it up with the database: without it, stored credentials must be entered again." +msgstr "المسار المطلق للمفتاح ذي 32 بايت الذي يشفّر بيانات الاعتماد المخزّنة. أنشئه بنفسك خارج جذر الويب، بحيث لا يقرأه إلا مستخدم خادم الويب والمستطلع، داخل دليل لا يكتب فيه إلا root وذلك المستخدم (وينطبق الأمر نفسه على ملفات بيانات الاعتماد)؛ لا تنشئه الإضافة ولا تكتب فيه مطلقًا. احتفظ بنسخة احتياطية منه مع قاعدة البيانات: بدونه، يجب إدخال بيانات الاعتماد المخزّنة مجددًا." + +#: lib/Settings.php +msgid "Credential File Directory" +msgstr "دليل ملفات بيانات الاعتماد" + +#: lib/Settings.php +msgid "Absolute path to the directory that holds credential files. An account can read its credential from a file only inside it, never the vault key file. Empty, the default, refuses credential files. Cloud Admin chooses the file, so keep only cloud credentials here." +msgstr "المسار المطلق للدليل الذي يحتوي على ملفات بيانات الاعتماد. لا يمكن للحساب قراءة بيانات اعتماده إلا من ملف داخله، ولا يمكنه قراءة ملف مفتاح الخزنة مطلقًا. القيمة الفارغة، وهي الافتراضية، ترفض ملفات بيانات الاعتماد. يختار مسؤول السحابة الملف، لذا احتفظ ببيانات اعتماد السحابة فقط هنا." + +#: lib/Settings.php +msgid "Collector" +msgstr "الجامع" + +#: lib/Settings.php +msgid "Collector Time Budget" +msgstr "الميزانية الزمنية للجامع" + +#: lib/Settings.php +msgid "Seconds one collector run may spend before it stops starting new work. Keep it below the poller interval; unfinished accounts resume on the next run." +msgstr "عدد الثواني التي يمكن أن تستغرقها عملية جمع واحدة قبل التوقف عن بدء أعمال جديدة. اجعلها أقل من فاصل المستطلع؛ وتُستأنف الحسابات غير المكتملة في التشغيل التالي." + +#: lib/Settings.php +msgid "Uninstall" +msgstr "إلغاء التثبيت" + +#: lib/Settings.php +msgid "Keep Plugin Tables on Uninstall" +msgstr "الاحتفاظ بجداول الإضافة عند إلغاء التثبيت" + +#: lib/Settings.php +msgid "When checked, uninstalling the plugin keeps its accounts, encrypted credentials, and cache. Clear it to have the uninstall drop them. Cloud resources are never touched either way." +msgstr "عند تحديد هذا الخيار، يحتفظ إلغاء تثبيت الإضافة بحساباتها وبيانات الاعتماد المشفّرة وذاكرة التخزين المؤقت. ألغِ تحديده لحذفها أثناء إلغاء التثبيت. لا تُمس الموارد السحابية في الحالتين." + +#: lib/VerifyStatus.php +msgid "Not verified yet." +msgstr "لم يتم التحقق بعد." + +#: lib/VerifyStatus.php +msgid "The credential works and has the permissions this account needs." +msgstr "بيانات الاعتماد صالحة وتملك الأذونات التي يحتاجها هذا الحساب." + +#: lib/VerifyStatus.php +msgid "The provider rejected the credential. It may be wrong, expired, or revoked." +msgstr "رفض المزوّد بيانات الاعتماد. قد تكون خاطئة أو منتهية الصلاحية أو ملغاة." + +#: lib/VerifyStatus.php +msgid "The credential works but lacks a permission this account needs." +msgstr "بيانات الاعتماد صالحة، لكنها تفتقر إلى إذن يحتاجه هذا الحساب." + +#: lib/VerifyStatus.php +msgid "The provider could not be reached. Check the network path and outbound policy from the poller." +msgstr "تعذّر الوصول إلى المزوّد. تحقق من مسار الشبكة وسياسة الاتصالات الصادرة من المستطلع." + +#: lib/VerifyStatus.php +msgid "The provider is throttling requests. Try again later." +msgstr "يحدّ المزوّد من معدل الطلبات. حاول مجددًا لاحقًا." + +#: lib/VerifyStatus.php +msgid "The provider sent a response the plugin could not read." +msgstr "أرسل المزوّد استجابة لم تتمكن الإضافة من قراءتها." + +#: lib/VerifyStatus.php +msgid "The account or its credential is not configured correctly." +msgstr "لم يُضبط الحساب أو بيانات اعتماده بشكل صحيح." + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later. This server runs PHP %s, so the plugin was not installed or enabled." +msgstr "تتطلب إضافة Cloud إصدار PHP %s أو أحدث. يعمل هذا الخادم بإصدار PHP %s، لذا لم تُثبّت الإضافة أو تُفعّل." + +#: setup.php +#, php-format +msgid "The Cloud plugin requires the PHP extensions %s, which this server does not load, so the plugin was not installed or enabled." +msgstr "تتطلب إضافة Cloud امتدادات PHP التالية: %s، التي لا يحمّلها هذا الخادم، لذا لم تُثبّت الإضافة أو تُفعّل." + +#: setup.php +msgid "Cloud" +msgstr "السحابة" + +#: setup.php +msgid "The Cloud plugin is not enabled." +msgstr "إضافة Cloud غير مفعّلة." + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later." +msgstr "تتطلب إضافة Cloud إصدار PHP %s أو أحدث." + +#: setup.php +msgid "Management" +msgstr "الإدارة" diff --git a/locales/po/cacti.pot b/locales/po/cacti.pot index 138301e..ade056a 100644 --- a/locales/po/cacti.pot +++ b/locales/po/cacti.pot @@ -46,6 +46,22 @@ msgstr "" msgid "The Cacti device was not created; see the Cacti log." msgstr "" +#: cloud_operator.php +msgid "Verify stored credential" +msgstr "" + +#: cloud_operator.php +msgid "Monitoring view" +msgstr "" + +#: cloud_operator.php +msgid "Observations could not be read. Ask an administrator to check the plugin log." +msgstr "" + +#: include/operator.php +msgid "Check the account graphs and collection freshness. Verify tests the stored credential; it cannot replace it or change the provider configuration." +msgstr "" + #: lib/AccountInput.php msgid "Provider: choose one of the listed providers." msgstr "" @@ -128,7 +144,7 @@ msgstr "" msgid "Credential" msgstr "" -#: lib/AccountsPage.php +#: lib/AccountsPage.php lib/OperatorPage.php msgid "State" msgstr "" @@ -140,7 +156,7 @@ msgstr "" msgid "Device" msgstr "" -#: lib/AccountsPage.php +#: lib/AccountsPage.php lib/OperatorPage.php msgid "Actions" msgstr "" @@ -357,7 +373,7 @@ msgstr "" msgid "Data" msgstr "" -#: lib/HealthPage.php +#: lib/HealthPage.php lib/OperatorPage.php msgid "Never" msgstr "" @@ -406,6 +422,46 @@ msgstr "" msgid "%s: the collection interval of %d seconds is not a multiple of the poller interval of %d seconds, so it is collected every %d seconds." msgstr "" +#: lib/OperatorPage.php +msgid "Review the recorded observations below. Acknowledgments are personal to this session, expire when observations change, and never suppress alerts or change health." +msgstr "" + +#: lib/OperatorPage.php lib/Pages.php +msgid "Cloud Operations" +msgstr "" + +#: lib/OperatorPage.php +msgid "Investigation" +msgstr "" + +#: lib/OperatorPage.php +msgid "Object" +msgstr "" + +#: lib/OperatorPage.php +msgid "Observed (UTC)" +msgstr "" + +#: lib/OperatorPage.php +msgid "Unknown or stale" +msgstr "" + +#: lib/OperatorPage.php +msgid "Acknowledged; health unchanged." +msgstr "" + +#: lib/OperatorPage.php +msgid "Acknowledge" +msgstr "" + +#: lib/OperatorPage.php +msgid "No observations are available for devices you may access." +msgstr "" + +#: lib/Pages.php +msgid "Cloud Operator" +msgstr "" + #: lib/Pages.php msgid "Cloud View" msgstr "" diff --git a/locales/po/es-419.po b/locales/po/es-419.po new file mode 100644 index 0000000..70613ab --- /dev/null +++ b/locales/po/es-419.po @@ -0,0 +1,592 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: 2026 Thomas Vincent +# +msgid "" +msgstr "" +"Project-Id-Version: cloud 0.1.0-dev\n" +"Report-Msgid-Bugs-To: https://github.com/somethingwithproof/plugin_cloud/issues\n" +"PO-Revision-Date: 2026-11-17 00:00+0000\n" +"Last-Translator: Thomas Vincent \n" +"Language-Team: Thomas Vincent \n" +"Language: es-419\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cloud_accounts.php +msgid "Name: another account already uses this name." +msgstr "Nombre: otra cuenta ya utiliza este nombre." + +#: cloud_accounts.php +#, php-format +msgid "The account was saved, but the credential was not stored: %s" +msgstr "La cuenta se ha guardado, pero no se ha almacenado la credencial: %s" + +#: cloud_accounts.php +msgid "The account was saved." +msgstr "La cuenta se ha guardado." + +#: cloud_accounts.php +msgid "The account could not be saved." +msgstr "No se ha podido guardar la cuenta." + +#: cloud_accounts.php +msgid "The account and its collected data were deleted. Its Cacti devices and graphs were left in place." +msgstr "Se han eliminado la cuenta y sus datos recopilados. Se han conservado sus dispositivos y gráficos de Cacti." + +#: cloud_accounts.php +#, php-format +msgid "The Cacti device for %s is ready." +msgstr "El dispositivo de Cacti para %s está listo." + +#: cloud_accounts.php +msgid "The Cacti device was not created; see the Cacti log." +msgstr "No se ha creado el dispositivo de Cacti; consulte el registro de Cacti." + +#: cloud_operator.php +msgid "Verify stored credential" +msgstr "Verificar la credencial almacenada" + +#: cloud_operator.php +msgid "Monitoring view" +msgstr "Vista de supervisión" + +#: cloud_operator.php +msgid "Observations could not be read. Ask an administrator to check the plugin log." +msgstr "No se han podido leer las observaciones. Pida a un administrador que revise el registro del complemento." + +#: include/operator.php +msgid "Check the account graphs and collection freshness. Verify tests the stored credential; it cannot replace it or change the provider configuration." +msgstr "Revise los gráficos de la cuenta y la vigencia de la recopilación. Verificar comprueba la credencial almacenada; no puede sustituirla ni cambiar la configuración del proveedor." + +#: lib/AccountInput.php +msgid "Provider: choose one of the listed providers." +msgstr "Proveedor: elija uno de los proveedores de la lista." + +#: lib/AccountInput.php +msgid "Name: enter 1 to 100 characters without control characters." +msgstr "Nombre: introduzca entre 1 y 100 caracteres, sin caracteres de control." + +#: lib/AccountInput.php +msgid "Poller: only the main poller can collect cloud accounts in this release." +msgstr "Sondeador: en esta versión solo el sondeador principal puede recopilar datos de cuentas en la nube." + +#: lib/AccountInput.php +#, php-format +msgid "%s: the value does not have the form this provider uses." +msgstr "%s: el valor no tiene el formato que utiliza este proveedor." + +#: lib/AccountInput.php +msgid "Credential Source: choose one this provider supports." +msgstr "Origen de la credencial: elija uno compatible con este proveedor." + +#: lib/AccountInput.php +msgid "Credential File: enter an absolute path without control characters, at most 512 characters." +msgstr "Archivo de credenciales: introduzca una ruta absoluta sin caracteres de control, de hasta 512 caracteres." + +#: lib/AccountInput.php +#, php-format +msgid "%s: enter whole seconds from %d to %d." +msgstr "%s: introduzca segundos enteros entre %d y %d." + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Collection Interval" +msgstr "Intervalo de recopilación" + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Discovery Interval" +msgstr "Intervalo de descubrimiento" + +#: lib/AccountInput.php +msgid "Request Share: enter a whole percentage from 1 to 100." +msgstr "Cuota de solicitudes: introduzca un porcentaje entero entre 1 y 100." + +#: lib/AccountInput.php +msgid "Monthly Ceiling: enter an amount of zero or more, or leave it blank for none." +msgstr "Límite mensual: introduzca un importe igual o superior a cero, o déjelo en blanco para no establecer un límite." + +#: lib/AccountInput.php +msgid "AWS Account ID" +msgstr "ID de cuenta de AWS" + +#: lib/AccountInput.php +msgid "Regions" +msgstr "Regiones" + +#: lib/AccountInput.php +msgid "Project ID" +msgstr "ID de proyecto" + +#: lib/AccountInput.php +msgid "Tenant ID" +msgstr "ID de inquilino" + +#: lib/AccountInput.php +msgid "Subscription ID" +msgstr "ID de suscripción" + +#: lib/AccountsPage.php lib/Pages.php +msgid "Cloud Accounts" +msgstr "Cuentas en la nube" + +#: lib/AccountsPage.php +msgid "Name" +msgstr "Nombre" + +#: lib/AccountsPage.php +msgid "Provider" +msgstr "Proveedor" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Credential" +msgstr "Credencial" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "State" +msgstr "Estado" + +#: lib/AccountsPage.php +msgid "Verify" +msgstr "Verificar" + +#: lib/AccountsPage.php +msgid "Device" +msgstr "Dispositivo" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "Actions" +msgstr "Acciones" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "No cloud accounts yet." +msgstr "Aún no hay cuentas en la nube." + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Disabled" +msgstr "Desactivada" + +#: lib/AccountsPage.php +msgid "Enabled" +msgstr "Activada" + +#: lib/AccountsPage.php +msgid "Delete" +msgstr "Eliminar" + +#: lib/AccountsPage.php +#, php-format +msgid "Cloud Account: %s" +msgstr "Cuenta en la nube: %s" + +#: lib/AccountsPage.php +msgid "New Cloud Account" +msgstr "Nueva cuenta en la nube" + +#: lib/AccountsPage.php +msgid "Credential Source" +msgstr "Origen de la credencial" + +#: lib/AccountsPage.php +msgid "Credential File" +msgstr "Archivo de credenciales" + +#: lib/AccountsPage.php +msgid "A credential is stored. Leave blank to keep it." +msgstr "Hay una credencial almacenada. Déjelo en blanco para conservarla." + +#: lib/AccountsPage.php +msgid "Paste the token or key to store in the vault." +msgstr "Pegue el token o la clave que se almacenará en la bóveda." + +#: lib/AccountsPage.php +msgid "Request Share" +msgstr "Cuota de solicitudes" + +#: lib/AccountsPage.php +msgid "Monthly Ceiling" +msgstr "Límite mensual" + +#: lib/AccountsPage.php +msgid "Save" +msgstr "Guardar" + +#: lib/AccountsPage.php +msgid "Stored in the vault" +msgstr "Almacenada en la bóveda" + +#: lib/AccountsPage.php +msgid "None stored" +msgstr "Ninguna almacenada" + +#: lib/AccountsPage.php +msgid "File on the poller" +msgstr "Archivo en el sondeador" + +#: lib/AccountsPage.php +msgid "Instance identity" +msgstr "Identidad de la instancia" + +#: lib/AccountsPage.php +#, php-format +msgid "Device %d" +msgstr "Dispositivo %d" + +#: lib/AccountsPage.php +msgid "Create Cacti Device" +msgstr "Crear dispositivo de Cacti" + +#: lib/CredentialSource.php +msgid "Stored in the plugin vault" +msgstr "Almacenada en la bóveda del complemento" + +#: lib/CredentialSource.php +msgid "Credential file on the poller" +msgstr "Archivo de credenciales en el sondeador" + +#: lib/CredentialSource.php +msgid "Instance identity of the poller" +msgstr "Identidad de instancia del sondeador" + +#: lib/EstimateView.php setup.php +msgid "Cloud Request Estimate" +msgstr "Estimación de solicitudes a la nube" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Account" +msgstr "Cuenta" + +#: lib/EstimateView.php +msgid "Selection" +msgstr "Selección" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Resources" +msgstr "Recursos" + +#: lib/EstimateView.php +msgid "Requests per Hour, One Resource" +msgstr "Solicitudes por hora, un recurso" + +#: lib/EstimateView.php +msgid "Requests per Month, One Resource" +msgstr "Solicitudes por mes, un recurso" + +#: lib/EstimateView.php +msgid "Requests per Hour" +msgstr "Solicitudes por hora" + +#: lib/EstimateView.php +msgid "Requests per Month" +msgstr "Solicitudes por mes" + +#: lib/EstimateView.php +msgid "Cost per Month" +msgstr "Costo mensual" + +#: lib/EstimateView.php +msgid "No accounts to estimate." +msgstr "No hay cuentas que estimar." + +#: lib/EstimateView.php +msgid "Estimates use list prices and exclude discounts and shared free tiers." +msgstr "Las estimaciones usan precios de catálogo y excluyen descuentos y niveles gratuitos compartidos." + +#: lib/EstimateView.php +#, php-format +msgid "%s prices from" +msgstr "Precios de %s obtenidos de" + +#: lib/EstimateView.php +#, php-format +msgid "checked %s." +msgstr "comprobados el %s." + +#: lib/EstimateView.php +msgid "Collected now" +msgstr "Recopilado actualmente" + +#: lib/EstimateView.php +msgid "Every graph on every resource" +msgstr "Todos los gráficos de todos los recursos" + +#: lib/EstimateView.php +#, php-format +msgid "Request share: %s requests per hour, %s percent of the token limit. Collected now: %s. Every graph: %s." +msgstr "Cuota de solicitudes: %s solicitudes por hora, %s por ciento del límite del token. Recopilado actualmente: %s. Todos los gráficos: %s." + +#: lib/EstimateView.php +msgid "Collection is capped; the remaining series read U." +msgstr "Se ha alcanzado el límite de recopilación; las series restantes devuelven U." + +#: lib/EstimateView.php +msgid "Metric estimate between discovery runs; discovery requests reduce the collection allowance." +msgstr "Estimación de métricas entre ejecuciones de descubrimiento; las solicitudes de descubrimiento reducen la cuota de recopilación." + +#: lib/EstimateView.php +msgid "No charge documented" +msgstr "No se documenta ningún cargo" + +#: lib/EstimateView.php +msgid "Droplet" +msgstr "Droplet" + +#: lib/EstimateView.php +msgid "Load Balancer" +msgstr "Balanceador de carga" + +#: lib/HealthPage.php +msgid "Cloud Warnings" +msgstr "Advertencias de la nube" + +#: lib/HealthPage.php +msgid "No warnings." +msgstr "No hay advertencias." + +#: lib/HealthPage.php +msgid "Cloud Collection" +msgstr "Recopilación de la nube" + +#: lib/HealthPage.php +msgid "Collection" +msgstr "Recopilación" + +#: lib/HealthPage.php +msgid "Last Run" +msgstr "Última ejecución" + +#: lib/HealthPage.php +msgid "Series Read" +msgstr "Series leídas" + +#: lib/HealthPage.php +msgid "Requests" +msgstr "Solicitudes" + +#: lib/HealthPage.php +msgid "Discovery" +msgstr "Descubrimiento" + +#: lib/HealthPage.php +msgid "Data" +msgstr "Datos" + +#: lib/HealthPage.php lib/OperatorPage.php +msgid "Never" +msgstr "Nunca" + +#: lib/HealthPage.php +#, php-format +msgid "retry in %d s" +msgstr "reintentar en %d s" + +#: lib/HealthPage.php +#, php-format +msgid "%d seconds ago" +msgstr "hace %d segundos" + +#: lib/HealthPage.php +#, php-format +msgid "%d minutes ago" +msgstr "hace %d minutos" + +#: lib/HealthPage.php +#, php-format +msgid "%d hours ago" +msgstr "hace %d horas" + +#: lib/HealthPage.php +#, php-format +msgid "%d days ago" +msgstr "hace %d días" + +#: lib/HealthWarnings.php +#, php-format +msgid "The vault key file cannot be used: %s. Accounts that store credentials in the vault cannot be verified or collected here." +msgstr "No se puede usar el archivo de clave de la bóveda: %s. Las cuentas que almacenan credenciales en la bóveda no se pueden verificar ni recopilar aquí." + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the credential file cannot be used: %s." +msgstr "%s: no se puede usar el archivo de credenciales: %s." + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is shorter than the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s: el intervalo de recopilación de %d segundos es menor que el intervalo del sondeador de %d segundos, por lo que se recopila cada %d segundos." + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is not a multiple of the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s: el intervalo de recopilación de %d segundos no es múltiplo del intervalo del sondeador de %d segundos, por lo que se recopila cada %d segundos." + +#: lib/OperatorPage.php +msgid "Review the recorded observations below. Acknowledgments are personal to this session, expire when observations change, and never suppress alerts or change health." +msgstr "Revise las observaciones registradas a continuación. Los acuses de recibo son personales y exclusivos de esta sesión, caducan cuando cambian las observaciones y no suprimen alertas ni modifican el estado de salud." + +#: lib/OperatorPage.php lib/Pages.php +msgid "Cloud Operations" +msgstr "Operaciones de la nube" + +#: lib/OperatorPage.php +msgid "Investigation" +msgstr "Investigación" + +#: lib/OperatorPage.php +msgid "Object" +msgstr "Objeto" + +#: lib/OperatorPage.php +msgid "Observed (UTC)" +msgstr "Observado (UTC)" + +#: lib/OperatorPage.php +msgid "Unknown or stale" +msgstr "Desconocido o desactualizado" + +#: lib/OperatorPage.php +msgid "Acknowledged; health unchanged." +msgstr "Acuse de recibo registrado; estado de salud sin cambios." + +#: lib/OperatorPage.php +msgid "Acknowledge" +msgstr "Acusar recibo" + +#: lib/OperatorPage.php +msgid "No observations are available for devices you may access." +msgstr "No hay observaciones disponibles para los dispositivos a los que tiene acceso." + +#: lib/Pages.php +msgid "Cloud Operator" +msgstr "Operador de la nube" + +#: lib/Pages.php +msgid "Cloud View" +msgstr "Vista de la nube" + +#: lib/Pages.php +msgid "Cloud Admin" +msgstr "Administrador de la nube" + +#: lib/Pages.php +msgid "Cloud Health" +msgstr "Estado de salud de la nube" + +#: lib/Provider.php +msgid "DigitalOcean" +msgstr "DigitalOcean" + +#: lib/Provider.php +msgid "Amazon Web Services" +msgstr "Amazon Web Services" + +#: lib/Provider.php +msgid "Google Cloud" +msgstr "Google Cloud" + +#: lib/Provider.php +msgid "Microsoft Azure" +msgstr "Microsoft Azure" + +#: lib/Settings.php +msgid "Credential Vault" +msgstr "Bóveda de credenciales" + +#: lib/Settings.php +msgid "Vault Key File" +msgstr "Archivo de clave de la bóveda" + +#: lib/Settings.php +msgid "Absolute path to the 32-byte key that encrypts stored credentials. Create it yourself, outside the web root, readable only by the web server and poller user, in a directory that only root and that user can write (the same applies to credential files); the plugin never creates or writes it. Back it up with the database: without it, stored credentials must be entered again." +msgstr "Ruta absoluta a la clave de 32 bytes que cifra las credenciales almacenadas. Créela usted mismo fuera de la raíz web, legible solo por el usuario del servidor web y del sondeador, en un directorio en el que solo root y ese usuario puedan escribir (lo mismo se aplica a los archivos de credenciales); el complemento nunca la crea ni escribe en ella. Haga una copia de seguridad junto con la base de datos: sin ella, tendrá que volver a introducir las credenciales almacenadas." + +#: lib/Settings.php +msgid "Credential File Directory" +msgstr "Directorio de archivos de credenciales" + +#: lib/Settings.php +msgid "Absolute path to the directory that holds credential files. An account can read its credential from a file only inside it, never the vault key file. Empty, the default, refuses credential files. Cloud Admin chooses the file, so keep only cloud credentials here." +msgstr "Ruta absoluta al directorio que contiene los archivos de credenciales. Una cuenta solo puede leer su credencial de un archivo dentro de él, nunca del archivo de clave de la bóveda. Vacío, el valor predeterminado, rechaza los archivos de credenciales. El administrador de la nube elige el archivo, por lo que aquí solo deben guardarse credenciales de la nube." + +#: lib/Settings.php +msgid "Collector" +msgstr "Recopilador" + +#: lib/Settings.php +msgid "Collector Time Budget" +msgstr "Presupuesto de tiempo del recopilador" + +#: lib/Settings.php +msgid "Seconds one collector run may spend before it stops starting new work. Keep it below the poller interval; unfinished accounts resume on the next run." +msgstr "Segundos que puede emplear una ejecución del recopilador antes de dejar de iniciar nuevas tareas. Manténgalo por debajo del intervalo del sondeador; las cuentas sin terminar se reanudan en la siguiente ejecución." + +#: lib/Settings.php +msgid "Uninstall" +msgstr "Desinstalación" + +#: lib/Settings.php +msgid "Keep Plugin Tables on Uninstall" +msgstr "Conservar las tablas del complemento al desinstalar" + +#: lib/Settings.php +msgid "When checked, uninstalling the plugin keeps its accounts, encrypted credentials, and cache. Clear it to have the uninstall drop them. Cloud resources are never touched either way." +msgstr "Si se marca, al desinstalar el complemento se conservan sus cuentas, credenciales cifradas y caché. Desmárquelo para eliminarlas durante la desinstalación. Los recursos de la nube nunca se modifican en ninguno de los dos casos." + +#: lib/VerifyStatus.php +msgid "Not verified yet." +msgstr "Aún no se ha verificado." + +#: lib/VerifyStatus.php +msgid "The credential works and has the permissions this account needs." +msgstr "La credencial funciona y tiene los permisos que necesita esta cuenta." + +#: lib/VerifyStatus.php +msgid "The provider rejected the credential. It may be wrong, expired, or revoked." +msgstr "El proveedor ha rechazado la credencial. Puede ser incorrecta, haber caducado o haber sido revocada." + +#: lib/VerifyStatus.php +msgid "The credential works but lacks a permission this account needs." +msgstr "La credencial funciona, pero le falta un permiso que necesita esta cuenta." + +#: lib/VerifyStatus.php +msgid "The provider could not be reached. Check the network path and outbound policy from the poller." +msgstr "No se ha podido contactar con el proveedor. Compruebe la ruta de red y la política de salida del sondeador." + +#: lib/VerifyStatus.php +msgid "The provider is throttling requests. Try again later." +msgstr "El proveedor está limitando las solicitudes. Inténtelo de nuevo más tarde." + +#: lib/VerifyStatus.php +msgid "The provider sent a response the plugin could not read." +msgstr "El proveedor ha enviado una respuesta que el complemento no ha podido leer." + +#: lib/VerifyStatus.php +msgid "The account or its credential is not configured correctly." +msgstr "La cuenta o su credencial no están configuradas correctamente." + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later. This server runs PHP %s, so the plugin was not installed or enabled." +msgstr "El complemento Cloud requiere PHP %s o posterior. Este servidor ejecuta PHP %s, por lo que no se ha instalado ni activado el complemento." + +#: setup.php +#, php-format +msgid "The Cloud plugin requires the PHP extensions %s, which this server does not load, so the plugin was not installed or enabled." +msgstr "El complemento Cloud requiere las extensiones de PHP %s, que este servidor no carga, por lo que no se ha instalado ni activado el complemento." + +#: setup.php +msgid "Cloud" +msgstr "Nube" + +#: setup.php +msgid "The Cloud plugin is not enabled." +msgstr "El complemento Cloud no está activado." + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later." +msgstr "El complemento Cloud requiere PHP %s o posterior." + +#: setup.php +msgid "Management" +msgstr "Gestión" diff --git a/locales/po/es-ES.po b/locales/po/es-ES.po new file mode 100644 index 0000000..8a849cc --- /dev/null +++ b/locales/po/es-ES.po @@ -0,0 +1,592 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: 2026 Thomas Vincent +# +msgid "" +msgstr "" +"Project-Id-Version: cloud 0.1.0-dev\n" +"Report-Msgid-Bugs-To: https://github.com/somethingwithproof/plugin_cloud/issues\n" +"PO-Revision-Date: 2026-11-17 00:00+0000\n" +"Last-Translator: Thomas Vincent \n" +"Language-Team: Thomas Vincent \n" +"Language: es-ES\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cloud_accounts.php +msgid "Name: another account already uses this name." +msgstr "Nombre: otra cuenta ya utiliza este nombre." + +#: cloud_accounts.php +#, php-format +msgid "The account was saved, but the credential was not stored: %s" +msgstr "La cuenta se ha guardado, pero no se ha almacenado la credencial: %s" + +#: cloud_accounts.php +msgid "The account was saved." +msgstr "La cuenta se ha guardado." + +#: cloud_accounts.php +msgid "The account could not be saved." +msgstr "No se ha podido guardar la cuenta." + +#: cloud_accounts.php +msgid "The account and its collected data were deleted. Its Cacti devices and graphs were left in place." +msgstr "Se han eliminado la cuenta y sus datos recopilados. Se han conservado sus dispositivos y gráficos de Cacti." + +#: cloud_accounts.php +#, php-format +msgid "The Cacti device for %s is ready." +msgstr "El dispositivo de Cacti para %s está listo." + +#: cloud_accounts.php +msgid "The Cacti device was not created; see the Cacti log." +msgstr "No se ha creado el dispositivo de Cacti; consulte el registro de Cacti." + +#: cloud_operator.php +msgid "Verify stored credential" +msgstr "Verificar la credencial almacenada" + +#: cloud_operator.php +msgid "Monitoring view" +msgstr "Vista de supervisión" + +#: cloud_operator.php +msgid "Observations could not be read. Ask an administrator to check the plugin log." +msgstr "No se han podido leer las observaciones. Pida a un administrador que revise el registro del complemento." + +#: include/operator.php +msgid "Check the account graphs and collection freshness. Verify tests the stored credential; it cannot replace it or change the provider configuration." +msgstr "Revise los gráficos de la cuenta y la vigencia de la recopilación. Verificar comprueba la credencial almacenada; no puede sustituirla ni cambiar la configuración del proveedor." + +#: lib/AccountInput.php +msgid "Provider: choose one of the listed providers." +msgstr "Proveedor: elija uno de los proveedores de la lista." + +#: lib/AccountInput.php +msgid "Name: enter 1 to 100 characters without control characters." +msgstr "Nombre: introduzca entre 1 y 100 caracteres, sin caracteres de control." + +#: lib/AccountInput.php +msgid "Poller: only the main poller can collect cloud accounts in this release." +msgstr "Sondeador: en esta versión solo el sondeador principal puede recopilar datos de cuentas en la nube." + +#: lib/AccountInput.php +#, php-format +msgid "%s: the value does not have the form this provider uses." +msgstr "%s: el valor no tiene el formato que utiliza este proveedor." + +#: lib/AccountInput.php +msgid "Credential Source: choose one this provider supports." +msgstr "Origen de la credencial: elija uno compatible con este proveedor." + +#: lib/AccountInput.php +msgid "Credential File: enter an absolute path without control characters, at most 512 characters." +msgstr "Fichero de credenciales: introduzca una ruta absoluta sin caracteres de control, de hasta 512 caracteres." + +#: lib/AccountInput.php +#, php-format +msgid "%s: enter whole seconds from %d to %d." +msgstr "%s: introduzca segundos enteros entre %d y %d." + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Collection Interval" +msgstr "Intervalo de recopilación" + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Discovery Interval" +msgstr "Intervalo de descubrimiento" + +#: lib/AccountInput.php +msgid "Request Share: enter a whole percentage from 1 to 100." +msgstr "Cuota de solicitudes: introduzca un porcentaje entero entre 1 y 100." + +#: lib/AccountInput.php +msgid "Monthly Ceiling: enter an amount of zero or more, or leave it blank for none." +msgstr "Límite mensual: introduzca un importe igual o superior a cero, o déjelo en blanco para no establecer un límite." + +#: lib/AccountInput.php +msgid "AWS Account ID" +msgstr "ID de cuenta de AWS" + +#: lib/AccountInput.php +msgid "Regions" +msgstr "Regiones" + +#: lib/AccountInput.php +msgid "Project ID" +msgstr "ID de proyecto" + +#: lib/AccountInput.php +msgid "Tenant ID" +msgstr "ID de inquilino" + +#: lib/AccountInput.php +msgid "Subscription ID" +msgstr "ID de suscripción" + +#: lib/AccountsPage.php lib/Pages.php +msgid "Cloud Accounts" +msgstr "Cuentas en la nube" + +#: lib/AccountsPage.php +msgid "Name" +msgstr "Nombre" + +#: lib/AccountsPage.php +msgid "Provider" +msgstr "Proveedor" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Credential" +msgstr "Credencial" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "State" +msgstr "Estado" + +#: lib/AccountsPage.php +msgid "Verify" +msgstr "Verificar" + +#: lib/AccountsPage.php +msgid "Device" +msgstr "Dispositivo" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "Actions" +msgstr "Acciones" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "No cloud accounts yet." +msgstr "Aún no hay cuentas en la nube." + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Disabled" +msgstr "Desactivada" + +#: lib/AccountsPage.php +msgid "Enabled" +msgstr "Activada" + +#: lib/AccountsPage.php +msgid "Delete" +msgstr "Eliminar" + +#: lib/AccountsPage.php +#, php-format +msgid "Cloud Account: %s" +msgstr "Cuenta en la nube: %s" + +#: lib/AccountsPage.php +msgid "New Cloud Account" +msgstr "Nueva cuenta en la nube" + +#: lib/AccountsPage.php +msgid "Credential Source" +msgstr "Origen de la credencial" + +#: lib/AccountsPage.php +msgid "Credential File" +msgstr "Fichero de credenciales" + +#: lib/AccountsPage.php +msgid "A credential is stored. Leave blank to keep it." +msgstr "Hay una credencial almacenada. Déjelo en blanco para conservarla." + +#: lib/AccountsPage.php +msgid "Paste the token or key to store in the vault." +msgstr "Pegue el token o la clave que se almacenará en la bóveda." + +#: lib/AccountsPage.php +msgid "Request Share" +msgstr "Cuota de solicitudes" + +#: lib/AccountsPage.php +msgid "Monthly Ceiling" +msgstr "Límite mensual" + +#: lib/AccountsPage.php +msgid "Save" +msgstr "Guardar" + +#: lib/AccountsPage.php +msgid "Stored in the vault" +msgstr "Almacenada en la bóveda" + +#: lib/AccountsPage.php +msgid "None stored" +msgstr "Ninguna almacenada" + +#: lib/AccountsPage.php +msgid "File on the poller" +msgstr "Fichero en el sondeador" + +#: lib/AccountsPage.php +msgid "Instance identity" +msgstr "Identidad de la instancia" + +#: lib/AccountsPage.php +#, php-format +msgid "Device %d" +msgstr "Dispositivo %d" + +#: lib/AccountsPage.php +msgid "Create Cacti Device" +msgstr "Crear dispositivo de Cacti" + +#: lib/CredentialSource.php +msgid "Stored in the plugin vault" +msgstr "Almacenada en la bóveda del complemento" + +#: lib/CredentialSource.php +msgid "Credential file on the poller" +msgstr "Fichero de credenciales en el sondeador" + +#: lib/CredentialSource.php +msgid "Instance identity of the poller" +msgstr "Identidad de instancia del sondeador" + +#: lib/EstimateView.php setup.php +msgid "Cloud Request Estimate" +msgstr "Estimación de solicitudes a la nube" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Account" +msgstr "Cuenta" + +#: lib/EstimateView.php +msgid "Selection" +msgstr "Selección" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Resources" +msgstr "Recursos" + +#: lib/EstimateView.php +msgid "Requests per Hour, One Resource" +msgstr "Solicitudes por hora, un recurso" + +#: lib/EstimateView.php +msgid "Requests per Month, One Resource" +msgstr "Solicitudes por mes, un recurso" + +#: lib/EstimateView.php +msgid "Requests per Hour" +msgstr "Solicitudes por hora" + +#: lib/EstimateView.php +msgid "Requests per Month" +msgstr "Solicitudes por mes" + +#: lib/EstimateView.php +msgid "Cost per Month" +msgstr "Coste mensual" + +#: lib/EstimateView.php +msgid "No accounts to estimate." +msgstr "No hay cuentas que estimar." + +#: lib/EstimateView.php +msgid "Estimates use list prices and exclude discounts and shared free tiers." +msgstr "Las estimaciones usan precios de catálogo y excluyen descuentos y niveles gratuitos compartidos." + +#: lib/EstimateView.php +#, php-format +msgid "%s prices from" +msgstr "Precios de %s obtenidos de" + +#: lib/EstimateView.php +#, php-format +msgid "checked %s." +msgstr "comprobados el %s." + +#: lib/EstimateView.php +msgid "Collected now" +msgstr "Recopilado actualmente" + +#: lib/EstimateView.php +msgid "Every graph on every resource" +msgstr "Todos los gráficos de todos los recursos" + +#: lib/EstimateView.php +#, php-format +msgid "Request share: %s requests per hour, %s percent of the token limit. Collected now: %s. Every graph: %s." +msgstr "Cuota de solicitudes: %s solicitudes por hora, %s por ciento del límite del token. Recopilado actualmente: %s. Todos los gráficos: %s." + +#: lib/EstimateView.php +msgid "Collection is capped; the remaining series read U." +msgstr "Se ha alcanzado el límite de recopilación; las series restantes devuelven U." + +#: lib/EstimateView.php +msgid "Metric estimate between discovery runs; discovery requests reduce the collection allowance." +msgstr "Estimación de métricas entre ejecuciones de descubrimiento; las solicitudes de descubrimiento reducen la cuota de recopilación." + +#: lib/EstimateView.php +msgid "No charge documented" +msgstr "No se documenta ningún cargo" + +#: lib/EstimateView.php +msgid "Droplet" +msgstr "Droplet" + +#: lib/EstimateView.php +msgid "Load Balancer" +msgstr "Equilibrador de carga" + +#: lib/HealthPage.php +msgid "Cloud Warnings" +msgstr "Advertencias de la nube" + +#: lib/HealthPage.php +msgid "No warnings." +msgstr "No hay advertencias." + +#: lib/HealthPage.php +msgid "Cloud Collection" +msgstr "Recopilación de la nube" + +#: lib/HealthPage.php +msgid "Collection" +msgstr "Recopilación" + +#: lib/HealthPage.php +msgid "Last Run" +msgstr "Última ejecución" + +#: lib/HealthPage.php +msgid "Series Read" +msgstr "Series leídas" + +#: lib/HealthPage.php +msgid "Requests" +msgstr "Solicitudes" + +#: lib/HealthPage.php +msgid "Discovery" +msgstr "Descubrimiento" + +#: lib/HealthPage.php +msgid "Data" +msgstr "Datos" + +#: lib/HealthPage.php lib/OperatorPage.php +msgid "Never" +msgstr "Nunca" + +#: lib/HealthPage.php +#, php-format +msgid "retry in %d s" +msgstr "reintentar en %d s" + +#: lib/HealthPage.php +#, php-format +msgid "%d seconds ago" +msgstr "hace %d segundos" + +#: lib/HealthPage.php +#, php-format +msgid "%d minutes ago" +msgstr "hace %d minutos" + +#: lib/HealthPage.php +#, php-format +msgid "%d hours ago" +msgstr "hace %d horas" + +#: lib/HealthPage.php +#, php-format +msgid "%d days ago" +msgstr "hace %d días" + +#: lib/HealthWarnings.php +#, php-format +msgid "The vault key file cannot be used: %s. Accounts that store credentials in the vault cannot be verified or collected here." +msgstr "No se puede usar el fichero de clave de la bóveda: %s. Las cuentas que almacenan credenciales en la bóveda no se pueden verificar ni recopilar aquí." + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the credential file cannot be used: %s." +msgstr "%s: no se puede usar el fichero de credenciales: %s." + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is shorter than the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s: el intervalo de recopilación de %d segundos es menor que el intervalo del sondeador de %d segundos, por lo que se recopila cada %d segundos." + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is not a multiple of the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s: el intervalo de recopilación de %d segundos no es múltiplo del intervalo del sondeador de %d segundos, por lo que se recopila cada %d segundos." + +#: lib/OperatorPage.php +msgid "Review the recorded observations below. Acknowledgments are personal to this session, expire when observations change, and never suppress alerts or change health." +msgstr "Revise las observaciones registradas a continuación. Los acuses de recibo son personales y exclusivos de esta sesión, caducan cuando cambian las observaciones y no suprimen alertas ni modifican el estado de salud." + +#: lib/OperatorPage.php lib/Pages.php +msgid "Cloud Operations" +msgstr "Operaciones de la nube" + +#: lib/OperatorPage.php +msgid "Investigation" +msgstr "Investigación" + +#: lib/OperatorPage.php +msgid "Object" +msgstr "Objeto" + +#: lib/OperatorPage.php +msgid "Observed (UTC)" +msgstr "Observado (UTC)" + +#: lib/OperatorPage.php +msgid "Unknown or stale" +msgstr "Desconocido o desactualizado" + +#: lib/OperatorPage.php +msgid "Acknowledged; health unchanged." +msgstr "Acuse de recibo registrado; estado de salud sin cambios." + +#: lib/OperatorPage.php +msgid "Acknowledge" +msgstr "Acusar recibo" + +#: lib/OperatorPage.php +msgid "No observations are available for devices you may access." +msgstr "No hay observaciones disponibles para los dispositivos a los que tiene acceso." + +#: lib/Pages.php +msgid "Cloud Operator" +msgstr "Operador de la nube" + +#: lib/Pages.php +msgid "Cloud View" +msgstr "Vista de la nube" + +#: lib/Pages.php +msgid "Cloud Admin" +msgstr "Administrador de la nube" + +#: lib/Pages.php +msgid "Cloud Health" +msgstr "Estado de salud de la nube" + +#: lib/Provider.php +msgid "DigitalOcean" +msgstr "DigitalOcean" + +#: lib/Provider.php +msgid "Amazon Web Services" +msgstr "Amazon Web Services" + +#: lib/Provider.php +msgid "Google Cloud" +msgstr "Google Cloud" + +#: lib/Provider.php +msgid "Microsoft Azure" +msgstr "Microsoft Azure" + +#: lib/Settings.php +msgid "Credential Vault" +msgstr "Bóveda de credenciales" + +#: lib/Settings.php +msgid "Vault Key File" +msgstr "Fichero de clave de la bóveda" + +#: lib/Settings.php +msgid "Absolute path to the 32-byte key that encrypts stored credentials. Create it yourself, outside the web root, readable only by the web server and poller user, in a directory that only root and that user can write (the same applies to credential files); the plugin never creates or writes it. Back it up with the database: without it, stored credentials must be entered again." +msgstr "Ruta absoluta a la clave de 32 bytes que cifra las credenciales almacenadas. Créela usted mismo fuera de la raíz web, legible solo por el usuario del servidor web y del sondeador, en un directorio en el que solo root y ese usuario puedan escribir (lo mismo se aplica a los ficheros de credenciales); el complemento nunca la crea ni escribe en ella. Haga una copia de seguridad junto con la base de datos: sin ella, tendrá que volver a introducir las credenciales almacenadas." + +#: lib/Settings.php +msgid "Credential File Directory" +msgstr "Directorio de ficheros de credenciales" + +#: lib/Settings.php +msgid "Absolute path to the directory that holds credential files. An account can read its credential from a file only inside it, never the vault key file. Empty, the default, refuses credential files. Cloud Admin chooses the file, so keep only cloud credentials here." +msgstr "Ruta absoluta al directorio que contiene los ficheros de credenciales. Una cuenta solo puede leer su credencial de un fichero dentro de él, nunca del fichero de clave de la bóveda. Vacío, el valor predeterminado, rechaza los ficheros de credenciales. El administrador de la nube elige el fichero, por lo que aquí solo deben guardarse credenciales de la nube." + +#: lib/Settings.php +msgid "Collector" +msgstr "Recopilador" + +#: lib/Settings.php +msgid "Collector Time Budget" +msgstr "Presupuesto de tiempo del recopilador" + +#: lib/Settings.php +msgid "Seconds one collector run may spend before it stops starting new work. Keep it below the poller interval; unfinished accounts resume on the next run." +msgstr "Segundos que puede emplear una ejecución del recopilador antes de dejar de iniciar nuevas tareas. Manténgalo por debajo del intervalo del sondeador; las cuentas sin terminar se reanudan en la siguiente ejecución." + +#: lib/Settings.php +msgid "Uninstall" +msgstr "Desinstalación" + +#: lib/Settings.php +msgid "Keep Plugin Tables on Uninstall" +msgstr "Conservar las tablas del complemento al desinstalar" + +#: lib/Settings.php +msgid "When checked, uninstalling the plugin keeps its accounts, encrypted credentials, and cache. Clear it to have the uninstall drop them. Cloud resources are never touched either way." +msgstr "Si se marca, al desinstalar el complemento se conservan sus cuentas, credenciales cifradas y caché. Desmárquelo para eliminarlas durante la desinstalación. Los recursos de la nube nunca se modifican en ninguno de los dos casos." + +#: lib/VerifyStatus.php +msgid "Not verified yet." +msgstr "Aún no se ha verificado." + +#: lib/VerifyStatus.php +msgid "The credential works and has the permissions this account needs." +msgstr "La credencial funciona y tiene los permisos que necesita esta cuenta." + +#: lib/VerifyStatus.php +msgid "The provider rejected the credential. It may be wrong, expired, or revoked." +msgstr "El proveedor ha rechazado la credencial. Puede ser incorrecta, haber caducado o haber sido revocada." + +#: lib/VerifyStatus.php +msgid "The credential works but lacks a permission this account needs." +msgstr "La credencial funciona, pero le falta un permiso que necesita esta cuenta." + +#: lib/VerifyStatus.php +msgid "The provider could not be reached. Check the network path and outbound policy from the poller." +msgstr "No se ha podido contactar con el proveedor. Compruebe la ruta de red y la política de salida del sondeador." + +#: lib/VerifyStatus.php +msgid "The provider is throttling requests. Try again later." +msgstr "El proveedor está limitando las solicitudes. Inténtelo de nuevo más tarde." + +#: lib/VerifyStatus.php +msgid "The provider sent a response the plugin could not read." +msgstr "El proveedor ha enviado una respuesta que el complemento no ha podido leer." + +#: lib/VerifyStatus.php +msgid "The account or its credential is not configured correctly." +msgstr "La cuenta o su credencial no están configuradas correctamente." + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later. This server runs PHP %s, so the plugin was not installed or enabled." +msgstr "El complemento Cloud requiere PHP %s o posterior. Este servidor ejecuta PHP %s, por lo que no se ha instalado ni activado el complemento." + +#: setup.php +#, php-format +msgid "The Cloud plugin requires the PHP extensions %s, which this server does not load, so the plugin was not installed or enabled." +msgstr "El complemento Cloud requiere las extensiones de PHP %s, que este servidor no carga, por lo que no se ha instalado ni activado el complemento." + +#: setup.php +msgid "Cloud" +msgstr "Nube" + +#: setup.php +msgid "The Cloud plugin is not enabled." +msgstr "El complemento Cloud no está activado." + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later." +msgstr "El complemento Cloud requiere PHP %s o posterior." + +#: setup.php +msgid "Management" +msgstr "Gestión" diff --git a/locales/po/hi-IN.po b/locales/po/hi-IN.po new file mode 100644 index 0000000..a982eec --- /dev/null +++ b/locales/po/hi-IN.po @@ -0,0 +1,592 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: 2026 Thomas Vincent +# +msgid "" +msgstr "" +"Project-Id-Version: cloud 0.1.0-dev\n" +"Report-Msgid-Bugs-To: https://github.com/somethingwithproof/plugin_cloud/issues\n" +"PO-Revision-Date: 2026-11-17 00:00+0000\n" +"Last-Translator: Thomas Vincent \n" +"Language-Team: Thomas Vincent \n" +"Language: hi-IN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cloud_accounts.php +msgid "Name: another account already uses this name." +msgstr "नाम: कोई अन्य खाता पहले से इस नाम का उपयोग कर रहा है।" + +#: cloud_accounts.php +#, php-format +msgid "The account was saved, but the credential was not stored: %s" +msgstr "खाता सहेजा गया, लेकिन क्रेडेंशियल संग्रहीत नहीं हुआ: %s" + +#: cloud_accounts.php +msgid "The account was saved." +msgstr "खाता सहेज दिया गया।" + +#: cloud_accounts.php +msgid "The account could not be saved." +msgstr "खाता सहेजा नहीं जा सका।" + +#: cloud_accounts.php +msgid "The account and its collected data were deleted. Its Cacti devices and graphs were left in place." +msgstr "खाता और उसका एकत्रित डेटा हटा दिया गया। उसके Cacti डिवाइस और ग्राफ़ यथावत रखे गए।" + +#: cloud_accounts.php +#, php-format +msgid "The Cacti device for %s is ready." +msgstr "%s के लिए Cacti डिवाइस तैयार है।" + +#: cloud_accounts.php +msgid "The Cacti device was not created; see the Cacti log." +msgstr "Cacti डिवाइस नहीं बनाया गया; Cacti लॉग देखें।" + +#: cloud_operator.php +msgid "Verify stored credential" +msgstr "संग्रहीत क्रेडेंशियल सत्यापित करें" + +#: cloud_operator.php +msgid "Monitoring view" +msgstr "निगरानी दृश्य" + +#: cloud_operator.php +msgid "Observations could not be read. Ask an administrator to check the plugin log." +msgstr "अवलोकन पढ़े नहीं जा सके। किसी प्रशासक से प्लगइन लॉग जाँचने को कहें।" + +#: include/operator.php +msgid "Check the account graphs and collection freshness. Verify tests the stored credential; it cannot replace it or change the provider configuration." +msgstr "खाते के ग्राफ़ और संग्रह की ताज़गी जाँचें। सत्यापन संग्रहीत क्रेडेंशियल को परखता है; वह उसे बदल नहीं सकता या प्रदाता का कॉन्फ़िगरेशन नहीं बदल सकता।" + +#: lib/AccountInput.php +msgid "Provider: choose one of the listed providers." +msgstr "प्रदाता: सूची में दिए गए प्रदाताओं में से एक चुनें।" + +#: lib/AccountInput.php +msgid "Name: enter 1 to 100 characters without control characters." +msgstr "नाम: नियंत्रण वर्णों के बिना 1 से 100 वर्ण दर्ज करें।" + +#: lib/AccountInput.php +msgid "Poller: only the main poller can collect cloud accounts in this release." +msgstr "पोलर: इस रिलीज़ में केवल मुख्य पोलर ही क्लाउड खातों से डेटा एकत्र कर सकता है।" + +#: lib/AccountInput.php +#, php-format +msgid "%s: the value does not have the form this provider uses." +msgstr "%s: मान इस प्रदाता के उपयोग किए जाने वाले प्रारूप में नहीं है।" + +#: lib/AccountInput.php +msgid "Credential Source: choose one this provider supports." +msgstr "क्रेडेंशियल स्रोत: इस प्रदाता द्वारा समर्थित स्रोत चुनें।" + +#: lib/AccountInput.php +msgid "Credential File: enter an absolute path without control characters, at most 512 characters." +msgstr "क्रेडेंशियल फ़ाइल: नियंत्रण वर्णों के बिना अधिकतम 512 वर्णों वाला पूर्ण पथ दर्ज करें।" + +#: lib/AccountInput.php +#, php-format +msgid "%s: enter whole seconds from %d to %d." +msgstr "%s: %d से %d तक पूर्ण सेकंड दर्ज करें।" + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Collection Interval" +msgstr "संग्रह अंतराल" + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Discovery Interval" +msgstr "खोज अंतराल" + +#: lib/AccountInput.php +msgid "Request Share: enter a whole percentage from 1 to 100." +msgstr "अनुरोध हिस्सा: 1 से 100 तक पूर्ण प्रतिशत दर्ज करें।" + +#: lib/AccountInput.php +msgid "Monthly Ceiling: enter an amount of zero or more, or leave it blank for none." +msgstr "मासिक सीमा: शून्य या उससे अधिक राशि दर्ज करें, या कोई सीमा न रखने के लिए खाली छोड़ें।" + +#: lib/AccountInput.php +msgid "AWS Account ID" +msgstr "AWS खाता ID" + +#: lib/AccountInput.php +msgid "Regions" +msgstr "क्षेत्र" + +#: lib/AccountInput.php +msgid "Project ID" +msgstr "प्रोजेक्ट ID" + +#: lib/AccountInput.php +msgid "Tenant ID" +msgstr "टेनेंट ID" + +#: lib/AccountInput.php +msgid "Subscription ID" +msgstr "सदस्यता ID" + +#: lib/AccountsPage.php lib/Pages.php +msgid "Cloud Accounts" +msgstr "क्लाउड खाते" + +#: lib/AccountsPage.php +msgid "Name" +msgstr "नाम" + +#: lib/AccountsPage.php +msgid "Provider" +msgstr "प्रदाता" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Credential" +msgstr "क्रेडेंशियल" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "State" +msgstr "स्थिति" + +#: lib/AccountsPage.php +msgid "Verify" +msgstr "सत्यापित करें" + +#: lib/AccountsPage.php +msgid "Device" +msgstr "डिवाइस" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "Actions" +msgstr "कार्रवाइयाँ" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "No cloud accounts yet." +msgstr "अभी कोई क्लाउड खाता नहीं है।" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Disabled" +msgstr "अक्षम" + +#: lib/AccountsPage.php +msgid "Enabled" +msgstr "सक्षम" + +#: lib/AccountsPage.php +msgid "Delete" +msgstr "हटाएँ" + +#: lib/AccountsPage.php +#, php-format +msgid "Cloud Account: %s" +msgstr "क्लाउड खाता: %s" + +#: lib/AccountsPage.php +msgid "New Cloud Account" +msgstr "नया क्लाउड खाता" + +#: lib/AccountsPage.php +msgid "Credential Source" +msgstr "क्रेडेंशियल स्रोत" + +#: lib/AccountsPage.php +msgid "Credential File" +msgstr "क्रेडेंशियल फ़ाइल" + +#: lib/AccountsPage.php +msgid "A credential is stored. Leave blank to keep it." +msgstr "क्रेडेंशियल संग्रहीत है। उसे रखने के लिए खाली छोड़ें।" + +#: lib/AccountsPage.php +msgid "Paste the token or key to store in the vault." +msgstr "वॉल्ट में संग्रहीत करने के लिए टोकन या कुंजी पेस्ट करें।" + +#: lib/AccountsPage.php +msgid "Request Share" +msgstr "अनुरोध हिस्सा" + +#: lib/AccountsPage.php +msgid "Monthly Ceiling" +msgstr "मासिक सीमा" + +#: lib/AccountsPage.php +msgid "Save" +msgstr "सहेजें" + +#: lib/AccountsPage.php +msgid "Stored in the vault" +msgstr "वॉल्ट में संग्रहीत" + +#: lib/AccountsPage.php +msgid "None stored" +msgstr "कुछ संग्रहीत नहीं" + +#: lib/AccountsPage.php +msgid "File on the poller" +msgstr "पोलर पर फ़ाइल" + +#: lib/AccountsPage.php +msgid "Instance identity" +msgstr "इंस्टेंस पहचान" + +#: lib/AccountsPage.php +#, php-format +msgid "Device %d" +msgstr "डिवाइस %d" + +#: lib/AccountsPage.php +msgid "Create Cacti Device" +msgstr "Cacti डिवाइस बनाएँ" + +#: lib/CredentialSource.php +msgid "Stored in the plugin vault" +msgstr "प्लगइन वॉल्ट में संग्रहीत" + +#: lib/CredentialSource.php +msgid "Credential file on the poller" +msgstr "पोलर पर क्रेडेंशियल फ़ाइल" + +#: lib/CredentialSource.php +msgid "Instance identity of the poller" +msgstr "पोलर की इंस्टेंस पहचान" + +#: lib/EstimateView.php setup.php +msgid "Cloud Request Estimate" +msgstr "क्लाउड अनुरोध अनुमान" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Account" +msgstr "खाता" + +#: lib/EstimateView.php +msgid "Selection" +msgstr "चयन" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Resources" +msgstr "संसाधन" + +#: lib/EstimateView.php +msgid "Requests per Hour, One Resource" +msgstr "प्रति घंटा अनुरोध, एक संसाधन" + +#: lib/EstimateView.php +msgid "Requests per Month, One Resource" +msgstr "प्रति माह अनुरोध, एक संसाधन" + +#: lib/EstimateView.php +msgid "Requests per Hour" +msgstr "प्रति घंटा अनुरोध" + +#: lib/EstimateView.php +msgid "Requests per Month" +msgstr "प्रति माह अनुरोध" + +#: lib/EstimateView.php +msgid "Cost per Month" +msgstr "प्रति माह लागत" + +#: lib/EstimateView.php +msgid "No accounts to estimate." +msgstr "अनुमान के लिए कोई खाता नहीं है।" + +#: lib/EstimateView.php +msgid "Estimates use list prices and exclude discounts and shared free tiers." +msgstr "अनुमान सूची मूल्यों पर आधारित हैं और उनमें छूट तथा साझा निःशुल्क स्तर शामिल नहीं हैं।" + +#: lib/EstimateView.php +#, php-format +msgid "%s prices from" +msgstr "%s की कीमतों का स्रोत" + +#: lib/EstimateView.php +#, php-format +msgid "checked %s." +msgstr "%s को जाँचा गया।" + +#: lib/EstimateView.php +msgid "Collected now" +msgstr "अभी एकत्रित" + +#: lib/EstimateView.php +msgid "Every graph on every resource" +msgstr "हर संसाधन पर हर ग्राफ़" + +#: lib/EstimateView.php +#, php-format +msgid "Request share: %s requests per hour, %s percent of the token limit. Collected now: %s. Every graph: %s." +msgstr "अनुरोध हिस्सा: प्रति घंटा %s अनुरोध, टोकन सीमा का %s प्रतिशत। अभी एकत्रित: %s। हर ग्राफ़: %s।" + +#: lib/EstimateView.php +msgid "Collection is capped; the remaining series read U." +msgstr "संग्रह सीमा तक पहुँच गया है; शेष शृंखलाएँ U देती हैं।" + +#: lib/EstimateView.php +msgid "Metric estimate between discovery runs; discovery requests reduce the collection allowance." +msgstr "खोज प्रक्रियाओं के बीच मेट्रिक अनुमान; खोज अनुरोध संग्रह के लिए उपलब्ध सीमा घटाते हैं।" + +#: lib/EstimateView.php +msgid "No charge documented" +msgstr "कोई शुल्क दस्तावेज़ित नहीं" + +#: lib/EstimateView.php +msgid "Droplet" +msgstr "Droplet" + +#: lib/EstimateView.php +msgid "Load Balancer" +msgstr "लोड बैलेंसर" + +#: lib/HealthPage.php +msgid "Cloud Warnings" +msgstr "क्लाउड चेतावनियाँ" + +#: lib/HealthPage.php +msgid "No warnings." +msgstr "कोई चेतावनी नहीं।" + +#: lib/HealthPage.php +msgid "Cloud Collection" +msgstr "क्लाउड संग्रह" + +#: lib/HealthPage.php +msgid "Collection" +msgstr "संग्रह" + +#: lib/HealthPage.php +msgid "Last Run" +msgstr "पिछला निष्पादन" + +#: lib/HealthPage.php +msgid "Series Read" +msgstr "पढ़ी गई शृंखलाएँ" + +#: lib/HealthPage.php +msgid "Requests" +msgstr "अनुरोध" + +#: lib/HealthPage.php +msgid "Discovery" +msgstr "खोज" + +#: lib/HealthPage.php +msgid "Data" +msgstr "डेटा" + +#: lib/HealthPage.php lib/OperatorPage.php +msgid "Never" +msgstr "कभी नहीं" + +#: lib/HealthPage.php +#, php-format +msgid "retry in %d s" +msgstr "%d सेकंड में फिर प्रयास करें" + +#: lib/HealthPage.php +#, php-format +msgid "%d seconds ago" +msgstr "%d सेकंड पहले" + +#: lib/HealthPage.php +#, php-format +msgid "%d minutes ago" +msgstr "%d मिनट पहले" + +#: lib/HealthPage.php +#, php-format +msgid "%d hours ago" +msgstr "%d घंटे पहले" + +#: lib/HealthPage.php +#, php-format +msgid "%d days ago" +msgstr "%d दिन पहले" + +#: lib/HealthWarnings.php +#, php-format +msgid "The vault key file cannot be used: %s. Accounts that store credentials in the vault cannot be verified or collected here." +msgstr "वॉल्ट कुंजी फ़ाइल उपयोग नहीं की जा सकती: %s। वॉल्ट में क्रेडेंशियल रखने वाले खातों को यहाँ सत्यापित या उनसे डेटा एकत्र नहीं किया जा सकता।" + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the credential file cannot be used: %s." +msgstr "%s: क्रेडेंशियल फ़ाइल उपयोग नहीं की जा सकती: %s।" + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is shorter than the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s: %d सेकंड का संग्रह अंतराल, %d सेकंड के पोलर अंतराल से छोटा है, इसलिए हर %d सेकंड में संग्रह होता है।" + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is not a multiple of the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s: %d सेकंड का संग्रह अंतराल, %d सेकंड के पोलर अंतराल का गुणज नहीं है, इसलिए हर %d सेकंड में संग्रह होता है।" + +#: lib/OperatorPage.php +msgid "Review the recorded observations below. Acknowledgments are personal to this session, expire when observations change, and never suppress alerts or change health." +msgstr "नीचे दर्ज अवलोकन देखें। पावती केवल इस सत्र में आपके लिए है, अवलोकन बदलने पर समाप्त हो जाती है और कभी अलर्ट नहीं दबाती या स्वास्थ्य नहीं बदलती।" + +#: lib/OperatorPage.php lib/Pages.php +msgid "Cloud Operations" +msgstr "क्लाउड संचालन" + +#: lib/OperatorPage.php +msgid "Investigation" +msgstr "जाँच" + +#: lib/OperatorPage.php +msgid "Object" +msgstr "ऑब्जेक्ट" + +#: lib/OperatorPage.php +msgid "Observed (UTC)" +msgstr "अवलोकन समय (UTC)" + +#: lib/OperatorPage.php +msgid "Unknown or stale" +msgstr "अज्ञात या पुराना" + +#: lib/OperatorPage.php +msgid "Acknowledged; health unchanged." +msgstr "पावती दर्ज; स्वास्थ्य अपरिवर्तित।" + +#: lib/OperatorPage.php +msgid "Acknowledge" +msgstr "पावती दें" + +#: lib/OperatorPage.php +msgid "No observations are available for devices you may access." +msgstr "जिन डिवाइसों तक आपकी पहुँच है, उनके लिए कोई अवलोकन उपलब्ध नहीं है।" + +#: lib/Pages.php +msgid "Cloud Operator" +msgstr "क्लाउड ऑपरेटर" + +#: lib/Pages.php +msgid "Cloud View" +msgstr "क्लाउड दृश्य" + +#: lib/Pages.php +msgid "Cloud Admin" +msgstr "क्लाउड प्रशासक" + +#: lib/Pages.php +msgid "Cloud Health" +msgstr "क्लाउड स्वास्थ्य" + +#: lib/Provider.php +msgid "DigitalOcean" +msgstr "DigitalOcean" + +#: lib/Provider.php +msgid "Amazon Web Services" +msgstr "Amazon Web Services" + +#: lib/Provider.php +msgid "Google Cloud" +msgstr "Google Cloud" + +#: lib/Provider.php +msgid "Microsoft Azure" +msgstr "Microsoft Azure" + +#: lib/Settings.php +msgid "Credential Vault" +msgstr "क्रेडेंशियल वॉल्ट" + +#: lib/Settings.php +msgid "Vault Key File" +msgstr "वॉल्ट कुंजी फ़ाइल" + +#: lib/Settings.php +msgid "Absolute path to the 32-byte key that encrypts stored credentials. Create it yourself, outside the web root, readable only by the web server and poller user, in a directory that only root and that user can write (the same applies to credential files); the plugin never creates or writes it. Back it up with the database: without it, stored credentials must be entered again." +msgstr "संग्रहीत क्रेडेंशियल एन्क्रिप्ट करने वाली 32-बाइट कुंजी का पूर्ण पथ। इसे स्वयं वेब रूट के बाहर बनाएँ, केवल वेब सर्वर और पोलर उपयोगकर्ता के पढ़ने योग्य रखें, और ऐसे डायरेक्टरी में रखें जिसमें केवल root और वह उपयोगकर्ता लिख सकें (क्रेडेंशियल फ़ाइलों पर भी यही नियम लागू होता है); प्लगइन इसे कभी बनाता या लिखता नहीं है। डेटाबेस के साथ इसका बैकअप लें: इसके बिना संग्रहीत क्रेडेंशियल फिर दर्ज करने होंगे।" + +#: lib/Settings.php +msgid "Credential File Directory" +msgstr "क्रेडेंशियल फ़ाइल डायरेक्टरी" + +#: lib/Settings.php +msgid "Absolute path to the directory that holds credential files. An account can read its credential from a file only inside it, never the vault key file. Empty, the default, refuses credential files. Cloud Admin chooses the file, so keep only cloud credentials here." +msgstr "क्रेडेंशियल फ़ाइलों वाली डायरेक्टरी का पूर्ण पथ। खाता केवल इसके भीतर की फ़ाइल से अपना क्रेडेंशियल पढ़ सकता है, वॉल्ट कुंजी फ़ाइल से कभी नहीं। डिफ़ॉल्ट खाली मान क्रेडेंशियल फ़ाइलों को अस्वीकार करता है। क्लाउड प्रशासक फ़ाइल चुनता है, इसलिए यहाँ केवल क्लाउड क्रेडेंशियल रखें।" + +#: lib/Settings.php +msgid "Collector" +msgstr "संग्राहक" + +#: lib/Settings.php +msgid "Collector Time Budget" +msgstr "संग्राहक समय बजट" + +#: lib/Settings.php +msgid "Seconds one collector run may spend before it stops starting new work. Keep it below the poller interval; unfinished accounts resume on the next run." +msgstr "नया काम शुरू करना बंद करने से पहले एक संग्राहक निष्पादन कितने सेकंड खर्च कर सकता है। इसे पोलर अंतराल से कम रखें; अधूरे खातों पर अगली बार काम फिर शुरू होगा।" + +#: lib/Settings.php +msgid "Uninstall" +msgstr "अनइंस्टॉल" + +#: lib/Settings.php +msgid "Keep Plugin Tables on Uninstall" +msgstr "अनइंस्टॉल करते समय प्लगइन तालिकाएँ रखें" + +#: lib/Settings.php +msgid "When checked, uninstalling the plugin keeps its accounts, encrypted credentials, and cache. Clear it to have the uninstall drop them. Cloud resources are never touched either way." +msgstr "चयनित होने पर, प्लगइन अनइंस्टॉल करने से उसके खाते, एन्क्रिप्ट किए गए क्रेडेंशियल और कैश बने रहते हैं। अनइंस्टॉल के दौरान इन्हें हटाने के लिए इसे अचयनित करें। दोनों ही स्थितियों में क्लाउड संसाधन नहीं छुए जाते।" + +#: lib/VerifyStatus.php +msgid "Not verified yet." +msgstr "अभी सत्यापित नहीं।" + +#: lib/VerifyStatus.php +msgid "The credential works and has the permissions this account needs." +msgstr "क्रेडेंशियल काम करता है और इस खाते के आवश्यक अनुमतियाँ रखता है।" + +#: lib/VerifyStatus.php +msgid "The provider rejected the credential. It may be wrong, expired, or revoked." +msgstr "प्रदाता ने क्रेडेंशियल अस्वीकार कर दिया। यह गलत, समाप्त या निरस्त हो सकता है।" + +#: lib/VerifyStatus.php +msgid "The credential works but lacks a permission this account needs." +msgstr "क्रेडेंशियल काम करता है, लेकिन इस खाते के लिए आवश्यक कोई अनुमति नहीं है।" + +#: lib/VerifyStatus.php +msgid "The provider could not be reached. Check the network path and outbound policy from the poller." +msgstr "प्रदाता तक पहुँचा नहीं जा सका। पोलर से नेटवर्क पथ और आउटबाउंड नीति जाँचें।" + +#: lib/VerifyStatus.php +msgid "The provider is throttling requests. Try again later." +msgstr "प्रदाता अनुरोधों की दर सीमित कर रहा है। बाद में फिर प्रयास करें।" + +#: lib/VerifyStatus.php +msgid "The provider sent a response the plugin could not read." +msgstr "प्रदाता ने ऐसा उत्तर भेजा जिसे प्लगइन पढ़ नहीं सका।" + +#: lib/VerifyStatus.php +msgid "The account or its credential is not configured correctly." +msgstr "खाता या उसका क्रेडेंशियल सही तरह कॉन्फ़िगर नहीं है।" + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later. This server runs PHP %s, so the plugin was not installed or enabled." +msgstr "Cloud प्लगइन को PHP %s या नया चाहिए। इस सर्वर पर PHP %s चल रहा है, इसलिए प्लगइन इंस्टॉल या सक्षम नहीं किया गया।" + +#: setup.php +#, php-format +msgid "The Cloud plugin requires the PHP extensions %s, which this server does not load, so the plugin was not installed or enabled." +msgstr "Cloud प्लगइन को PHP एक्सटेंशन %s चाहिए, जिन्हें यह सर्वर लोड नहीं करता, इसलिए प्लगइन इंस्टॉल या सक्षम नहीं किया गया।" + +#: setup.php +msgid "Cloud" +msgstr "क्लाउड" + +#: setup.php +msgid "The Cloud plugin is not enabled." +msgstr "Cloud प्लगइन सक्षम नहीं है।" + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later." +msgstr "Cloud प्लगइन को PHP %s या नया चाहिए।" + +#: setup.php +msgid "Management" +msgstr "प्रबंधन" diff --git a/locales/po/zh-CN.po b/locales/po/zh-CN.po new file mode 100644 index 0000000..0486adf --- /dev/null +++ b/locales/po/zh-CN.po @@ -0,0 +1,592 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: 2026 Thomas Vincent +# +msgid "" +msgstr "" +"Project-Id-Version: cloud 0.1.0-dev\n" +"Report-Msgid-Bugs-To: https://github.com/somethingwithproof/plugin_cloud/issues\n" +"PO-Revision-Date: 2026-11-17 00:00+0000\n" +"Last-Translator: Thomas Vincent \n" +"Language-Team: Thomas Vincent \n" +"Language: zh-CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: cloud_accounts.php +msgid "Name: another account already uses this name." +msgstr "名称:其他账户已使用此名称。" + +#: cloud_accounts.php +#, php-format +msgid "The account was saved, but the credential was not stored: %s" +msgstr "账户已保存,但凭据未存储:%s" + +#: cloud_accounts.php +msgid "The account was saved." +msgstr "账户已保存。" + +#: cloud_accounts.php +msgid "The account could not be saved." +msgstr "无法保存账户。" + +#: cloud_accounts.php +msgid "The account and its collected data were deleted. Its Cacti devices and graphs were left in place." +msgstr "账户及其采集的数据已删除。其 Cacti 设备和图表已保留。" + +#: cloud_accounts.php +#, php-format +msgid "The Cacti device for %s is ready." +msgstr "%s 的 Cacti 设备已就绪。" + +#: cloud_accounts.php +msgid "The Cacti device was not created; see the Cacti log." +msgstr "未创建 Cacti 设备;请查看 Cacti 日志。" + +#: cloud_operator.php +msgid "Verify stored credential" +msgstr "验证已存储的凭据" + +#: cloud_operator.php +msgid "Monitoring view" +msgstr "监控视图" + +#: cloud_operator.php +msgid "Observations could not be read. Ask an administrator to check the plugin log." +msgstr "无法读取观测结果。请联系管理员检查插件日志。" + +#: include/operator.php +msgid "Check the account graphs and collection freshness. Verify tests the stored credential; it cannot replace it or change the provider configuration." +msgstr "检查账户图表及采集数据的新鲜度。验证操作仅测试已存储的凭据,不能替换凭据或更改提供商配置。" + +#: lib/AccountInput.php +msgid "Provider: choose one of the listed providers." +msgstr "提供商:请选择列表中的提供商。" + +#: lib/AccountInput.php +msgid "Name: enter 1 to 100 characters without control characters." +msgstr "名称:请输入 1 至 100 个字符,不得包含控制字符。" + +#: lib/AccountInput.php +msgid "Poller: only the main poller can collect cloud accounts in this release." +msgstr "轮询器:此版本仅允许主轮询器采集云账户。" + +#: lib/AccountInput.php +#, php-format +msgid "%s: the value does not have the form this provider uses." +msgstr "%s:此值不符合该提供商使用的格式。" + +#: lib/AccountInput.php +msgid "Credential Source: choose one this provider supports." +msgstr "凭据来源:请选择该提供商支持的来源。" + +#: lib/AccountInput.php +msgid "Credential File: enter an absolute path without control characters, at most 512 characters." +msgstr "凭据文件:请输入不含控制字符的绝对路径,最多 512 个字符。" + +#: lib/AccountInput.php +#, php-format +msgid "%s: enter whole seconds from %d to %d." +msgstr "%s:请输入 %d 至 %d 之间的整数秒数。" + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Collection Interval" +msgstr "采集间隔" + +#: lib/AccountInput.php lib/AccountsPage.php +msgid "Discovery Interval" +msgstr "发现间隔" + +#: lib/AccountInput.php +msgid "Request Share: enter a whole percentage from 1 to 100." +msgstr "请求配额比例:请输入 1 至 100 之间的整数百分比。" + +#: lib/AccountInput.php +msgid "Monthly Ceiling: enter an amount of zero or more, or leave it blank for none." +msgstr "每月上限:请输入大于或等于零的金额,留空表示无上限。" + +#: lib/AccountInput.php +msgid "AWS Account ID" +msgstr "AWS 账户 ID" + +#: lib/AccountInput.php +msgid "Regions" +msgstr "区域" + +#: lib/AccountInput.php +msgid "Project ID" +msgstr "项目 ID" + +#: lib/AccountInput.php +msgid "Tenant ID" +msgstr "租户 ID" + +#: lib/AccountInput.php +msgid "Subscription ID" +msgstr "订阅 ID" + +#: lib/AccountsPage.php lib/Pages.php +msgid "Cloud Accounts" +msgstr "云账户" + +#: lib/AccountsPage.php +msgid "Name" +msgstr "名称" + +#: lib/AccountsPage.php +msgid "Provider" +msgstr "提供商" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Credential" +msgstr "凭据" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "State" +msgstr "状态" + +#: lib/AccountsPage.php +msgid "Verify" +msgstr "验证" + +#: lib/AccountsPage.php +msgid "Device" +msgstr "设备" + +#: lib/AccountsPage.php lib/OperatorPage.php +msgid "Actions" +msgstr "操作" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "No cloud accounts yet." +msgstr "尚无云账户。" + +#: lib/AccountsPage.php lib/HealthPage.php +msgid "Disabled" +msgstr "已禁用" + +#: lib/AccountsPage.php +msgid "Enabled" +msgstr "已启用" + +#: lib/AccountsPage.php +msgid "Delete" +msgstr "删除" + +#: lib/AccountsPage.php +#, php-format +msgid "Cloud Account: %s" +msgstr "云账户:%s" + +#: lib/AccountsPage.php +msgid "New Cloud Account" +msgstr "新建云账户" + +#: lib/AccountsPage.php +msgid "Credential Source" +msgstr "凭据来源" + +#: lib/AccountsPage.php +msgid "Credential File" +msgstr "凭据文件" + +#: lib/AccountsPage.php +msgid "A credential is stored. Leave blank to keep it." +msgstr "已存储凭据。留空可保留现有凭据。" + +#: lib/AccountsPage.php +msgid "Paste the token or key to store in the vault." +msgstr "粘贴要存入凭据库的令牌或密钥。" + +#: lib/AccountsPage.php +msgid "Request Share" +msgstr "请求配额比例" + +#: lib/AccountsPage.php +msgid "Monthly Ceiling" +msgstr "每月上限" + +#: lib/AccountsPage.php +msgid "Save" +msgstr "保存" + +#: lib/AccountsPage.php +msgid "Stored in the vault" +msgstr "已存入凭据库" + +#: lib/AccountsPage.php +msgid "None stored" +msgstr "未存储" + +#: lib/AccountsPage.php +msgid "File on the poller" +msgstr "轮询器上的文件" + +#: lib/AccountsPage.php +msgid "Instance identity" +msgstr "实例身份" + +#: lib/AccountsPage.php +#, php-format +msgid "Device %d" +msgstr "设备 %d" + +#: lib/AccountsPage.php +msgid "Create Cacti Device" +msgstr "创建 Cacti 设备" + +#: lib/CredentialSource.php +msgid "Stored in the plugin vault" +msgstr "已存入插件凭据库" + +#: lib/CredentialSource.php +msgid "Credential file on the poller" +msgstr "轮询器上的凭据文件" + +#: lib/CredentialSource.php +msgid "Instance identity of the poller" +msgstr "轮询器的实例身份" + +#: lib/EstimateView.php setup.php +msgid "Cloud Request Estimate" +msgstr "云请求估算" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Account" +msgstr "账户" + +#: lib/EstimateView.php +msgid "Selection" +msgstr "选择范围" + +#: lib/EstimateView.php lib/HealthPage.php +msgid "Resources" +msgstr "资源" + +#: lib/EstimateView.php +msgid "Requests per Hour, One Resource" +msgstr "单个资源每小时请求数" + +#: lib/EstimateView.php +msgid "Requests per Month, One Resource" +msgstr "单个资源每月请求数" + +#: lib/EstimateView.php +msgid "Requests per Hour" +msgstr "每小时请求数" + +#: lib/EstimateView.php +msgid "Requests per Month" +msgstr "每月请求数" + +#: lib/EstimateView.php +msgid "Cost per Month" +msgstr "每月费用" + +#: lib/EstimateView.php +msgid "No accounts to estimate." +msgstr "没有可估算的账户。" + +#: lib/EstimateView.php +msgid "Estimates use list prices and exclude discounts and shared free tiers." +msgstr "估算采用标价,不包含折扣和共享免费额度。" + +#: lib/EstimateView.php +#, php-format +msgid "%s prices from" +msgstr "%s 价格来源" + +#: lib/EstimateView.php +#, php-format +msgid "checked %s." +msgstr "已于 %s 核查。" + +#: lib/EstimateView.php +msgid "Collected now" +msgstr "当前采集" + +#: lib/EstimateView.php +msgid "Every graph on every resource" +msgstr "所有资源上的所有图表" + +#: lib/EstimateView.php +#, php-format +msgid "Request share: %s requests per hour, %s percent of the token limit. Collected now: %s. Every graph: %s." +msgstr "请求配额:每小时 %s 次请求,占令牌限额的 %s 个百分点。当前采集:%s。所有图表:%s。" + +#: lib/EstimateView.php +msgid "Collection is capped; the remaining series read U." +msgstr "采集已达上限;其余序列返回 U。" + +#: lib/EstimateView.php +msgid "Metric estimate between discovery runs; discovery requests reduce the collection allowance." +msgstr "此为两次发现之间的指标估算;发现请求会减少采集额度。" + +#: lib/EstimateView.php +msgid "No charge documented" +msgstr "文档未注明收费" + +#: lib/EstimateView.php +msgid "Droplet" +msgstr "Droplet" + +#: lib/EstimateView.php +msgid "Load Balancer" +msgstr "负载均衡器" + +#: lib/HealthPage.php +msgid "Cloud Warnings" +msgstr "云告警提示" + +#: lib/HealthPage.php +msgid "No warnings." +msgstr "无告警提示。" + +#: lib/HealthPage.php +msgid "Cloud Collection" +msgstr "云采集" + +#: lib/HealthPage.php +msgid "Collection" +msgstr "采集" + +#: lib/HealthPage.php +msgid "Last Run" +msgstr "上次运行" + +#: lib/HealthPage.php +msgid "Series Read" +msgstr "读取的序列数" + +#: lib/HealthPage.php +msgid "Requests" +msgstr "请求" + +#: lib/HealthPage.php +msgid "Discovery" +msgstr "发现" + +#: lib/HealthPage.php +msgid "Data" +msgstr "数据" + +#: lib/HealthPage.php lib/OperatorPage.php +msgid "Never" +msgstr "从未" + +#: lib/HealthPage.php +#, php-format +msgid "retry in %d s" +msgstr "%d 秒后重试" + +#: lib/HealthPage.php +#, php-format +msgid "%d seconds ago" +msgstr "%d 秒前" + +#: lib/HealthPage.php +#, php-format +msgid "%d minutes ago" +msgstr "%d 分钟前" + +#: lib/HealthPage.php +#, php-format +msgid "%d hours ago" +msgstr "%d 小时前" + +#: lib/HealthPage.php +#, php-format +msgid "%d days ago" +msgstr "%d 天前" + +#: lib/HealthWarnings.php +#, php-format +msgid "The vault key file cannot be used: %s. Accounts that store credentials in the vault cannot be verified or collected here." +msgstr "无法使用凭据库密钥文件:%s。凭据存储在凭据库中的账户无法在此验证或采集。" + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the credential file cannot be used: %s." +msgstr "%s:无法使用凭据文件:%s。" + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is shorter than the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s:采集间隔 %d 秒短于轮询器间隔 %d 秒,因此每 %d 秒采集一次。" + +#: lib/HealthWarnings.php +#, php-format +msgid "%s: the collection interval of %d seconds is not a multiple of the poller interval of %d seconds, so it is collected every %d seconds." +msgstr "%s:采集间隔 %d 秒不是轮询器间隔 %d 秒的整数倍,因此每 %d 秒采集一次。" + +#: lib/OperatorPage.php +msgid "Review the recorded observations below. Acknowledgments are personal to this session, expire when observations change, and never suppress alerts or change health." +msgstr "查看下方记录的观测结果。确认记录仅对当前会话中的您有效,在观测结果变化时失效,且不会抑制告警或更改健康状态。" + +#: lib/OperatorPage.php lib/Pages.php +msgid "Cloud Operations" +msgstr "云运维" + +#: lib/OperatorPage.php +msgid "Investigation" +msgstr "调查" + +#: lib/OperatorPage.php +msgid "Object" +msgstr "对象" + +#: lib/OperatorPage.php +msgid "Observed (UTC)" +msgstr "观测时间(UTC)" + +#: lib/OperatorPage.php +msgid "Unknown or stale" +msgstr "未知或已过期" + +#: lib/OperatorPage.php +msgid "Acknowledged; health unchanged." +msgstr "已确认;健康状态未改变。" + +#: lib/OperatorPage.php +msgid "Acknowledge" +msgstr "确认" + +#: lib/OperatorPage.php +msgid "No observations are available for devices you may access." +msgstr "您有权访问的设备暂无观测结果。" + +#: lib/Pages.php +msgid "Cloud Operator" +msgstr "云操作员" + +#: lib/Pages.php +msgid "Cloud View" +msgstr "云查看权限" + +#: lib/Pages.php +msgid "Cloud Admin" +msgstr "云管理员" + +#: lib/Pages.php +msgid "Cloud Health" +msgstr "云健康状态" + +#: lib/Provider.php +msgid "DigitalOcean" +msgstr "DigitalOcean" + +#: lib/Provider.php +msgid "Amazon Web Services" +msgstr "Amazon Web Services" + +#: lib/Provider.php +msgid "Google Cloud" +msgstr "Google Cloud" + +#: lib/Provider.php +msgid "Microsoft Azure" +msgstr "Microsoft Azure" + +#: lib/Settings.php +msgid "Credential Vault" +msgstr "凭据库" + +#: lib/Settings.php +msgid "Vault Key File" +msgstr "凭据库密钥文件" + +#: lib/Settings.php +msgid "Absolute path to the 32-byte key that encrypts stored credentials. Create it yourself, outside the web root, readable only by the web server and poller user, in a directory that only root and that user can write (the same applies to credential files); the plugin never creates or writes it. Back it up with the database: without it, stored credentials must be entered again." +msgstr "用于加密已存储凭据的 32 字节密钥的绝对路径。请自行在 Web 根目录之外创建,仅允许 Web 服务器和轮询器用户读取,并放在只有 root 和该用户可写的目录中(凭据文件也须遵守此要求);插件绝不会创建或写入该文件。请随数据库一起备份:没有此文件,必须重新输入已存储的凭据。" + +#: lib/Settings.php +msgid "Credential File Directory" +msgstr "凭据文件目录" + +#: lib/Settings.php +msgid "Absolute path to the directory that holds credential files. An account can read its credential from a file only inside it, never the vault key file. Empty, the default, refuses credential files. Cloud Admin chooses the file, so keep only cloud credentials here." +msgstr "存放凭据文件的目录的绝对路径。账户只能从此目录内的文件读取凭据,且不能读取凭据库密钥文件。默认值为空,表示拒绝使用凭据文件。文件由云管理员选择,因此请仅在此目录存放云凭据。" + +#: lib/Settings.php +msgid "Collector" +msgstr "采集器" + +#: lib/Settings.php +msgid "Collector Time Budget" +msgstr "采集器时间预算" + +#: lib/Settings.php +msgid "Seconds one collector run may spend before it stops starting new work. Keep it below the poller interval; unfinished accounts resume on the next run." +msgstr "单次采集器运行在停止启动新任务之前可用的秒数。请设为小于轮询器间隔;未完成的账户将在下次运行时继续处理。" + +#: lib/Settings.php +msgid "Uninstall" +msgstr "卸载" + +#: lib/Settings.php +msgid "Keep Plugin Tables on Uninstall" +msgstr "卸载时保留插件表" + +#: lib/Settings.php +msgid "When checked, uninstalling the plugin keeps its accounts, encrypted credentials, and cache. Clear it to have the uninstall drop them. Cloud resources are never touched either way." +msgstr "勾选后,卸载插件时会保留账户、加密凭据和缓存。取消勾选则在卸载时删除这些数据。无论如何都不会更改云资源。" + +#: lib/VerifyStatus.php +msgid "Not verified yet." +msgstr "尚未验证。" + +#: lib/VerifyStatus.php +msgid "The credential works and has the permissions this account needs." +msgstr "凭据有效,且具有此账户所需的权限。" + +#: lib/VerifyStatus.php +msgid "The provider rejected the credential. It may be wrong, expired, or revoked." +msgstr "提供商拒绝了凭据。凭据可能有误、已过期或已被撤销。" + +#: lib/VerifyStatus.php +msgid "The credential works but lacks a permission this account needs." +msgstr "凭据有效,但缺少此账户所需的某项权限。" + +#: lib/VerifyStatus.php +msgid "The provider could not be reached. Check the network path and outbound policy from the poller." +msgstr "无法连接到提供商。请检查轮询器的网络路径和出站策略。" + +#: lib/VerifyStatus.php +msgid "The provider is throttling requests. Try again later." +msgstr "提供商正在限制请求速率。请稍后重试。" + +#: lib/VerifyStatus.php +msgid "The provider sent a response the plugin could not read." +msgstr "提供商返回了插件无法读取的响应。" + +#: lib/VerifyStatus.php +msgid "The account or its credential is not configured correctly." +msgstr "账户或其凭据配置不正确。" + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later. This server runs PHP %s, so the plugin was not installed or enabled." +msgstr "Cloud 插件要求 PHP %s 或更高版本。此服务器运行 PHP %s,因此未安装或启用插件。" + +#: setup.php +#, php-format +msgid "The Cloud plugin requires the PHP extensions %s, which this server does not load, so the plugin was not installed or enabled." +msgstr "Cloud 插件要求 PHP 扩展 %s,但此服务器未加载这些扩展,因此未安装或启用插件。" + +#: setup.php +msgid "Cloud" +msgstr "云" + +#: setup.php +msgid "The Cloud plugin is not enabled." +msgstr "Cloud 插件未启用。" + +#: setup.php +#, php-format +msgid "The Cloud plugin requires PHP %s or later." +msgstr "Cloud 插件要求 PHP %s 或更高版本。" + +#: setup.php +msgid "Management" +msgstr "管理" diff --git a/phpstan.neon b/phpstan.neon index 342a476..83cb76a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -23,6 +23,7 @@ parameters: paths: - lib - setup.php + - include/operator.php - include/unbooted-uninstall.php scanDirectories: - %env.CACTI_PATH%/lib diff --git a/setup.php b/setup.php index 3cb1637..e4cc700 100644 --- a/setup.php +++ b/setup.php @@ -138,13 +138,18 @@ function plugin_cloud_check_config(): bool { } /** - * Common start of every page script, after include/auth.php has authorized - * the realm. Refuses on an unsupported runtime or a disabled plugin, because - * Cacti keeps plugin realms registered while a plugin is disabled. + * Common start after include/auth.php establishes the user. Recheck the + * realm here because cookie and Basic login restore the user after the + * alternate-realms hook. Disabled plugins and unsupported runtimes refuse. */ function cloud_page_start(): bool { if (cloud_boot() && api_plugin_is_enabled('cloud')) { - return true; + if (cloud_page_allowed()) { + return true; + } + http_response_code(403); + + return false; } top_header(); @@ -256,12 +261,14 @@ function cloud_setup_hooks(bool $grant = false): void { include_once($config['library_path'] . '/poller.php'); } + $enabled = (new \Somethingwithproof\Cloud\Schema(false))->pluginEnabled(); + foreach (\Somethingwithproof\Cloud\Schema::HOOKS as $hook => $function) { - api_plugin_register_hook('cloud', $hook, $function, 'setup.php'); + api_plugin_register_hook('cloud', $hook, $function, 'setup.php', $enabled); } foreach (\Somethingwithproof\Cloud\Pages::realms() as $realm) { - api_plugin_register_realm('cloud', implode(',', $realm['files']), $realm['name'], $grant); + api_plugin_register_realm('cloud', implode(',', $realm['files']), $realm['name'], $grant && $realm['files'] !== \Somethingwithproof\Cloud\Pages::OPERATOR); } } @@ -376,6 +383,10 @@ function cloud_config_arrays(): void { function cloud_config_settings(): void { global $tabs, $settings; + if (PHP_SAPI !== 'cli' && !api_plugin_user_realm_auth('cloud_accounts.php')) { + return; + } + if (!cloud_boot()) { return; } @@ -389,10 +400,17 @@ function cloud_config_settings(): void { * @return array */ function cloud_draw_navigation_text($nav) { + global $current_user; + if (!cloud_boot()) { return $nav; } + // Refresh settings after core restores cookie or Basic authentication. + if (get_current_page() === 'settings.php' && (PHP_SAPI === 'cli' || ($current_user['enabled'] ?? '') === 'on')) { + cloud_config_settings(); + } + return array_merge($nav, \Somethingwithproof\Cloud\Pages::navigation()); } @@ -630,3 +648,63 @@ function cloud_collector(int $pollerId): \Somethingwithproof\Cloud\Collector { cloud_scope_devices(1) ); } + +/** Resolve role inheritance against Cacti's current user and group grants. */ +function cloud_auth_alternate_realms(): void { + global $user_auth_realm_filenames; + + static $deferred = array(); + + foreach ($deferred as $file => $realm) { + $user_auth_realm_filenames[$file] = $realm; + } + $deferred = array(); + + if (!api_plugin_is_enabled('cloud')) { + return; + } + + if (empty($_SESSION['sess_user_id'])) { + // Core restores cookie and Basic authentication after this hook. Only + // these entrypoints defer the realm check to their post-auth guard. + $page = get_current_page(); + + if (in_array($page, array('cloud_health.php', 'cloud_operator.php'), true) && isset($user_auth_realm_filenames[$page])) { + $deferred[$page] = $user_auth_realm_filenames[$page]; + $user_auth_realm_filenames[$page] = -1; + } + + return; + } + $operator = 'cloud_operator.php'; + $admin = 'cloud_accounts.php'; + $files = array('cloud_health.php'); + $realm = $user_auth_realm_filenames[$admin] ?? 0; + if ($realm > 0 && is_realm_allowed($realm)) { + $files[] = $operator; + } else { + $realm = $user_auth_realm_filenames[$operator] ?? 0; + if ($realm <= 0 || !is_realm_allowed($realm)) { + return; + } + } + foreach ($files as $file) { + $user_auth_realm_filenames[$file] = $realm; + } +} + +/** Recheck the authenticated user before a plugin page reads data or acts. */ +function cloud_page_allowed(): bool { + global $current_user; + + cloud_auth_alternate_realms(); + $userId = $current_user['id'] ?? null; + $sessionId = $_SESSION['sess_user_id'] ?? null; + + return (is_int($userId) || (is_string($userId) && ctype_digit($userId))) + && (is_int($sessionId) || (is_string($sessionId) && ctype_digit($sessionId))) + && (int) $userId > 0 && (int) $userId === (int) $sessionId + && api_plugin_is_enabled('cloud') + && ($current_user['enabled'] ?? '') === 'on' + && api_plugin_user_realm_auth(get_current_page()); +} diff --git a/tests/Integration/LifecycleTest.php b/tests/Integration/LifecycleTest.php index 8d75e07..13020f8 100644 --- a/tests/Integration/LifecycleTest.php +++ b/tests/Integration/LifecycleTest.php @@ -35,16 +35,7 @@ 'plugin_cloud_series', ]; -const CLOUD_HOOKS = [ - 'api_device_new', - 'api_device_save', - 'config_arrays', - 'config_settings', - 'device_remove', - 'draw_navigation_text', - 'graphs_new_top_links', - 'poller_bottom', -]; +const CLOUD_HOOKS = ['api_device_new', 'api_device_save', 'auth_alternate_realms', 'config_arrays', 'config_settings', 'device_remove', 'draw_navigation_text', 'graphs_new_top_links', 'poller_bottom']; beforeEach(function () { lifecycle('reset'); @@ -54,7 +45,7 @@ lifecycle('reset'); }); -it('installs fresh with tracked tables, hooks, and both realms, leaving the plugin disabled', function () { +it('installs fresh with tracked tables, hooks, and three realms, leaving the plugin disabled', function () { $state = lifecycle('install'); expect($state['plugin']['status'])->toEqual('4') @@ -65,7 +56,8 @@ ->and(array_keys($state['hooks']))->toBe(CLOUD_HOOKS) ->and($state['realms'])->toEqual([ 'cloud_accounts.php' => 'Cloud Admin', - 'cloud_health.php' => 'Cloud View', + 'cloud_health.php' => 'Cloud View', + 'cloud_operator.php' => 'Cloud Operator', ]) ->and($state['admin'])->toBe(2); }); @@ -113,7 +105,7 @@ expect($state['result'])->toBeTrue() ->and(array_keys($state['hooks']))->toBe(CLOUD_HOOKS) - ->and($state['realms'])->toHaveCount(2); + ->and($state['realms'])->toHaveCount(3); }); it('finishes an upgrade that was interrupted after creating only some tables', function () { @@ -295,7 +287,7 @@ expect(lifecycle('install')['admin'])->toBe(2); $repair = lifecycle('repair_as_viewer'); - expect($repair['realms'])->toHaveCount(2) + expect($repair['realms'])->toHaveCount(3) ->and($repair['result'])->toBe(['viewer_realms' => 0]); }); @@ -328,3 +320,23 @@ ['metric' => 'cpu', 'value' => '7', 'observed_at' => '1799999940', 'status' => 'ok'] ]); }); + +it('preserves old grants and resolves the three roles through Cacti including groups', function () { + lifecycle('install'); + lifecycle('enable'); + $roles = lifecycle('operator_roles')['result']; + expect($roles['ids_preserved'])->toBeTrue() + ->and($roles['viewer_grants'])->toBe([$roles['expected_view']]) + ->and($roles['hook_enabled'])->toBe(1) + ->and($roles['viewer'])->toBe([true, false, false]) + ->and($roles['operator'])->toBe([true, true, false]) + ->and($roles['admin'])->toBe([true, true, true]) + ->and($roles['revoked'])->toBe([false, false, false]) + ->and($roles['group_operator'])->toBe([true, true, false]) + ->and($roles['disabled_group'])->toBe([false, false, false]) + ->and($roles['first_request']['viewer'])->toBe([[true, true, true], [true, false, true], [false, false, true]]) + ->and($roles['first_request']['operator'])->toBe([[true, true, true], [true, true, true], [false, false, true]]) + ->and($roles['first_request']['admin'])->toBe([[true, true, true], [true, true, true], [false, true, true]]) + ->and($roles['first_request']['revoked'])->toBe([false, false, false]) + ->and($roles['disabled_user'])->toBe([false, false, false]); +}); diff --git a/tests/Unit/OperatorTest.php b/tests/Unit/OperatorTest.php new file mode 100644 index 0000000..0c31632 --- /dev/null +++ b/tests/Unit/OperatorTest.php @@ -0,0 +1,78 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_cloud, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_cloud + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +use Somethingwithproof\Cloud\OperatorPage; + +function cloud_triage_fixture(): array { + return ['id' => '7', 'name' => '', 'state' => 'failed', 'observed' => 900, 'interval' => 60, 'detail' => 'timeout']; +} + +it('requires an operator, a known action, POST and a valid CSRF token', function () { + $actions = ['acknowledge', 'retry']; + expect(OperatorPage::actionStatus(false, 'retry', 'POST', true, $actions))->toBe(403) + ->and(OperatorPage::actionStatus(true, 'delete', 'POST', true, $actions))->toBe(400) + ->and(OperatorPage::actionStatus(true, 'retry', 'GET', true, $actions))->toBe(405) + ->and(OperatorPage::actionStatus(true, 'retry', 'POST', false, $actions))->toBe(403) + ->and(OperatorPage::actionStatus(true, 'retry', 'POST', true, $actions))->toBe(200); +}); + +it('acknowledges only unchanged, current evidence for the acting user', function () { + $row = cloud_triage_fixture(); + $session = []; + $fingerprint = OperatorPage::fingerprint($row); + expect(OperatorPage::acknowledge($session, $row, $fingerprint, 2, 1000))->toBeTrue() + ->and(OperatorPage::acknowledged($session, $row, 2, 1000))->toBeTrue() + ->and(OperatorPage::acknowledged($session, $row, 3, 1000))->toBeFalse() + ->and(OperatorPage::acknowledged($session, $row, 2, 1021))->toBeFalse() + ->and(OperatorPage::acknowledged($session, array_replace($row, ['state' => 'ok']), 2, 1000))->toBeFalse() + ->and(OperatorPage::acknowledged($session, array_replace($row, ['observed' => 950]), 2, 1000))->toBeFalse() + ->and(OperatorPage::acknowledge($session, $row, 'forged', 2, 1000))->toBeFalse() + ->and(OperatorPage::acknowledge($session, $row, $fingerprint, 0, 1000))->toBeFalse() + ->and(OperatorPage::acknowledge($session, $row, $fingerprint, 2, 800))->toBeFalse(); +}); + +it('bounds personal acknowledgments and drops the previous users entries', function () { + $session = []; + + for ($i = 1; $i <= 120; $i++) { + $row = array_replace(cloud_triage_fixture(), ['id' => (string) $i]); + OperatorPage::acknowledge($session, $row, OperatorPage::fingerprint($row), 2, 1000); + } + expect($session['entries'])->toHaveCount(100) + ->and($session['entries'])->not->toHaveKey('1'); + $row = cloud_triage_fixture(); + OperatorPage::acknowledge($session, $row, OperatorPage::fingerprint($row), 3, 1000); + expect($session['entries'])->toHaveCount(1)->and($session['user'])->toBe(3); +}); + +it('never treats absent or future observations as fresh', function () { + $row = cloud_triage_fixture(); + expect(OperatorPage::fresh(array_replace($row, ['observed' => 0]), 1000))->toBeFalse() + ->and(OperatorPage::fresh(array_replace($row, ['observed' => 1001]), 1000))->toBeFalse() + ->and(OperatorPage::fresh($row, 1020))->toBeTrue() + ->and(OperatorPage::fresh($row, 1021))->toBeFalse(); +}); + +it('ignores malformed session acknowledgments without hiding current health', function () { + $row = cloud_triage_fixture(); + expect(OperatorPage::acknowledged(['user' => 2, 'entries' => 'bad'], $row, 2, 1000))->toBeFalse(); + $session = ['user' => 2, 'entries' => ['7' => ['at' => 'invalid']]]; + expect(OperatorPage::acknowledge($session, $row, OperatorPage::fingerprint($row), 2, 1000))->toBeTrue() + ->and($row['state'])->toBe('failed'); +}); diff --git a/tests/bin/archive-check.sh b/tests/bin/archive-check.sh index 089a179..d10502f 100644 --- a/tests/bin/archive-check.sh +++ b/tests/bin/archive-check.sh @@ -26,7 +26,7 @@ listing=$(tar -tf "$archive") while IFS= read -r path; do case "$path" in - cloud_accounts.php|cloud_health.php|index.php|poller_cloud.php|setup.php|ss_cloud.php|INFO|README.md|LICENSE|SECURITY.md) ;; + cloud_accounts.php|cloud_health.php|cloud_operator.php|index.php|poller_cloud.php|setup.php|ss_cloud.php|INFO|README.md|LICENSE|SECURITY.md) ;; LICENSES/|LICENSES/*|docs/|docs/*|include/|include/*|lib/|lib/*|locales/|locales/*|templates/|templates/*) ;; *) printf 'Unexpected file in release archive: %s\n' "$path" >&2 @@ -35,7 +35,7 @@ while IFS= read -r path; do esac done <<< "$listing" -for required in INFO README.md LICENSE setup.php cloud_accounts.php cloud_health.php poller_cloud.php ss_cloud.php index.php; do +for required in INFO README.md LICENSE setup.php cloud_accounts.php cloud_health.php cloud_operator.php poller_cloud.php ss_cloud.php index.php; do if ! grep -Fxq "$required" <<< "$listing"; then printf 'Required release file is missing: %s\n' "$required" >&2 exit 1 diff --git a/tests/bin/lifecycle.php b/tests/bin/lifecycle.php index c9e6e3d..172d14a 100644 --- a/tests/bin/lifecycle.php +++ b/tests/bin/lifecycle.php @@ -486,6 +486,10 @@ case 'collector_kill': include($config['base_path'] . '/plugins/cloud/tests/bin/collector-restart.php'); + break; + case 'operator_roles': + include(__DIR__ . '/operator-roles.php'); + break; case 'state': break; diff --git a/tests/bin/operator-roles.php b/tests/bin/operator-roles.php new file mode 100644 index 0000000..e9a825e --- /dev/null +++ b/tests/bin/operator-roles.php @@ -0,0 +1,114 @@ + + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This file is part of plugin_cloud, a plugin for Cacti. + * https://github.com/somethingwithproof/plugin_cloud + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +// Executed only by lifecycle.php in a disposable Cacti database. +if (PHP_SAPI !== 'cli') { + exit(1); +} + +if (getenv('CLOUD_TEST_DATABASE') !== 'disposable') { + exit(2); +} +require_once $config['library_path'] . '/auth.php'; +require_once $config['base_path'] . '/plugins/cloud/setup.php'; +cloud_boot(); +$view = \Somethingwithproof\Cloud\Pages::VIEW[0]; +$admin = \Somethingwithproof\Cloud\Pages::ADMIN[0]; +$operator = 'cloud_operator.php'; +api_plugin_load_realms(); +$old = [$view => $user_auth_realm_filenames[$view], $admin => $user_auth_realm_filenames[$admin]]; +// Emulate an installed two-realm release without modifying the existing IDs. +$operatorId = $user_auth_realm_filenames[$operator]; +db_execute_prepared('DELETE FROM user_auth_realm WHERE realm_id = ?', [$operatorId]); +db_execute_prepared('DELETE FROM plugin_realms WHERE id = ?', [$operatorId - 100]); +db_execute("DELETE FROM plugin_hooks WHERE name = 'cloud' AND hook = 'auth_alternate_realms'"); +db_execute("INSERT INTO user_auth (username, password, realm, full_name, enabled) VALUES ('cloud_role_test', '', 0, 'Role test', 'on')"); +$user = (int) db_fetch_insert_id(); +db_execute_prepared('INSERT INTO user_auth_realm (user_id, realm_id) VALUES (?, ?)', [$user, $old[$view]]); +$_SESSION = ['sess_user_id' => $user]; +plugin_cloud_upgrade(); +api_plugin_load_realms(); +$result = [ + 'ids_preserved' => $old === [$view => $user_auth_realm_filenames[$view], $admin => $user_auth_realm_filenames[$admin]], + 'viewer_grants' => array_map('intval', array_column(db_fetch_assoc_prepared('SELECT realm_id FROM user_auth_realm WHERE user_id = ?', [$user]), 'realm_id')), + 'expected_view' => $old[$view], + 'hook_enabled' => (int) db_fetch_cell("SELECT status FROM plugin_hooks WHERE name = 'cloud' AND hook = 'auth_alternate_realms'"), +]; +$realms = [$view => $user_auth_realm_filenames[$view], $operator => $user_auth_realm_filenames[$operator], $admin => $user_auth_realm_filenames[$admin]]; +$check = static function () use ($user, $view, $operator, $admin): array { + $_SESSION = ['sess_user_id' => $user]; + api_plugin_load_realms(); + cloud_auth_alternate_realms(); + + return [api_plugin_user_realm_auth($view), api_plugin_user_realm_auth($operator), api_plugin_user_realm_auth($admin)]; +}; + +foreach (['viewer' => $view, 'operator' => $operator, 'admin' => $admin] as $role => $file) { + db_execute_prepared('DELETE FROM user_auth_realm WHERE user_id = ?', [$user]); + db_execute_prepared('INSERT INTO user_auth_realm (user_id, realm_id) VALUES (?, ?)', [$user, $realms[$file]]); + $result[$role] = $check(); + + foreach ([$view, $operator, $admin] as $page) { + $_SERVER['SCRIPT_NAME'] = '/plugins/cloud/' . $page; + $_SESSION = []; + api_plugin_load_realms(); + cloud_auth_alternate_realms(); + $deferred = $user_auth_realm_filenames[$page] === -1; + // Both cookie restore and Basic auth establish the user after the hook. + $_SESSION = ['sess_user_id' => $user]; + $current_user = db_fetch_row_prepared('SELECT * FROM user_auth WHERE id = ?', [$user]); + $allowed = cloud_page_allowed(); + $result['first_request'][$role][] = [$deferred, $allowed, $user_auth_realm_filenames[$page] > 0]; + } +} +// A valid realm never enables a disabled account after authentication restore. +db_execute_prepared("UPDATE user_auth SET enabled = '' WHERE id = ?", [$user]); +foreach ([$view, $operator, $admin] as $page) { + $_SERVER['SCRIPT_NAME'] = '/plugins/cloud/' . $page; + $_SESSION = []; + api_plugin_load_realms(); + cloud_auth_alternate_realms(); + $_SESSION = ['sess_user_id' => $user]; + $current_user = db_fetch_row_prepared('SELECT * FROM user_auth WHERE id = ?', [$user]); + $result['disabled_user'][] = cloud_page_allowed(); +} +db_execute_prepared("UPDATE user_auth SET enabled = 'on' WHERE id = ?", [$user]); +db_execute_prepared('DELETE FROM user_auth_realm WHERE user_id = ?', [$user]); +$result['revoked'] = $check(); +foreach ([$view, $operator, $admin] as $page) { + $_SERVER['SCRIPT_NAME'] = '/plugins/cloud/' . $page; + $_SESSION = []; + api_plugin_load_realms(); + cloud_auth_alternate_realms(); + $_SESSION = ['sess_user_id' => $user]; + $current_user = db_fetch_row_prepared('SELECT * FROM user_auth WHERE id = ?', [$user]); + $result['first_request']['revoked'][] = cloud_page_allowed(); +} +db_execute("INSERT INTO user_auth_group (name, enabled) VALUES ('cloud_role_test', 'on')"); +$group = (int) db_fetch_insert_id(); +db_execute_prepared('INSERT INTO user_auth_group_members (group_id, user_id) VALUES (?, ?)', [$group, $user]); +db_execute_prepared('INSERT INTO user_auth_group_realm (group_id, realm_id) VALUES (?, ?)', [$group, $realms[$operator]]); +$result['group_operator'] = $check(); +db_execute_prepared("UPDATE user_auth_group SET enabled = '' WHERE id = ?", [$group]); +$result['disabled_group'] = $check(); +db_execute_prepared('DELETE FROM user_auth_group_realm WHERE group_id = ?', [$group]); +db_execute_prepared('DELETE FROM user_auth_group_members WHERE group_id = ?', [$group]); +db_execute_prepared('DELETE FROM user_auth_group WHERE id = ?', [$group]); +db_execute_prepared('DELETE FROM user_auth WHERE id = ?', [$user]); +$_SESSION = []; diff --git a/tests/bin/php-guard-check.php b/tests/bin/php-guard-check.php index df62c3f..c4438b7 100644 --- a/tests/bin/php-guard-check.php +++ b/tests/bin/php-guard-check.php @@ -127,7 +127,7 @@ function guard_call_shims() { if ($supported) { guard_expect($state['status'] == 1, 'install and enable succeed (status ' . $state['status'] . ')'); guard_expect($state['tables'] === 9, 'all nine plugin tables exist (' . $state['tables'] . ')'); - guard_expect($state['hooks'] >= 3 && $state['realms'] === 2, 'hooks and realms are registered'); + guard_expect($state['hooks'] >= 3 && $state['realms'] === 3, 'hooks and realms are registered'); } else { guard_expect( $state['status'] == 2, diff --git a/tests/check_translations.py b/tests/check_translations.py new file mode 100644 index 0000000..316e179 --- /dev/null +++ b/tests/check_translations.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: 2026 Thomas Vincent +"""Check required catalogs and translated user guides without third-party packages.""" + +import ast +import gettext +import hashlib +import json +from pathlib import Path +import re +import sys +from urllib.parse import unquote, urlsplit + + +LOCALES = ("zh-CN", "hi-IN", "es-ES", "es-419", "ar-SA") +NAVIGATION = re.compile(r"\n.*?\n\n?", re.S) +HEADER = re.compile(r"") +TOKENS = re.compile(r"%(?:\d+\$)?[-+ 0#]*\d*(?:\.\d+)?[sdfuxXcoeEgGi]|%%|<[^>]*>") + + +def messages(path): + result = [] + for block in path.read_text(encoding="utf-8").split("\n\n"): + fields = {} + current = None + for line in block.splitlines(): + match = re.match(r'(msgid_plural|msgid) (".*")$', line) + if match: + current = match[1] + fields[current] = ast.literal_eval(match[2]) + elif line.startswith('"') and current: + fields[current] += ast.literal_eval(line) + else: + current = None + if fields.get("msgid"): + result.append(fields) + return result + + +def edges(text): + return (text[:len(text) - len(text.lstrip())], text[len(text.rstrip()):]) + + +def source_text(text): + return NAVIGATION.sub("", text) + + +def fenced_sections(text: str) -> tuple[list[tuple[str, str]], str]: + blocks = [] + prose = [] + fence = None + content = [] + language = "" + for line in text.splitlines(): + match = re.match(r"^[ \t]*(`{3,}|~{3,})(.*)$", line) + if fence is None and match: + fence, language = match[1], match[2].strip() + content = [] + prose.append("") + elif (fence is not None and match + and match[1][0] == fence[0] + and len(match[1]) >= len(fence) + and not match[2].strip()): + blocks.append((language, "\n".join(content))) + fence = None + elif fence is not None: + content.append(line) + else: + prose.append(line) + if fence is not None: + raise ValueError("unclosed code fence") + return blocks, "\n".join(prose) + + +def code_blocks(text): + blocks, _ = fenced_sections(text) + return [content for language, content in blocks if language != "mermaid"] + + +def links(text): + # Fenced examples can contain literal Markdown and URLs that are not links. + _, text = fenced_sections(text) + result = re.findall(r"\]\(]+)>?(?:\s+[\"'][^\n]*?[\"'])?\)", text) + result.extend(re.findall(r"(?:href|src|srcset)=[\"']([^\"']+)[\"']", text)) + return result + + +def heading_levels(text): + _, text = fenced_sections(text) + return [len(level) for level in re.findall(r"^(#{1,6})\s+", text, re.M)] + + +def validate(root): + failures = [] + manifest_path = root / "docs/i18n/manifest.json" + manifest = json.loads(manifest_path.read_text(encoding="utf-8")) + sources = manifest["sources"] + if manifest["locales"] != list(LOCALES): + failures.append("manifest locales must include both Spanish variants") + if "README.md" not in sources or len(sources) != len(set(sources)): + failures.append("manifest needs README.md and unique source paths") + template = messages(root / "locales/po/cacti.pot") + for locale in LOCALES: + for path in (root / "locales/po" / (locale + ".po"), root / "locales/LC_MESSAGES" / (locale + ".mo")): + if not path.is_file(): + failures.append("missing catalog: " + str(path.relative_to(root))) + mo = root / "locales/LC_MESSAGES" / (locale + ".mo") + if mo.is_file(): + with mo.open("rb") as stream: + catalog = gettext.GNUTranslations(stream) + if catalog.info().get("language") != locale: + failures.append("wrong compiled language header: " + locale) + for entry in template: + original = entry["msgid"] + values = [catalog.gettext(original)] + if "msgid_plural" in entry: + values = [catalog.ngettext(original, entry["msgid_plural"], n) for n in (0, 1, 2, 3, 11, 100)] + for value in values: + if sorted(TOKENS.findall(original)) != sorted(TOKENS.findall(value)) or edges(original) != edges(value): + failures.append("placeholder, markup or whitespace mismatch: " + locale + ": " + original) + for source in sources: + original = root / source + translated = root / "docs/i18n" / locale / source + label = str(translated.relative_to(root)) + if not original.is_file() or not translated.is_file(): + failures.append("missing source or translation: " + label) + continue + english = source_text(original.read_text(encoding="utf-8")) + text = translated.read_text(encoding="utf-8") + header = HEADER.search(text) + digest = hashlib.sha256(english.encode()).hexdigest() + if header is None or header[1] != source or header[2] != digest: + failures.append("source changed; review and refresh translation: " + label) + body = re.sub(r'^\n', "", text, flags=re.M) + if source_text(HEADER.sub("", body)).strip() == english.strip(): + failures.append("translation is an English copy: " + label) + if heading_levels(english) != heading_levels(text): + failures.append("heading structure differs from source: " + label) + try: + if code_blocks(english) != code_blocks(text): + failures.append("code examples differ from source: " + label) + except ValueError as error: + failures.append(str(error) + ": " + label) + for link in links(text): + parts = urlsplit(link) + if parts.scheme or parts.netloc or not parts.path or parts.path.startswith("/"): + continue + target = (translated.parent / unquote(parts.path)).resolve() + if not target.is_relative_to(root.resolve()) or not target.exists(): + failures.append("broken local link: " + label + " -> " + link) + if failures: + print("\n".join(failures), file=sys.stderr) + return 1 + print(f"Verified {len(LOCALES)} locale catalogs and {len(sources) * len(LOCALES)} translated guides") + return 0 + + +if __name__ == "__main__": + try: + sys.exit(validate(Path(__file__).resolve().parents[1])) + except (OSError, ValueError, KeyError) as error: + print("Translation validation failed: " + str(error), file=sys.stderr) + sys.exit(1)