This image runs the VastNFS Prometheus exporter, an HTTP server that exposes VastNFS RPC transport statistics for Prometheus. It runs on NFS client hosts (the hosts that mount VastNFS exports) and reads kernel debugfs/sysfs; the NFS server is out of scope.
The exporter mirrors the discovery logic of vastnfs-ctl: it walks VastNFS mount RPC
transports and publishes per-operation counters (same source as
vastnfs-ctl rpc-transports-stats), live per-transport queue depths (same sysfs fields as
vastnfs-ctl rpc-transports), transport state flags, and per-mount configuration.
Published as vastdataorg/vastnfs-exporter. The latest tag tracks the most recent GA
release; pin a specific version with vastdataorg/vastnfs-exporter:TAG. Images are
multi-arch (linux/amd64, linux/arm64).
The exporter reports on the VastNFS kernel module installed on the host. The module is not part of this image and must be installed on the node separately.
The container must see the host network namespace and the host's debugfs and sunrpc sysfs trees (read-only):
docker run -d --name vastnfs-exporter --network host --pid host \
--read-only --cap-drop ALL --security-opt no-new-privileges \
-v /sys/kernel/debug:/sys/kernel/debug:ro \
-v /sys/kernel/sunrpc:/sys/kernel/sunrpc:ro \
vastdataorg/vastnfs-exporter:latest
curl -s localhost:9001/metrics | head
The container runs as root with all capabilities dropped, so it can traverse the root-owned debugfs files without any additional privilege.
--pid host lets the exporter read the host's mount table (/proc/1/mountinfo) to
label each VastNFS mount with its mount point and options. Without it the container only
sees its own mount namespace, and vastnfs_mount_info and
vastnfs_exporter_mount_count stay empty.
To run it on Kubernetes, see Deploy as a Kubernetes DaemonSet.
Run one exporter pod on every node that mounts VastNFS exports. The pod needs the host
network namespace (so Prometheus scrapes the node address) and read-only hostPath mounts
of the host's debugfs and sunrpc sysfs trees.
Save the following as vastnfs-exporter.yaml:
apiVersion: v1
kind: Namespace
metadata:
name: vastnfs-exporter
labels:
# hostNetwork, hostPath and root need the "privileged" Pod Security level.
pod-security.kubernetes.io/enforce: privileged
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: vastnfs-exporter
namespace: vastnfs-exporter
spec:
selector:
matchLabels:
app: vastnfs-exporter
template:
metadata:
labels:
app: vastnfs-exporter
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9001"
prometheus.io/path: "/metrics"
spec:
# hostNetwork only affects how the exporter is *reached* (node IP + port
# on the host vs. pod IP); it is not needed to read debugfs/sysfs, which
# come from the hostPath mounts. Set to false to use the pod network.
hostNetwork: true
# Needed so /proc/1/mountinfo is the host's mount table (mountpoint and
# options of the VastNFS mounts). Without it vastnfs_mount_info is empty.
hostPID: true
containers:
- name: vastnfs-exporter
image: docker.io/vastdataorg/vastnfs-exporter:latest
env:
- name: VASTNFS_EXPORTER_PORT
valueFrom:
fieldRef:
fieldPath: metadata.annotations['prometheus.io/port']
securityContext:
runAsUser: 0
runAsGroup: 0
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
volumeMounts:
- name: debugfs
mountPath: /sys/kernel/debug
readOnly: true
- name: sysfs-sunrpc
mountPath: /sys/kernel/sunrpc
readOnly: true
volumes:
- name: debugfs
hostPath:
path: /sys/kernel/debug
type: Directory
- name: sysfs-sunrpc
hostPath:
path: /sys/kernel/sunrpc
type: Directory
Apply it and verify:
kubectl apply -f vastnfs-exporter.yaml
kubectl -n vastnfs-exporter rollout status ds/vastnfs-exporter
kubectl -n vastnfs-exporter get pods -o wide
# Scrape one node directly (replace NODE_IP)
curl -s NODE_IP:9001/metrics | head
Notes:
VastNFS must be installed on the nodes. The pod mounts /sys/kernel/sunrpc, which only
exists once the sunrpc module is loaded. On a node without it the pod stays in
ContainerCreating. Restrict the DaemonSet to nodes that run VastNFS with a
nodeSelector (for example a label you apply to those nodes) in the pod spec.
Pod Security. hostNetwork, hostPath and running as root require the privileged
Pod Security level, which is why the namespace carries the
pod-security.kubernetes.io/enforce: privileged label. The container itself drops all
capabilities, forbids privilege escalation and uses a read-only root filesystem.
Host PID is required for mount labels. hostPID: true makes /proc/1/mountinfo the
node's mount table, which is how the exporter finds each VastNFS mount's mount point and
options. Without it the pod sees only its own mounts, and vastnfs_mount_info and
vastnfs_exporter_mount_count stay empty (RPC transport metrics are unaffected). The
container still drops all capabilities. If a security policy (for example an AppArmor or
SELinux profile) blocks reading /proc/1/mountinfo, the exporter falls back to its own
table and the mount labels stay empty.
Host network is optional. The exporter reads its data from the hostPath mounts, not
from the network namespace, so hostNetwork only decides how Prometheus reaches it. With
hostNetwork: true (the default here, like node_exporter) the exporter listens on the
node's IP and the port must be free on every node; it is also reachable on every node
interface, so restrict access with a host firewall if needed. With hostNetwork: false it
gets a pod IP, there are no host port conflicts, and NetworkPolicy can limit who scrapes
it. Switch with:
kubectl -n vastnfs-exporter patch ds/vastnfs-exporter --type merge -p \
'{"spec":{"template":{"spec":{"hostNetwork":false}}}}'
Either way the pod still needs the privileged Pod Security level because of the
hostPath mounts and root user.
Changing the port. The pod annotation prometheus.io/port is the single source of
truth: it is passed to the container as VASTNFS_EXPORTER_PORT through the downward API,
and Prometheus uses the same annotation to find the target. Change that one value, for
example:
kubectl -n vastnfs-exporter patch ds/vastnfs-exporter --type merge -p \
'{"spec":{"template":{"metadata":{"annotations":{"prometheus.io/port":"9100"}}}}}'
The pod uses the host network, so make sure the port is free on every node.
Pinning the version. Replace :latest with a specific tag for reproducible rollouts.
Scraping with Prometheus. With annotation-based discovery (the default
kubernetes-pods scrape config) the prometheus.io/* annotations are all that is needed.
With the Prometheus Operator, create a PodMonitor selecting app: vastnfs-exporter in
the vastnfs-exporter namespace with podMetricsEndpoints on the /metrics path and
the port you configured.
Tolerations. Add tolerations to the pod spec if the nodes that mount VastNFS are
tainted.
The listen address and port are set at deployment time through environment variables. Command-line flags take precedence over the environment.
| Environment variable | Flag | Default | Description |
|---|---|---|---|
VASTNFS_EXPORTER_HOST | --host | 0.0.0.0 | Listen address |
VASTNFS_EXPORTER_PORT | --port | 9001 | Listen port |
VASTNFS_EXPORTER_MOUNTINFO | – | /proc/1/mountinfo in the image (/proc/self/mountinfo otherwise) | Mount table used for mount point and options labels; falls back to /proc/self/mountinfo if unreadable |
| – | --shutdown-timeout | 5 | Grace period after SIGTERM/SIGINT before exit (seconds) |
For example, to listen on port 9100:
docker run -d --network host -e VASTNFS_EXPORTER_PORT=9100 ... vastdataorg/vastnfs-exporter:latest
Because the container uses the host network, the effective port is whatever
VASTNFS_EXPORTER_PORT is set to; the EXPOSE 9001 in the image only documents the
default. In a Kubernetes DaemonSet, set the port in one place (for example from the
prometheus.io/port pod annotation via the downward API) so the exporter and the
Prometheus scrape configuration always agree.
Endpoints:
| Path | Description |
|---|---|
/metrics | Prometheus text exposition |
/ | Minimal health/index body |
The exporter reads kernel debugfs and sysfs, not /proc mountstats. debugfs
must be mounted on the host at /sys/kernel/debug (most distributions do this at boot):
mount | grep debugfs
ls /sys/kernel/debug/vastnfs
If debugfs is not mounted, RPC metrics stay empty and vastnfs_exporter_vastnfs_present
is 0. Mount it manually if needed:
sudo mount -t debugfs none /sys/kernel/debug
Paths the exporter uses:
| Path | Filesystem | Role |
|---|---|---|
/sys/kernel/debug/vastnfs/nfs_sb/* | debugfs | Identify VastNFS mounts (not present in upstream Linux NFS) |
/sys/kernel/debug/vastnfs/nfs_clnt/* | debugfs | Map NFS clients to rpc_clnt IDs |
/sys/kernel/debug/sunrpc/rpc_xprt/*/extra | debugfs | Per-operation RPC counters |
/sys/kernel/debug/sunrpc/rpc_xprt/*/info | debugfs | Transport id, netid, addr, port labels |
/sys/kernel/sunrpc/rpc-clients/, xprt-switches/ | sysfs | Traverse RPC client → xprt-switch → transport IDs |
/sys/kernel/sunrpc/xprt-switches/*/xprt*/xprt_state | sysfs | Transport state flags (CONNECTED, BOUND, etc.) |
/sys/kernel/sunrpc/xprt-switches/*/xprt*/xprt_info | sysfs | Live queue depths |
Discovery walks VastNFS NFS clients, resolves each to an RPC client and its transports via sysfs, then reads per-op counters from debugfs and queue depths and state flags from sysfs for those transports only.
The exporter uses a private Prometheus registry (no default python_* or process_*
series).
Per-transport labels used across RPC metrics:
| Label | Description | Example |
|---|---|---|
xprt_id | Kernel RPC transport ID | 2 |
netid | RPC network ID | tcp, rdma |
addr | Remote endpoint | 192.168.23.11:2049 |
RPC counter metrics add op (RPC operation name, e.g. READ, WRITE, GETATTR).
Queue length gauges and vastnfs_rpc_xprt_state use only xprt_id, netid, and addr
(state gauges also add state). Exporter-level state and self-observability metrics have
no transport labels.
Each counter is a cumulative total with labels xprt_id, netid, addr, and op.
All-zero per-op rows are omitted (same filter as vastnfs-ctl rpc-transports-stats).
| Metric | Description |
|---|---|
vastnfs_rpc_xprt_ops_total | Total RPC operations |
vastnfs_rpc_xprt_trans_total | Total RPC transmissions |
vastnfs_rpc_xprt_timeouts_total | Total RPC timeouts |
vastnfs_rpc_xprt_bytes_sent_total | Total bytes sent |
vastnfs_rpc_xprt_bytes_received_total | Total bytes received |
vastnfs_rpc_xprt_queue_milliseconds_total | Cumulative queue wait time (ms); not an instantaneous queue depth |
vastnfs_rpc_xprt_rtt_milliseconds_total | Total round-trip time (ms) |
vastnfs_rpc_xprt_execute_milliseconds_total | Total execute time (ms) |
vastnfs_rpc_xprt_errors_total | Total RPC errors |
Instantaneous queue depths for each VastNFS mount transport (gauges, not cumulative
counters). Labels: xprt_id, netid, addr.
| Metric | Sysfs field | Description |
|---|---|---|
vastnfs_rpc_xprt_binding_queue_length | binding_q_len | Tasks waiting for bind/rpcbind |
vastnfs_rpc_xprt_sending_queue_length | sending_q_len | Tasks waiting to send |
vastnfs_rpc_xprt_pending_queue_length | pending_q_len | Tasks in flight (awaiting reply) |
vastnfs_rpc_xprt_backlog_queue_length | backlog_q_len | Tasks waiting for a free request slot |
vastnfs_rpc_xprt_tasks_queue_length | tasks_queuelen | Total tasks associated with this transport |
Queue gauges are omitted when xprt_info is unreadable or the kernel reports <closed>
(disconnected transports). During reconnection a transport may show state flags (e.g.
CONNECTING) while queue gauges are absent.
vastnfs_rpc_xprt_state is a gauge set to 1 for each active state flag on a transport;
a transport in CONNECTED BOUND emits two series. Common state values: CONNECTED,
BOUND, CONNECTING, CLOSE, DISCONN. Labels: xprt_id, netid, addr, state.
vastnfs_mount_info is a gauge 1 per mount. Labels: nfs_id, mountpoint, proto
(effective transport), options (NFS mount options from the host mount table, see VASTNFS_EXPORTER_MOUNTINFO).
| Metric | Values | Description |
|---|---|---|
vastnfs_exporter_vastnfs_present | 0 or 1 | 1 when /sys/kernel/debug/vastnfs exists |
vastnfs_exporter_mount_count | integer | Number of VastNFS mounts exported this scrape |
vastnfs_exporter_xprt_count | integer | Number of VastNFS mount transports exported this scrape |
| Metric | Type | Description |
|---|---|---|
vastnfs_exporter_build_info | info | Build version (version label) |
vastnfs_exporter_scrape_duration_seconds | gauge | Wall-clock time of the last collection |
vastnfs_exporter_collection_errors_total | counter | Failed collection attempts |
The exporter process stays up. /metrics always returns HTTP 200, never 5xx for
collection failures. State gauges are always emitted so operators can tell why a scrape is
empty:
| Condition | vastnfs_exporter_vastnfs_present | vastnfs_exporter_xprt_count | RPC metrics |
|---|---|---|---|
| debugfs not mounted / vastnfs not loaded | 0 | 0 | absent |
| vastnfs loaded, no mounts | 1 | 0 | absent |
| vastnfs loaded, mounts active | 1 | > 0 | present |
docker pull vastdataorg/vastnfs-exporter:latest