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
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
<!-- translations:start -->
[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)
<!-- translations:end -->

# plugin_hpcsched

A Cacti 1.2 plugin that graphs the state of an HPC batch scheduler next to the devices Cacti already monitors: queue depth, pending versus running jobs, why jobs are pending, node states, and partition utilization. Slurm is the first backend. Thold alerts on the resulting data sources, and Maint can be driven by drained nodes and maintenance reservations.

> **Status: in development, no release yet.** Milestone 2 (foundation) is merged on `main`, and this branch adds milestone 3 (cluster graphs and pending reasons). The code installs, upgrades, and uninstalls through Cacti's plugin API and refuses PHP below 8.2. It keeps a registry of Slurm clusters, each assigned to one Cacti poller. A background reader on the main poller collects one snapshot per cluster per interval, either by running `squeue`, `scontrol`, and `sshare` with `--json` or by reading `slurmrestd` over HTTPS, and stores job counts by state and pending reason, node states, partitions, reservations, and fair-share usage with their freshness. The plugin ships Cacti templates and, on an administrator's confirmation, creates or maps one Cacti device per cluster with graphs of jobs by state, pending jobs by reason family, nodes by state, CPUs, and utilization, for the cluster and for each partition, plus the snapshot age. A read-only overview page shows counts per cluster with their freshness and a pending reasons view per cluster, and an admin-only health page shows what each collection returned and whether the templates are installed. Every page and action follows Cacti's device permissions. The data sources are ones Thold can alert on, but no Thold or Maint integration has been tested yet; that is milestone 4 and later. The test suite runs against stand-in Slurm commands and a stand-in `slurmrestd` with synthetic data. It has not run against a real Slurm cluster. Below the operator notes, this README describes the design, not shipped behavior.
> **Status: in development, no release yet.** Milestone 2 (foundation) is merged on `main`, and this branch adds milestone 3 (cluster graphs and pending reasons). The code installs, upgrades, and uninstalls through Cacti's plugin API and refuses PHP below 8.2. It keeps a registry of Slurm clusters, each assigned to one Cacti poller. A background reader on the main poller collects one snapshot per cluster per interval, either by running `squeue`, `scontrol`, and `sshare` with `--json` or by reading `slurmrestd` over HTTPS, and stores job counts by state and pending reason, node states, partitions, reservations, and fair-share usage with their freshness. The plugin ships Cacti templates and, on an administrator's confirmation, creates or maps one Cacti device per cluster with graphs of jobs by state, pending jobs by reason family, nodes by state, CPUs, and utilization, for the cluster and for each partition, plus the snapshot age. A read-only overview page shows counts per cluster with their freshness and a pending reasons view per cluster, and an admin-only health page shows what each collection returned and whether the templates are installed. Every page and action follows Cacti's device permissions. The data sources are ones Thold can alert on, but no Thold or Maint integration has been tested yet; that is milestone 4 and later. The test suite covers synthetic Slurm commands and `slurmrestd` responses, and CI also exercises a real six-node Slurm cluster in containers as described below. The reader has not run against a production cluster. Below the operator notes, this README describes the design, not shipped behavior.

This is an independent project and is not affiliated with the Cacti project.

## Access roles

| Realm | Access |
| --- | --- |
| HPC Scheduler View | Existing monitoring pages. |
| HPC Scheduler Operator | Monitoring plus the Operations page and personal triage acknowledgments. |
| HPC Scheduler 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
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.
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.

## Operator notes for milestone 2

**Least privilege.** The plugin only reads. Give it a dedicated Slurm user with no administrator or operator role (`AdminLevel=None` in `sacctmgr`). With `PrivateData=jobs` (or `nodes`, `reservations`, `usage`) in `slurm.conf`, that user sees only its own records, so the counts are incomplete and the plugin cannot detect it. Lifting that for the account means an operator or administrator level, which also allows changes; that tradeoff is the site's call. For client commands, the Cacti poller user needs the Slurm client binaries and a `slurm.conf` that reaches the controller; the binary paths are absolute settings under Configuration > Settings > HPC Scheduler. For `slurmrestd`, the URL must be `https://`, or `http://` on a loopback address only. TLS certificates are verified and redirects are not followed. An optional slurmrestd host list under Configuration > Settings > HPC Scheduler limits the hosts and ports a cluster may name.
Expand Down
4 changes: 2 additions & 2 deletions docs/PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ Plugin code is object-oriented wherever Cacti's plugin contract allows it. No ma
- Classes in `lib/*.php` under the `Somethingwithproof\Hpcsched` namespace (milestone 2; the plan earlier named `Cacti\HpcSched`, which would claim the Cacti project's vendor name for an independent plugin), one per file, loaded by a small autoloader registered after the PHP check. No runtime Composer dependency. Files stay at depth 2 or less because the gettext build scans only that deep (to be confirmed against current Cacti build scripts).
- Settings use the `config_settings` hook. Logging uses `cacti_log()` with an `HPCSCHED` tag. Forms rely on csrf-magic.
- Strings use the `hpcsched` text domain, with a `locales/` directory and POT file.
- Realms: "HPC Scheduler View" and "HPC Scheduler Admin".
- Realms: "HPC Scheduler View", "HPC Scheduler Operator" and "HPC Scheduler Admin".

| Kind | Examples | Notes |
|---|---|---|
Expand Down Expand Up @@ -450,7 +450,7 @@ The setup screen shows the number of data sources and RRD files an import will c

| Boundary | Control |
|---|---|
| Browser to Cacti | Cacti session, csrf-magic, two realms, device and graph permissions, prepared queries, contextual escaping |
| Browser to Cacti | Cacti session, csrf-magic, three realms, device and graph permissions, prepared queries, contextual escaping |
| Cacti poller to Slurm client commands | Argument arrays, no shell, fixed command and option allowlist, no operator input in commands, timeouts and size limits, no `sudo`, no elevated user |
| Cacti poller to slurmrestd | GET-only path allowlist, TLS verification on, token from a file with owner-only permissions, token never logged, timeouts and size limits |
| Scheduler account | A dedicated, least-privilege Slurm account; the plugin documents what it must see and what `PrivateData` hides |
Expand Down
Loading
Loading