Configuration¶
Scope¶
This chapter describes the configuration of a processing system and how all the pieces gear into each other. It will cover application specific configuration, inventory (station metadata) and application station bindings.
Overview¶
The SeisComP framework defines a common schema to read configuration parameters. This schema is used by all SeisComP modules with names starting with sc, e.g. scautopick. Other applications might be available as well such as third party applications which use other naming conventions.
A way to discover an application that uses the SeisComP configuration schema
is to call it with --help
. The first lines of a typical output look
like this:
Generic:
-h [ --help ] produce help message
-V [ --version ] show version information
--config-file arg Use alternative configuration file
The reason for that is that there are also other applications which do not
use the SeisComP core and client libraries such Seedlink plugins, Seedlink
itself and some others which are not part of the trunk source package. Those
applications need translators to generate their native configuration when
the configuration is updated (seiscomp update-config
).
Again, the two indicators that an application uses the following configuration schema are:
The application name is prefixed with sc, e.g. scautopick
The output of
--help
looks like the text fragment above
A typical configuration requires the following steps:
Generation and import of the inventory (station meta data)
Configuration of modules
Configuration of bindings.
Note
Standalone modules can also run without inventory.
Inventory¶
A correct inventory is fundamental to SeisComP. Read the inventory section in concepts for a description. SMP 1 can be used to generate the required files in SCML format.
Configuration of Modules¶
SeisComP modules provide 2 types of configurations:
Module configurations define module control parameters which are equally applied to all operations on waveforms, event parameters, etc.
All daemon modules and some command-line tools provide module configurations. Module configurations are overridden by bindings configurations.
Binding configurations define control parameters per station and even stream. They are used for station- and even stream-specific definitions, e.g. the data acquisition from a particular station or server using seedlink or the phase detection by scautopick.
In contrast to module configuration, only some daemon modules and a very few GUI modules provide bindings. Binding configurations override module configurations.
Whether or not a module considers bindings configurations can be read in the module configuration panel of scconfig.
Module configuration¶
Module configuration files are saved as .cfg
files and an application will look
into 6 locations to read all of its configuration parameters:
$SEISCOMP_ROOT/etc/defaults/global.cfg
$SEISCOMP_ROOT/etc/defaults/[application].cfg
$SEISCOMP_ROOT/etc/global.cfg
$SEISCOMP_ROOT/etc/[application].cfg
$HOME/.seiscomp/global.cfg
$HOME/.seiscomp/[application].cfg
The order of files also represents the order of loading. There are three directories involved:
$SEISCOMP_ROOT/etc/defaults/
: This directory ships with the distribution of SeisComP and should never be touched. All contained files might be overwritten with the next software update.$SEISCOMP_ROOT/etc/
: This directory will never be populated by a software update and it is save to store global application configuration files there. Depending on the system setup this directory might be read-only to users. It is called the system configuration directory.$HOME/.seiscomp/
: This directory is in the user’s home directory and it is meant to provide configurations which override default and system configurations. It is called the user configuration directory.
Furthermore there are two filenames involved: global.cfg
and
[application].cfg
. The file global.cfg
will be loaded by all applications
and it is a good place to store common parameters such as messaging
connections or logging configurations.
scconfig provides a graphical interface to adjust the global and the module configuration parameters.
Bindings configuration¶
Bindings configure parameters specific to stations and for a certain module or application. A station might require a custom set of parameters for e.g. data acquisition from a remote data logger or server, for processing or displaying. SeisComP design is that bindings will be stored in the database. All applications requiring this information read the them from the database. In this way consistent inventory and its bindings will be distributed.
Hint
Bindings can be conveniently configured in the Bindings panel of scconfig. Read the section Bindings panel for instructions.
A binding holds the configuration how a station is used in a module.
Parameters defined in bindings override parameters in module configurations. Bindings configurations are saved as stations bindings or as bindings profiles with given names:
Station binding parameters:
$SEISCOMP_ROOT/etc/key/[application]/station_NET_STA
is used only be one station NET.STA.Binding profile parameters:
$SEISCOMP_ROOT/etc/key/[application]/profile_[name]
can be used by many stations. Then any update of this file applies to all stations bound to this profile.
Like in this list, the actual binding parameters for each module are
expected in either etc/key/$MODULE/station_$NET_$STA
or
etc/key/$MODULE/profile_$PROFILE
. That depends if a profile should
be used or not. If the station key file registers a module with a colon
following a name then this name is the profile name. If just a module is given
then the station binding file will be read.
The bindings themselves are links from the module to the station. They are written into key files, e.g.
$SEISCOMP_ROOT/etc/key/station_NET_STA
Example of bindings profiles:
# Binding references
global:__HH
scautopick:default
seedlink:geofon
Example of bindings profiles and a station binding for slarchive:
# Binding references
global:__HH
scautopick:default
seedlink:geofon
slarchive
The key files are named like station_$NET_$STA
, e.g. station_GE_MORC
.
The names within the key files define for which modules the station registers. In the
above example it is the global, scautopick, seedlink and slarchive.
To list all modules a particular station is configured for is very simple by printing the content of the station key file:
$ cat etc/key/station_GE_MORC
seedlink:geofon
global:BH
scautopick
Another way is a bit more complicated but at least all information is there. To show all stations configured for SeedLink could be done this way:
$ for i in `find etc/key -type f -maxdepth 1 -name "station_*_*"`; do
> egrep -q '^seedlink(:.*){0,1}$' $i && echo $i;
> done
etc/key/station_GE_MORC
etc/key/station_GE_UGM
Modules usually read the bindings configuration from the database but not from files. Therefore, the bindings are stored in the database when executing
seiscomp update-config
The database tables involved are ConfigModule
, ConfigStation
, Setup
,
ParameterSet
and Parameter
.
To illustrate the contents of the objects, the XML representation is used below.
<Config>
<module publicID="Config/trunk" name="trunk" enabled="true">
...
</module>
</Config>
A ConfigModule with publicID Config/trunk is created with name trunk. This
ConfigModule is managed by the global initialization script (etc/init/trunk.py
)
and will be synchronized with configured bindings of all trunk modules. The
ConfigModule trunk is the one that is actually used by all configurations unless
configured otherwise with:
scapp --config-module test
Here scapp would read ConfigModule test. Because a ConfigModule test is not managed by seiscomp update-config it is up to the user to create it.
For each station that has at least one binding, a ConfigStation object is attached to the ConfigModule:
<Config>
<module publicID="Config/trunk" name="trunk" enabled="true">
<station publicID="Config/trunk/GE/UGM"
networkCode="GE" stationCode="UGM" enabled="true">
...
</station>
</module>
</Config>
and finally one Setup per module:
<Config>
<module publicID="Config/trunk" name="trunk" enabled="true">
<station publicID="Config/trunk/GE/UGM"
networkCode="GE" stationCode="UGM" enabled="true">
<setup name="default" enabled="true">
<parameterSetID>
ParameterSet/trunk/Station/GE/UGM/default
</parameterSetID>
</setup>
<setup name="scautopick" enabled="true">
<parameterSetID>
ParameterSet/trunk/Station/GE/UGM/scautopick
</parameterSetID>
</setup>
</station>
</module>
</Config>
Here two setups have been created: default (which is a special case for module global to be backwards compatible) and scautopick where each refers to a ParameterSet by its publicID. The next XML fragment shows the ParameterSet referred by the scautopick setup of station GE.UGM:
<Config>
<parameterSet publicID="ParameterSet/trunk/Station/GE/UGM/scautopick"
created="...">
<baseID>ParameterSet/trunk/Station/GE/UGM/default</baseID>
<moduleID>Config/trunk</moduleID>
<parameter publicID="...">
<name>timeCorr</name>
<value>-0.8</value>
</parameter>
<parameter publicID="...">
<name>detecFilter</name>
<value>
RMHP(10)>>ITAPER(30)>>BW(4,0.7,2)>>STALTA(2,80)
</value>
</parameter>
<parameter publicID="...">
<name>trigOff</name>
<value>1.5</value>
</parameter>
<parameter publicID="...">
<name>trigOn</name>
<value>3</value>
</parameter>
</parameterSet>
</Config>
The mapping to the binding configuration files is 1:1. Each parameter in the configuration file is exactly one parameter in the database and their names are matching exactly.
The concept of global bindings which are specialized for each application is reflected by the baseID of the ParameterSet which points to setup default of station GE.UGM:
<Config>
<parameterSet publicID="ParameterSet/trunk/Station/GE/UGM/default"
created="...">
<moduleID>Config/trunk</moduleID>
<parameter publicID="...">
<name>detecStream</name>
<value>BH</value>
</parameter>
</parameterSet>
</Config>
This ends up with a final configuration for scautopick and station GE.UGM:
Name |
Value |
---|---|
detecStream |
BH |
timeCorr |
-0.8 |
detecFilter |
RMHP(10)>>ITAPER(30)>>BW(4,0.7,2)>>STALTA(2,80) |
trigOff |
1.5 |
trigOn |
3 |
which is the concatenation of the two files etc/key/global/station_GE_UGM
and etc/key/scautopick/station_GE_UGM
. The filter grammar is explained in
filter grammar section.
The etc/key
directory is only used to ease the configuration of bindings.
They are finally transferred to the database or converted to other
representations a module might require to access them. The directory etc/key
is meant
for backup and used for copying bindings from one computer to another.
scconfig provides a graphical interface to adjust the global and the module
bindings parameters and to create the bindings. It populates the etc/key
directory and it takes care that they synchronize with the database when processing
Update configuration in the System panel.
Example: global bindings¶
A binding is a set of name value pairs just like a configuration file but for a station. In the file system a binding looks like this:
detecLocid = ""
detecStream = HH
Simple. These are actually two parameters from the global binding and it solves a common issue elegantly: a station might provide a couple of channels, often data in various sampling rates, e.g. LH, BH, SH and HH. Co-located stations with velocity and acceleration sensors also provide at least two channel groups, e.g. HL and HH. Those groups are also provided with different location code, e.g. 00 and 10. To process a station an application needs to know which channel it should process. To display a representative data channel a viewer needs to know which channel to show. Global bindings solve that issue by defining the “preferred” location code and channel code with the two parameters detecLocid and detecStream. The TraceView, scrttv can read all available station bindings, compose a fully qualified channel name from network code (part of the binding), station code, detecLocid and detecStream. It will then lookup the inventory information for that channel and display it.
The meta data of a binding are:
network code
station code
module name
The actual binding data are the key value pairs.
Reading bindings¶
Binding configuration parameters are read during a module start after the module configuration parameters. They override the module configuration. Like module configurations, parameters defined in the global bindings can be overridden in module bindings. The order of loading is:
$SEISCOMP_ROOT/etc/key/global/
: Global bindings configurations$SEISCOMP_ROOT/etc/key/[application]
: Bindings configurations for a particular module.
If the application connects to a messaging server then it will receive the database parameters, connect to it and read the bindings. Otherwise the user has to provide the database address. An application never reads the key directory. It only gets the bindings from the configuration tables.
As with inventory information there might are cases when an application should
not connect to a database and work offline, in particular when --ep
is being
used.
In order to
read the bindings configuration from XML files (again in SCML format),
use scxmldump to dump the configuration XML file and let
the application use this XML file, --config-db
must be used:
$ myapp --config-db config.xml
That will completely bypass the database (even if used for event information or inventory) for reading station bindings.
To extract a configuration XML file from the database, scxmldump can be used:
$ scxmldump -fC -d localhost -o config.xml
One can also create a config XML file straight from the etc/key
directory
with bindings2cfg
:
$ bindings2cfg -o config.xml
To create an XML file from a temporary key directory, an alternative directory
can be specified with --key-dir
:
$ bindings2cfg --key-dir /tmp/key -o config.xml
Summary¶
Bindings are maintained as key files in
etc/key
Key files are another human readable representation of bindings
seiscomp update-config
orseiscomp update-config trunk
writes the information frometc/key
to the databaseAn application never reads
etc/key
Bindings are being read from the database or an XML file