Skip to content

fix(monitor-cpu-load): attribute CPU correctly when run from cron - #45

Merged
locus313 merged 1 commit into
mainfrom
fix/cpu-monitor-cron-path
Oct 10, 2026
Merged

locus313 merged 1 commit into
mainfrom
fix/cpu-monitor-cron-path

Conversation

@locus313

Copy link
Copy Markdown
Collaborator

Alerts showed an empty subscription table and "0 of 0 requests", so the attack-vs-app verdict had no data.

  • Cron's default PATH lacks /usr/sbin, so plesk (and fail2ban-client) were not found. The log showed WARNING: plesk CLI not found on every run. The script now appends the sbin directories to PATH.
  • With an empty owner map, the FNR == NR awk idiom treated the CPU file as the map and produced no rows. It now keys on ARGV[1].

Verified on the server: the owner query works as root, and the log confirms the PATH warning. shellcheck passes.

Cron's PATH lacks /usr/sbin, so plesk was not found and the subscription
map was empty. The FNR == NR awk idiom then consumed the CPU file as the
map, hiding all CPU rows and skipping log analysis.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@locus313
locus313 merged commit 7159852 into main Oct 10, 2026
5 checks passed
@locus313
locus313 deleted the fix/cpu-monitor-cron-path branch October 10, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant