Scroll to navigation

nbdkit-probing(1) NBDKIT nbdkit-probing(1)

NAME

nbdkit-probing - how to probe for nbdkit configuration and plugins

SYNOPSIS

 nbdkit --dump-config
 nbdkit PLUGIN --dump-plugin

DESCRIPTION

You can query information about nbdkit and available plugins from the nbdkit binary.

Query basic configuration

 nbdkit --dump-config

lists information about how nbdkit was configured. The most important fields in the output are the name of the directory where nbdkit looks for plugins and the version of nbdkit, eg:

 plugindir=/usr/lib64/nbdkit/plugins
 version=1.2.3

Query information about a particular plugin

 nbdkit pluginname --dump-plugin

(where pluginname is the name or full path of a plugin) will dump information about that plugin, eg:

 $ nbdkit file --dump-plugin
 path=/usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so
 name=file
 version=1.2.3
 api_version=1
 struct_size=176
 thread_model=serialize_requests
 [etc]

Plugins which ship with nbdkit usually have the same version as the corresponding nbdkit binary. The nbdkit binary will always be able to utilize plugins compiled against an older version of the header; however, newer plugins may not be fully supported by an older nbdkit binary (for example, a plugin compiled with "NBDKIT_API_VERSION" of 2 fails to load with an older nbdkit that only knows "NBDKIT_API_VERSION" 1).

Detect if a plugin is installed

To find out if a plugin is installed (and working) in the plugin directory, use --dump-plugin as above:

 $ nbdkit foo --dump-plugin
 nbdkit: /usr/lib64/nbdkit/plugins/nbdkit-foo-plugin.so: /usr/lib64/nbdkit/plugins/nbdkit-foo-plugin.so: cannot open shared object file: No such file or directory

Note it is better to test for the existence of plugins this way rather than just seeing if the .so file exists, because nbdkit will load the plugin and check that all its dependencies can be satisfied, and also that plugin registration works.

List all plugins in the plugin directory

You could simply get the plugin directory (from --dump-config) and list all files in this directory called nbdkit-*-plugin.so.

However a better test is to run --dump-plugin (see above) on each one to check that it is working and all of its dependencies are installed. A complete shell script which does this is:

 #!/bin/sh -
 plugindir=`nbdkit --dump-config | grep ^plugindir= | sed 's/[^=]*=//'`
 for f in $plugindir/nbdkit-*-plugin.so; do
     if nbdkit "$f" --dump-plugin >/dev/null 2>&1; then
         b=`echo "$f" | sed 's,.*/nbdkit-\(.*\)-plugin.so$,\1,'`
         echo "$b ($f)"
     fi
 done

SEE ALSO

nbdkit(1).

AUTHORS

Eric Blake

Richard W.M. Jones

Pino Toscano

COPYRIGHT

Copyright (C) 2013-2018 Red Hat Inc.

LICENSE

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2020-09-29 nbdkit-1.8.0