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.
  • PreBackupCreate Called before a backup process begins (cloud backups, S3 backups and backups to a MON disk).
  • PostBackupSuccess Called after a backup completes successfully.
  • PostBackupFailed Called when a backup fails during creation or upload.
  • OnTaskAdvisorFindingAdded Called when a new Task Advisor finding is added.
  • OnTaskAdvisorFindingRemoved Called when an existing Task Advisor finding is removed.

Scheduled Hooks

Scheduled hooks run on a schedule instead of in response to an event:

  • CronSchedule Called on a UNIX cron schedule. Each hook chooses where it runs: on the management node, on the chosen servers, or both.

The schedule uses crontab(5) syntax (minute, hour, day of month, month, day of week) and is evaluated in the cluster's scheduling timezone, the same one snapshot schedules use. The schedule picker in Config -> Hook Scripts previews the next runs before you save.

Common Usecases