When an NFS datastore drops, the first place most teams find out is a vCenter alarm, a wall of “inaccessible” VMs, or a ticket from an application owner. The host knew minutes earlier. ESXi writes a precise sequence into vmkernel.log and vobd.log as it loses its NFS server, enters All-Paths-Down, and finally gives up and fast-fails I/O. This post routes that sequence through the OpenTelemetry log pipeline, turns it into structured fields, counters and LogQL alerts, and shows how to rehearse the whole thing safely in a lab, so the page arrives while there is still time to act and keeps working when vCenter itself is the casualty.
Level: advanced · Stack: ESXi 7 or 8, otelcol-contrib (syslog receiver, transform processor, count connector), Loki 3 with ruler, Alertmanager or Grafana alerting, Prometheus or Mimir · Build time: about 90 minutes, plus a 20 minute lab test
Contents
- Why logs, when vCenter already alarms
- What ESXi actually logs
- The APD timeline, and where each alert fires
- The log-to-alert pipeline
- Parsing rules
- Turning log events into metrics
- LogQL alert rules
- Routing and inhibition
- Testing it safely in a lab
- End-to-end workflow
- Troubleshooting
- What’s next
01. Why logs, when vCenter already alarms
Be precise about the claim first. The host raises the same VOB (vSphere observation) events that vCenter turns into host events and alarms, and on a healthy management network vCenter hears about them within seconds. A syslog pipeline is not magically faster at the moment of a single event. What it gives you is coverage of the cases where the vCenter path is late, absent or blind:
- vCenter lives on the failing datastore. Broadcom KB 404260 describes exactly this: an NFS mount point lost, the datastore inaccessible, and vCenter going down with the VMs on it. Every alarm you configured goes with it. ESXi syslog leaves the host over the management network to a collector that does not depend on that datastore.
- Hosts going Not Responding. Broadcom documents that hosts in an APD condition may appear as Not Responding in vCenter (KB 318938). Events queued behind a stuck management agent arrive late or in a burst.
- Signals that never become alarms. The vmkernel warning “NFS volume … performance has deteriorated”, with the latency jump in microseconds, is a plain vmkernel warning with no VOB ID in the line. It is a direct measure of NFS latency degrading, often before anything disconnects, and nothing in a default alarm set watches it. That is the one alert in this post that can genuinely fire earlier.
- Cross-host correlation. A vCenter alarm is per host or per datastore. “Three hosts entered APD on the same filesystem within five minutes” is a different incident (the NFS server or a shared switch) from “one host lost its uplink”, and it is one LogQL expression.
- One place for evidence. The same records that page you are the post-incident timeline, already parsed, next to array and network logs in Loki.
Do not duplicate the vCenter alarm, complement it. Keep vCenter's “Cannot connect to storage” alarm and HA VM Component Protection doing what they do. The log pipeline adds the early warning, the vCenter-independent path and the blast-radius view. If both page for the same thing, someone will mute one of them.
02. What ESXi actually logs
Everything below is quoted from Broadcom and NetApp knowledge base articles for ESXi 7.x and 8.x, with IPs and names replaced. I have kept to message text that appears in those articles; where the articles truncate or vary, the parsing rules are written to tolerate the variation rather than assume one exact form.
NFS heartbeats, and why detection takes about two minutes
ESXi monitors each NFS volume with heartbeats, which are GETATTR requests on the volume's root file handle (KB 381569). Four advanced settings control them, with these defaults on ESXi 7.x and 8.x according to KB 323325:
| Setting | Default | Meaning |
|---|---|---|
NFS.HeartbeatFrequency | 12 | How often the heartbeat world checks whether volumes need a heartbeat (seconds) |
NFS.HeartbeatTimeout | 5 | How long a heartbeat request may take before it is abandoned (seconds) |
NFS.HeartbeatDelta | 5 | Time after a successful GETATTR before the next heartbeat is due (seconds) |
NFS.HeartbeatMaxFailures | 10 | Consecutive failed heartbeats before the server is marked unavailable |
The same KB gives the formula: minimum time to mark a volume down is HeartbeatFrequency × (HeartbeatMaxFailures − 1) + HeartbeatTimeout, and the maximum adds HeartbeatDelta + HeartbeatFrequency. With defaults that is 12 × 9 + 5 = 113 seconds minimum and 130 seconds maximum. So when a path silently black-holes, the host spends roughly two minutes with I/O stalling before it declares anything. Changing these values requires a host reboot, and I would not change them to make an alert fire sooner; the alert should adapt to the platform, not the other way round.
Connection lost, in vmkernel.log and vobd.log
When the server is declared unavailable, vmkernel logs a warning. The NFS source line number (NFS: 331, NFS: 338) differs between builds, which is a good reason never to match on it:
cpu11:2098577)WARNING: NFS: 338: Lost connection to the server 10.0.30.20 mount point /export/ds-nfs-01, mounted as 651fb76f-6d318d68-0000-000000000000 ("ds-nfs-01")
Older articles show the same message as “Lost connection to server …” without “the”, so the parser accepts both. vobd records the observation twice, once as the internal vob.* ID with readable text and once as the esx.problem.* event that is forwarded to vCenter:
[vmfsCorrelator] 65758735896396us: [vob.vmfs.nfs.server.disconnect] Lost connection to the server 10.0.30.20 mount point /export/ds-nfs-01, mounted as 651fb76f-6d318d68-0000-000000000000 ("ds-nfs-01")
[vmfsCorrelator] 65759457445021us: [esx.problem.vmfs.nfs.server.disconnect] 10.0.30.20/export/ds-nfs-01 651fb76f-6d318d68-0000-000000000000 ds-nfs-01
On recovery vmkernel logs the mirror image, “Restored connection to the server … mount point …, mounted as …”, and Broadcom's guidance (KB 341361) is that no action is needed once you see it. The same KB lists MTU mismatches on the VMkernel interface, the physical path or the NAS as a common cause of these drops.
All-Paths-Down: start, timeout, exit
APD events come from the APD correlator in vobd, again as a vob.* and esx.* pair. KB 381569 shows them for NFS datastores specifically, and KB 2032940 gives the full timeout text:
[APDCorrelator] ...us: [esx.problem.storage.apd.start] Device or filesystem with identifier [651fb76f-6d318d68] has entered the All Paths Down state.
[APDCorrelator] ...us: [esx.problem.storage.apd.timeout] Device or filesystem with identifier [651fb76f-6d318d68] has entered the All Paths Down Timeout state after being in the All Paths Down state for 140 seconds. I/Os will now be fast failed.
[APDCorrelator] ...us: [esx.clear.storage.apd.exit] Device or filesystem with identifier [651fb76f-6d318d68] has exited the All Paths Down state.
Look at the identifiers. The NFS lines say mounted as 651fb76f-6d318d68-0000-000000000000, the APD lines say [651fb76f-6d318d68]. The NetApp article on NFS volumes becoming invisible to ESXi shows exactly this pair for the same datastore. The first two groups of the NFS volume UUID are the APD identifier, so the parser extracts both into one field, fs_id, and every NFS and APD record about the same datastore can be joined on it.
There is also an early warning that is not a VOB at all:
WARNING: NFS: 5015: NFS volume ds-nfs-01 performance has deteriorated. I/O latency increased from average value of 3352(us) to 109867(us).
NFS: 4971: NFS volume ds-nfs-01 performance has improved. I/O latency reduced from 109867(us) to 21955(us).
Timeout settings that shape the timeline
| Setting | Default | Source |
|---|---|---|
Misc.APDHandlingEnable | Enabled | KB 406100. With it disabled the host retries indefinitely, which is worse. |
Misc.APDTimeout | 140 seconds | KB 406100 and KB 2032940. The vSphere 8 storage docs allow 20 to 99999 seconds. |
| HA “Delay for failure response” (APD) | 3 minutes | KB 414574, vSphere 8.0. Starts after the APD timeout; HA acts only if APD is still present when it expires. |
Broadcom's advice in KB 406100 is not to change the APD settings unless support asks you to. Check what your hosts actually run, because alert wording that says “140 seconds” should be true:
Get-VMHost | Get-AdvancedSetting -Name Misc.APDHandlingEnable, Misc.APDTimeout, NFS.HeartbeatMaxFailures |
Select-Object Entity, Name, Value | Sort-Object Name, Entity | Format-Table -AutoSize
NFS 4.1. The vmkernel lines above come from articles about NFS 3 mounts. NFS 4.1 datastores use a separate client module, so treat the “Lost connection” text rules as unverified for 4.1 until you have seen them in your own vmkernel.log. The APD rules match VOB IDs rather than prose and are the ones to rely on first, but the lab test in section 09 is the real verification for either protocol.
03. The APD timeline, and where each alert fires
Read it left to right. At T0 the path to the NFS server starts dropping packets. Guest I/O stalls immediately, but the host only knows that heartbeats are failing. After the heartbeat window (113 to 130 seconds by the KB formula for a silent black hole) the server is marked down at T1: vmkernel and vobd log the lost connection, and the APD start event follows. Misc.APDTimeout starts counting. If nothing recovers, at T2 (140 seconds after APD start) the host logs the APD timeout and fast-fails non-VM I/O. If HA is configured to respond to APD, VM Component Protection waits its own delay (3 minutes by default) and then acts, if APD is still present.
Two things the diagram deliberately shows. First, there is no PDL branch. Permanent Device Loss is signalled by SCSI sense codes from a block array; an NFS mount has no equivalent, so an NFS outage ends either in recovery or in a datastore that stays inaccessible. Do not build rules that wait for a PDL event on NFS. Second, recovery can happen at any point: “Restored connection” and esx.clear.storage.apd.exit are the events that resolve the stateful alerts.
| Alert | Fires on | Severity | Why at that point |
|---|---|---|---|
| A1 EsxiNfsLatencyDeteriorated | Three or more “performance has deteriorated” lines in 10 min for one host and datastore | warning | The only signal before T0 or during the heartbeat window. Often the first sign of a congested or failing path. |
| A2 EsxiNfsConnectionLost | Lost connection without a matching Restored in 15 min | critical | T1. The host has given up on the server. |
| A3 EsxiApdActive | esx.problem.storage.apd.start without esx.clear.storage.apd.exit in 30 min | critical | T1. The 140 s clock is running; this is the window to fail over the NFS server or fix the path. |
| A4 EsxiNfsApdTimeout | esx.problem.storage.apd.timeout in 15 min | page | T2. I/O is being failed. Applications are now affected regardless of recovery. |
| A5 EsxiNfsMultiHostApd | Two or more hosts with APD start on the same fs_id in 5 min | page | Server or shared network, not one host. Different team, different runbook. |
| EsxiNfsFlapping | Six or more Lost connection events in 1 h | warning | Short outages that recover before APD timeout: the MTU-mismatch signature from KB 341361. |
04. The log-to-alert pipeline
The collector is the one from part 3, generated per vCenter by the PowerCLI generator: ESXi 8 hosts send RFC 5424 over TCP 1514 with octet counting, ESXi 7 hosts send RFC 3164 over UDP 514. The syslog receiver parses the header into attributes (hostname, appname, message and friends). This post adds three things to that collector: a transform processor that understands NFS and APD lines, a count connector that turns selected records into counters, and the alert rules that sit in Loki.
Why alert in Loki rather than on the counters? Because LogQL keeps state the counters cannot. “APD started and has not exited” is a set difference over two log streams in one expression; on counters emitted only when something happens, Prometheus never sees a sample for the quiet half of that question. The counters are for dashboards and trends: events per vCenter per week, the noisiest datastores, whether last month's switch change reduced flapping.
One design rule makes the whole pipeline hold together: syslog must not share fate with the storage it reports on. Send it over the management VMkernel interface, not the NFS one; prefer TCP so a busy collector applies backpressure rather than silently dropping; and do not put Syslog.global.logDir or scratch on an NFS datastore you are monitoring.
05. Parsing rules
All parsing happens in one transform processor using OTTL. Each statement runs ExtractPatterns (named regex groups become a map) and merge_maps into the record's attributes. Statements are independent and a regex that does not match returns an empty map, so a record only gains the fields that apply to it. The regexes avoid build-specific details: no NFS line numbers, no fixed whitespace, no anchoring to the cpuN:world) prefix.
| Statement | Matches | Adds |
|---|---|---|
| 1 | Any [esx.problem.*], [esx.clear.*] or [vob.*] ID | vob_id |
| 2 | NFS server and APD VOB IDs, either prefix | storage_event, for example storage.apd.start, identical for both twins |
| 3 | “Lost/Restored connection to (the) server … mount point …” | nfs_state, nfs_server, nfs_share |
| 4 | mounted as <uuid> ("<name>") | datastore |
| 5 | NFS volume UUID, APD identifier, or the esx.problem NFS line | fs_id (first two UUID groups) |
| 6, 7 | “NFS volume … performance has deteriorated/improved” | datastore, nfs_latency_state, storage_event |
The complete collector config for one vCenter. Replace the four placeholders, put the password-free parts under version control, and nothing else needs editing. It passes otelcol-contrib validate on 0.166.0.
# /etc/otelcol-contrib/<COLLECTOR_NAME>/config.yaml
# ESXi syslog -> NFS/APD parsing -> Loki (all logs) + Prometheus/Mimir (event counters)
extensions:
health_check:
endpoint: 0.0.0.0:13133
receivers:
syslog/esxi_rfc5424:
tcp:
listen_address: 0.0.0.0:1514
protocol: rfc5424
enable_octet_counting: true
resource:
service.name: esxi
syslog/esxi_rfc3164:
udp:
listen_address: 0.0.0.0:514
protocol: rfc3164
location: UTC
resource:
service.name: esxi
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 20
resource/vcenter:
attributes:
- key: service.namespace
value: <COLLECTOR_NAME>
action: upsert
- key: vcenter.server
value: <VCENTER_FQDN>
action: upsert
transform/esxi_storage:
error_mode: ignore
log_statements:
# 1. Any VOB id in square brackets: [esx.problem.storage.apd.start], [vob.vmfs.nfs.server.disconnect]
- 'merge_maps(log.attributes, ExtractPatterns(log.attributes["message"], "\\[(?P<vob_id>(?:esx\\.(?:problem|clear)|vob)\\.[A-Za-z0-9_.]+)\\]"), "upsert") where log.attributes["message"] != nil'
# 2. Normalised event name, identical for the vob.* line and its esx.* twin
- 'merge_maps(log.attributes, ExtractPatterns(log.attributes["vob_id"], "^(?:esx\\.(?:problem|clear)|vob)\\.(?P<storage_event>vmfs\\.nfs\\.server\\.[a-z]+|storage\\.apd\\.[a-z]+)$"), "upsert") where log.attributes["vob_id"] != nil'
# 3. "Lost/Restored connection to (the) server <ip> mount point <share>" (vmkernel and vobd)
- 'merge_maps(log.attributes, ExtractPatterns(log.attributes["message"], "(?P<nfs_state>Lost|Restored) connection to (?:the )?server (?P<nfs_server>\\S+) mount point (?P<nfs_share>[^,\\s]+)"), "upsert") where log.attributes["message"] != nil'
# 4. Datastore display name: mounted as <uuid> ("<name>")
- 'merge_maps(log.attributes, ExtractPatterns(log.attributes["message"], "mounted as [0-9A-Fa-f-]+ \\(\"(?P<datastore>[^\"]+)\"\\)"), "upsert") where log.attributes["message"] != nil'
# 5. Filesystem id: first two groups of the NFS volume UUID, or the APD identifier. Same value for both.
- 'merge_maps(log.attributes, ExtractPatterns(log.attributes["message"], "(?:mounted as |identifier \\[|nfs\\.server\\.[a-z]+\\] \\S+ )(?P<fs_id>[0-9a-f]{8}-[0-9a-f]{8})"), "upsert") where log.attributes["message"] != nil'
# 6. NFS latency warnings from vmkernel (no VOB id on these)
- 'merge_maps(log.attributes, ExtractPatterns(log.attributes["message"], "NFS volume (?P<datastore>\\S+) performance has (?P<nfs_latency_state>deteriorated|improved)"), "upsert") where log.attributes["message"] != nil'
- 'set(log.attributes["storage_event"], Concat(["nfs.latency", log.attributes["nfs_latency_state"]], ".")) where log.attributes["nfs_latency_state"] != nil'
delta_to_cumulative:
max_stale: 24h
connectors:
count/esxi_storage:
logs:
esxi.storage.events:
description: ESXi NFS and APD events, one per esx.* VOB (vob.* twins are not counted)
conditions:
- 'log.attributes["vob_id"] != nil and IsMatch(log.attributes["vob_id"], "^esx\\.(problem|clear)\\.(vmfs\\.nfs\\.server|storage\\.apd)\\.")'
attributes:
- key: hostname
default_value: unknown
- key: storage_event
- key: fs_id
default_value: unknown
esxi.nfs.latency.warnings:
description: vmkernel "NFS volume ... performance has deteriorated" lines
conditions:
- 'log.attributes["storage_event"] == "nfs.latency.deteriorated"'
attributes:
- key: hostname
default_value: unknown
- key: datastore
default_value: unknown
exporters:
otlp_http/loki:
endpoint: http://<LOKI_FQDN>:3100/otlp
sending_queue:
batch: {}
prometheus_remote_write:
http:
endpoint: https://<MIMIR_FQDN>/api/v1/push
resource_constant_labels:
included: ["service.namespace", "vcenter.server"]
service:
extensions: [health_check]
telemetry:
metrics:
readers:
- pull:
exporter:
prometheus:
host: 0.0.0.0
port: 8888
pipelines:
logs/esxi:
receivers: [syslog/esxi_rfc5424, syslog/esxi_rfc3164]
processors: [memory_limiter, resource/vcenter, transform/esxi_storage]
exporters: [otlp_http/loki, count/esxi_storage]
metrics/storage_events:
receivers: [count/esxi_storage]
processors: [delta_to_cumulative]
exporters: [prometheus_remote_write]
Notes on the details that are easy to get wrong:
- Escaping. Each statement is a YAML single-quoted string, so backslashes reach OTTL unchanged. Inside the OTTL string literal,
\\.becomes the regex\.and\"becomes a quote. In a YAML double-quoted string you would need twice as many backslashes. Single quotes, always. - Context prefixes. The statements use
log.attributes, not bareattributes. Current releases infer the OTTL context from the prefix. The count connector still accepts bare paths, but 0.166.0 logs that it rewrote them and asks you to add the prefix, so the config already has it. - Twins. The
vob.*line and theesx.*line both get the samestorage_eventandfs_id. Loki keeps both, which is useful when reading a timeline. The count connector counts onlyesx.*, so every event is counted once. - Cost. Every statement after the first is guarded with a
whereclause, and the regexes are linear-time RE2. On a busy collector the transform is not where the CPU goes; the syslog receiver and the exporters are. Measure it with the collector's own metrics before optimising. - Field names. Underscored names are deliberate: Loki converts dots in OTLP attribute names to underscores anyway, so
fs_idisfs_ideverywhere, in the collector, in LogQL and in Prometheus labels.
What a parsed APD start looks like at the collector (debug exporter, trimmed). This is real output from 0.166.0 fed the KB message over RFC 5424 with octet counting:
Attributes:
-> appname: Str(vobd)
-> hostname: Str(esx01.lab.local)
-> vob_id: Str(esx.problem.storage.apd.start)
-> storage_event: Str(storage.apd.start)
-> fs_id: Str(651fb76f-6d318d68)
In Loki, service.name and service.namespace become the index labels service_name and service_namespace (both are on Loki's default list of resource attributes promoted to labels). Everything else, including every field above, is stored as structured metadata: no extra streams and no cardinality explosion, and still filterable with | fs_id="...". That split is why the parsing happens in the collector and not in LogQL at query time.
06. Turning log events into metrics
The count connector (alpha for logs-to-metrics) sits as an exporter on the logs pipeline and a receiver on a metrics pipeline. For each batch of logs it emits a Sum, one data point per unique set of the attributes you list, for records matching any of the OTTL conditions. Two counters are defined:
esxi.storage.eventsbyhostname,storage_eventandfs_id, counting onlyesx.problem.*andesx.clear.*NFS server and APD IDs.esxi.nfs.latency.warningsbyhostnameanddatastore.
The connector emits delta sums (it sets delta temporality in its source). Prometheus remote write expects cumulative counters, so the metrics pipeline runs delta_to_cumulative (alpha) before prometheus_remote_write; in the test run the output showed cumulative temporality after that processor. Both the connector and that processor are stateful and keep their counts in memory, so all logs for a given host must reach the same collector instance, which the one-collector-per-vCenter layout guarantees. max_stale: 24h keeps a quiet counter's state for a day instead of the default five minutes, so a second outage on the same datastore increments the existing series rather than starting a new one at 1.
With the default translation the names arrive as esxi_storage_events_total and esxi_nfs_latency_warnings_total. Dashboard queries:
# Storage events per vCenter and type, last 24 hours (bar gauge)
sum by (service_namespace, storage_event) (increase(esxi_storage_events_total[24h]))
# Noisiest NFS datastores by latency warnings this week (table)
topk(10, sum by (datastore) (increase(esxi_nfs_latency_warnings_total[7d])))
# Hosts that have seen APD on a filesystem in the last 30 days (table)
count by (service_namespace, fs_id) (
sum by (service_namespace, fs_id, hostname) (increase(esxi_storage_events_total{storage_event="storage.apd.start"}[30d])) > 0
)
Why not page from these counters? A counter that only gets a sample when an event happens is a poor alerting source. The first event creates a brand new series with value 1, and
increase()needs two samples in its window to see a change, so the very first APD on a datastore can be invisible to a naiveincrease(...) > 0rule. You can work around it withunless ... offsettricks, but Loki already has the records. Page from Loki, trend from Prometheus.
07. LogQL alert rules
These run in the Loki ruler, which evaluates LogQL on a schedule and sends firing alerts to Alertmanager. The ruler needs local or object storage for rule files and an Alertmanager URL in Loki's config:
# loki config (excerpt)
ruler:
storage:
type: local
local:
directory: /loki/rules
rule_path: /loki/rules-temp
alertmanager_url: http://<ALERTMANAGER_FQDN>:9093
ring:
kvstore:
store: inmemory
enable_api: true
The rule file. Every query starts with a cheap line filter (|= "apd.start") so Loki scans chunks with a substring match before it touches structured metadata, then narrows with an exact label filter on the parsed field. Grouping always includes fs_id, which is what lets Alertmanager inhibit correctly across stages.
# Loki ruler: /loki/rules/<TENANT_ID>/esxi-nfs-apd.yaml (<TENANT_ID> is "fake" when auth_enabled: false)
groups:
- name: esxi-nfs-apd
interval: 30s
rules:
- alert: EsxiNfsLatencyDeteriorated
expr: |
sum by (service_namespace, hostname, datastore) (
count_over_time({service_name="esxi"} |= "performance has deteriorated"
| storage_event="nfs.latency.deteriorated" [10m])
) >= 3
labels:
severity: warning
team: storage
annotations:
summary: "NFS latency warnings on {{ $labels.hostname }} for {{ $labels.datastore }}"
description: "{{ $value }} vmkernel 'performance has deteriorated' lines in 10 minutes. Check the array and the storage network before it becomes a disconnect."
- alert: EsxiNfsConnectionLost
expr: |
sum by (service_namespace, hostname, fs_id) (
count_over_time({service_name="esxi"} |= "Lost connection to" | nfs_state="Lost" [15m])
)
unless
sum by (service_namespace, hostname, fs_id) (
count_over_time({service_name="esxi"} |= "Restored connection to" | nfs_state="Restored" [15m])
)
labels:
severity: critical
team: storage
annotations:
summary: "{{ $labels.hostname }} lost its NFS server for filesystem {{ $labels.fs_id }}"
description: "No 'Restored connection' seen yet. APD timeout follows 140 s after APD start unless the path comes back."
- alert: EsxiApdActive
expr: |
sum by (service_namespace, hostname, fs_id) (
count_over_time({service_name="esxi"} |= "apd.start" | vob_id="esx.problem.storage.apd.start" [30m])
)
unless
sum by (service_namespace, hostname, fs_id) (
count_over_time({service_name="esxi"} |= "apd.exit" | vob_id="esx.clear.storage.apd.exit" [30m])
)
labels:
severity: critical
team: storage
annotations:
summary: "APD on {{ $labels.hostname }} for {{ $labels.fs_id }}"
description: "Host is retrying I/O. Misc.APDTimeout (140 s default) is running."
- alert: EsxiNfsApdTimeout
expr: |
sum by (service_namespace, hostname, fs_id) (
count_over_time({service_name="esxi"} |= "apd.timeout" | vob_id="esx.problem.storage.apd.timeout" [15m])
) > 0
labels:
severity: page
team: storage
annotations:
summary: "APD timeout on {{ $labels.hostname }} for {{ $labels.fs_id }}: I/O is being fast-failed"
description: "If HA APD response is configured, VM Component Protection acts after its delay (3 min default)."
- alert: EsxiNfsMultiHostApd
expr: |
count by (service_namespace, fs_id) (
sum by (service_namespace, fs_id, hostname) (
count_over_time({service_name="esxi"} |= "apd.start" | vob_id="esx.problem.storage.apd.start" [5m])
)
) >= 2
labels:
severity: page
team: storage
annotations:
summary: "{{ $value }} hosts entered APD on {{ $labels.fs_id }} within 5 minutes"
description: "Several hosts at once points at the NFS server or a shared network segment, not one host's uplink."
- alert: EsxiNfsFlapping
expr: |
sum by (service_namespace, hostname, fs_id) (
count_over_time({service_name="esxi"} |= "Lost connection to" | nfs_state="Lost" [1h])
) >= 6
labels:
severity: warning
team: storage
annotations:
summary: "NFS connection to {{ $labels.fs_id }} from {{ $labels.hostname }} keeps dropping"
description: "Repeated short outages that recover before APD timeout. Classic MTU mismatch or failing link signature."
Design notes:
- Stateful rules use
unless.EsxiApdActiveis “APD start in the last 30 minutes, minus series that also have an APD exit”. It resolves at the next evaluation after the exit arrives, not 30 minutes later. The limit is a flap inside the window (start, exit, start) which reads as resolved;EsxiNfsFlappingexists to catch that pattern. - Event rules use a window.
EsxiNfsApdTimeouthas no clear event to wait for, so it stays firing for 15 minutes after the timeout line. That is long enough for a human to acknowledge and short enough not to hang around after recovery. - No
for:clauses. The events are already debounced by the host (113 seconds of heartbeat failures, 140 seconds of APD). Addingfor: 2mon top would only push the page past the point where an NFS server failover could still beat the APD timeout. - Thresholds that are judgement calls. Three latency warnings in 10 minutes and six disconnects per hour are starting points. Run the rules for a fortnight in a non-paging route and adjust to what your arrays actually do.
The same rule in Grafana-managed alerting
If you already route everything through Grafana alerting rather than Alertmanager, provision the rules as files under provisioning/alerting. A Loki instant query returns a vector, so a single threshold expression is enough:
# provisioning/alerting/esxi-nfs-apd.yaml
apiVersion: 1
groups:
- orgId: 1
name: esxi-nfs-apd
folder: vSphere storage
interval: 30s
rules:
- uid: esxi-nfs-apd-timeout
title: EsxiNfsApdTimeout
condition: C
data:
- refId: A
relativeTimeRange:
from: 900
to: 0
datasourceUid: <LOKI_DATASOURCE_UID>
model:
refId: A
queryType: instant
expr: 'sum by (service_namespace, hostname, fs_id) (count_over_time({service_name="esxi"} |= "apd.timeout" | vob_id="esx.problem.storage.apd.timeout" [15m]))'
- refId: C
datasourceUid: __expr__
model:
refId: C
type: threshold
expression: A
conditions:
- evaluator:
type: gt
params: [0]
noDataState: OK
execErrState: Error
for: 0s
labels:
severity: page
team: storage
annotations:
summary: 'APD timeout on {{ $labels.hostname }} for {{ $labels.fs_id }}'
noDataState: OK matters here: no matching log lines is the normal state, and the default would treat it as a problem.
08. Routing and inhibition
Three goals: page once per incident, page the right people, and stop the earlier stages from shouting once a later stage has fired. Group by fs_id so that every alert about one datastore lands in one notification; inhibit the per-host stages when the multi-host alert fires; inhibit “connection lost” and “APD active” once the timeout has fired for the same host and filesystem. Secrets for the chat webhook and the paging key are read from files, never written into the config.
# alertmanager.yml (excerpt): routing for the esxi-nfs-apd group
route:
receiver: storage-chat
group_by: [alertname, service_namespace, fs_id]
group_wait: 15s
group_interval: 2m
repeat_interval: 4h
routes:
- matchers: ['severity="page"']
receiver: storage-oncall
group_wait: 0s
continue: true
- matchers: ['team="storage"']
receiver: storage-chat
inhibit_rules:
# Once APD has timed out, the earlier stages are noise.
- source_matchers: ['alertname="EsxiNfsApdTimeout"']
target_matchers: ['alertname=~"EsxiNfsConnectionLost|EsxiApdActive"']
equal: [service_namespace, hostname, fs_id]
# A multi-host APD is one incident, not one per host.
- source_matchers: ['alertname="EsxiNfsMultiHostApd"']
target_matchers: ['alertname=~"EsxiNfsConnectionLost|EsxiApdActive|EsxiNfsApdTimeout"']
equal: [service_namespace, fs_id]
receivers:
- name: storage-chat
slack_configs:
- api_url_file: /etc/alertmanager/secrets/slack-storage-webhook
channel: '#<STORAGE_CHANNEL>'
send_resolved: true
title: '{{ .CommonLabels.alertname }} on {{ .CommonLabels.service_namespace }}'
text: '{{ range .Alerts }}{{ .Annotations.summary }}{{ "\n" }}{{ end }}'
- name: storage-oncall
pagerduty_configs:
- routing_key_file: /etc/alertmanager/secrets/pagerduty-storage-key
send_resolved: true
| Alert | Route | Inhibited by |
|---|---|---|
| EsxiNfsLatencyDeteriorated | storage chat | nothing |
| EsxiNfsConnectionLost | storage chat | EsxiNfsApdTimeout (same host and fs_id), EsxiNfsMultiHostApd (same fs_id) |
| EsxiApdActive | storage chat | the same two |
| EsxiNfsApdTimeout | on-call page and chat | EsxiNfsMultiHostApd (same fs_id) |
| EsxiNfsMultiHostApd | on-call page and chat | nothing |
| EsxiNfsFlapping | storage chat | nothing |
Add a runbook link annotation to each rule pointing at your NFS runbook. The first two minutes of an APD are best spent answering one question: is it one host or many? The EsxiNfsMultiHostApd alert answers it before anyone opens a console.
09. Testing it safely in a lab
Warning: lab only. This procedure deliberately makes a datastore inaccessible. Never run it in production, never against an NFS server or IP that serves any production export, and never on hosts whose vCenter, scratch, logs or HA heartbeat datastores could be affected. If you are not certain which exports share an IP, stop here.
The safe way to break exactly one datastore is to give the test export its own IP address on the NFS server and mount the test datastore through that IP only. Firewall rules work on addresses and ports, not on exports: dropping TCP 2049 to the server's main address would take every datastore on it with it. With a dedicated address, the rule touches nothing else.
Preparation checklist
- A lab NFS server (any Linux box with nfs-kernel-server or nfs-utils works) with a secondary IP,
<TEST_EXPORT_IP>, and a test export reachable only through it. - The test datastore mounted on one or two lab hosts through
<TEST_EXPORT_IP>. Confirm withesxcli storage nfs listthat the Host column shows that IP. - Nothing important on it: no vCenter, no vCLS VMs (move them or exclude the datastore), not selected as an HA heartbeat datastore, not the location of scratch or
Syslog.global.logDir. - At most one throwaway VM. Heartbeats run whether or not VMs do I/O, so APD happens without any VM. If HA is configured to respond to APD, that VM may be terminated after the timeout plus the delay; set a VM override or accept it.
- The alert rules routed to a test receiver, not to on-call.
- A shell on the NFS server and an SSH session on one test host for
tail.
Procedure
# On the LAB NFS server, as root. Affects only traffic from one ESXi vmk to the test IP.
TEST_IP=<TEST_EXPORT_IP> # serves ONLY the test export
ESXI_IP=<ESXI_NFS_VMK_IP> # the vmk the host uses for NFS
nft add table inet apdtest
nft add chain inet apdtest input '{ type filter hook input priority -10 ; policy accept ; }'
nft add rule inet apdtest input ip saddr "$ESXI_IP" ip daddr "$TEST_IP" tcp dport 2049 drop
# Dead man's switch: the rule removes itself after 8 minutes even if you lose the session
systemd-run --on-active=8min --unit=apdtest-cleanup nft delete table inet apdtest
date -u +%FT%TZ # record T0
# ... watch the host and Loki (below) ...
# Restore early or after the timeout has been seen
nft delete table inet apdtest
systemctl stop apdtest-cleanup.timer 2>/dev/null || true
date -u +%FT%TZ # record restore time
On the ESXi host, watch the raw lines arrive:
tail -F /var/log/vobd.log /var/log/vmkernel.log | grep -Ei 'nfs|apd'
In Grafana Explore against Loki, the whole incident for that datastore in one query:
{service_name="esxi", service_namespace="<COLLECTOR_NAME>"}
| fs_id="<FS_ID>"
| storage_event!="" or nfs_state!=""
What to record
| Mark | Expected event | Expected timing with defaults | Alert |
|---|---|---|---|
| T0 | Rule inserted (your date output) | 0 | none |
| T1 | “Lost connection to the server …” in vmkernel and vobd, esx.problem.vmfs.nfs.server.disconnect | Roughly T0 + 113 to 130 s for a silent drop | A2 at the next ruler evaluation |
| T1+ | esx.problem.storage.apd.start | At or shortly after T1 | A3, plus A5 if two hosts mount the test IP |
| T2 | esx.problem.storage.apd.timeout, “after being in the All Paths Down state for 140 seconds” | APD start + 140 s | A4 |
| R | Rule removed: “Restored connection …”, esx.clear.storage.apd.exit | Within a heartbeat or two of restore | A2 and A3 resolve; A4 resolves after its 15 min window |
Run it twice: once restoring before T2 (you should see A2 and A3 fire and resolve, no page), and once letting the timeout happen. Write the measured T0 to T1 and T1 to T2 gaps into the runbook. Those are your real numbers, and they are what tells you how much time on-call actually has between the first alert and the APD timeout.
10. End-to-end workflow
| # | Step | Verify | Expected |
|---|---|---|---|
| 1 | ESXi syslog reaching the collector (part 3 or the generator post) | Loki: {service_name="esxi"} |= "vobd" | Recent vobd lines from every host |
| 2 | Check the APD and heartbeat settings on all hosts | The Get-AdvancedSetting command in section 02 | Misc.APDTimeout 140, Misc.APDHandlingEnable 1, NFS.HeartbeatMaxFailures 10, or documented exceptions |
| 3 | Add the transform, count connector and pipelines (section 05) | otelcol-contrib validate --config=/etc/otelcol-contrib/<name>/config.yaml with env loaded | Exit 0, no output |
| 4 | Reload the collector | systemctl reload otelcol-contrib@<name>, then journalctl -u otelcol-contrib@<name> -n 20 | No errors; no “modified to include their context prefix” notice |
| 5 | Prove parsing without an outage: send a synthetic APD line from a lab host | On the lab host: esxcli system syslog mark --message "[esx.problem.storage.apd.start] Device or filesystem with identifier [00000000-00000000] has entered the All Paths Down state. TEST" | Loki: the record has vob_id, storage_event=storage.apd.start, fs_id=00000000-00000000 |
| 6 | Confirm the counter | PromQL: esxi_storage_events_total{fs_id="00000000-00000000"} | One series, value 1 |
| 7 | Configure the Loki ruler and load the rule file | curl -s http://<LOKI_FQDN>:3100/loki/api/v1/rules | The esxi-nfs-apd group with six rules |
| 8 | Watch the synthetic event fire | curl -s http://<LOKI_FQDN>:3100/prometheus/api/v1/alerts | EsxiApdActive firing for fs_id="00000000-00000000" (it will not resolve; it ages out after 30 min) |
| 9 | Configure Alertmanager routes and inhibitions (section 08) | amtool check-config alertmanager.yml | SUCCESS, listing 2 inhibit rules and 2 receivers |
| 10 | Run the lab test (section 09) with a test receiver | The timing table | A2, A3, A4 (and A5 with two hosts) in order; resolutions after restore |
| 11 | Point the routes at real chat and on-call | Send a test notification from Alertmanager | Message in chat, test incident in the paging tool |
Step 5 is worth calling out. The marker message travels through vmsyslogd exactly like a real vobd line, so it exercises transport, parsing, Loki ingestion, the counter and the ruler without touching storage. Use an identifier of zeros so nobody mistakes it for a real datastore, and expect the syslog marker to arrive with its own app name rather than vobd; the rules key on the message content, so they still match. Keep step 5 as a monthly synthetic check.
11. Troubleshooting
| Symptom | Likely cause | Check | Fix |
|---|---|---|---|
vobd lines in Loki but no vob_id field | Transform not in the pipeline, or statements in double-quoted YAML lost their backslashes | otelcol-contrib validate, then the debug exporter on one record | Add transform/esxi_storage to the logs pipeline; keep statements single-quoted |
fs_id missing on NFS “Lost connection” lines | Message variant without “mounted as” | Read the raw line in Loki | Extend statement 5 with the variant you see; do not loosen it to any 8-8 hex pair |
| ESXi 8 messages arrive split or unparsed | RFC 5424 without octet counting, or sent to the UDP port | logHost string on the host | tcp://...:1514?formatter=RFC_5424&framing=octet_counting and enable_octet_counting: true |
| Lab test: no lines from the host at all during the outage | Syslog uses the same vmk or uplink as NFS, so it went down too | esxcli network ip route ipv4 list and the vmk used to reach the collector | Route syslog via the management vmk; move logDir and scratch off NFS |
| Host log shows “vmsyslog logger … lost N log messages” | Collector or network cannot keep up; the host queue overflowed (KB 427023) | Collector otelcol_receiver_refused_log_records and CPU | TCP instead of UDP, more collector CPU, check the path for drops |
| Alerts never fire, records are there | Ruler not loading the file (wrong tenant folder) or no Alertmanager URL | /loki/api/v1/rules and ruler logs | Single tenant uses the folder fake; set alertmanager_url |
LogQL error grouping by hostname | Structured metadata disabled, or schema older than v13 / TSDB | Loki limits_config and schema_config | Enable structured metadata (default on Loki 3 with a v13 schema) |
| Every APD appears twice in a table | Counting both vob.* and esx.* twins | Group by vob_id | Filter on vob_id=~"esx\\..*" as the counter does |
| Counter series start at 1 after every outage | delta_to_cumulative state expired, or collector restarted | max_stale value, collector uptime | Raise max_stale; dashboards use increase(), which handles resets |
| Flapping alert storms during array maintenance | Planned controller failovers produce real short disconnects | Change calendar | Silence by service_namespace and fs_id for the window, not by alert name |
| “Lost connection” without any APD event following | Path restored within the APD handling window, or APD handling disabled | Misc.APDHandlingEnable on that host | If disabled, re-enable per KB 406100 guidance; the host otherwise retries forever |
12. What’s next
This post covers the failure end of NFS. The latency end, the gradual slide that usually comes first, is covered with metrics in NFS datastore latency with OpenTelemetry, and the protocol background (NFSv3 versus 4.1 behaviour, locking, multipathing) is in NFSv3 and NFSv4.1 in VMware vSphere. If you prefer offline analysis of a support bundle, the ESXi log analyser parses vmkernel, hostd and vobd for SCSI and path problems; the NFS and APD patterns in this post are a natural addition to it. To roll the collector changes out to every vCenter at once, use the PowerCLI generator, and for the Loki and Grafana side of the stack see part 4.
Collector config validated, and the parsing and counting exercised end to end, on otelcol-contrib 0.166.0 using the log formats quoted in Broadcom KBs 341361, 390832, 339587, 404260, 381569, 2032940 and the NetApp KB on NFS volumes becoming invisible to ESXi. Timings come from KBs 323325, 406100 and 414574. Measure your own timings with the lab test before writing them into a runbook.
Leave a Reply