nfsd.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. // 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. // Package nfsd implements parsing of /proc/net/rpc/nfsd.
  14. // Fields are documented in https://www.svennd.be/nfsd-stats-explained-procnetrpcnfsd/
  15. package nfsd
  16. // ReplyCache models the "rc" line.
  17. type ReplyCache struct {
  18. Hits uint64
  19. Misses uint64
  20. NoCache uint64
  21. }
  22. // FileHandles models the "fh" line.
  23. type FileHandles struct {
  24. Stale uint64
  25. TotalLookups uint64
  26. AnonLookups uint64
  27. DirNoCache uint64
  28. NoDirNoCache uint64
  29. }
  30. // InputOutput models the "io" line.
  31. type InputOutput struct {
  32. Read uint64
  33. Write uint64
  34. }
  35. // Threads models the "th" line.
  36. type Threads struct {
  37. Threads uint64
  38. FullCnt uint64
  39. }
  40. // ReadAheadCache models the "ra" line.
  41. type ReadAheadCache struct {
  42. CacheSize uint64
  43. CacheHistogram []uint64
  44. NotFound uint64
  45. }
  46. // Network models the "net" line.
  47. type Network struct {
  48. NetCount uint64
  49. UDPCount uint64
  50. TCPCount uint64
  51. TCPConnect uint64
  52. }
  53. // RPC models the "rpc" line.
  54. type RPC struct {
  55. RPCCount uint64
  56. BadCnt uint64
  57. BadFmt uint64
  58. BadAuth uint64
  59. BadcInt uint64
  60. }
  61. // V2Stats models the "proc2" line.
  62. type V2Stats struct {
  63. Null uint64
  64. GetAttr uint64
  65. SetAttr uint64
  66. Root uint64
  67. Lookup uint64
  68. ReadLink uint64
  69. Read uint64
  70. WrCache uint64
  71. Write uint64
  72. Create uint64
  73. Remove uint64
  74. Rename uint64
  75. Link uint64
  76. SymLink uint64
  77. MkDir uint64
  78. RmDir uint64
  79. ReadDir uint64
  80. FsStat uint64
  81. }
  82. // V3Stats models the "proc3" line.
  83. type V3Stats struct {
  84. Null uint64
  85. GetAttr uint64
  86. SetAttr uint64
  87. Lookup uint64
  88. Access uint64
  89. ReadLink uint64
  90. Read uint64
  91. Write uint64
  92. Create uint64
  93. MkDir uint64
  94. SymLink uint64
  95. MkNod uint64
  96. Remove uint64
  97. RmDir uint64
  98. Rename uint64
  99. Link uint64
  100. ReadDir uint64
  101. ReadDirPlus uint64
  102. FsStat uint64
  103. FsInfo uint64
  104. PathConf uint64
  105. Commit uint64
  106. }
  107. // V4Stats models the "proc4" line.
  108. type V4Stats struct {
  109. Null uint64
  110. Compound uint64
  111. }
  112. // V4Ops models the "proc4ops" line: NFSv4 operations
  113. // Variable list, see:
  114. // v4.0 https://tools.ietf.org/html/rfc3010 (38 operations)
  115. // v4.1 https://tools.ietf.org/html/rfc5661 (58 operations)
  116. // v4.2 https://tools.ietf.org/html/draft-ietf-nfsv4-minorversion2-41 (71 operations)
  117. type V4Ops struct {
  118. //Values uint64 // Variable depending on v4.x sub-version. TODO: Will this always at least include the fields in this struct?
  119. Op0Unused uint64
  120. Op1Unused uint64
  121. Op2Future uint64
  122. Access uint64
  123. Close uint64
  124. Commit uint64
  125. Create uint64
  126. DelegPurge uint64
  127. DelegReturn uint64
  128. GetAttr uint64
  129. GetFH uint64
  130. Link uint64
  131. Lock uint64
  132. Lockt uint64
  133. Locku uint64
  134. Lookup uint64
  135. LookupRoot uint64
  136. Nverify uint64
  137. Open uint64
  138. OpenAttr uint64
  139. OpenConfirm uint64
  140. OpenDgrd uint64
  141. PutFH uint64
  142. PutPubFH uint64
  143. PutRootFH uint64
  144. Read uint64
  145. ReadDir uint64
  146. ReadLink uint64
  147. Remove uint64
  148. Rename uint64
  149. Renew uint64
  150. RestoreFH uint64
  151. SaveFH uint64
  152. SecInfo uint64
  153. SetAttr uint64
  154. Verify uint64
  155. Write uint64
  156. RelLockOwner uint64
  157. }
  158. // RPCStats models all stats from /proc/net/rpc/nfsd.
  159. type RPCStats struct {
  160. ReplyCache ReplyCache
  161. FileHandles FileHandles
  162. InputOutput InputOutput
  163. Threads Threads
  164. ReadAheadCache ReadAheadCache
  165. Network Network
  166. RPC RPC
  167. V2Stats V2Stats
  168. V3Stats V3Stats
  169. V4Stats V4Stats
  170. V4Ops V4Ops
  171. }