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