Which Config File to Use
Butler SOS can use multiple config files. Here you learn to control which one is used.
A description of the config file format is available in the Configuration File Format reference.
Select Which Config File to Use
Butler SOS uses configuration files in YAML format.
Butler SOS comes with a default config file called production_template.yaml.
Make a copy of it, then rename the copy to butler-sos-config-prod.yaml, production.yaml, staging.yaml or something else suitable to your specific use case. The file name must end in .yaml.
Update the config file as needed (see the config file reference page for details).
Important
Trying to run Butler SOS with the default config file (the one included in the files download from GitHub) will not work - you must adapt it to your server environment. For example, you need to enter the IP or host name of your Sense server(s), the IP or host name where Butler SOS is running, where the Sense certificates are stored, etc.
Butler SOS cannot run without a config file, which you point it at with the -c (or --configfile) option:
butler-sos --configfile /opt/butler-sos/config/butler-sos-config-prod.yaml --loglevel infoOn Windows:
butler-sos.exe --configfile d:\some\path\butler-sos-config-prod.yaml --loglevel infoWhen no config file is given
Changed in 15.1.2
Before Butler SOS 15.1.2, starting without a config file printed the help text, gave no reason, and exited with code 0 — "finished normally". That looked like Butler SOS refusing to start for no visible reason, and restart policies and monitoring treated it as a clean exit.
If Butler SOS is started without a config file, it:
- Prints an error saying the config file is missing, after the usual help text.
- Exits with code 1, so Docker, systemd and scripts can tell that it did not start.
The help text is shown first, followed by the error, framed so it is easy to spot at the end of the help text:
================================================================
Error: No config file specified.
Use -c <file> or --configfile <file> to point Butler SOS at one.
================================================================In a terminal that supports colour, the frame and the first line of the error are shown in red. Colour is left out when the output goes to a log file, a pipe or a container log, and when the NO_COLOR environment variable is set, so logs contain plain text only.
The help text and the error are both written to standard error rather than standard output. --help and --version are unchanged: they still print to standard output and exit with code 0.
The most common cause: running Butler SOS through npm
If you run Butler SOS from a copy of the source code with npm, this command looks right but does not work:
npm run butler-sos -c src/config/production.yamlnpm has its own -c option, so it keeps -c and the file name for itself and starts Butler SOS with no options at all. Butler SOS never sees the config file.
Butler SOS recognises this case and says so:
===================================================================
Error: No config file specified.
Use -c <file> or --configfile <file> to point Butler SOS at one.
npm read "-c src/config/production.yaml" as one of its own options,
so the config file never reached Butler SOS.
Add -- after the script name to pass options on to Butler SOS:
npm run butler-sos -- -c src/config/production.yaml
===================================================================The -- tells npm that everything after it belongs to Butler SOS. The same applies to every other Butler SOS option, such as --loglevel:
npm run butler-sos -- -c src/config/production.yaml --loglevel debugRunning Node.js directly avoids npm altogether:
node src/butler-sos.js -c src/config/production.yamlThe standalone Butler SOS executables and the Docker image do not go through npm, so they are not affected by this.
When the config file does not exist
Changed in 15.1.2
Before Butler SOS 15.1.2, a -c option pointing at a file that is not there gave only Error: Specified config file does not exist, without saying where Butler SOS had looked. Since 15.4.0 the error is shown in the same report as every other config file problem.
If the -c option points at a file that is not there, Butler SOS names the full path it tried:
Config file /opt/butler-sos/src/config/production.yaml has 1 problem:
There is no config file at /opt/butler-sos/src/config/production.yaml. "src/config/production.yaml" was resolved from the current directory, /opt/butler-sos.
Fix this and start Butler SOS again. Run with --help for the command-line options.The sentence about the current directory appears only when the path you gave is relative. A relative path is looked up from the directory Butler SOS was started in, not from where the Butler SOS program itself is installed. Starting it from a different directory — a service manager, a scheduled task, or a shortcut with a different working directory — is the usual reason a config file that plainly exists is reported as missing. Use an absolute path in service definitions to rule this out.
This error is written to standard error rather than standard output, and Butler SOS exits with code 1. Started with --on-invalid-config wait, Butler SOS instead reports the missing file and stays up without starting any of its services, so that a service manager does not restart it in a loop. See Staying up on an invalid config file.
Docker and systemd
The Butler SOS Docker image does not include a config file option in its default command. A container started without one — for example, a Docker Compose file whose command: line is missing or misspelled — exits with code 1 and the error above appears in the container log.
Under a restart policy such as Docker's restart: on-failure or systemd's Restart=on-failure, the container or service will restart and fail again until the config file option is added. That restart loop is intended: it makes a setup that can never start visible, instead of leaving Butler SOS quietly stopped. Check the log, add the -c option, and the loop stops.
To limit how often a permanently broken setup is retried, give the restart policy a maximum retry count (Docker: restart: on-failure:5; systemd: StartLimitBurst and StartLimitIntervalSec).
Running Several Butler SOS Instances in Parallel
If you have several Sense clusters (for example DEV, TEST and PROD environments) you can either monitor them all from a single Butler SOS instance, or set up separate instances for each Sense cluster.
The second case is implemented by creating several config files: butler-sos-dev.yaml, butler-sos-test.yaml and butler-sos-prod.yaml.
In this scenario three instances of Butler SOS should be started, each given its own config file with the --configfile command line option.
Note
If running several Butler SOS instances in parallel, you must also ensure that each one uses unique port numbers for their respective UDP servers, etc.