Monitor Configuration (monitors.yaml)
Monitors are the core of Argus, defining what events to watch for on the blockchain and what actions to take when those events occur. This document explains how to configure your monitors.yaml file.
Basic Structure
A monitors.yaml file contains a list of monitor definitions. Each monitor has a name, network, filter_script, and a list of actions.
monitors:
- name: "Large ETH Transfers"
network: "ethereum"
filter_script: |
tx.value > ether(10)
actions:
- "Telegram Large ETH Transfers"
Monitor Fields
name(string, required): A unique, human-readable name for the monitor.network(string, required): The blockchain network this monitor should observe (e.g., "ethereum", "sepolia", "arbitrum"). This must correspond to a network configured in yourapp.yaml.address(string, optional): The contract address to monitor. If omitted, the monitor will process all transactions on the specifiednetwork(useful for native token transfers). Set to"all"to create a global log monitor that processes all logs on the network (requires anabi). See Example 1: Basic ETH Transfer Monitor for an example without an address, and Example 4: All ERC20 Transfers for a Wallet for an example of global log monitoring.abi(string, optional): The name of the ABI (Application Binary Interface) to use for decoding contract events. This name should correspond to a.jsonfile (without the.jsonextension) located in theabis/directory (or the directory configured for ABIs inapp.yaml). Required iffilter_scriptaccesseslogdata. See ABI Management for more details and Example 2: Large USDC Transfer Monitor for an example.actions(list of strings, required): A list of names of actions (defined inactions.yaml) that should be triggered when this monitor'sfilter_scriptreturnstrue.
Monitor Validation
Argus performs several validation checks on your monitor configurations at startup to ensure they are correctly defined and can operate as expected. If any validation fails, the application will not start and will report a detailed error.
Here are the key validation rules:
-
Network Mismatch: The
networkspecified in a monitor must exactly match thenetwork_idconfigured in yourapp.yaml. -
Unknown Action: Every action name listed in a monitor's
actionsfield must correspond to anamedefined in youractions.yamlfile. -
Invalid Address: If an
addressis provided, it must be a valid hexadecimal Ethereum address (e.g.,0x...) or the special string"all"for global log monitoring. -
Script Compilation: The
filter_scriptmust be valid Rhai code that compiles without errors. -
Script Static Analysis: Argus analyzes your Rhai script to prevent common logical errors before they can cause issues at runtime. This includes:
- Log Access without ABI: If your script accesses the
logvariable (e.g.,log.name), the monitor must have anabifield defined. - ABI Requirement: If an
abiis specified, the corresponding ABI file must exist in the configuredabi_config_pathand be a valid JSON ABI. - Return Type: The script must evaluate to a boolean (
trueorfalse). Argus will reject scripts that return other types. - Invalid Field Access: The script is checked for invalid field access (e.g.,
tx.foobar,log.params.nonexistent). The validator uses the provided ABI to ensure thatlog.paramsaccess is valid.
- Log Access without ABI: If your script accesses the
Using the dry-run CLI command is highly recommended to test your monitor configurations and scripts against historical data, which can help catch validation issues early.
Examples
For more detailed examples of monitor configurations, refer to the Example Gallery.