cnspec serve
Start cnspec in background mode to run scheduled security scans.
Run cnspec as a background service that performs scheduled security scans at regular intervals, so you get continuous security monitoring without manually triggering scans. Use --timer to set the scan interval and --splay to randomize the start time. This requires cnspec to be registered with Mondoo Platform.
Scan every 30 minutes with up to 5 minutes of random delay:
cnspec serve --timer 30 --splay 5Scan a set of assets defined in an inventory file:
cnspec serve --timer 60 --inventory-file inventory.ymlcnspec reloads the inventory before every scan cycle, so you don't need to restart the service after you add or edit an inventory file. This includes an inventory.yml that you place next to mondoo.yml after the service starts. If the file is temporarily invalid, for example while you're editing it, cnspec keeps scanning with the last valid inventory. If you remove an inventory.yml that cnspec picked up next to mondoo.yml, cnspec goes back to scanning the local system. An inventory piped in on stdin (--inventory-file -) can only be read once, so cnspec keeps the inventory it read at startup.
Options
-h, --help help for serve
--inventory-file string Set the path to the inventory file
--splay int Randomize the timer by up to this many minutes (default 60)
--timer int Set the scan interval in minutes (default 60)Options inherited from parent commands
--api-proxy string Set the proxy for communications with Mondoo Platform API
--auto-update Enable automatic provider installation and update (default true)
--config string Set config file path (default $HOME/.config/mondoo/mondoo.yml)
--log-level string Set the log level: error, warn, info, debug, trace (default "info")
--logging-config string Path to a logging configuration file (YAML or JSON) that selects the log writer, level, and writer-specific options
--strict Default MQL strict mode for policies that do not declare one: every link in an MQL chain must resolve
-v, --verbose Enable verbose outputSEE ALSO
- cnspec - cnspec CLI