Skip to content

MagicNetworkMonitoringConfig

Source: src/Cloudflare/MagicNetworkMonitoring/Config.ts

The Magic Network Monitoring (MNM) account configuration — the singleton that registers your network’s routers (and optionally WARP devices) as flow-data sources and sets the fallback packet sampling rate.

There is exactly one MNM configuration per Cloudflare account, and MNM rules cannot be created until it exists. Creating a second configuration fails (MnmConfigAlreadyExists), so reconcile tolerates the race by falling through to an update. When the engine has no prior state but a configuration already exists on the account, read reports it as Unowned and takeover is gated behind --adopt.

Minimal configuration

const config = yield* Cloudflare.MagicNetworkMonitoringConfig("Mnm", {
name: "my-network",
defaultSampling: 1,
});

Configuration with router IPs

const config = yield* Cloudflare.MagicNetworkMonitoringConfig("Mnm", {
name: "my-network",
defaultSampling: 100,
routerIps: ["203.0.113.1/32"],
});
const config = yield* Cloudflare.MagicNetworkMonitoringConfig("Mnm", {
name: "my-network",
defaultSampling: 1,
});
// Reference an output attribute so the rule deploys after the config.
yield* Cloudflare.MagicNetworkMonitoringRule("VolumetricAlert", {
accountId: config.accountId,
type: "threshold",
prefixes: ["10.0.0.0/24"],
bandwidthThreshold: 1_000_000,
});