API Reliability Monitor with Kestra
Monitor an HTTP endpoint, detect unexpected status codes, and generate structured health events.
Run a Kestra flow only on the last Saturday of every month using a Schedule trigger gated by a DayWeekInMonth `when` expression.
id: schedule-condition-dayweekinmonth
namespace: company.team
triggers:
- id: schedule
type: io.kestra.plugin.core.trigger.Schedule
cron: "0 11 * * *"
when: "{{ isDayWeekInMonth(trigger.date, 'SATURDAY', 'LAST') }}"
tasks:
- id: hello
type: io.kestra.plugin.core.log.Log
message: Demo for DayWeekInMonth condition
Plain cron expressions cannot express calendar rules like "the last Saturday of every month" or "the second Tuesday." This blueprint shows how Kestra solves that with a daily io.kestra.plugin.core.trigger.Schedule trigger combined with a when Pebble expression built on the isDayWeekInMonth() function, so the flow evaluates every day at 11am but only actually runs when the trigger date lands on the last Saturday of the month. It is the canonical pattern for monthly, position-based scheduling (week-of-month plus day-of-week) that raw cron syntax simply does not support.
schedule trigger uses cron 0 11 * * *, which fires the evaluation every day at 11am.when expression calls isDayWeekInMonth({{ trigger.date }}, 'SATURDAY', 'LAST').SATURDAY, LAST) mean the function returns true only on the last Saturday of the month.hello task (io.kestra.plugin.core.log.Log) runs and logs a demo message. On every other day the expression is false and no execution is created.A standard scheduler can fire on a day of the month, but it cannot natively express "the last Saturday" or "the first Monday." Kestra closes that gap with a declarative when Pebble expression on top of the Schedule trigger, and adds retries, backfills, full execution lineage, and event-driven triggers around the same flow. You get position-based calendar logic plus production-grade orchestration in one place.
This flow uses no secrets. The hello task only logs a message, so no credentials are required.
when expression immediately.isDayWeekInMonth() arguments (day of week, and position: FIRST, SECOND, THIRD, FOURTH, LAST) for other calendar rules.hello Log task with your real workload: a database job, an export, or a downstream subflow.when expression with and/or to further narrow when the flow runs.