Two kinds of sensor watch Dagster itself instead of an outside system.
An asset sensor, @dg.asset_sensor(asset_key=dg.AssetKey("daily_totals"), job=report_job), runs when the asset has a new materialization since its last tick. The function receives the context and the materialization event; use context.cursor, which Dagster sets to the event's id, as the run key. For assets in the same code location, declarative automation is often simpler; asset sensors shine across code locations or when the reaction is not an asset.
A run status sensor reacts to runs reaching a status. @dg.run_failure_sensor is the common one: it is called once per failed run with context.dagster_run (its id, job name and tags) and context.failure_event. Send the alert from there. monitored_jobs=[...] limits it to some jobs. Like other sensors, both start stopped unless their default_status is RUNNING.
One message per failed run.