Skip to content

About

Read-only Slurm monitoring for Cacti: queues, running and pending jobs, pending reasons, node and partition state, graphs, Thold alerts, and Maint integration.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

English | 简体中文 | हिन्दी | Español (España) | Español (Latinoamérica) | العربية

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 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; 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 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.

Remote pollers. This release collects only on the main Cacti poller. A cluster assigned to a remote data collector is not collected: the reader there refuses with a logged reason and the health page names the cluster. Remote collection is phase 3.

Memory. Each collection run decodes one scheduler answer at a time, which takes about 12 times the answer's size in PHP memory (measured at about 10 times for job records shaped like Slurm's, plus the text itself). The run raises its PHP memory limit to the Collection Memory setting (1024 MiB by default) and allows answers up to (Collection Memory - 64) / 12 MiB, 80 MiB by default, even when Maximum Answer Size is set higher; the health page warns when it is. A larger answer fails its section as too large, and a run that still runs out of memory is recorded as failed. A large cluster may need both settings raised; 100,000 real job records have not been measured.

Token files. A slurmrestd cluster names a token file; the token itself is never stored in the database, shown on a page, or written to the log. The file must lie inside one of the token file directories set under Configuration > Settings > HPC Scheduler, reached without a symbolic link, and be a regular file owned by the poller user that only that user can write, holding one line: the token, or SLURM_JWT=<token> as scontrol token prints it. With no token directories set, no cluster can use slurmrestd. These two settings are on Cacti's Settings page, so the plugin's Admin realm alone cannot change them; keep each token directory writable only by root and the poller user. A file the group or other users can read is still used, and the health page warns. The health page also warns when the token expires within the configured warning time.

To rotate a token without a window in which the reader sees a partial file, write the new token next to the old one and rename it into place:

dir=/etc/cacti/hpcsched
tmp=$(mktemp "$dir/.token.XXXXXX")
scontrol token username=cactiread lifespan=2592000 > "$tmp"
chown cacti:cacti "$tmp"
chmod 0600 "$tmp"
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); 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.

Tested against real Slurm output. CI starts a six-node Slurm cluster in containers (26.05.5 on every change, 25.11.8 built from source on pushes to main, weekly, and on request) and checks node states, the maintenance reservation, pending reasons, and arrays as the plugin parses them, then collects from that cluster with the plugin's own command and slurmrestd transports. Older releases are covered only by synthetic fixtures. The reader has still not run against a production cluster.

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:

  • No "why is work not starting". Slurm records a reason for each pending job. A full queue next to idle node graphs does not say whether the cause is priority, resource limits, holds, dependencies, or drained nodes.
  • No link between scheduler state and alerting. Thold alerts on a device an administrator has already drained, and administrators create Maint schedules by hand.

The plugin collects one cached snapshot per cluster, publishes it as ordinary Cacti data sources and graphs, maps scheduler nodes onto existing Cacti devices, and can place drained nodes and maintenance reservations into Maint. It reuses Cacti's permissions, remote data collectors, Thold, and Maint, and it is read-only toward the scheduler.

Planned scope

Phase Scope Milestones
0, research Slurm release matrix, upstream behavior confirmation, controller load, node naming fixtures M1
1, cluster graphs Queue depth, pending and running jobs, pending reasons, node states, partition utilization, Thold alerting, health page, release M2, M3, M4
2, nodes and maintenance Node-to-device mapping, per-node state, automatic Maint windows for drained nodes and maintenance reservations M5
3, accounting Fair-share usage, bounded accounting statistics, remote data collectors M6

Out of scope: any scheduler write path (submit, cancel, hold, drain, resume), a plugin-owned alerting engine, a reporting or chargeback engine, per-user and per-job series. PBS Pro, OpenPBS, and LSF backends are research.

Compatibility targets

Component Target
Cacti 1.2.31 or later, no core patches
PHP 8.2 or later; setup.php stays parseable on 8.0 so an unsupported runtime gets a refusal instead of a broken Cacti UI
Slurm 25.05, 25.11, and 26.05, the three latest releases (ADR 0013); 25.11 and 26.05 are tested against a live cluster, 25.05 against fixtures only. Client commands are the default transport (ADR 0012) and use the data parser setting: v0.0.43 by default, which SchedMD removes in 27.05, or v0.0.44 or v0.0.45 on releases that ship them. slurmrestd clusters discover the newest parser the daemon serves
Thold, Maint No Thold change; Maint integration is a proposal that needs Maint maintainers' agreement

Design

  • docs/PLAN.md is the full plan: architecture, upstream facts it depends on (with sources and an explicit list of unconfirmed assumptions), node mapping, state model, security boundaries, performance arithmetic, testing, and risks.
  • docs/decisions/ holds architecture decision records.
  • docs/REQUIREMENTS.md maps every requirement ID to its issue.
flowchart LR
    S[Slurm controller] -->|read-only calls, one set per cycle| R[Reader on the assigned Cacti poller]
    R --> SNAP[(Snapshot tables)]
    SNAP --> SS[Script server inputs]
    SS -->|poller_output| T[Thold and Maint]
    SS --> G[Cacti graphs and permissions]
    SNAP --> MAP[Node to device mapping]
    MAP -->|owned, expiring schedules| T
Loading

How work is tracked

  • Milestones follow the plan's milestones. Each has an epic issue listing its sub-issues and exit evidence.
  • Issues are typed by label: type: requirement, type: research, type: decision, type: epic. Requirement issues state numbered, testable requirements (REQ-AREA-NNN) and acceptance criteria.
  • Labels also carry area:, phase:, priority:, and status:. See CONTRIBUTING.md.
  • The project board shows all issues across milestones.

Contributing

Read CONTRIBUTING.md. Commits need a DCO sign-off. Design discussion happens on issues; open decisions carry the type: decision label.

Security

Report vulnerabilities privately; see SECURITY.md.

License

GNU General Public License v2.0, the same license as Cacti and its plugins. See LICENSE.

About

Read-only Slurm monitoring for Cacti: queues, running and pending jobs, pending reasons, node and partition state, graphs, Thold alerts, and Maint integration.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages