Set up job capacity alerts
Turn the decision matrix into Prometheus alerts. You need the baseline first.
Plan your alerts
The rules, recording rules, and routing in this topic use Prometheus and Alertmanager. If you use a different monitoring stack, recreate the same logic in it:
- Count job and task starts each minute, and compute the 30-day p99 of the busy minutes.
- Flag demand as above baseline when at least five of the last 15 minutes beat both your floor and 1.5 times the p99.
- Compute host CPU and Workflow Engine CPU per server, with Workflow Engine CPU as a percent of its thread ceiling.
- Combine the three signals for each row of the decision matrix, and require the condition to hold for the
forduration before the alert fires. - Route by severity, and suppress lower severities while a higher one fires for the same host.
The alerting plan has two parts. Decision-matrix alerts turn the matrix rows into alerts that name the action to take. Recommended-metric alerts cover data health, host, process, MongoDB, Redis, and downstream signals. Set up the data-health alerts first, because every other alert depends on them.
Itential documents thresholds for host, process, MongoDB, and Redis only. The rest are proposals to tune from your baseline.
- Use Itential’s three tiers as severity labels: warning, critical, and emergency.
- Group by alert name and host, and suppress lower tiers while a higher one fires for the same host and resource.
- Run every new alert in notify-only mode for two weeks, count false positives, and tune before it pages anyone.
Understand the for setting
Every alert rule in this topic has a for setting. It’s a field in a Prometheus alert rule, not part of the PromQL query. It sets how long the alert condition must stay true, without a break, before the alert fires. For example, for: 15m means the condition must hold for 15 minutes in a row. If the condition drops out at any point, the timer starts again.
A longer for ignores short spikes and alerts later. A shorter one alerts sooner and more often. To see for in use, look at the for: line in each alert in the rules file. To change it, see the steps to shorten the alert window in that section.
Decision-matrix alerts
Each alert matches one row of the matrix. Host CPU between 70% and 85% for 5 minutes raises ItentialHostCpuWarningBand regardless of demand. The healthy row needs no alert.
The rules work as follows:
itential:demand:job_start_1mcounts job starts each minute.itential:demand:job_start_1m:p99_30dis the p99 of busy minutes over 30 days. The task rules work the same way.itential:demand:above_baselineis1when job or task starts are above baseline, and0otherwise. A signal counts as above baseline when the per-minute count beat both its floor and 1.5 times its p99 in at least five of the last 15 minutes. Requiring five of 15 stops one burst from tripping a decision.itential:host_cpu:busy_pctanditential:wfe_cpu:ceiling_pctgive host and Workflow Engine CPU per server. Both get ahostlabel from the instance name, so the alerts can matchnode_exporterandprocess_exporterseries for the same server.- Each alert combines the three signals.
and on (host)pairs the two CPU figures from the same server, andand on ()adds the cluster-wide demand flag. Thefor:duration means the condition must hold that long before the alert fires.
Example scenarios
Assume a job p99 of 40 per minute, so the demand line is 60 jobs a minute. Workflow Engine figures are a percent of its thread ceiling, so they hold at any thread count once the divisor in the rules matches your task_worker_thread_count. The second scenario uses three threads to show the conversion.
Time to fire is the sum of three delays. Demand needs five busy minutes before the flag turns on. CPU values are 5-minute averages, so a sudden jump takes up to 5 minutes to show at full height. Then the for: duration must elapse.
No alert fires in these cases:
- Host CPU below 70% with Workflow Engine CPU between 70% and 90% is a watch zone. No alert fires, so watch the trend, and add your own rule if you need one for it.
- Short spikes don’t trigger anything. If the Workflow Engine hits 100% for 3 minutes and drops back, the 15-minute window resets.
Load the decision-matrix rules
Save the rules file
Save the rules in the following block as itential-decision-matrix.rules.yml. Load the file at the start of the baseline phase so the recording rules collect 30 days of history. If you already did, the rules are running, so use these steps to change them. The alerts stay quiet until you connect Alertmanager.
Set the thread-count divisor
The rules ship with a divisor of 1 in itential:wfe_cpu:ceiling_pct, the Itential default for task_worker_thread_count. If you run more worker threads, replace it with the value set on one Platform instance. Don’t use the total across instances, so two servers with three threads each use a divisor of 3, not 6. Every Platform host must use the same task_worker_thread_count, because the rules use one divisor for all of them. When you raise the thread count, update the divisor and reload Prometheus. Otherwise the ceiling is calculated too low and the Workflow Engine looks saturated too early.
Set the host regex
Replace <itential-hosts> with a regex for your Platform servers. Prometheus matches =~ against the whole label value, and instance often includes a port or domain, such as pe-iap01:9100. For servers pe-iap01 and pe-iap02, this pattern is the safest:
The shorter pe-iap0[12].* also matches names such as pe-iap010. The pattern pe-iap.* matches every server that starts with pe-iap, including ones you add later.
Confirm the match first. This query lists exactly your Platform servers:
Set the demand floors
The floor is the minimum number of starts per minute before demand can count as above baseline. It matters on quiet Platforms. With a 30-day p99 of 2 jobs a minute, 1.5 × p99 is only 3, and an ordinary small batch would trip every demand alert. Start each floor at your busy-minute p50, rounded up. The rules use 10 jobs and 50 tasks. Raise a floor if alerts fire on loads that caused no slowdown. Lower it if a real surge stayed under it. Recheck at each quarterly refresh.
To shorten the alert window, edit the file:
Change the duration
In each alert, change for: 15m to for: 10m or for: 5m. Change ItentialOutOfCompute from for: 10m to for: 5m if you want it faster too.
Don’t go below 5 minutes. Host and Workflow Engine CPU use 5-minute rates, so a shorter for: adds noise without catching problems sooner.
Use a fixed p99
By default, the demand alerts compare each minute with the 30-day p99 of your busy minutes. Use a fixed value instead in these cases:
- You have less than 30 days of history. Recording rules don’t backfill, so until the history builds up, a missing p99 reads as within baseline and the demand alerts stay quiet.
- You want to alert against a number you chose, such as a ceiling you tested.
A fixed number doesn’t follow growth. Update it each time you refresh your baseline. When you have 30 days of history, restore the original quantile_over_time expressions.
Route alerts in Alertmanager
Prometheus evaluates the rules and sends firing alerts to Alertmanager. Prometheus doesn’t notify anyone itself. Alertmanager groups, routes, and delivers the notifications.
Connect Alertmanager when you finish the baseline phase and want notifications. Add it under alerting in prometheus.yml:
Every alert sets three labels. severity is critical, warning, info, or emergency. category is decision, host, or a recommended-alert category. resource is cpu, memory, disk, network, mongodb, redis, jobs, or downstream. The host label comes from the scrape relabeling. Add host and resource to any alert you write. The decision alerts use critical, warning, and info. The emergency tier is for Itential’s tiered resource alerts. The following example pages on-call for emergency alerts, sends critical alerts to the team channel, and sends info and everything else to email.
The inhibit rules match on host and resource, so a critical CPU alert quiets the warning CPU alerts on the same host but not a disk alert. An emergency memory alert quiets only the critical and warning memory alerts. The rules file sets resource on every alert, and host comes from the scrape relabeling.
Validate the configuration with amtool check-config alertmanager.yml, reload Alertmanager, and test routing with a test alert:
If you use Grafana-managed alerting instead, create the same conditions as Grafana alert rules. The expressions carry over unchanged.
Recommended-metric alerts
These alerts cover the other metrics you recorded in the baseline. The decision-matrix alerts already cover demand, host CPU, and Workflow Engine CPU, so they aren’t repeated here. Host CPU between 70% and 85% for 5 minutes, which no matrix row covers, raises the ItentialHostCpuWarningBand warning in the decision-matrix rules file.
For the Itential tiers, see Exporters. The following rules are examples. Build the others the same way, and set the network and IOPS thresholds to your link speed and volume rating.
Check each file with promtool check rules and run every expression in Prometheus before you load it.
These alerts leave out jobs that run too long, started-versus-completed gaps, and any capacity judgment built on completion counts or durations. Manual tasks and long-running jobs trigger those when nothing is wrong. The two task-completion alerts in the table are the exception. They watch for stuck workers, not capacity.
Per-runner job concurrency matters if you run gateway servers, but Itential describes it qualitatively and publishes no metric or threshold, so it isn’t in this list.