Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
8b62a79
docs: decide the pending reason families and counting rules (#12)
somethingwithproof Nov 15, 2026
f4a1763
feat: serve cluster and partition series from the snapshot (#42, #43,…
somethingwithproof Nov 15, 2026
6c32d6a
feat: ship the cluster device, data query, and graph templates (#41)
somethingwithproof Nov 15, 2026
f69ad72
feat: create cluster devices and add the pending reasons view (#41, #…
somethingwithproof Nov 15, 2026
a76613b
test: check the device flow and device permissions against Cacti (#41…
somethingwithproof Nov 15, 2026
277b06f
test: measure reader, script server, and page cost on synthetic snaps…
somethingwithproof Nov 15, 2026
2707b65
docs: describe milestone 3 in the README and the plan
somethingwithproof Nov 15, 2026
795e685
fix: map cluster devices with a compare-and-set and recover stale map…
somethingwithproof Nov 15, 2026
05b91d7
fix: own only a query file the install wrote, and refuse a link
somethingwithproof Nov 15, 2026
6c681d7
fix: serve U for a failed section, and recheck freshness on cache hits
somethingwithproof Nov 15, 2026
bd46ad9
fix: read the reasons view from one snapshot and date its node table
somethingwithproof Nov 15, 2026
ffa0997
ci: check the log lines before the device flow sets its own aside
somethingwithproof Nov 15, 2026
394660c
test: expect U from a failed section in the reader flow
somethingwithproof Nov 15, 2026
cef50b2
docs: say who sees a cluster whose device was deleted
somethingwithproof Nov 15, 2026
fbbc397
chore: regenerate the translation template with build_gettext.sh
somethingwithproof Nov 15, 2026
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
33 changes: 32 additions & 1 deletion .github/workflows/plugin-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
run: |
set -euo pipefail
php -v
for f in *.php include/*.php locales/*.php tests/bin/*.php; do
for f in *.php include/*.php locales/*.php scripts/*.php tests/bin/*.php; do
php -l "$f"
done
# The Slurm client stand-ins the tests run are POSIX sh.
Expand Down Expand Up @@ -239,10 +239,41 @@ jobs:
sleep 1
done
php plugins/hpcsched/tests/bin/page-permissions.php http://127.0.0.1:8080/cacti/
php plugins/hpcsched/tests/bin/device-permissions.php http://127.0.0.1:8080/cacti/
if grep -E "Fatal error|Warning:|Uncaught" "$RUNNER_TEMP/php-server.log"; then
exit 1
fi

# Creates a cluster device from the shipped templates, polls it with
# Cacti's poller, and compares the RRD files with the fixtures. It
# provokes the refusal of a foreign data query file, which the plugin
# logs as an error, so the lines it adds are set aside like the
# integration tests' log. The lines before it stay in cacti.log for
# the final check.
- name: Check the cluster device flow
working-directory: cacti
env:
HPCSCHED_TEST_DATABASE: disposable
run: |
touch log/cacti.log
before=$(wc -l < log/cacti.log)
php plugins/hpcsched/tests/bin/device-flow.php
tail -n "+$((before + 1))" log/cacti.log >> log/integration.log
head -n "$before" log/cacti.log > "$RUNNER_TEMP/cacti-before-device-flow.log"
cat "$RUNNER_TEMP/cacti-before-device-flow.log" > log/cacti.log

# The export is rebuilt from the builder and must match the shipped
# file, so the two cannot drift. 1.2.31 only: the export is what that
# release writes.
- name: Check the template export is current
if: matrix.cacti == 'release/1.2.31'
working-directory: cacti
env:
HPCSCHED_TEST_DATABASE: disposable
run: |
php plugins/hpcsched/tests/bin/build-templates.php "$RUNNER_TEMP/hpcsched-templates.xml"
diff -u plugins/hpcsched/templates/hpcsched-templates.xml "$RUNNER_TEMP/hpcsched-templates.xml"

- name: Check Cacti log for errors
if: always()
run: |
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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`. 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. A read-only overview page shows job and node counts per cluster with their freshness, and an admin-only health page shows what each collection returned. It creates no Cacti devices, data sources, or graphs yet, and it has no Thold or Maint integration; those start in milestone 3. 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 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.

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

Expand All @@ -29,6 +29,18 @@ mv -f "$tmp" "$dir/cluster1.token"

The next collection reads the new file. Generating tokens with `scontrol token` needs a Slurm administrator; run it where that is allowed and copy the file to the poller.

## Operator notes for milestone 3

**Templates.** Install and upgrade import the HPC Scheduler device, data, and graph templates and copy the partition data query to Cacti's `resource/script_server/` directory. If that directory is not writable by the user that installs the plugin, a different file of the same name is already there and was not written by the plugin, or the name is a symbolic link, the import stops, the file is left alone, and the health page says what to do; Install Templates on the health page retries. An identical copy made by hand is used but stays yours. Uninstall removes the query file only if the plugin wrote it and it is unchanged, and keeps the templates, devices, and graphs.

**Cluster devices.** HPC Clusters > Device shows what a device will add (graphs, data sources, RRD files, and script server calls per poll) before anything is created. Create Device makes a device with a host name in the reserved `.invalid` domain and no availability check; Map Device instead attaches the graphs to an existing device and leaves its settings alone. Each cluster graph and each partition graph has its own data source: six for the cluster and five per partition, one script server call per cluster data source and one per value of a partition (32) per poll. Partitions added later are indexed when the reader sees them and get graphs from Cacti's New Graphs page; a removed partition stops being polled and keeps its graphs. Deleting the device unmaps the cluster and keeps it.

**What the graphs count.** Pending excludes held jobs, which have their own series. A pending array counts its remaining tasks. A job or node in several partitions counts once in the cluster graphs and once in each partition, so partition graphs need not add up to the cluster's. Pending reasons are grouped into eleven families ([ADR 0011](docs/decisions/0011-pending-reason-families-and-counting.md)); the pending reasons view lists the raw reasons, including those in Other. Each job reports only the last reason the scheduler examined. The utilization denominator includes drained, down, and other unavailable nodes. Stale or failed data is `U`, never zero; `age` stays numeric.

**Alerting.** Thold can alert on any of these data sources; set Thold durations to at least one collection interval, and alert on `age` to catch a stopped reader. The end-to-end Thold check is milestone 4.

**Permissions.** A cluster on a device is shown, exported, and changed only for users Cacti allows that device, on every plugin page; mapping a device also needs permission for the target device. A cluster without a device is visible to everyone with the plugin realm. A cluster still mapped to a device that was deleted while the plugin was disabled is shown only to users with the HPC Scheduler Admin realm, who can create or map a device for it. Graph access is Cacti's own.

## Why

Operators who run Cacti already graph their compute nodes. The scheduler's view is missing from those graphs, which leaves two gaps:
Expand Down
7 changes: 5 additions & 2 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ version = 1

# Files that cannot carry a comment header, or whose format makes one
# awkward: documentation, repository metadata, GitHub templates, test
# configuration, captured node output fixtures, and translation catalogs,
# which gettext regenerates.
# configuration, captured node output fixtures, translation catalogs,
# which gettext regenerates, and the Cacti template export and data query
# file, which Cacti reads and the template builder regenerates.
[[annotations]]
path = [
"README.md",
Expand All @@ -20,6 +21,8 @@ path = [
"tests/node-matching/fixtures.json",
"locales/po/**",
"locales/LC_MESSAGES/**",
"resource/script_server/*.xml",
"templates/*.xml",
]
precedence = "aggregate"
SPDX-FileCopyrightText = "2026 Thomas Vincent <thomasvincent@gmail.com>"
Expand Down
Loading
Loading