diff --git a/docs/chapters/configuration.rst b/docs/chapters/configuration.rst index 7212e6e2..5c6b7de0 100644 --- a/docs/chapters/configuration.rst +++ b/docs/chapters/configuration.rst @@ -81,6 +81,13 @@ This is the default `bastille.conf` file. bastille_template_thin="default/thin" ## default: "default/thin" bastille_template_vnet="default/vnet" ## default: "default/vnet" + ## Monitoring + bastille_monitor_cron_path="/usr/local/etc/cron.d/bastille-monitor" ## default: "/usr/local/etc/cron.d/bastille-monitor" + bastille_monitor_cron="*/5 * * * * root /usr/local/bin/bastille monitor ALL >/dev/null 2>&1" # default: "*/5 * * * * root /usr/local/bin/bastille monitor ALL >/dev/null 2>&1" + bastille_monitor_logfile="${bastille_logsdir}/monitor.log" ## default: "${bastille_logsdir}/monitor.log" + bastille_monitor_healthchecks="" ## default: "" + + Notes ----- diff --git a/docs/chapters/subcommands/monitor.rst b/docs/chapters/subcommands/monitor.rst new file mode 100644 index 00000000..567342e0 --- /dev/null +++ b/docs/chapters/subcommands/monitor.rst @@ -0,0 +1,55 @@ +Monitor +======= + +NEW in Bastille version 1.1.20250814 + +The ``monitor`` sub-command adds, removes, lists and enables/disables monitoring for container services. + +.. code-block:: shell + + ishmael ~ # bastille monitor help ## display monitor help + ishmael ~ # bastille monitor TARGET add "service1 service2" ## add the services "service1" and "service2" to TARGET monitoring + ishmael ~ # bastille monitor TARGET delete service1 ## delete service "service1" from TARGET monitoring + ishmael ~ # bastille monitor TARGET list ## list services monitored on TARGET + ishmael ~ # bastille monitor ALL list ## list monitored services from ALL containers + + ishmael ~ # bastille monitor -s ## return monitoring cronjob status + ishmael ~ # bastille monitor -e ## enable monitoring cronjob + ishmael ~ # bastille monitor -d ## disable monitoring cronjob + +.. code-block:: shell + + ishmael ~ # bastille monitor help + Usage: bastille monitor [option(s)] TARGET [add|delete|list] [service1 service2] + + Options: + + -x | --debug Enable debug mode. + -e | --enable Enable (install) bastille-monitor cronjob. Configurable in bastille.conf. + -d | --disable Disable (uninstall) bastille-monitor cronjob. + -s | --status Return monitor status (Enabled or Disabled). + + +Configuration +------------- + +The monitor sub-command is configurable via the `bastille.conf` file. See below +for configuration defaults: + +.. code-block:: shell + + bastille_monitor_cron_path="/usr/local/etc/cron.d/bastille-monitor" + bastille_monitor_cron="*/5 * * * * root /usr/local/bin/bastille monitor ALL >/dev/null 2&>1" + bastille_monitor_logfile="${bastille_logsdir}/monitor.log" + bastille_monitor_healthchecks="" + + +Alerting modules +---------------- + +The first alerting module to be supported is Health Checks +(https://healthchecks.io), which is both a free SaaS service (up to 20 checks) +and provides a self-hosted option (see `sysutils/py-healthchecks`). + +Simply configure the `${bastille_monitor_healthchecks}` variable with your Ping +URL and you're done! diff --git a/docs/chapters/usage.rst b/docs/chapters/usage.rst index b6623a8f..ace08701 100644 --- a/docs/chapters/usage.rst +++ b/docs/chapters/usage.rst @@ -29,6 +29,7 @@ Usage limits Apply resources limits to targeted jail(s). See rctl(8) and cpuset(1). list List jails, releases, templates and more... migrate Migrate targeted jail(s) to a remote system. + monitor Monitor and attempt to restart container service(s). Manual and cron execution. mount Mount a volume inside targeted jail(s). network Add or remove interfaces from targeted jail(s). pkg Manipulate binary packages within targeted jail(s). See pkg(8). @@ -53,4 +54,4 @@ Usage Use "bastille -v|--version" for version information. Use "bastille command -h|--help" for more information about a command. Use "bastille -c|--config config.conf command" to specify a non-default config file. - Use "bastille -p|--parallel VALUE command" to run bastille in parallel mode. \ No newline at end of file + Use "bastille -p|--parallel VALUE command" to run bastille in parallel mode.