Node Monitor Plugin
The Node Monitor plugin (node_monitor.py) collects node-level load, memory, uptime, temporary filesystem usage (/tmp, /dev/shm), active user sessions, per-process resource metrics, and optional hardware metrics (such as GPU utilization and per-process GPU memory), and writes LML files for LLview's dbupdate action.
Unlike cluster-wide plugins such as the Scheduler plugin—where the LLview Remote workflow runs on a single machine to query a central scheduler—the Monitor Node plugin inspects local kernel interfaces (/proc, ps, df, find, who, nvidia-smi). Because those metrics are local to each host, it is recommended to deploy this plugin as an independent cronjob on every login node, writing each node's LML file to a shared directory accessible by LLview Remote:
* * * * * . ~/.llview_remote_rc ; python3 $LLVIEW_HOME/da/rms/login_nodes/node_monitor.py --config $LLVIEW_CONF/plugins/node_monitor.yaml --prefix login_ --outfolder $LLVIEW_SHARED/remote/ >> "$LLVIEW_DATA/$LLVIEW_SYSTEMNAME/logs/login_$(hostname)$(date +.\%Y.\%m.\%d).log" 2>> "$LLVIEW_DATA/$LLVIEW_SYSTEMNAME/logs/login_$(hostname)$(date +.\%Y.\%m.\%d).errlog"
The short hostname is resolved automatically at runtime (socket.gethostname().split('.')[0]), allowing a single shared YAML configuration file to be used across heterogeneous login nodes (with or without GPUs).
Command-Line Interface
python3 node_monitor.py [OPTIONS]
| Flag |
Required |
Default |
Description |
--config <file> |
No |
node_monitor.yaml |
Path to the YAML configuration file. |
--log-level <level> |
No |
INFO |
Logging verbosity (DEBUG, INFO, WARNING, ERROR). |
--outfolder <dir> |
No |
output.dir or ~/node_monitor_logs |
Directory where the output LML XML file (<prefix><hostname>.xml) is written. |
--prefix <str> |
No |
"" |
Prefix prepended to the output filename and all generated LML <object id="..."> attributes. |
Processing Pipeline
On each execution, the plugin resolves the node's short hostname and executes the enabled collectors in the following order:
- Processes (
processes): Runs ps -eo using the configured field_map, parses numeric types and elapsed durations into seconds, applies min_cpu_pct, min_mem_pct, exclude, and include filters, optionally truncates to top_n, and attaches d_state_threads counts via ps -eLo pid,s.
- Temporary Filesystems (
tmp): Queries overall filesystem capacity via df -B1 and estimates per-user directory usage via find -maxdepth for each configured target path.
- Load Average (
load): Reads 1/5/15-minute load averages and runnable/total process counts from /proc/loadavg.
- Memory (
memory): Reads requested fields from /proc/meminfo (converted from kB to MB) and applies any configured subtract_from_mb or add_to_mb adjustments.
- Logged-in Users (
logged_in_users): Parses active sessions from who -u into per-user session counts, unique remote hosts, minimum idle seconds, and earliest login time.
- Extra Commands (
extra_commands): Evaluates optional condition_cmd rules, runs enabled commands via /bin/bash, parses outputs (raw, json, csv, lines), and routes fields to node_stat, matching process entries, or standalone objects.
- LML Output: Assigns a single shared Unix epoch timestamp (
ts) across all collected entities, reads total_cores (os.cpu_count()) and uptime_secs (/proc/uptime), escapes XML special characters, and writes <outfolder>/<prefix><hostname>.xml.
Section Configuration Reference
output
| Key |
Type |
Default |
Description |
dir |
string |
'~/node_monitor_logs' |
Fallback output directory used when --outfolder is omitted (~ and environment variables are expanded). |
processes
| Key |
Type |
Default |
Description |
enabled |
bool |
true |
Enables or disables process collection. |
sort_by |
string |
'cpu_pct' |
Output field name (from field_map) passed to ps --sort=-<keyword>. |
d_state_threads |
bool |
true |
Counts threads in uninterruptible sleep (D state) per PID via ps -eLo pid,s and stores d_state_threads on each process. |
top_n |
int |
None |
Maximum number of process rows retained after sorting and filtering (0 or omitted keeps all). |
min_cpu_pct |
float |
0.0 |
Excludes processes whose cpu_pct is below this threshold. |
min_mem_pct |
float |
0.0 |
Excludes processes whose mem_pct is below this threshold. |
field_map |
dict |
— |
Map of output_name: ps_keyword passed to ps -eo. The entry whose keyword starts with args is automatically moved to the end of the format string. |
exclude |
dict |
{} |
Regex rules removing matching processes (see Filtering). |
include |
dict |
{} |
Regex rules retaining only matching processes (see Filtering). |
Built-in Field Conversions in field_map
| Output Key |
Conversion Applied |
cpu_pct, mem_pct |
Parsed as float. |
pid, ppid, threads, priority, nice, cpu_time_secs |
Parsed as int. |
mem_rss_mb, mem_vsz_mb |
Parsed as kB from ps and converted to MB (float, rounded to 1 decimal). |
elapsed |
Parsed from [[DD-]HH:]MM:SS and converted to total integer seconds. |
| Any other key |
Kept as a string. |
tmp
| Key |
Type |
Default |
Description |
enabled |
bool |
true |
Enables or disables temporary filesystem collection. |
per_user_find_depth |
int |
4 |
Maximum directory depth traversed by find for per-user usage estimates. |
targets |
list[dict] |
[{path: '/tmp', prefix: 'tmp'}] |
List of target filesystems (path and prefix). Each target attaches <prefix>_total_mb, <prefix>_used_mb, <prefix>_avail_mb, and <prefix>_used_pct to node_stat, and emits user_storage objects per user. |
path |
string |
'/tmp' |
Legacy single-path fallback used if targets is omitted (uses prefix 'tmp'). |
load
| Key |
Type |
Default |
Description |
enabled |
bool |
true |
Enables or disables reading /proc/loadavg. |
memory
| Key |
Type |
Default |
Description |
enabled |
bool |
true |
Enables or disables reading /proc/meminfo. |
fields |
list[string] |
['MemTotal', 'MemFree', 'MemAvailable', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree', 'Shmem'] |
/proc/meminfo keys to collect. Converted from kB to MB and stored on node_stat as mem_<field>_mb. |
subtract_from_mb |
dict[string, string] |
{} |
Map of meminfo_field: shell_cmd. Runs shell_cmd (expecting a numeric value in MB) and subtracts it from mem_<field>_mb (floored at 0.0). Failed or empty commands are skipped. |
add_to_mb |
dict[string, string] |
{} |
Map of meminfo_field: shell_cmd. Runs shell_cmd (expecting a numeric value in MB) and adds it to mem_<field>_mb. Failed or empty commands are skipped. |
logged_in_users
| Key |
Type |
Default |
Description |
enabled |
bool |
true |
Enables or disables who -u session collection. |
extra_commands
A list of custom shell commands executed via /bin/bash (shell=True, supporting pipes and subshells). Commands exiting with a non-zero return code are logged as errors and omitted from the LML output.
| Key |
Type |
Default |
Description |
name |
string |
— |
Identifier for the command (required). |
cmd |
string |
— |
Shell command to execute (required). |
enabled |
bool |
true |
Enables or disables the entry. |
condition_cmd / conditions |
string / list / dict |
— |
Pre-execution condition(s) (see Conditional Execution). |
parse |
string |
'raw' |
Output parser: 'raw', 'json', 'csv', or 'lines'. |
fields |
list[string] |
[] |
Column names mapped by position (required when parse: csv). |
timeout |
int |
15 |
Command timeout in seconds. |
inject_into |
string |
— |
Target entity for parse: csv rows: 'process' (matches by pid; unmatched/excluded PIDs are skipped), 'node' / 'node_stat' (attaches extra_<name>_<row_idx>_<field>), or omitted for standalone extra_<name> objects. |
parse Output Routing
parse Mode |
Expected stdout |
LML Output Behavior |
raw |
Single string value |
Attached directly to node_stat as extra_<name>. |
json |
JSON object |
Scalar top-level keys are attached to node_stat as extra_<name>_<key>. |
csv |
Comma-separated lines matching fields |
Merged into process or node_stat via inject_into, or emitted as standalone extra_<name> objects. |
lines |
One item per line |
Stored internally as a list (lines); skipped during scalar LML serialization. |
Filtering (exclude and include)
In processes, regex matching uses re.search (substring match; use ^...$ anchors for exact matches) against the mapped output field names in field_map:
| Rule Format |
Behavior |
Example |
dict[field, string] |
Matches if the field value matches the regex. |
exclude: {user: '^root$'} |
dict[field, list[string]] |
Matches if the field value matches any regex in the list. |
exclude: {user: ['^root$', '^systemd-'], cmd: ['/usr/lib/systemd/systemd']} |
exclude is evaluated before include: any row matching at least one exclude rule is dropped, and when include is defined, a row must match at least one include rule to be retained.
Conditional Execution (condition_cmd)
condition_cmd (or conditions) determines whether an extra_commands entry should run on the current node based on exit codes (0 = pass, non-zero = skip, 5-second timeout per check):
| Format |
Logic |
Example |
string |
Command must exit with 0. |
condition_cmd: "test -s /etc/FZJ/systemname" |
list[string] |
Logical AND: all commands must exit with 0. |
condition_cmd: ["command -v nvidia-smi", "nvidia-smi -L"] |
dict (any / or) |
Logical OR: at least one command must exit with 0. |
condition_cmd: {any: ["test -e /dev/nvidia0", "test -e /dev/kfd"]} |
dict (all / and) |
Logical AND: all commands must exit with 0. |
condition_cmd: {all: ["command -v nvidia-smi", "nvidia-smi -L"]} |
Generated LML Entities
Every <object> emitted in <prefix><hostname>.xml carries hostname and ts (Unix epoch seconds) so LLview can join tables by node and detect stale files when a node becomes unresponsive.
Entity type |
Object id Pattern |
Emitted <data> Keys |
node_stat |
<prefix><hostname> |
hostname, ts, total_cores, uptime_secs, logged_in_sessions, logged_in_unique_users, load_*, mem_<field>_mb, <tmp_prefix>_total_mb, <tmp_prefix>_used_mb, <tmp_prefix>_avail_mb, <tmp_prefix>_used_pct, plus raw/json/node-injected extra_* keys. |
process |
<prefix><hostname>_proc_<pid> |
hostname, ts, all mapped keys in field_map, d_state_threads, plus process-injected extra_commands keys (e.g., gpu_mem_used_mb, gpu_sm_pct, gpu_mem_bw_pct). |
user_storage |
<prefix><hostname>_storage_<prefix>_<user> |
hostname, username, target_path, ts, used_mb. |
user_session |
<prefix><hostname>_session_<user> |
hostname, username, ts, session_count, from_hosts, min_idle_secs, oldest_login. |
extra_<name> |
<prefix><hostname>_extra_<name>_<idx> |
hostname, ts, plus all fields defined on the parse: csv command (when inject_into is omitted). |
Example Configuration
A reference Node Monitor configuration is maintained in the LLview configuration repository: