proc_net_rpc_nfsd.c 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #include "plugin_proc.h"
  3. #define PLUGIN_PROC_MODULE_NFSD_NAME "/proc/net/rpc/nfsd"
  4. struct nfsd_procs {
  5. char name[30];
  6. unsigned long long value;
  7. int present;
  8. RRDDIM *rd;
  9. };
  10. struct nfsd_procs nfsd_proc2_values[] = {
  11. { "null" , 0ULL, 0, NULL}
  12. , {"getattr" , 0ULL, 0, NULL}
  13. , {"setattr" , 0ULL, 0, NULL}
  14. , {"root" , 0ULL, 0, NULL}
  15. , {"lookup" , 0ULL, 0, NULL}
  16. , {"readlink", 0ULL, 0, NULL}
  17. , {"read" , 0ULL, 0, NULL}
  18. , {"wrcache" , 0ULL, 0, NULL}
  19. , {"write" , 0ULL, 0, NULL}
  20. , {"create" , 0ULL, 0, NULL}
  21. , {"remove" , 0ULL, 0, NULL}
  22. , {"rename" , 0ULL, 0, NULL}
  23. , {"link" , 0ULL, 0, NULL}
  24. , {"symlink" , 0ULL, 0, NULL}
  25. , {"mkdir" , 0ULL, 0, NULL}
  26. , {"rmdir" , 0ULL, 0, NULL}
  27. , {"readdir" , 0ULL, 0, NULL}
  28. , {"fsstat" , 0ULL, 0, NULL}
  29. ,
  30. /* termination */
  31. { "" , 0ULL, 0, NULL}
  32. };
  33. struct nfsd_procs nfsd_proc3_values[] = {
  34. { "null" , 0ULL, 0, NULL}
  35. , {"getattr" , 0ULL, 0, NULL}
  36. , {"setattr" , 0ULL, 0, NULL}
  37. , {"lookup" , 0ULL, 0, NULL}
  38. , {"access" , 0ULL, 0, NULL}
  39. , {"readlink" , 0ULL, 0, NULL}
  40. , {"read" , 0ULL, 0, NULL}
  41. , {"write" , 0ULL, 0, NULL}
  42. , {"create" , 0ULL, 0, NULL}
  43. , {"mkdir" , 0ULL, 0, NULL}
  44. , {"symlink" , 0ULL, 0, NULL}
  45. , {"mknod" , 0ULL, 0, NULL}
  46. , {"remove" , 0ULL, 0, NULL}
  47. , {"rmdir" , 0ULL, 0, NULL}
  48. , {"rename" , 0ULL, 0, NULL}
  49. , {"link" , 0ULL, 0, NULL}
  50. , {"readdir" , 0ULL, 0, NULL}
  51. , {"readdirplus", 0ULL, 0, NULL}
  52. , {"fsstat" , 0ULL, 0, NULL}
  53. , {"fsinfo" , 0ULL, 0, NULL}
  54. , {"pathconf" , 0ULL, 0, NULL}
  55. , {"commit" , 0ULL, 0, NULL}
  56. ,
  57. /* termination */
  58. { "" , 0ULL, 0, NULL}
  59. };
  60. struct nfsd_procs nfsd_proc4_values[] = {
  61. { "null" , 0ULL, 0, NULL}
  62. , {"read" , 0ULL, 0, NULL}
  63. , {"write" , 0ULL, 0, NULL}
  64. , {"commit" , 0ULL, 0, NULL}
  65. , {"open" , 0ULL, 0, NULL}
  66. , {"open_conf" , 0ULL, 0, NULL}
  67. , {"open_noat" , 0ULL, 0, NULL}
  68. , {"open_dgrd" , 0ULL, 0, NULL}
  69. , {"close" , 0ULL, 0, NULL}
  70. , {"setattr" , 0ULL, 0, NULL}
  71. , {"fsinfo" , 0ULL, 0, NULL}
  72. , {"renew" , 0ULL, 0, NULL}
  73. , {"setclntid" , 0ULL, 0, NULL}
  74. , {"confirm" , 0ULL, 0, NULL}
  75. , {"lock" , 0ULL, 0, NULL}
  76. , {"lockt" , 0ULL, 0, NULL}
  77. , {"locku" , 0ULL, 0, NULL}
  78. , {"access" , 0ULL, 0, NULL}
  79. , {"getattr" , 0ULL, 0, NULL}
  80. , {"lookup" , 0ULL, 0, NULL}
  81. , {"lookup_root" , 0ULL, 0, NULL}
  82. , {"remove" , 0ULL, 0, NULL}
  83. , {"rename" , 0ULL, 0, NULL}
  84. , {"link" , 0ULL, 0, NULL}
  85. , {"symlink" , 0ULL, 0, NULL}
  86. , {"create" , 0ULL, 0, NULL}
  87. , {"pathconf" , 0ULL, 0, NULL}
  88. , {"statfs" , 0ULL, 0, NULL}
  89. , {"readlink" , 0ULL, 0, NULL}
  90. , {"readdir" , 0ULL, 0, NULL}
  91. , {"server_caps" , 0ULL, 0, NULL}
  92. , {"delegreturn" , 0ULL, 0, NULL}
  93. , {"getacl" , 0ULL, 0, NULL}
  94. , {"setacl" , 0ULL, 0, NULL}
  95. , {"fs_locations" , 0ULL, 0, NULL}
  96. , {"rel_lkowner" , 0ULL, 0, NULL}
  97. , {"secinfo" , 0ULL, 0, NULL}
  98. , {"fsid_present" , 0ULL, 0, NULL}
  99. ,
  100. /* nfsv4.1 client ops */
  101. { "exchange_id" , 0ULL, 0, NULL}
  102. , {"create_session" , 0ULL, 0, NULL}
  103. , {"destroy_session" , 0ULL, 0, NULL}
  104. , {"sequence" , 0ULL, 0, NULL}
  105. , {"get_lease_time" , 0ULL, 0, NULL}
  106. , {"reclaim_comp" , 0ULL, 0, NULL}
  107. , {"layoutget" , 0ULL, 0, NULL}
  108. , {"getdevinfo" , 0ULL, 0, NULL}
  109. , {"layoutcommit" , 0ULL, 0, NULL}
  110. , {"layoutreturn" , 0ULL, 0, NULL}
  111. , {"secinfo_no" , 0ULL, 0, NULL}
  112. , {"test_stateid" , 0ULL, 0, NULL}
  113. , {"free_stateid" , 0ULL, 0, NULL}
  114. , {"getdevicelist" , 0ULL, 0, NULL}
  115. , {"bind_conn_to_ses", 0ULL, 0, NULL}
  116. , {"destroy_clientid", 0ULL, 0, NULL}
  117. ,
  118. /* nfsv4.2 client ops */
  119. { "seek" , 0ULL, 0, NULL}
  120. , {"allocate" , 0ULL, 0, NULL}
  121. , {"deallocate" , 0ULL, 0, NULL}
  122. , {"layoutstats" , 0ULL, 0, NULL}
  123. , {"clone" , 0ULL, 0, NULL}
  124. ,
  125. /* termination */
  126. { "" , 0ULL, 0, NULL}
  127. };
  128. struct nfsd_procs nfsd4_ops_values[] = {
  129. { "unused_op0" , 0ULL, 0, NULL}
  130. , {"unused_op1" , 0ULL, 0, NULL}
  131. , {"future_op2" , 0ULL, 0, NULL}
  132. , {"access" , 0ULL, 0, NULL}
  133. , {"close" , 0ULL, 0, NULL}
  134. , {"commit" , 0ULL, 0, NULL}
  135. , {"create" , 0ULL, 0, NULL}
  136. , {"delegpurge" , 0ULL, 0, NULL}
  137. , {"delegreturn" , 0ULL, 0, NULL}
  138. , {"getattr" , 0ULL, 0, NULL}
  139. , {"getfh" , 0ULL, 0, NULL}
  140. , {"link" , 0ULL, 0, NULL}
  141. , {"lock" , 0ULL, 0, NULL}
  142. , {"lockt" , 0ULL, 0, NULL}
  143. , {"locku" , 0ULL, 0, NULL}
  144. , {"lookup" , 0ULL, 0, NULL}
  145. , {"lookup_root" , 0ULL, 0, NULL}
  146. , {"nverify" , 0ULL, 0, NULL}
  147. , {"open" , 0ULL, 0, NULL}
  148. , {"openattr" , 0ULL, 0, NULL}
  149. , {"open_confirm" , 0ULL, 0, NULL}
  150. , {"open_downgrade" , 0ULL, 0, NULL}
  151. , {"putfh" , 0ULL, 0, NULL}
  152. , {"putpubfh" , 0ULL, 0, NULL}
  153. , {"putrootfh" , 0ULL, 0, NULL}
  154. , {"read" , 0ULL, 0, NULL}
  155. , {"readdir" , 0ULL, 0, NULL}
  156. , {"readlink" , 0ULL, 0, NULL}
  157. , {"remove" , 0ULL, 0, NULL}
  158. , {"rename" , 0ULL, 0, NULL}
  159. , {"renew" , 0ULL, 0, NULL}
  160. , {"restorefh" , 0ULL, 0, NULL}
  161. , {"savefh" , 0ULL, 0, NULL}
  162. , {"secinfo" , 0ULL, 0, NULL}
  163. , {"setattr" , 0ULL, 0, NULL}
  164. , {"setclientid" , 0ULL, 0, NULL}
  165. , {"setclientid_confirm" , 0ULL, 0, NULL}
  166. , {"verify" , 0ULL, 0, NULL}
  167. , {"write" , 0ULL, 0, NULL}
  168. , {"release_lockowner" , 0ULL, 0, NULL}
  169. ,
  170. /* nfs41 */
  171. { "backchannel_ctl" , 0ULL, 0, NULL}
  172. , {"bind_conn_to_session", 0ULL, 0, NULL}
  173. , {"exchange_id" , 0ULL, 0, NULL}
  174. , {"create_session" , 0ULL, 0, NULL}
  175. , {"destroy_session" , 0ULL, 0, NULL}
  176. , {"free_stateid" , 0ULL, 0, NULL}
  177. , {"get_dir_delegation" , 0ULL, 0, NULL}
  178. , {"getdeviceinfo" , 0ULL, 0, NULL}
  179. , {"getdevicelist" , 0ULL, 0, NULL}
  180. , {"layoutcommit" , 0ULL, 0, NULL}
  181. , {"layoutget" , 0ULL, 0, NULL}
  182. , {"layoutreturn" , 0ULL, 0, NULL}
  183. , {"secinfo_no_name" , 0ULL, 0, NULL}
  184. , {"sequence" , 0ULL, 0, NULL}
  185. , {"set_ssv" , 0ULL, 0, NULL}
  186. , {"test_stateid" , 0ULL, 0, NULL}
  187. , {"want_delegation" , 0ULL, 0, NULL}
  188. , {"destroy_clientid" , 0ULL, 0, NULL}
  189. , {"reclaim_complete" , 0ULL, 0, NULL}
  190. ,
  191. /* nfs42 */
  192. { "allocate" , 0ULL, 0, NULL}
  193. , {"copy" , 0ULL, 0, NULL}
  194. , {"copy_notify" , 0ULL, 0, NULL}
  195. , {"deallocate" , 0ULL, 0, NULL}
  196. , {"ioadvise" , 0ULL, 0, NULL}
  197. , {"layouterror" , 0ULL, 0, NULL}
  198. , {"layoutstats" , 0ULL, 0, NULL}
  199. , {"offload_cancel" , 0ULL, 0, NULL}
  200. , {"offload_status" , 0ULL, 0, NULL}
  201. , {"read_plus" , 0ULL, 0, NULL}
  202. , {"seek" , 0ULL, 0, NULL}
  203. , {"write_same" , 0ULL, 0, NULL}
  204. ,
  205. /* termination */
  206. { "" , 0ULL, 0, NULL}
  207. };
  208. int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
  209. (void)dt;
  210. static procfile *ff = NULL;
  211. static int do_rc = -1, do_fh = -1, do_io = -1, do_th = -1, do_ra = -1, do_net = -1, do_rpc = -1, do_proc2 = -1, do_proc3 = -1, do_proc4 = -1, do_proc4ops = -1;
  212. static int ra_warning = 0, th_warning = 0, proc2_warning = 0, proc3_warning = 0, proc4_warning = 0, proc4ops_warning = 0;
  213. if(unlikely(!ff)) {
  214. char filename[FILENAME_MAX + 1];
  215. snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/rpc/nfsd");
  216. ff = procfile_open(config_get("plugin:proc:/proc/net/rpc/nfsd", "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
  217. if(unlikely(!ff)) return 1;
  218. }
  219. ff = procfile_readall(ff);
  220. if(unlikely(!ff)) return 0; // we return 0, so that we will retry to open it next time
  221. if(unlikely(do_rc == -1)) {
  222. do_rc = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "read cache", 1);
  223. do_fh = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "file handles", 1);
  224. do_io = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "I/O", 1);
  225. do_th = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "threads", 1);
  226. do_ra = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "read ahead", 1);
  227. do_net = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "network", 1);
  228. do_rpc = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "rpc", 1);
  229. do_proc2 = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "NFS v2 procedures", 1);
  230. do_proc3 = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "NFS v3 procedures", 1);
  231. do_proc4 = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "NFS v4 procedures", 1);
  232. do_proc4ops = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "NFS v4 operations", 1);
  233. }
  234. // if they are enabled, reset them to 1
  235. // later we do them = 2 to avoid doing strcmp() for all lines
  236. if(do_rc) do_rc = 1;
  237. if(do_fh) do_fh = 1;
  238. if(do_io) do_io = 1;
  239. if(do_th) do_th = 1;
  240. if(do_ra) do_ra = 1;
  241. if(do_net) do_net = 1;
  242. if(do_rpc) do_rpc = 1;
  243. if(do_proc2) do_proc2 = 1;
  244. if(do_proc3) do_proc3 = 1;
  245. if(do_proc4) do_proc4 = 1;
  246. if(do_proc4ops) do_proc4ops = 1;
  247. size_t lines = procfile_lines(ff), l;
  248. char *type;
  249. unsigned long long rc_hits = 0, rc_misses = 0, rc_nocache = 0;
  250. unsigned long long fh_stale = 0, fh_total_lookups = 0, fh_anonymous_lookups = 0, fh_dir_not_in_dcache = 0, fh_non_dir_not_in_dcache = 0;
  251. unsigned long long io_read = 0, io_write = 0;
  252. unsigned long long th_threads = 0, th_fullcnt = 0, th_hist10 = 0, th_hist20 = 0, th_hist30 = 0, th_hist40 = 0, th_hist50 = 0, th_hist60 = 0, th_hist70 = 0, th_hist80 = 0, th_hist90 = 0, th_hist100 = 0;
  253. unsigned long long ra_size = 0, ra_hist10 = 0, ra_hist20 = 0, ra_hist30 = 0, ra_hist40 = 0, ra_hist50 = 0, ra_hist60 = 0, ra_hist70 = 0, ra_hist80 = 0, ra_hist90 = 0, ra_hist100 = 0, ra_none = 0;
  254. unsigned long long net_count = 0, net_udp_count = 0, net_tcp_count = 0, net_tcp_connections = 0;
  255. unsigned long long rpc_calls = 0, rpc_bad_format = 0, rpc_bad_auth = 0, rpc_bad_client = 0;
  256. for(l = 0; l < lines ;l++) {
  257. size_t words = procfile_linewords(ff, l);
  258. if(unlikely(!words)) continue;
  259. type = procfile_lineword(ff, l, 0);
  260. if(do_rc == 1 && strcmp(type, "rc") == 0) {
  261. if(unlikely(words < 4)) {
  262. error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 4);
  263. continue;
  264. }
  265. rc_hits = str2ull(procfile_lineword(ff, l, 1));
  266. rc_misses = str2ull(procfile_lineword(ff, l, 2));
  267. rc_nocache = str2ull(procfile_lineword(ff, l, 3));
  268. unsigned long long sum = rc_hits + rc_misses + rc_nocache;
  269. if(sum == 0ULL) do_rc = -1;
  270. else do_rc = 2;
  271. }
  272. else if(do_fh == 1 && strcmp(type, "fh") == 0) {
  273. if(unlikely(words < 6)) {
  274. error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 6);
  275. continue;
  276. }
  277. fh_stale = str2ull(procfile_lineword(ff, l, 1));
  278. fh_total_lookups = str2ull(procfile_lineword(ff, l, 2));
  279. fh_anonymous_lookups = str2ull(procfile_lineword(ff, l, 3));
  280. fh_dir_not_in_dcache = str2ull(procfile_lineword(ff, l, 4));
  281. fh_non_dir_not_in_dcache = str2ull(procfile_lineword(ff, l, 5));
  282. unsigned long long sum = fh_stale + fh_total_lookups + fh_anonymous_lookups + fh_dir_not_in_dcache + fh_non_dir_not_in_dcache;
  283. if(sum == 0ULL) do_fh = -1;
  284. else do_fh = 2;
  285. }
  286. else if(do_io == 1 && strcmp(type, "io") == 0) {
  287. if(unlikely(words < 3)) {
  288. error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 3);
  289. continue;
  290. }
  291. io_read = str2ull(procfile_lineword(ff, l, 1));
  292. io_write = str2ull(procfile_lineword(ff, l, 2));
  293. unsigned long long sum = io_read + io_write;
  294. if(sum == 0ULL) do_io = -1;
  295. else do_io = 2;
  296. }
  297. else if(do_th == 1 && strcmp(type, "th") == 0) {
  298. if(unlikely(words < 13)) {
  299. error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 13);
  300. continue;
  301. }
  302. th_threads = str2ull(procfile_lineword(ff, l, 1));
  303. th_fullcnt = str2ull(procfile_lineword(ff, l, 2));
  304. th_hist10 = (unsigned long long)(atof(procfile_lineword(ff, l, 3)) * 1000.0);
  305. th_hist20 = (unsigned long long)(atof(procfile_lineword(ff, l, 4)) * 1000.0);
  306. th_hist30 = (unsigned long long)(atof(procfile_lineword(ff, l, 5)) * 1000.0);
  307. th_hist40 = (unsigned long long)(atof(procfile_lineword(ff, l, 6)) * 1000.0);
  308. th_hist50 = (unsigned long long)(atof(procfile_lineword(ff, l, 7)) * 1000.0);
  309. th_hist60 = (unsigned long long)(atof(procfile_lineword(ff, l, 8)) * 1000.0);
  310. th_hist70 = (unsigned long long)(atof(procfile_lineword(ff, l, 9)) * 1000.0);
  311. th_hist80 = (unsigned long long)(atof(procfile_lineword(ff, l, 10)) * 1000.0);
  312. th_hist90 = (unsigned long long)(atof(procfile_lineword(ff, l, 11)) * 1000.0);
  313. th_hist100 = (unsigned long long)(atof(procfile_lineword(ff, l, 12)) * 1000.0);
  314. // threads histogram has been disabled on recent kernels
  315. // http://permalink.gmane.org/gmane.linux.nfs/24528
  316. unsigned long long sum = th_hist10 + th_hist20 + th_hist30 + th_hist40 + th_hist50 + th_hist60 + th_hist70 + th_hist80 + th_hist90 + th_hist100;
  317. if(sum == 0ULL) {
  318. if(!th_warning) {
  319. info("Disabling /proc/net/rpc/nfsd threads histogram. It seems unused on this machine. It will be enabled automatically when found with data in it.");
  320. th_warning = 1;
  321. }
  322. do_th = -1;
  323. }
  324. else do_th = 2;
  325. }
  326. else if(do_ra == 1 && strcmp(type, "ra") == 0) {
  327. if(unlikely(words < 13)) {
  328. error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 13);
  329. continue;
  330. }
  331. ra_size = str2ull(procfile_lineword(ff, l, 1));
  332. ra_hist10 = str2ull(procfile_lineword(ff, l, 2));
  333. ra_hist20 = str2ull(procfile_lineword(ff, l, 3));
  334. ra_hist30 = str2ull(procfile_lineword(ff, l, 4));
  335. ra_hist40 = str2ull(procfile_lineword(ff, l, 5));
  336. ra_hist50 = str2ull(procfile_lineword(ff, l, 6));
  337. ra_hist60 = str2ull(procfile_lineword(ff, l, 7));
  338. ra_hist70 = str2ull(procfile_lineword(ff, l, 8));
  339. ra_hist80 = str2ull(procfile_lineword(ff, l, 9));
  340. ra_hist90 = str2ull(procfile_lineword(ff, l, 10));
  341. ra_hist100 = str2ull(procfile_lineword(ff, l, 11));
  342. ra_none = str2ull(procfile_lineword(ff, l, 12));
  343. unsigned long long sum = ra_hist10 + ra_hist20 + ra_hist30 + ra_hist40 + ra_hist50 + ra_hist60 + ra_hist70 + ra_hist80 + ra_hist90 + ra_hist100 + ra_none;
  344. if(sum == 0ULL) {
  345. if(!ra_warning) {
  346. info("Disabling /proc/net/rpc/nfsd read ahead histogram. It seems unused on this machine. It will be enabled automatically when found with data in it.");
  347. ra_warning = 1;
  348. }
  349. do_ra = -1;
  350. }
  351. else do_ra = 2;
  352. }
  353. else if(do_net == 1 && strcmp(type, "net") == 0) {
  354. if(unlikely(words < 5)) {
  355. error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 5);
  356. continue;
  357. }
  358. net_count = str2ull(procfile_lineword(ff, l, 1));
  359. net_udp_count = str2ull(procfile_lineword(ff, l, 2));
  360. net_tcp_count = str2ull(procfile_lineword(ff, l, 3));
  361. net_tcp_connections = str2ull(procfile_lineword(ff, l, 4));
  362. unsigned long long sum = net_count + net_udp_count + net_tcp_count + net_tcp_connections;
  363. if(sum == 0ULL) do_net = -1;
  364. else do_net = 2;
  365. }
  366. else if(do_rpc == 1 && strcmp(type, "rpc") == 0) {
  367. if(unlikely(words < 6)) {
  368. error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 6);
  369. continue;
  370. }
  371. rpc_calls = str2ull(procfile_lineword(ff, l, 1));
  372. rpc_bad_format = str2ull(procfile_lineword(ff, l, 2));
  373. rpc_bad_auth = str2ull(procfile_lineword(ff, l, 3));
  374. rpc_bad_client = str2ull(procfile_lineword(ff, l, 4));
  375. unsigned long long sum = rpc_calls + rpc_bad_format + rpc_bad_auth + rpc_bad_client;
  376. if(sum == 0ULL) do_rpc = -1;
  377. else do_rpc = 2;
  378. }
  379. else if(do_proc2 == 1 && strcmp(type, "proc2") == 0) {
  380. // the first number is the count of numbers present
  381. // so we start for word 2
  382. unsigned long long sum = 0;
  383. unsigned int i, j;
  384. for(i = 0, j = 2; j < words && nfsd_proc2_values[i].name[0] ; i++, j++) {
  385. nfsd_proc2_values[i].value = str2ull(procfile_lineword(ff, l, j));
  386. nfsd_proc2_values[i].present = 1;
  387. sum += nfsd_proc2_values[i].value;
  388. }
  389. if(sum == 0ULL) {
  390. if(!proc2_warning) {
  391. error("Disabling /proc/net/rpc/nfsd v2 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
  392. proc2_warning = 1;
  393. }
  394. do_proc2 = 0;
  395. }
  396. else do_proc2 = 2;
  397. }
  398. else if(do_proc3 == 1 && strcmp(type, "proc3") == 0) {
  399. // the first number is the count of numbers present
  400. // so we start for word 2
  401. unsigned long long sum = 0;
  402. unsigned int i, j;
  403. for(i = 0, j = 2; j < words && nfsd_proc3_values[i].name[0] ; i++, j++) {
  404. nfsd_proc3_values[i].value = str2ull(procfile_lineword(ff, l, j));
  405. nfsd_proc3_values[i].present = 1;
  406. sum += nfsd_proc3_values[i].value;
  407. }
  408. if(sum == 0ULL) {
  409. if(!proc3_warning) {
  410. info("Disabling /proc/net/rpc/nfsd v3 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
  411. proc3_warning = 1;
  412. }
  413. do_proc3 = 0;
  414. }
  415. else do_proc3 = 2;
  416. }
  417. else if(do_proc4 == 1 && strcmp(type, "proc4") == 0) {
  418. // the first number is the count of numbers present
  419. // so we start for word 2
  420. unsigned long long sum = 0;
  421. unsigned int i, j;
  422. for(i = 0, j = 2; j < words && nfsd_proc4_values[i].name[0] ; i++, j++) {
  423. nfsd_proc4_values[i].value = str2ull(procfile_lineword(ff, l, j));
  424. nfsd_proc4_values[i].present = 1;
  425. sum += nfsd_proc4_values[i].value;
  426. }
  427. if(sum == 0ULL) {
  428. if(!proc4_warning) {
  429. info("Disabling /proc/net/rpc/nfsd v4 procedure calls chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
  430. proc4_warning = 1;
  431. }
  432. do_proc4 = 0;
  433. }
  434. else do_proc4 = 2;
  435. }
  436. else if(do_proc4ops == 1 && strcmp(type, "proc4ops") == 0) {
  437. // the first number is the count of numbers present
  438. // so we start for word 2
  439. unsigned long long sum = 0;
  440. unsigned int i, j;
  441. for(i = 0, j = 2; j < words && nfsd4_ops_values[i].name[0] ; i++, j++) {
  442. nfsd4_ops_values[i].value = str2ull(procfile_lineword(ff, l, j));
  443. nfsd4_ops_values[i].present = 1;
  444. sum += nfsd4_ops_values[i].value;
  445. }
  446. if(sum == 0ULL) {
  447. if(!proc4ops_warning) {
  448. info("Disabling /proc/net/rpc/nfsd v4 operations chart. It seems unused on this machine. It will be enabled automatically when found with data in it.");
  449. proc4ops_warning = 1;
  450. }
  451. do_proc4ops = 0;
  452. }
  453. else do_proc4ops = 2;
  454. }
  455. }
  456. // --------------------------------------------------------------------
  457. if(do_rc == 2) {
  458. static RRDSET *st = NULL;
  459. static RRDDIM *rd_hits = NULL,
  460. *rd_misses = NULL,
  461. *rd_nocache = NULL;
  462. if(unlikely(!st)) {
  463. st = rrdset_create_localhost(
  464. "nfsd"
  465. , "readcache"
  466. , NULL
  467. , "cache"
  468. , NULL
  469. , "NFS Server Read Cache"
  470. , "reads/s"
  471. , PLUGIN_PROC_NAME
  472. , PLUGIN_PROC_MODULE_NFSD_NAME
  473. , NETDATA_CHART_PRIO_NFSD_READCACHE
  474. , update_every
  475. , RRDSET_TYPE_STACKED
  476. );
  477. rd_hits = rrddim_add(st, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  478. rd_misses = rrddim_add(st, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  479. rd_nocache = rrddim_add(st, "nocache", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  480. }
  481. else rrdset_next(st);
  482. rrddim_set_by_pointer(st, rd_hits, rc_hits);
  483. rrddim_set_by_pointer(st, rd_misses, rc_misses);
  484. rrddim_set_by_pointer(st, rd_nocache, rc_nocache);
  485. rrdset_done(st);
  486. }
  487. // --------------------------------------------------------------------
  488. if(do_fh == 2) {
  489. static RRDSET *st = NULL;
  490. static RRDDIM *rd_stale = NULL,
  491. *rd_total_lookups = NULL,
  492. *rd_anonymous_lookups = NULL,
  493. *rd_dir_not_in_dcache = NULL,
  494. *rd_non_dir_not_in_dcache = NULL;
  495. if(unlikely(!st)) {
  496. st = rrdset_create_localhost(
  497. "nfsd"
  498. , "filehandles"
  499. , NULL
  500. , "filehandles"
  501. , NULL
  502. , "NFS Server File Handles"
  503. , "handles/s"
  504. , PLUGIN_PROC_NAME
  505. , PLUGIN_PROC_MODULE_NFSD_NAME
  506. , NETDATA_CHART_PRIO_NFSD_FILEHANDLES
  507. , update_every
  508. , RRDSET_TYPE_LINE
  509. );
  510. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  511. rd_stale = rrddim_add(st, "stale", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
  512. rd_total_lookups = rrddim_add(st, "total_lookups", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  513. rd_anonymous_lookups = rrddim_add(st, "anonymous_lookups", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  514. rd_dir_not_in_dcache = rrddim_add(st, "dir_not_in_dcache", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  515. rd_non_dir_not_in_dcache = rrddim_add(st, "non_dir_not_in_dcache", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  516. }
  517. else rrdset_next(st);
  518. rrddim_set_by_pointer(st, rd_stale, fh_stale);
  519. rrddim_set_by_pointer(st, rd_total_lookups, fh_total_lookups);
  520. rrddim_set_by_pointer(st, rd_anonymous_lookups, fh_anonymous_lookups);
  521. rrddim_set_by_pointer(st, rd_dir_not_in_dcache, fh_dir_not_in_dcache);
  522. rrddim_set_by_pointer(st, rd_non_dir_not_in_dcache, fh_non_dir_not_in_dcache);
  523. rrdset_done(st);
  524. }
  525. // --------------------------------------------------------------------
  526. if(do_io == 2) {
  527. static RRDSET *st = NULL;
  528. static RRDDIM *rd_read = NULL,
  529. *rd_write = NULL;
  530. if(unlikely(!st)) {
  531. st = rrdset_create_localhost(
  532. "nfsd"
  533. , "io"
  534. , NULL
  535. , "io"
  536. , NULL
  537. , "NFS Server I/O"
  538. , "kilobytes/s"
  539. , PLUGIN_PROC_NAME
  540. , PLUGIN_PROC_MODULE_NFSD_NAME
  541. , NETDATA_CHART_PRIO_NFSD_IO
  542. , update_every
  543. , RRDSET_TYPE_AREA
  544. );
  545. rd_read = rrddim_add(st, "read", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
  546. rd_write = rrddim_add(st, "write", NULL, -1, 1000, RRD_ALGORITHM_INCREMENTAL);
  547. }
  548. else rrdset_next(st);
  549. rrddim_set_by_pointer(st, rd_read, io_read);
  550. rrddim_set_by_pointer(st, rd_write, io_write);
  551. rrdset_done(st);
  552. }
  553. // --------------------------------------------------------------------
  554. if(do_th == 2) {
  555. {
  556. static RRDSET *st = NULL;
  557. static RRDDIM *rd_threads = NULL;
  558. if(unlikely(!st)) {
  559. st = rrdset_create_localhost(
  560. "nfsd"
  561. , "threads"
  562. , NULL
  563. , "threads"
  564. , NULL
  565. , "NFS Server Threads"
  566. , "threads"
  567. , PLUGIN_PROC_NAME
  568. , PLUGIN_PROC_MODULE_NFSD_NAME
  569. , NETDATA_CHART_PRIO_NFSD_THREADS
  570. , update_every
  571. , RRDSET_TYPE_LINE
  572. );
  573. rd_threads = rrddim_add(st, "threads", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
  574. }
  575. else rrdset_next(st);
  576. rrddim_set_by_pointer(st, rd_threads, th_threads);
  577. rrdset_done(st);
  578. }
  579. {
  580. static RRDSET *st = NULL;
  581. static RRDDIM *rd_full_count = NULL;
  582. if(unlikely(!st)) {
  583. st = rrdset_create_localhost(
  584. "nfsd"
  585. , "threads_fullcnt"
  586. , NULL
  587. , "threads"
  588. , NULL
  589. , "NFS Server Threads Full Count"
  590. , "events"
  591. , PLUGIN_PROC_NAME
  592. , PLUGIN_PROC_MODULE_NFSD_NAME
  593. , NETDATA_CHART_PRIO_NFSD_THREADS_FULLCNT
  594. , update_every
  595. , RRDSET_TYPE_LINE
  596. );
  597. rd_full_count = rrddim_add(st, "full_count", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  598. }
  599. else rrdset_next(st);
  600. rrddim_set_by_pointer(st, rd_full_count, th_fullcnt);
  601. rrdset_done(st);
  602. }
  603. {
  604. static RRDSET *st = NULL;
  605. static RRDDIM *rd_th_hist10 = NULL,
  606. *rd_th_hist20 = NULL,
  607. *rd_th_hist30 = NULL,
  608. *rd_th_hist40 = NULL,
  609. *rd_th_hist50 = NULL,
  610. *rd_th_hist60 = NULL,
  611. *rd_th_hist70 = NULL,
  612. *rd_th_hist80 = NULL,
  613. *rd_th_hist90 = NULL,
  614. *rd_th_hist100 = NULL;
  615. if(unlikely(!st)) {
  616. st = rrdset_create_localhost(
  617. "nfsd"
  618. , "threads_histogram"
  619. , NULL
  620. , "threads"
  621. , NULL
  622. , "NFS Server Threads Usage Histogram"
  623. , "percentage"
  624. , PLUGIN_PROC_NAME
  625. , PLUGIN_PROC_MODULE_NFSD_NAME
  626. , NETDATA_CHART_PRIO_NFSD_THREADS_HISTOGRAM
  627. , update_every
  628. , RRDSET_TYPE_LINE
  629. );
  630. rd_th_hist10 = rrddim_add(st, "0%-10%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  631. rd_th_hist20 = rrddim_add(st, "10%-20%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  632. rd_th_hist30 = rrddim_add(st, "20%-30%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  633. rd_th_hist40 = rrddim_add(st, "30%-40%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  634. rd_th_hist50 = rrddim_add(st, "40%-50%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  635. rd_th_hist60 = rrddim_add(st, "50%-60%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  636. rd_th_hist70 = rrddim_add(st, "60%-70%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  637. rd_th_hist80 = rrddim_add(st, "70%-80%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  638. rd_th_hist90 = rrddim_add(st, "80%-90%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  639. rd_th_hist100 = rrddim_add(st, "90%-100%", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
  640. }
  641. else rrdset_next(st);
  642. rrddim_set_by_pointer(st, rd_th_hist10, th_hist10);
  643. rrddim_set_by_pointer(st, rd_th_hist20, th_hist20);
  644. rrddim_set_by_pointer(st, rd_th_hist30, th_hist30);
  645. rrddim_set_by_pointer(st, rd_th_hist40, th_hist40);
  646. rrddim_set_by_pointer(st, rd_th_hist50, th_hist50);
  647. rrddim_set_by_pointer(st, rd_th_hist60, th_hist60);
  648. rrddim_set_by_pointer(st, rd_th_hist70, th_hist70);
  649. rrddim_set_by_pointer(st, rd_th_hist80, th_hist80);
  650. rrddim_set_by_pointer(st, rd_th_hist90, th_hist90);
  651. rrddim_set_by_pointer(st, rd_th_hist100, th_hist100);
  652. rrdset_done(st);
  653. }
  654. }
  655. // --------------------------------------------------------------------
  656. if(do_ra == 2) {
  657. static RRDSET *st = NULL;
  658. static RRDDIM *rd_ra_hist10 = NULL,
  659. *rd_ra_hist20 = NULL,
  660. *rd_ra_hist30 = NULL,
  661. *rd_ra_hist40 = NULL,
  662. *rd_ra_hist50 = NULL,
  663. *rd_ra_hist60 = NULL,
  664. *rd_ra_hist70 = NULL,
  665. *rd_ra_hist80 = NULL,
  666. *rd_ra_hist90 = NULL,
  667. *rd_ra_hist100 = NULL,
  668. *rd_ra_none = NULL;
  669. if(unlikely(!st)) {
  670. st = rrdset_create_localhost(
  671. "nfsd"
  672. , "readahead"
  673. , NULL
  674. , "readahead"
  675. , NULL
  676. , "NFS Server Read Ahead Depth"
  677. , "percentage"
  678. , PLUGIN_PROC_NAME
  679. , PLUGIN_PROC_MODULE_NFSD_NAME
  680. , NETDATA_CHART_PRIO_NFSD_READAHEAD
  681. , update_every
  682. , RRDSET_TYPE_STACKED
  683. );
  684. rd_ra_hist10 = rrddim_add(st, "10%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  685. rd_ra_hist20 = rrddim_add(st, "20%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  686. rd_ra_hist30 = rrddim_add(st, "30%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  687. rd_ra_hist40 = rrddim_add(st, "40%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  688. rd_ra_hist50 = rrddim_add(st, "50%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  689. rd_ra_hist60 = rrddim_add(st, "60%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  690. rd_ra_hist70 = rrddim_add(st, "70%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  691. rd_ra_hist80 = rrddim_add(st, "80%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  692. rd_ra_hist90 = rrddim_add(st, "90%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  693. rd_ra_hist100 = rrddim_add(st, "100%", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  694. rd_ra_none = rrddim_add(st, "misses", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
  695. }
  696. else rrdset_next(st);
  697. // ignore ra_size
  698. (void)ra_size;
  699. rrddim_set_by_pointer(st, rd_ra_hist10, ra_hist10);
  700. rrddim_set_by_pointer(st, rd_ra_hist20, ra_hist20);
  701. rrddim_set_by_pointer(st, rd_ra_hist30, ra_hist30);
  702. rrddim_set_by_pointer(st, rd_ra_hist40, ra_hist40);
  703. rrddim_set_by_pointer(st, rd_ra_hist50, ra_hist50);
  704. rrddim_set_by_pointer(st, rd_ra_hist60, ra_hist60);
  705. rrddim_set_by_pointer(st, rd_ra_hist70, ra_hist70);
  706. rrddim_set_by_pointer(st, rd_ra_hist80, ra_hist80);
  707. rrddim_set_by_pointer(st, rd_ra_hist90, ra_hist90);
  708. rrddim_set_by_pointer(st, rd_ra_hist100,ra_hist100);
  709. rrddim_set_by_pointer(st, rd_ra_none, ra_none);
  710. rrdset_done(st);
  711. }
  712. // --------------------------------------------------------------------
  713. if(do_net == 2) {
  714. static RRDSET *st = NULL;
  715. static RRDDIM *rd_udp = NULL,
  716. *rd_tcp = NULL;
  717. if(unlikely(!st)) {
  718. st = rrdset_create_localhost(
  719. "nfsd"
  720. , "net"
  721. , NULL
  722. , "network"
  723. , NULL
  724. , "NFS Server Network Statistics"
  725. , "packets/s"
  726. , PLUGIN_PROC_NAME
  727. , PLUGIN_PROC_MODULE_NFSD_NAME
  728. , NETDATA_CHART_PRIO_NFSD_NET
  729. , update_every
  730. , RRDSET_TYPE_STACKED
  731. );
  732. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  733. rd_udp = rrddim_add(st, "udp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  734. rd_tcp = rrddim_add(st, "tcp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  735. }
  736. else rrdset_next(st);
  737. // ignore net_count, net_tcp_connections
  738. (void)net_count;
  739. (void)net_tcp_connections;
  740. rrddim_set_by_pointer(st, rd_udp, net_udp_count);
  741. rrddim_set_by_pointer(st, rd_tcp, net_tcp_count);
  742. rrdset_done(st);
  743. }
  744. // --------------------------------------------------------------------
  745. if(do_rpc == 2) {
  746. static RRDSET *st = NULL;
  747. static RRDDIM *rd_calls = NULL,
  748. *rd_bad_format = NULL,
  749. *rd_bad_auth = NULL;
  750. if(unlikely(!st)) {
  751. st = rrdset_create_localhost(
  752. "nfsd"
  753. , "rpc"
  754. , NULL
  755. , "rpc"
  756. , NULL
  757. , "NFS Server Remote Procedure Calls Statistics"
  758. , "calls/s"
  759. , PLUGIN_PROC_NAME
  760. , PLUGIN_PROC_MODULE_NFSD_NAME
  761. , NETDATA_CHART_PRIO_NFSD_RPC
  762. , update_every
  763. , RRDSET_TYPE_LINE
  764. );
  765. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  766. rd_calls = rrddim_add(st, "calls", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  767. rd_bad_format = rrddim_add(st, "bad_format", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  768. rd_bad_auth = rrddim_add(st, "bad_auth", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  769. }
  770. else rrdset_next(st);
  771. // ignore rpc_bad_client
  772. (void)rpc_bad_client;
  773. rrddim_set_by_pointer(st, rd_calls, rpc_calls);
  774. rrddim_set_by_pointer(st, rd_bad_format, rpc_bad_format);
  775. rrddim_set_by_pointer(st, rd_bad_auth, rpc_bad_auth);
  776. rrdset_done(st);
  777. }
  778. // --------------------------------------------------------------------
  779. if(do_proc2 == 2) {
  780. static RRDSET *st = NULL;
  781. if(unlikely(!st)) {
  782. st = rrdset_create_localhost(
  783. "nfsd"
  784. , "proc2"
  785. , NULL
  786. , "nfsv2rpc"
  787. , NULL
  788. , "NFS v2 Server Remote Procedure Calls"
  789. , "calls/s"
  790. , PLUGIN_PROC_NAME
  791. , PLUGIN_PROC_MODULE_NFSD_NAME
  792. , NETDATA_CHART_PRIO_NFSD_PROC2
  793. , update_every
  794. , RRDSET_TYPE_STACKED
  795. );
  796. }
  797. else rrdset_next(st);
  798. size_t i;
  799. for(i = 0; nfsd_proc2_values[i].present ; i++) {
  800. if(unlikely(!nfsd_proc2_values[i].rd))
  801. nfsd_proc2_values[i].rd = rrddim_add(st, nfsd_proc2_values[i].name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  802. rrddim_set_by_pointer(st, nfsd_proc2_values[i].rd, nfsd_proc2_values[i].value);
  803. }
  804. rrdset_done(st);
  805. }
  806. // --------------------------------------------------------------------
  807. if(do_proc3 == 2) {
  808. static RRDSET *st = NULL;
  809. if(unlikely(!st)) {
  810. st = rrdset_create_localhost(
  811. "nfsd"
  812. , "proc3"
  813. , NULL
  814. , "nfsv3rpc"
  815. , NULL
  816. , "NFS v3 Server Remote Procedure Calls"
  817. , "calls/s"
  818. , PLUGIN_PROC_NAME
  819. , PLUGIN_PROC_MODULE_NFSD_NAME
  820. , NETDATA_CHART_PRIO_NFSD_PROC3
  821. , update_every
  822. , RRDSET_TYPE_STACKED
  823. );
  824. }
  825. else rrdset_next(st);
  826. size_t i;
  827. for(i = 0; nfsd_proc3_values[i].present ; i++) {
  828. if(unlikely(!nfsd_proc3_values[i].rd))
  829. nfsd_proc3_values[i].rd = rrddim_add(st, nfsd_proc3_values[i].name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  830. rrddim_set_by_pointer(st, nfsd_proc3_values[i].rd, nfsd_proc3_values[i].value);
  831. }
  832. rrdset_done(st);
  833. }
  834. // --------------------------------------------------------------------
  835. if(do_proc4 == 2) {
  836. static RRDSET *st = NULL;
  837. if(unlikely(!st)) {
  838. st = rrdset_create_localhost(
  839. "nfsd"
  840. , "proc4"
  841. , NULL
  842. , "nfsv4rpc"
  843. , NULL
  844. , "NFS v4 Server Remote Procedure Calls"
  845. , "calls/s"
  846. , PLUGIN_PROC_NAME
  847. , PLUGIN_PROC_MODULE_NFSD_NAME
  848. , NETDATA_CHART_PRIO_NFSD_PROC4
  849. , update_every
  850. , RRDSET_TYPE_STACKED
  851. );
  852. }
  853. else rrdset_next(st);
  854. size_t i;
  855. for(i = 0; nfsd_proc4_values[i].present ; i++) {
  856. if(unlikely(!nfsd_proc4_values[i].rd))
  857. nfsd_proc4_values[i].rd = rrddim_add(st, nfsd_proc4_values[i].name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  858. rrddim_set_by_pointer(st, nfsd_proc4_values[i].rd, nfsd_proc4_values[i].value);
  859. }
  860. rrdset_done(st);
  861. }
  862. // --------------------------------------------------------------------
  863. if(do_proc4ops == 2) {
  864. static RRDSET *st = NULL;
  865. if(unlikely(!st)) {
  866. st = rrdset_create_localhost(
  867. "nfsd"
  868. , "proc4ops"
  869. , NULL
  870. , "nfsv2ops"
  871. , NULL
  872. , "NFS v4 Server Operations"
  873. , "operations/s"
  874. , PLUGIN_PROC_NAME
  875. , PLUGIN_PROC_MODULE_NFSD_NAME
  876. , NETDATA_CHART_PRIO_NFSD_PROC4OPS
  877. , update_every
  878. , RRDSET_TYPE_STACKED
  879. );
  880. }
  881. else rrdset_next(st);
  882. size_t i;
  883. for(i = 0; nfsd4_ops_values[i].present ; i++) {
  884. if(unlikely(!nfsd4_ops_values[i].rd))
  885. nfsd4_ops_values[i].rd = rrddim_add(st, nfsd4_ops_values[i].name, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  886. rrddim_set_by_pointer(st, nfsd4_ops_values[i].rd, nfsd4_ops_values[i].value);
  887. }
  888. rrdset_done(st);
  889. }
  890. return 0;
  891. }