Server side of the Seedlink protocol is implemented as a C++ module which is used as a basis of the Seedlink program (the Seedlink server). Client side is implemented as an extension to the Comserv package--most Comserv clients (netmon, datalog, datadump, msgmon, qplot, dpda, etc.) work unmodified in the Seedlink system.
Seedlink server uses only high-level socket interface, so it can run on any physical communication media which is supported by the underlying operating system; this includes modems, ISDN, and Ethernet among others. It is possible to link several Seedlink systems together--this allows both ``chain'' or ``star'' type communication models or a mixture of both.
Seedlink is designed to support unreliable connections--some number of recent packets are kept in the main memory for very efficient access, older packets are temporarily stored in the disk buffer. So it is possible to completely recover the connection even if the network is down for a long time. The size of memory and disk buffers can be specified by the user. No error correction is implemented by the Seedlink, however, because the TCP protocol guarantees error-free communication.
The data source of a Seedlink server can be anything which supported by a Seedlink ``plugin''. Data supplied by a plugin can be in a form of Mini-SEED packets or just raw samples. In the latter case, Seedlink server uses an integrated, flexibly configurable, Stream Processor module to create the datastreams and assemble Mini-SEED packets. Two plugins have been implemented--Comserv plugin is used to feed Comserv data into Seedlink and to create Seedlink ``chains''. Serial plugin is designed to support various serial digitizer protocols and can also read data from a UNIX fifo.
It is worth to note that the Comserv package used in the latest SeisComP distribution is completely backwards compatible with the Berkeley distribution. It is possible to compile the Comserv package with a regular C compiler on a Sun machine to get a big-endian version of the binaries with Seedlink support.
The drawback of this approach is that the design is not symmetric: Quanterra is a ``special case'' since it is directly supported by the Comserv while all other digitizers need some kind of Seedlink plugin for their support. To make the architecture more symmetric and easier to understand, we have to run two instances of the Seedlink server as seen below.
.
Note that Digiserv and Seedlink are two instances of the same program:
one is used internally in the system, the other is used to serve outside
world.
![]() |
serial_plugin -v edata 255>data.datType Ctrl-C to stop the program. The file data.dat should now contain some messages and data in Seedlink's internal format. If you want to test the digitizer without a GPS, you need to set pctime=1 in the configuration. If this works, we can go to the next step.
First we'll need to tell the Digiserv, how it should create Mini-SEED channels from the raw data supplied by the serial_plugin. This configuration is stored in streams.ini and the easiest way to set it up is to take streams.ini supplied in the distribution and make necessary modifications.
The configuration of Digiserv is stored in the [digiserv] section of the file seedlink.ini; sample seedlink.ini is supplied in the distribution.
Now we can test digiserv by entering at the shell prompt:
digiserv -vAlong with Digiserv's messages, messages from serial_plugin should also appear, because it is started by the Digiserv. Let's open another xterm and type:
telnet localhost 60999If this succeeds then Digiserv is listening at this port. Now type:
HELLODigiserv should respond with a message containing the version of the program and station name. Now enter:
FETCHDigiserv should respond with some garbage after a short time. If the garbage doesn't appear and the Serial Plugin was checked to be functional in the previous step, then there are most probably one or more of the following reasons:
Let's hope that everything works, so we can go to the next step.
Most notable exception to this is the Netmon client: the job of Netmon is to query the servers for status of the clients and to start and shutdown servers and clients according to user requests. Before shutting down the system, Netmon first sends the ``suspend'' command to the servers, then waits until no client has pending data. This ensures that there will be no data loss when you restart the system: if you care about data gaps, you should use Netmon instead of just killing the programs.
When setting up a Comserv system, we will first have to create the files /etc/stations.ini and /etc/network.ini, which are located in /etc instead of /home/sysop/config for historical reasons. Former is a general Comserv file which is used by all Comserv programs to find station's individual config file. The server will also look for the source= parameter in this file to find out if it should connect a Seedlink server or a local Quanterra: you should set source=comlink for all your Quanterra stations and source=seedlink for all remote Seedlink and local Digiserv stations.
/etc/network.ini contains system-wide configuration of the Netmon client. The content of this file is thoroughly documented in the file netmon.txt. Sample versions of stations.ini and network.ini can be found in the distribution.
Each station has an config file, called station.ini, which is located in that station's directory. Comserv server uses the [comlink] or [seedlink] section of this file, depending on the setting of the source= parameter in /etc/stations.ini. Traditionally, the station.ini file has a section for each Comserv client and Netmon will warn if it is asked to run a client which has no section in station.ini. Some clients (normally not run by the Netmon) have separate config files, though.
Once /etc/stations.ini and /etc/network.ini have been set up, a separate directory, as specified in the /etc/stations.ini, has to be created for each station, containing the station.ini file. You can replicate the version which is found in the distribution, change station codes to their right values and make other necessary modifications. Be sure to set the segid= parameter to a unique value for each station--it will save you lots of head scratching later. You can delete the [comlink] section if the station is a remote Seedlink station or a local station served by the Digiserv. In the same way, you can delete the [seedlink] section if the station is a local Quanterra station.
For Seedlink stations, you should set the port= parameter to the Internet address of the Seedlink server; for Digiserv stations (which are technically local Seedlink stations), you should set the port= parameter to something like localhost:60999, depending on the port setting in the [digiserv] section of seedlink.ini. The uptime=, standby=, schedule=, ifup=, and fdown= parameters should be commented out, unless you want to run the Comserv in the ``dialup mode''2.
One more parameter which deserves attention is netto= (network timeout). If the Comserv server doesn't receive any data from Seedlink in this number of seconds, it closes the connection and opens anew. It doesn't make sense to set netto= to a value which is smaller than the dialing interval if you have a dialup link somewhere in the way, unless you want to get lots of messages in your log files.
Here are some very important things to note about Comserv's clients:
client1=dlog,/home/sysop/bin/datalogand not try to use eg.
client1=datalog,/home/sysop/bin/datalogbecause Netmon queries the servers for running clients, and it will not notice that Datalog is running unless you use the right client name. The client names which might be of interest are as follows:
This issue is not important if you use a local Quanterra--in this case the data is coming in at a determined slow speed, and the clients have no problems to fetch it all. But in the case of Seedlink, the data can come in large chunks after the net has been down for some time (or some node is operating in the dialup mode). In this case, there will be lots of tiny data gaps if clients are not running in the blocking mode.
The bottom line is that Datalog and Comserv Plugin should always run in the blocking mode. If you are using these programs, write into your station.ini files:
client1=dlog,600 client2=slnk,600On the other hand, Datadump should never run in the blocking mode, even if it is permanently running, because Datadump does not request any data from the Comserv server. The only reason for implementing Datadump as a Comserv client was probably to make it monitored by the Netmon. Further down in the station.ini file, you will find Datadump's section which I am not going to explain here, because I don't know much about it, and Netmon's and Datalog's sections which I am not going to explain here either, because good documentation exists in the files netmon.txt and datalog.txt.
When the Comserv has been set up, it's time to test the system on the next level. First run the Digiserv as follows:
digiserv -v > digiserv.log 2>&1 &Now start Comserv server for each of the stations, eg.:
server KRIS > KRIS.server.log 2>&1 & server EIL > EIL.server.log 2>&1 & server XXX > XXX.server.log 2>&1 &In this point, check the logfiles for possible error messages. If everything seems normal, try to run the dataread client--it will attach to all available stations and output a message for each packet received. Stop the Dataread by typing Ctrl-C, and the servers by
killall serverNow type
netmon -D -B -l -bto start the Comserv system in it's full. The startup can be rather slow, depending on the parameters in /etc/network.ini. You can type, eg.
ps axu | grep sysopperiodically to see when all the processes have been started. The logfiles are written in the /home/sysop/logs directory. The Comserv system should be now fully functional and Mini-SEED data should appear in the subdirectories under the /home/sysop/data/ directory. You can shut down the Comserv by typing:
netmon -t allNote that this leaves the Netmon daemon running, so next time you should use ``netmon -s all'' instead of ``netmon -D -B -l -b'' unless you have previously killed the Netmon daemon (or rebooted the PC).
seedlink -v > /home/sysop/logs/seedlink.log 2>&1 &Because Seedlink is the same program as Digiserv, you can test it the same way you tested Digiserv before (eg. telnet, HELLO, FETCH, ...). Further testing can be performed by setting up a remote Comserv system.
Note that you can reboot the Seedlink server without any data loss--it resumes where it left off when it comes up. You should not stop the Seedlink for a longer time than the timeout of the Comserv's SLNK client, though.
Moreover, Comserv itself can be rebooted without data loss as well if you use Netmon3. In the case of Quanterra stations, the Quanterra keeps track which packets have been acknowledged by the Comserv server. In the case of Seedlink and Digiserv stations, the Comserv server writes the sequence number to a file like XXX.seq in the /home/comserv/logs directory upon exit and resumes from the next Seedlink packet when it is started. If you don't want the Comserv server request any old data, you can remove the corresponding *.seq file before you start Comserv.
So if you are using only Seedlink and Comserv stations, you can safely reboot your PC. Quanterra comlink buffers are rather small, so you should restart the system as soon as possible. Seedlink doesn't have this problem, because it uses the disk buffer which is normally rather large.
The disk buffer of the Seedlink is usually physically located in the /home/sysop/seedlink directory, and it can be configured by the segments= and segsize= parameters. For efficiency reasons, Seedlink does not search any data from the disk, but instead keeps internal data structures, so it ``knows'' where the data is located. For this reason, you should not modify the disk buffer by hand--Seedlink gets very confused if it wants to read some data and it isn't there. All you can do is to remove all of the files of a station when the Seedlink is not running (eg. rm XXX.* if you have station XXX) to reset the Seedlink to its initial state. When you stop Seedlink, it writes *.buffers and *.segments files; if Seedlink is not running and there are no *.segments files, then the disk buffer is abandoned and you should remove other files as well. Note that Seedlink removes *.buffers and *.segments files itself when it starts.
As mentioned above, Seedlink does not search any data from the disk, so it makes not sense to create files in the disk buffer by hand and hope that Seedlink will read them. If you want to feed arbitrary data to Seedlink, you'll have to implement a plugin. The plugin interface is very simple, just take a look at the file plugin.h in the Seedlink sources!
Now you can start the complete system like this
digiserv -v > /home/sysop/logs/digiserv.log 2>&1 & seedlink -v > /home/sysop/logs/seedlink.log 2>&1 & netmon -D -B -l -band to shut down the system, type:
netmon -t all killall seedlink killall digiservNote that after typing ``netmon -t all'' you should wait a few seconds to ensure that Seedlink has got all pending data from the Comserv. SeisComP distribution includes a script check_seiscomp which can be used to properly start up and shut down the system. If you would like to install this script as a cron job to check the system every 10 minutes, enter this at your shell prompt:
echo "*/10 * * * * /home/sysop/bin/check_seiscomp check" | crontab -
The ``local0'' facility is used with four levels as follows:
local0.info;local0.!warning /home/sysop/logs/seedlink-info.log local0.warning /home/sysop/logs/seedlink-warn.logIn this case you would normally want to disable logging Seedlink messages to other logfiles, so you should add ``local0.none'' to other selector fields. Please take a look at syslogd(8) and syslog.conf(5) manpages for more information.
When using Syslog, you can start the system in a bit simpler way:
digiserv seedlink netmon -D -B -l -b
digiserv : ALL EXCEPT localhost