Skip to content

mountstats: Add support for UDP NFS mounts#100

Merged
grobie merged 1 commit intoprometheus:masterfrom
hakoerber:mountstats-nfs-udp
Jul 5, 2018
Merged

mountstats: Add support for UDP NFS mounts#100
grobie merged 1 commit intoprometheus:masterfrom
hakoerber:mountstats-nfs-udp

Conversation

@hakoerber
Copy link
Copy Markdown
Contributor

Ok, this took a lot longer than I actually thought. :)

Overview

The goal was to support parsing of NFS xprt mountstats for UDP mounts. Because the format of the xprt line in /proc/self/mountstats differs between TCP and UDP, getting stats for UDP mount points was not possible before and led to the following error in the prometheus node exporter:

failed to parse mountstats: invalid NFS transport stats 1.1 statement: [740 1 881477 875055 5946 2888414103 286261 16 258752 2080886]

See also issue #99 for reference.

Details

The difference of the xprt line between TCP and UDP is described here: https://utcc.utoronto.ca/~cks/space/blog/linux/NFSMountstatsXprt

For the udp RPC transport there is no connection count, connect idle time, or idle time (fields 3, 4 and 5); all other fields are the same.

The statvers bump from 1.0 to 1.1 had the same impact to both TCP and UDP, see this kernel commit for reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=15a4520621824a3c2eb2de2d1f3984bc1663d3c8. The difference between statvers=1.0 and statvers=1.1 are the three last fields (11-13 for TCP and 8-10 for UDP). To make it more clear, here is how the lines are supposed to look like, with the numbering taken from the link above:

TCP statvers=1.0: 1 2 3 4 5 6 7 8 9 10
TCP statvers=1.1: 1 2 3 4 5 6 7 8 9 10 11 12 13
UDP statvers=1.0: 1 2       6 7 8 9 10
UDP statvers=1.1: 1 2       6 7 8 9 10 11 12 13

In the struct, all field that are missing in the respective xprt line are set to 0

This led to the following code changes:

I added a new fields protocol to the NFSTransportStats struct that is either tcp or udp. In the struct, the fields are the same for TCP and UDP, with the fields 3-5 being set to 0 for UDP.

Closes #99

Ping @grobie @SuperQ

I'm also working on incorporating the changes into the prometheus node exporter and got a first version working, but I want to wait for this pull request to be done before continuing.

@hakoerber hakoerber force-pushed the mountstats-nfs-udp branch 4 times, most recently from 5029ca5 to 38ecfcb Compare July 1, 2018 07:51
* Add "protocol" field to the NFSTransportStats struct that is either
  udp or tcp

* Parse xprt lines for UDP NFS mounts correctly

Closes prometheus#99

Signed-off-by: Hannes Körber <[email protected]>
Copy link
Copy Markdown
Member

@grobie grobie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me.

@grobie grobie merged commit ae68e2d into prometheus:master Jul 5, 2018
hakoerber pushed a commit to hakoerber/node_exporter that referenced this pull request Jul 12, 2018
In prometheus/procfs#100, the NFSTransportStats
struct was expanded by a field called protocol that specifies the NFS
protocol in use, either "tcp" or "udp". This commit adds the protocol as
a label to all NFS metrics exported via the mountstats collector.

Signed-off-by: Hannes Körber <[email protected]>
discordianfish pushed a commit to prometheus/node_exporter that referenced this pull request Jul 23, 2018
* vendor: Update prometheus/procfs

Signed-off-by: Hannes Körber <[email protected]>

* mountstats: Use new NFS protocol field

In prometheus/procfs#100, the NFSTransportStats
struct was expanded by a field called protocol that specifies the NFS
protocol in use, either "tcp" or "udp". This commit adds the protocol as
a label to all NFS metrics exported via the mountstats collector.

Signed-off-by: Hannes Körber <[email protected]>

* Update fixtures for UDP mount

Signed-off-by: Hannes Körber <[email protected]>
remijouannet pushed a commit to remijouannet/procfs that referenced this pull request Oct 20, 2022
* Add "protocol" field to the NFSTransportStats struct that is either
  udp or tcp

* Parse xprt lines for UDP NFS mounts correctly

Closes prometheus#99

Signed-off-by: Hannes Körber <[email protected]>
bobrik pushed a commit to bobrik/procfs that referenced this pull request Jan 14, 2023
oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this pull request Apr 9, 2024
* vendor: Update prometheus/procfs

Signed-off-by: Hannes Körber <[email protected]>

* mountstats: Use new NFS protocol field

In prometheus/procfs#100, the NFSTransportStats
struct was expanded by a field called protocol that specifies the NFS
protocol in use, either "tcp" or "udp". This commit adds the protocol as
a label to all NFS metrics exported via the mountstats collector.

Signed-off-by: Hannes Körber <[email protected]>

* Update fixtures for UDP mount

Signed-off-by: Hannes Körber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants