Hook Scripts

Hook scripts are scripts that are executed during the lifecycle of your croit cluster. Hook scripts can be created in Config -> Hook Scripts.

Server Hooks

Server hooks are executed on your croit cluster nodes:

  • PreNetworkConfig Called before the network configuration on a server is changed.
  • PostNetworkConfig Called after a network configuration change on a server was applied.
  • PreDaemonStart Called before the croit daemon on a server runs the initial configuration. This is a good place to install custom drivers or packages (e.g., via the /api/extra-files endpoint).
  • PostDaemonStart Called after the croit daemon finishes startup on a server.
  • PreFormatDisk Called before the croit daemon formats a disk.
  • PostFormatDisk Called after the croit daemon formats a disk.
  • PostCephDaemonStart Called after a Ceph daemon is started by the croit daemon. Does not trigger for automatic udev-based starts on startup or hot swap.
  • PostConfigChanged Called after any configuration on a server was changed.
  • OnPersistentAvailable Called after /persistent (a place to store server-specific data in CephFS) is mounted.
  • OnCephFsSnapshotComplete Called after CephFS snapshot completion. If multiple servers are selected, a server will be randomly chosen to run the hook.
  • OnRbdSnapshotComplete Called after RBD snapshot completion. If multiple servers are selected, a server will be randomly chosen to run the hook.

Management Node Hooks

Management Node hooks are executed on the croit management node:

  • OnHealthDegrade Called when a health warning appears, the count of a warning increases (ignored above 5) or the Ceph status worsens.
  • OnHealthImprove Called when a health warning disappears or the count of a warning decreases (ignored above 5).
  • OnHealthRecover Called when the Ceph status transitions back to HEALTH_OK.
  • PreCrushMapChange Called before the CRUSH map is changed by croit.
  • PostCrushMapChange Called after the CRUSH map is changed by croit.
  • OnDhcpLeaseUpdate Called when the DHCP server gives out a new lease or updates an existing lease.
  • OnAudit Called after new audit event is inserted.
  • OnCroitStartup Called after the croit app has finished starting. Some startup jobs may still be running in the background, see OnCroitAsyncStartup.
  • OnCroitAsyncStartup Called after the croit app has finished its asynchronous startup jobs. This usually happens some time after OnCroitStartup.

Common Usecases