blob: 651bf68195284ca3809e3e661562d474a7306f87 [file] [log] [blame]
Matthias Andreas Benkard832a54e2019-01-29 09:27:38 +01001// Copyright 2018 The Prometheus Authors
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14// Package nfs implements parsing of /proc/net/rpc/nfsd.
15// Fields are documented in https://www.svennd.be/nfsd-stats-explained-procnetrpcnfsd/
16package nfs
17
18// ReplyCache models the "rc" line.
19type ReplyCache struct {
20 Hits uint64
21 Misses uint64
22 NoCache uint64
23}
24
25// FileHandles models the "fh" line.
26type FileHandles struct {
27 Stale uint64
28 TotalLookups uint64
29 AnonLookups uint64
30 DirNoCache uint64
31 NoDirNoCache uint64
32}
33
34// InputOutput models the "io" line.
35type InputOutput struct {
36 Read uint64
37 Write uint64
38}
39
40// Threads models the "th" line.
41type Threads struct {
42 Threads uint64
43 FullCnt uint64
44}
45
46// ReadAheadCache models the "ra" line.
47type ReadAheadCache struct {
48 CacheSize uint64
49 CacheHistogram []uint64
50 NotFound uint64
51}
52
53// Network models the "net" line.
54type Network struct {
55 NetCount uint64
56 UDPCount uint64
57 TCPCount uint64
58 TCPConnect uint64
59}
60
61// ClientRPC models the nfs "rpc" line.
62type ClientRPC struct {
63 RPCCount uint64
64 Retransmissions uint64
65 AuthRefreshes uint64
66}
67
68// ServerRPC models the nfsd "rpc" line.
69type ServerRPC struct {
70 RPCCount uint64
71 BadCnt uint64
72 BadFmt uint64
73 BadAuth uint64
74 BadcInt uint64
75}
76
77// V2Stats models the "proc2" line.
78type V2Stats struct {
79 Null uint64
80 GetAttr uint64
81 SetAttr uint64
82 Root uint64
83 Lookup uint64
84 ReadLink uint64
85 Read uint64
86 WrCache uint64
87 Write uint64
88 Create uint64
89 Remove uint64
90 Rename uint64
91 Link uint64
92 SymLink uint64
93 MkDir uint64
94 RmDir uint64
95 ReadDir uint64
96 FsStat uint64
97}
98
99// V3Stats models the "proc3" line.
100type V3Stats struct {
101 Null uint64
102 GetAttr uint64
103 SetAttr uint64
104 Lookup uint64
105 Access uint64
106 ReadLink uint64
107 Read uint64
108 Write uint64
109 Create uint64
110 MkDir uint64
111 SymLink uint64
112 MkNod uint64
113 Remove uint64
114 RmDir uint64
115 Rename uint64
116 Link uint64
117 ReadDir uint64
118 ReadDirPlus uint64
119 FsStat uint64
120 FsInfo uint64
121 PathConf uint64
122 Commit uint64
123}
124
125// ClientV4Stats models the nfs "proc4" line.
126type ClientV4Stats struct {
127 Null uint64
128 Read uint64
129 Write uint64
130 Commit uint64
131 Open uint64
132 OpenConfirm uint64
133 OpenNoattr uint64
134 OpenDowngrade uint64
135 Close uint64
136 Setattr uint64
137 FsInfo uint64
138 Renew uint64
139 SetClientID uint64
140 SetClientIDConfirm uint64
141 Lock uint64
142 Lockt uint64
143 Locku uint64
144 Access uint64
145 Getattr uint64
146 Lookup uint64
147 LookupRoot uint64
148 Remove uint64
149 Rename uint64
150 Link uint64
151 Symlink uint64
152 Create uint64
153 Pathconf uint64
154 StatFs uint64
155 ReadLink uint64
156 ReadDir uint64
157 ServerCaps uint64
158 DelegReturn uint64
159 GetACL uint64
160 SetACL uint64
161 FsLocations uint64
162 ReleaseLockowner uint64
163 Secinfo uint64
164 FsidPresent uint64
165 ExchangeID uint64
166 CreateSession uint64
167 DestroySession uint64
168 Sequence uint64
169 GetLeaseTime uint64
170 ReclaimComplete uint64
171 LayoutGet uint64
172 GetDeviceInfo uint64
173 LayoutCommit uint64
174 LayoutReturn uint64
175 SecinfoNoName uint64
176 TestStateID uint64
177 FreeStateID uint64
178 GetDeviceList uint64
179 BindConnToSession uint64
180 DestroyClientID uint64
181 Seek uint64
182 Allocate uint64
183 DeAllocate uint64
184 LayoutStats uint64
185 Clone uint64
186}
187
188// ServerV4Stats models the nfsd "proc4" line.
189type ServerV4Stats struct {
190 Null uint64
191 Compound uint64
192}
193
194// V4Ops models the "proc4ops" line: NFSv4 operations
195// Variable list, see:
196// v4.0 https://tools.ietf.org/html/rfc3010 (38 operations)
197// v4.1 https://tools.ietf.org/html/rfc5661 (58 operations)
198// v4.2 https://tools.ietf.org/html/draft-ietf-nfsv4-minorversion2-41 (71 operations)
199type V4Ops struct {
200 //Values uint64 // Variable depending on v4.x sub-version. TODO: Will this always at least include the fields in this struct?
201 Op0Unused uint64
202 Op1Unused uint64
203 Op2Future uint64
204 Access uint64
205 Close uint64
206 Commit uint64
207 Create uint64
208 DelegPurge uint64
209 DelegReturn uint64
210 GetAttr uint64
211 GetFH uint64
212 Link uint64
213 Lock uint64
214 Lockt uint64
215 Locku uint64
216 Lookup uint64
217 LookupRoot uint64
218 Nverify uint64
219 Open uint64
220 OpenAttr uint64
221 OpenConfirm uint64
222 OpenDgrd uint64
223 PutFH uint64
224 PutPubFH uint64
225 PutRootFH uint64
226 Read uint64
227 ReadDir uint64
228 ReadLink uint64
229 Remove uint64
230 Rename uint64
231 Renew uint64
232 RestoreFH uint64
233 SaveFH uint64
234 SecInfo uint64
235 SetAttr uint64
236 Verify uint64
237 Write uint64
238 RelLockOwner uint64
239}
240
241// ClientRPCStats models all stats from /proc/net/rpc/nfs.
242type ClientRPCStats struct {
243 Network Network
244 ClientRPC ClientRPC
245 V2Stats V2Stats
246 V3Stats V3Stats
247 ClientV4Stats ClientV4Stats
248}
249
250// ServerRPCStats models all stats from /proc/net/rpc/nfsd.
251type ServerRPCStats struct {
252 ReplyCache ReplyCache
253 FileHandles FileHandles
254 InputOutput InputOutput
255 Threads Threads
256 ReadAheadCache ReadAheadCache
257 Network Network
258 ServerRPC ServerRPC
259 V2Stats V2Stats
260 V3Stats V3Stats
261 ServerV4Stats ServerV4Stats
262 V4Ops V4Ops
263}