Programs of the LDM System

The LDM Program ldmd

An LDM system's main program is the binary executable ldmd. This program

The Utility pqact

The pqact utility reads data-products from the product-queue and disposes of them according to user-configurable instructions. One or more instances of this program are, typically, started by the top-level ldmd process as the result of EXEC entries in the LDM configuration-file, ldmd.conf. Instructions for the disposition of data-products are contained in a pqact configuration-file.

Certain instructions in the pqact configuration-file cause the pqact utility to spawn child processs to aid in the disposition of data-products. These instructions are the pqact PIPE action and the pqact EXEC action.

Typically, pqact processes are terminated by reception of a SIGINT or SIGTERM from the top-level ldmd process.

When a pqact process terminates, it saves the insertion-time of the last, successfully-processed data-product in a file. The pathname of the file is that of the pqact configuration-file with ".state" appended. This allows a subsequent pqact process that uses the same configuration-file to start processing where the previous process stopped. It also means only one pqact process should use any configuration-file.

Data-Product Ingesters

An LDM data-product ingester is a program that creates data-products and inserts them into the LDM product-queue using the pq(3) API. Such a program has the following characteristics:

It is, ultimately, irrelevant how ingesters obtain the data from which they create data-products because such information is lost once the data-product has been created and inserted into the product-queue. Data sources that have been used include the following: serial ports, files, and pseudo-random number generators.

The LDM package comes with the following ingesters. While some are useful in their own right, their primary purpose is to provide examples of how to write ingesters.

pqing
Reads meteorological data in WMO or AFOS format from a file or serial port. This is a "classical" data-product ingester.
pqinsert
Inserts files as data-products. This is an example of an ingester that not only runs outside the LDM process group but also self-terminates.

Data-Product Decoders

An LDM data-product decoder is a program that reads data-product data from standard input and disposes of the data in some fashion -- often by writing the data into a file that is specific to an analysis package (e.g., McIDAS or GEMPAK). Such programs have the following characteristics:

Because a decoder doesn't have a useful standard output or standard error, a decoder that depends them (to report errors, for example) will not function correctly. An easy workaround exists, however: wrap the decoder in a simple shell script that redirects such output into files. The following shell script is an example:

      #!/bin/sh
      exec 1><stdout>
      exec 2><stderr>
      <decoder> "$@"
    

where:

<stdout>
Is the pathname of the file to contain standard output
<stderr>
Is the pathname of the file to contain standard error
<decoder>
Is the pathname of the actual decoder

Decoders that are, themselves, shell scripts, may use the LDM package's ulogger utility to log error messages. For example, the following, simple shell script concatenates its standard input to a file -- reproducing the effect of the pqact(1) FILE action:

      progname=`basename $0`
      if test $# -ne 1; then
        ulogger -p FATAL "$progname: Usage: $progname <file>"
      else
        file=$1
        if ! cat >> "$file"; then
          ulogger -p FATAL "$progname: Couldn't append to file \"$file\""
        fi
      fi
    

By default, the ulogger utility logs at the NOTE level. It also uses the same logging mechanism as the other LDM programs; consequently, it will log to the LDM log file by default unless overridden by the "-l file" option.

The ldmadmin Script

The ldmadmin utility is a Perl-5 script intended for high-level administration of an LDM system. The script acts as a facade for more primitive utilities -- coordinating their use for the sake of convenience. The things you can do with the ldmadmin script include the following:

Command Action
ldmadmin start Start the LDM system
ldmadmin stop Stop the LDM system
ldmadmin restart Stop then restart the LDM system
ldmadmin isrunning Determine if the LDM system is running
ldmadmin mkqueue Create the product-queue
ldmadmin delqueue Delete the product-queue
ldmadmin watch Watch the most recent data-products arrive in the product-queue
ldmadmin pqactcheck Check the syntax of all pqact configuration-files associated with active EXEC pqact entries in the LDM configuration-file.
ldmadmin newlog Rotate the LDM logfiles
ldmadmin addmetrics Accumulate performance metrics on the LDM system.
ldmadmin plotmetrics Plot performance metrics on the LDM system.
ldmadmin newmetrics Rotate the performance metrics data-files.
ldmadmin check Check that everything is OK with the LDM system. Usually executed periodically via the crontab utility.

Ancillary Utilities of the LDM

Utilities that are included in the LDM package but are less important than the separately-documented ones above include the following:

Utility Description
feedme Requests data-products from an upstream LDM and writes them to standard output. Deprecated.
ldmping Temporarily connects to an upstream LDM to test its availability.
ldmsend Sends files as LDM data-products to a downstream LDM using HEREIS messages.
notifyme Requests data-product metadata from an upstream LDM and, optionally, writes the metadata to an LDM logfile.
plotMetrics Plots performance metrics on the LDM system.
pqcat Reads once through a product-queue and writes the data-products to a file or to standard output. Useful for ensuring that a product-queue isn't corrupt.
pqcheck Checks the writer-counter in the product-queue. Useful for ensuring that a product-queue isn't corrupt.
pqcopy Copies data-products from one product-queue to another.
pqcreate Creates an empty product-queue.
pqexpire Deletes old data-products from a product-queue. Deprecated.
pqmon Prints a summary of the state of a product-queue.
pqsend Reads a product-queue and sends the data-products to a downstream LDM.Waits for more data-products.
pqsurf Reads data-products that are composite WMO surface bulletins from the product-queue, splits them into individual bulletins, inserts them as data-products into a separate product-queue, and processes the individual bulletins similar to pqact. Deprecated.
pqutil Interactive program for accessing the product-queue.
regex Utility for testing extended regular expressions (ERE).
regutil Manages the LDM registry.
rtstats Monitors the product-queue and periodically sends summary statistics to a downstream LDM (which, for the IDD, is at the Unidata Program Center).
scour crontab-driven utility for deleting old data-files based on pathname patterns and retention-times.
wasReceived Indicates if a data-product matching specifiable selection criteria has been inserted into the product-queue.
uldbutil Accesses the transitory database of upstream LDM processes.