1nbdkit-probing(1) NBDKIT nbdkit-probing(1)
2
3
4
6 nbdkit-probing - how to probe for nbdkit configuration and plugins
7
9 nbdkit --dump-config
10
11 nbdkit PLUGIN --dump-plugin
12
14 You can query information about nbdkit and available plugins from the
15 nbdkit binary.
16
17 Query basic configuration
18 nbdkit --dump-config
19
20 lists information about how nbdkit was configured. The most important
21 fields in the output are the name of the directory where nbdkit looks
22 for plugins and the version of nbdkit, eg:
23
24 plugindir=/usr/lib64/nbdkit/plugins
25 version=1.2.3
26
27 Query information about a particular plugin
28 nbdkit pluginname --dump-plugin
29
30 (where pluginname is the name or full path of a plugin) will dump
31 information about that plugin, eg:
32
33 $ nbdkit file --dump-plugin
34 path=/usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so
35 name=file
36 version=1.2.3
37 api_version=1
38 struct_size=176
39 thread_model=serialize_requests
40 [etc]
41
42 Plugins which ship with nbdkit usually have the same version as the
43 corresponding nbdkit binary. The nbdkit binary will always be able to
44 utilize plugins compiled against an older version of the header;
45 however, newer plugins may not be fully supported by an older nbdkit
46 binary (for example, a plugin compiled with "NBDKIT_API_VERSION" of 2
47 fails to load with an older nbdkit that only knows "NBDKIT_API_VERSION"
48 1).
49
50 Detect if a plugin is installed
51 To find out if a plugin is installed (and working) in the plugin
52 directory, use --dump-plugin as above:
53
54 $ nbdkit foo --dump-plugin
55 nbdkit: error: cannot open plugin 'foo': /usr/lib64/nbdkit/plugins/nbdkit-foo-plugin.so: cannot open shared object file: No such file or directory
56 Use 'nbdkit --help' or read the nbdkit(1) manual page for documentation.
57
58 Note it is better to test for the existence of plugins this way rather
59 than just seeing if the .so file exists, because nbdkit will load the
60 plugin and check that all its dependencies can be satisfied, and also
61 that plugin registration works.
62
63 List all plugins in the plugin directory
64 You could simply get the plugin directory (from --dump-config) and list
65 all files in this directory called nbdkit-*-plugin.so.
66
67 However a better test is to run --dump-plugin (see above) on each one
68 to check that it is working and all of its dependencies are installed.
69 A complete shell script which does this is:
70
71 #!/bin/sh -
72 plugindir=`nbdkit --dump-config | grep ^plugindir= | sed 's/[^=]*=//'`
73 for f in $plugindir/nbdkit-*-plugin.so; do
74 if nbdkit "$f" --dump-plugin >/dev/null 2>&1; then
75 b=`echo "$f" | sed 's,.*/nbdkit-\(.*\)-plugin.so$,\1,'`
76 echo "$b ($f)"
77 fi
78 done
79
80 Detect if a filter is installed
81 To find out if a filter is installed (and working) use --dump-plugin
82 with the "null" plugin and the name of the filter to test:
83
84 nbdkit --dump-plugin --filter=foo null
85
86 This will fail with an error and non-zero exit code if the "foo" filter
87 cannot be loaded.
88
90 nbdkit(1).
91
93 Eric Blake
94
95 Richard W.M. Jones
96
97 Pino Toscano
98
100 Copyright (C) 2013-2018 Red Hat Inc.
101
103 Redistribution and use in source and binary forms, with or without
104 modification, are permitted provided that the following conditions are
105 met:
106
107 · Redistributions of source code must retain the above copyright
108 notice, this list of conditions and the following disclaimer.
109
110 · Redistributions in binary form must reproduce the above copyright
111 notice, this list of conditions and the following disclaimer in the
112 documentation and/or other materials provided with the
113 distribution.
114
115 · Neither the name of Red Hat nor the names of its contributors may
116 be used to endorse or promote products derived from this software
117 without specific prior written permission.
118
119 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
120 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
121 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
122 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
123 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
124 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
125 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
126 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
127 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
128 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
129 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
130
131
132
133nbdkit-1.16.1 2019-12-03 nbdkit-probing(1)