Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inherits Operator access, and Operator access inherits View access on each reque
this does not add stored grants to users or groups. Plugin settings also require
HPC Scheduler 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.
Cacti device permissions still limit the rows and actions available to each user; a cluster without a device is listed on the administrative pages for every user with the plugin realm, but not in the operator views, which list only clusters mapped to a device.
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
Expand Down
4 changes: 2 additions & 2 deletions docs/i18n/ar-SA/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Source: README.md; SHA256: d5c640066f5b2621b57497556f3c9a2fa9226804df633dceda3224538767760c -->
<!-- Source: README.md; SHA256: 16caa3e34c4d150a7fb1018f637e200a7580330f033b485047d8413bce09abba -->

<!-- translations:start -->
[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)
Expand All @@ -24,7 +24,7 @@

بعد نسخ ملفات الترقية، افتح صفحة الإضافات بصفتك مسؤولًا لتسجيل نطاق الأذونات الجديد. امنح نطاق Operator صراحةً ضمن **الإعداد > المستخدمون** أو مجموعات المستخدمين. تحتفظ الترقيات بمعرّفات نطاقي View وAdmin ومنحهما الحالي. يرث Admin وصول Operator ويرث Operator وصول View في كل طلب؛ ولا يضيف ذلك منحًا مخزّنة للمستخدمين أو المجموعات. تتطلب إعدادات الإضافة أيضًا HPC Scheduler Admin بالإضافة إلى إذن الإعدادات في Cacti.

تظل أذونات أجهزة Cacti تقيّد الصفوف والإجراءات المتاحة لكل مستخدم؛ وتتطلب الكائنات غير المرتبطة مسؤولًا. تبقى بيانات الاعتماد والإعدادات والربط والحذف والتغييرات الإدارية الأخرى في الصفحات الإدارية. لا تستمر الإقرارات إلا في جلسة المستخدم الحالي، لمدة ساعة على الأكثر وفقط ما دامت الملاحظة نفسها حديثة. تُبطلها الملاحظات الجديدة أو المعدّلة. ولا تجعل قياسًا فاشلًا سليمًا أو تكبح التنبيهات مطلقًا.
تظل أذونات أجهزة Cacti تقيّد الصفوف والإجراءات المتاحة لكل مستخدم؛ ويظهر العنقود الذي ليس له جهاز في الصفحات الإدارية لكل مستخدم يملك نطاق أذونات الإضافة، لكنه لا يظهر في صفحات العمليات التي تعرض فقط العناقيد المرتبطة بجهاز. تبقى بيانات الاعتماد والإعدادات والربط والحذف والتغييرات الإدارية الأخرى في الصفحات الإدارية. لا تستمر الإقرارات إلا في جلسة المستخدم الحالي، لمدة ساعة على الأكثر وفقط ما دامت الملاحظة نفسها حديثة. تُبطلها الملاحظات الجديدة أو المعدّلة. ولا تجعل قياسًا فاشلًا سليمًا أو تكبح التنبيهات مطلقًا.

<a id="operator-notes-for-milestone-2"></a>
## ملاحظات المشغّل للمعلم 2
Expand Down
4 changes: 2 additions & 2 deletions docs/i18n/es-419/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Source: README.md; SHA256: d5c640066f5b2621b57497556f3c9a2fa9226804df633dceda3224538767760c -->
<!-- Source: README.md; SHA256: 16caa3e34c4d150a7fb1018f637e200a7580330f033b485047d8413bce09abba -->

<!-- translations:start -->
[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)
Expand All @@ -24,7 +24,7 @@ Este proyecto es independiente y no está afiliado al proyecto Cacti.

Después de copiar los archivos de actualización, abra la página Complementos como administrador para registrar el nuevo permiso. Asigne expresamente Operator en **Configuración > Usuarios** o en los grupos de usuarios. Las actualizaciones conservan los identificadores y las concesiones de View y Admin. En cada petición, Admin hereda el acceso Operator y Operator hereda View; esto no añade concesiones almacenadas a usuarios ni grupos. Los ajustes del complemento también requieren HPC Scheduler Admin, además del permiso Ajustes de Cacti.

Los permisos de dispositivos de Cacti siguen limitando las filas y acciones disponibles para cada usuario; los objetos sin asociación requieren un administrador. Credenciales, configuración, asociaciones, eliminación y otros cambios administrativos permanecen en las páginas administrativas. Los acuses solo duran en la sesión del usuario actual, como máximo una hora y mientras la misma observación siga vigente. Las observaciones nuevas o modificadas los invalidan. Nunca marcan como correcta una medición fallida ni suprimen alertas.
Los permisos de dispositivos de Cacti siguen limitando las filas y acciones disponibles para cada usuario; un clúster sin dispositivo aparece en las páginas administrativas para todo usuario con el permiso del complemento, pero no en las páginas de operaciones, que solo muestran los clústeres asociados a un dispositivo. Credenciales, configuración, asociaciones, eliminación y otros cambios administrativos permanecen en las páginas administrativas. Los acuses solo duran en la sesión del usuario actual, como máximo una hora y mientras la misma observación siga vigente. Las observaciones nuevas o modificadas los invalidan. Nunca marcan como correcta una medición fallida ni suprimen alertas.

<a id="operator-notes-for-milestone-2"></a>
## Notas para operadores del hito 2
Expand Down
4 changes: 2 additions & 2 deletions docs/i18n/es-ES/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Source: README.md; SHA256: d5c640066f5b2621b57497556f3c9a2fa9226804df633dceda3224538767760c -->
<!-- Source: README.md; SHA256: 16caa3e34c4d150a7fb1018f637e200a7580330f033b485047d8413bce09abba -->

<!-- translations:start -->
[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)
Expand All @@ -24,7 +24,7 @@ Este proyecto es independiente y no está afiliado al proyecto Cacti.

Después de copiar los archivos de actualización, abra la página Complementos como administrador para registrar el nuevo permiso. Asigne expresamente Operator en **Configuración > Usuarios** o en los grupos de usuarios. Las actualizaciones conservan los identificadores y las concesiones de View y Admin. En cada petición, Admin hereda el acceso Operator y Operator hereda View; esto no añade concesiones almacenadas a usuarios ni grupos. Los ajustes del complemento también requieren HPC Scheduler Admin, además del permiso Ajustes de Cacti.

Los permisos de dispositivos de Cacti siguen limitando las filas y acciones disponibles para cada usuario; los objetos sin asociación requieren un administrador. Credenciales, configuración, asociaciones, eliminación y otros cambios administrativos permanecen en las páginas administrativas. Los acuses solo duran en la sesión del usuario actual, como máximo una hora y mientras la misma observación siga vigente. Las observaciones nuevas o modificadas los invalidan. Nunca marcan como correcta una medición fallida ni suprimen alertas.
Los permisos de dispositivos de Cacti siguen limitando las filas y acciones disponibles para cada usuario; un clúster sin dispositivo aparece en las páginas administrativas para todo usuario con el permiso del complemento, pero no en las páginas de operaciones, que solo muestran los clústeres asociados a un dispositivo. Credenciales, configuración, asociaciones, eliminación y otros cambios administrativos permanecen en las páginas administrativas. Los acuses solo duran en la sesión del usuario actual, como máximo una hora y mientras la misma observación siga vigente. Las observaciones nuevas o modificadas los invalidan. Nunca marcan como correcta una medición fallida ni suprimen alertas.

<a id="operator-notes-for-milestone-2"></a>
## Notas para operadores del hito 2
Expand Down
4 changes: 2 additions & 2 deletions docs/i18n/hi-IN/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Source: README.md; SHA256: d5c640066f5b2621b57497556f3c9a2fa9226804df633dceda3224538767760c -->
<!-- Source: README.md; SHA256: 16caa3e34c4d150a7fb1018f637e200a7580330f033b485047d8413bce09abba -->

<!-- translations:start -->
[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)
Expand All @@ -24,7 +24,7 @@

अपग्रेड फ़ाइलें कॉपी करने के बाद नया अनुमति क्षेत्र दर्ज करने के लिए व्यवस्थापक के रूप में प्लगइन पृष्ठ खोलें। **कॉन्फ़िगरेशन > उपयोगकर्ता** या उपयोगकर्ता समूहों में Operator अनुमति स्पष्ट रूप से दें। अपग्रेड मौजूदा View और Admin क्षेत्र के ID और अनुदान सुरक्षित रखते हैं। हर अनुरोध में Admin को Operator और Operator को View पहुँच विरासत में मिलती है; इससे उपयोगकर्ता या समूह में संग्रहीत अनुदान नहीं जुड़ते। प्लगइन सेटिंग के लिए Cacti की Settings अनुमति के अतिरिक्त HPC Scheduler Admin भी आवश्यक है।

Cacti डिवाइस अनुमतियाँ अब भी हर उपयोगकर्ता के लिए उपलब्ध पंक्तियाँ और कार्रवाइयाँ सीमित करती हैं; अनमैप ऑब्जेक्ट के लिए व्यवस्थापक चाहिए। क्रेडेंशियल, कॉन्फ़िगरेशन, मैपिंग, हटाना और अन्य प्रशासनिक बदलाव प्रशासनिक पृष्ठों में ही रहते हैं। पुष्टि केवल वर्तमान उपयोगकर्ता के सत्र में, अधिकतम एक घंटे तक और उसी अवलोकन के ताज़ा रहने तक रहती है। नए या बदले अवलोकन उसे अमान्य कर देते हैं। यह कभी विफल माप को स्वस्थ नहीं बताती या अलर्ट नहीं दबाती।
Cacti डिवाइस अनुमतियाँ अब भी हर उपयोगकर्ता के लिए उपलब्ध पंक्तियाँ और कार्रवाइयाँ सीमित करती हैं; डिवाइस के बिना क्लस्टर प्रशासनिक पृष्ठों पर प्लगइन अनुमति क्षेत्र वाले हर उपयोगकर्ता को दिखता है, पर संचालन पृष्ठों में नहीं; वे केवल डिवाइस से मैप किए गए क्लस्टर सूचीबद्ध करते हैं। क्रेडेंशियल, कॉन्फ़िगरेशन, मैपिंग, हटाना और अन्य प्रशासनिक बदलाव प्रशासनिक पृष्ठों में ही रहते हैं। पुष्टि केवल वर्तमान उपयोगकर्ता के सत्र में, अधिकतम एक घंटे तक और उसी अवलोकन के ताज़ा रहने तक रहती है। नए या बदले अवलोकन उसे अमान्य कर देते हैं। यह कभी विफल माप को स्वस्थ नहीं बताती या अलर्ट नहीं दबाती।

<a id="operator-notes-for-milestone-2"></a>
## माइलस्टोन 2 के लिए ऑपरेटर टिप्पणियाँ
Expand Down
4 changes: 2 additions & 2 deletions docs/i18n/zh-CN/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Source: README.md; SHA256: d5c640066f5b2621b57497556f3c9a2fa9226804df633dceda3224538767760c -->
<!-- Source: README.md; SHA256: 16caa3e34c4d150a7fb1018f637e200a7580330f033b485047d8413bce09abba -->

<!-- translations:start -->
[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)
Expand All @@ -24,7 +24,7 @@

复制升级文件后,以管理员身份打开插件页面,注册新权限域。在**配置 > 用户**或用户组中明确授予 Operator 权限域。升级保留现有 View 和 Admin 权限域的 ID 及授权。每次请求时,Admin 继承 Operator 访问权限,Operator 继承 View 访问权限;这不会向用户或组添加持久化授权。插件设置除需要 Cacti 的设置权限外,还需要 HPC Scheduler Admin 权限。

Cacti 设备权限仍限制每位用户可访问的行和操作;未映射对象需要管理员处理。凭据、配置、映射、删除和其他管理更改仍在管理页面中执行。确认记录仅在当前用户会话中有效,最多一小时,并且仅在同一观测结果仍然新鲜时有效。新出现或更改的观测结果会使确认失效。确认绝不会将失败的测量标记为健康,也不会抑制告警。
Cacti 设备权限仍限制每位用户可访问的行和操作;没有设备的集群会列在管理页面上,所有拥有插件权限域的用户都能看到,但不会出现在运维页面中,运维页面只列出已映射到设备的集群。凭据、配置、映射、删除和其他管理更改仍在管理页面中执行。确认记录仅在当前用户会话中有效,最多一小时,并且仅在同一观测结果仍然新鲜时有效。新出现或更改的观测结果会使确认失效。确认绝不会将失败的测量标记为健康,也不会抑制告警。

<a id="operator-notes-for-milestone-2"></a>
## 里程碑 2 操作员说明
Expand Down
33 changes: 30 additions & 3 deletions hpcsched_clusters.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@
case 'enable':
case 'disable':
$hpcsched_cluster = hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access);
$hpcsched_clusters->setState($hpcsched_cluster->id, $hpcsched_action === 'enable' ? \Somethingwithproof\Hpcsched\AdminState::Enabled : \Somethingwithproof\Hpcsched\AdminState::Disabled);

if (!$hpcsched_clusters->setState($hpcsched_cluster->id, $hpcsched_action === 'enable' ? \Somethingwithproof\Hpcsched\AdminState::Enabled : \Somethingwithproof\Hpcsched\AdminState::Disabled)) {

Check warning on line 103 in hpcsched_clusters.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 195 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3OpKvYBckUq_g_5nm&open=AaH3OpKvYBckUq_g_5nm&pullRequest=78
raise_message('hpcsched_state', __('The cluster state was not changed: the write failed. See the Cacti log.', 'hpcsched'), MESSAGE_LEVEL_ERROR);

Check warning on line 104 in hpcsched_clusters.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 147 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3OpKwYBckUq_g_5nn&open=AaH3OpKwYBckUq_g_5nn&pullRequest=78
}

header('Location: hpcsched_clusters.php');
exit;
case 'delete':
Expand Down Expand Up @@ -130,6 +134,8 @@
} elseif ($hpcsched_cluster->hostId > 0 && !$hpcsched_access->orphaned($hpcsched_cluster)) {
$hpcsched_devices->attach($hpcsched_cluster->id, $hpcsched_cluster->hostId, $hpcsched_graphs);
raise_message('hpcsched_device', __('Missing graphs were added.', 'hpcsched'), MESSAGE_LEVEL_INFO);
} else {
raise_message('hpcsched_device', __('No graphs were added: the cluster has no device, or its device no longer exists.', 'hpcsched'), MESSAGE_LEVEL_ERROR);

Check warning on line 138 in hpcsched_clusters.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 157 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3OpKwYBckUq_g_5no&open=AaH3OpKwYBckUq_g_5no&pullRequest=78
}

header('Location: ' . $hpcsched_back);
Expand All @@ -142,8 +148,29 @@
exit;
case 'reindex_device':
$hpcsched_cluster = hpcsched_cluster_request($hpcsched_clusters, $hpcsched_access);
$hpcsched_devices->reindex($hpcsched_cluster->hostId);
raise_message('hpcsched_device', __('The partitions were reindexed from the snapshot.', 'hpcsched'), MESSAGE_LEVEL_INFO);
$hpcsched_result = $hpcsched_cluster->hostId > 0 && !$hpcsched_access->orphaned($hpcsched_cluster) ? $hpcsched_devices->reindex($hpcsched_cluster->hostId) : \Somethingwithproof\Hpcsched\ReindexResult::NotRun;

Check warning on line 151 in hpcsched_clusters.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 211 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3riXnXsOE0DJ8geEn&open=AaH3riXnXsOE0DJ8geEn&pullRequest=78

switch ($hpcsched_result) {
case \Somethingwithproof\Hpcsched\ReindexResult::Completed:
raise_message('hpcsched_device', __('The partitions were reindexed from the snapshot.', 'hpcsched'), MESSAGE_LEVEL_INFO);
break;
case \Somethingwithproof\Hpcsched\ReindexResult::Skipped:
raise_message('hpcsched_device', __('The partitions were not reindexed: the device is disabled or down, so Cacti skipped its data query.', 'hpcsched'), MESSAGE_LEVEL_ERROR);

Check warning on line 158 in hpcsched_clusters.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 177 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3riXnXsOE0DJ8geEo&open=AaH3riXnXsOE0DJ8geEo&pullRequest=78
break;
case \Somethingwithproof\Hpcsched\ReindexResult::Failed:
raise_message('hpcsched_device', __('The partitions were not reindexed: Cacti could not run the data query. See the Cacti log.', 'hpcsched'), MESSAGE_LEVEL_ERROR);

Check warning on line 161 in hpcsched_clusters.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 167 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3riXnXsOE0DJ8geEp&open=AaH3riXnXsOE0DJ8geEp&pullRequest=78
break;
case \Somethingwithproof\Hpcsched\ReindexResult::NoQuery:
raise_message('hpcsched_device', __('The partitions were not reindexed: the HPC Scheduler data query is not installed. Install the templates from the health page.', 'hpcsched'), MESSAGE_LEVEL_ERROR);

Check warning on line 164 in hpcsched_clusters.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 203 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3vnXGBuf0E5kPEfHo&open=AaH3vnXGBuf0E5kPEfHo&pullRequest=78
break;
default:
raise_message(
'hpcsched_device',

Check warning on line 168 in hpcsched_clusters.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Align all arguments in this list at column "8".

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3vnXGBuf0E5kPEfHp&open=AaH3vnXGBuf0E5kPEfHp&pullRequest=78
__('The partitions were not reindexed: the cluster has no device, or its device no longer exists.', 'hpcsched'),
MESSAGE_LEVEL_ERROR
);
}

header('Location: hpcsched_clusters.php?action=device&id=' . $hpcsched_cluster->id);
exit;
case 'device':
Expand Down
11 changes: 11 additions & 0 deletions lib/CactiObjectRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@
return ['id' => Row::int($row, 'id', 0, 1), 'description' => Row::string($row, 'description'), 'poller_id' => Row::int($row, 'poller_id', 1, 1)];
}

/**
* Whether Cacti's run_data_query() skips this device: it returns true
* without running the query for a disabled device or one that is down
* (HOST_DOWN is 1).
*/
public function queriesSkipped(int $hostId): bool {

Check warning on line 86 in lib/CactiObjectRepository.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this open curly brace to the beginning of the next line.

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3riXLXsOE0DJ8geEm&open=AaH3riXLXsOE0DJ8geEm&pullRequest=78
$row = Row::one(db_fetch_row_prepared('SELECT status, disabled FROM host WHERE id = ?', [$hostId], true, $this->connection));

Check warning on line 87 in lib/CactiObjectRepository.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 127 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3riXLXsOE0DJ8geEl&open=AaH3riXLXsOE0DJ8geEl&pullRequest=78

return $row !== null && (Row::int($row, 'status', 0, 1) === 1 || Row::string($row, 'disabled') === 'on');
}

/**
* Devices a cluster may be mapped to: every device not already mapped.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/ClusterRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
return $ok && db_affected_rows($this->connection) === 1 ? $input->id : 0;
}

public function setState(int $id, AdminState $state): void {
db_execute_prepared('UPDATE plugin_hpcsched_cluster SET admin_state = ?, updated_at = GREATEST(updated_at + 1, ?) WHERE id = ?', [$state->value, $this->clock->now(), $id], true, $this->connection);
public function setState(int $id, AdminState $state): bool {
return db_execute_prepared('UPDATE plugin_hpcsched_cluster SET admin_state = ?, updated_at = GREATEST(updated_at + 1, ?) WHERE id = ?', [$state->value, $this->clock->now(), $id], true, $this->connection) !== false;

Check warning on line 136 in lib/ClusterRepository.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 216 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=somethingwithproof_plugin_hpcsched&issues=AaH3OpEdYBckUq_g_5nj&open=AaH3OpEdYBckUq_g_5nj&pullRequest=78
}

public function delete(int $id): bool {
Expand Down
Loading