proc_net_netstat.c 152 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #include "plugin_proc.h"
  3. #define RRD_TYPE_NET_NETSTAT "ip"
  4. #define RRD_TYPE_NET_SNMP "ipv4"
  5. #define RRD_TYPE_NET_SNMP6 "ipv6"
  6. #define PLUGIN_PROC_MODULE_NETSTAT_NAME "/proc/net/netstat"
  7. #define CONFIG_SECTION_PLUGIN_PROC_NETSTAT "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_NETSTAT_NAME
  8. static struct proc_net_snmp {
  9. // kernel_uint_t ip_Forwarding;
  10. kernel_uint_t ip_DefaultTTL;
  11. kernel_uint_t ip_InReceives;
  12. kernel_uint_t ip_InHdrErrors;
  13. kernel_uint_t ip_InAddrErrors;
  14. kernel_uint_t ip_ForwDatagrams;
  15. kernel_uint_t ip_InUnknownProtos;
  16. kernel_uint_t ip_InDiscards;
  17. kernel_uint_t ip_InDelivers;
  18. kernel_uint_t ip_OutRequests;
  19. kernel_uint_t ip_OutDiscards;
  20. kernel_uint_t ip_OutNoRoutes;
  21. kernel_uint_t ip_ReasmTimeout;
  22. kernel_uint_t ip_ReasmReqds;
  23. kernel_uint_t ip_ReasmOKs;
  24. kernel_uint_t ip_ReasmFails;
  25. kernel_uint_t ip_FragOKs;
  26. kernel_uint_t ip_FragFails;
  27. kernel_uint_t ip_FragCreates;
  28. kernel_uint_t icmp_InMsgs;
  29. kernel_uint_t icmp_OutMsgs;
  30. kernel_uint_t icmp_InErrors;
  31. kernel_uint_t icmp_OutErrors;
  32. kernel_uint_t icmp_InCsumErrors;
  33. kernel_uint_t icmpmsg_InEchoReps;
  34. kernel_uint_t icmpmsg_OutEchoReps;
  35. kernel_uint_t icmpmsg_InDestUnreachs;
  36. kernel_uint_t icmpmsg_OutDestUnreachs;
  37. kernel_uint_t icmpmsg_InRedirects;
  38. kernel_uint_t icmpmsg_OutRedirects;
  39. kernel_uint_t icmpmsg_InEchos;
  40. kernel_uint_t icmpmsg_OutEchos;
  41. kernel_uint_t icmpmsg_InRouterAdvert;
  42. kernel_uint_t icmpmsg_OutRouterAdvert;
  43. kernel_uint_t icmpmsg_InRouterSelect;
  44. kernel_uint_t icmpmsg_OutRouterSelect;
  45. kernel_uint_t icmpmsg_InTimeExcds;
  46. kernel_uint_t icmpmsg_OutTimeExcds;
  47. kernel_uint_t icmpmsg_InParmProbs;
  48. kernel_uint_t icmpmsg_OutParmProbs;
  49. kernel_uint_t icmpmsg_InTimestamps;
  50. kernel_uint_t icmpmsg_OutTimestamps;
  51. kernel_uint_t icmpmsg_InTimestampReps;
  52. kernel_uint_t icmpmsg_OutTimestampReps;
  53. //kernel_uint_t tcp_RtoAlgorithm;
  54. //kernel_uint_t tcp_RtoMin;
  55. //kernel_uint_t tcp_RtoMax;
  56. ssize_t tcp_MaxConn;
  57. kernel_uint_t tcp_ActiveOpens;
  58. kernel_uint_t tcp_PassiveOpens;
  59. kernel_uint_t tcp_AttemptFails;
  60. kernel_uint_t tcp_EstabResets;
  61. kernel_uint_t tcp_CurrEstab;
  62. kernel_uint_t tcp_InSegs;
  63. kernel_uint_t tcp_OutSegs;
  64. kernel_uint_t tcp_RetransSegs;
  65. kernel_uint_t tcp_InErrs;
  66. kernel_uint_t tcp_OutRsts;
  67. kernel_uint_t tcp_InCsumErrors;
  68. kernel_uint_t udp_InDatagrams;
  69. kernel_uint_t udp_NoPorts;
  70. kernel_uint_t udp_InErrors;
  71. kernel_uint_t udp_OutDatagrams;
  72. kernel_uint_t udp_RcvbufErrors;
  73. kernel_uint_t udp_SndbufErrors;
  74. kernel_uint_t udp_InCsumErrors;
  75. kernel_uint_t udp_IgnoredMulti;
  76. kernel_uint_t udplite_InDatagrams;
  77. kernel_uint_t udplite_NoPorts;
  78. kernel_uint_t udplite_InErrors;
  79. kernel_uint_t udplite_OutDatagrams;
  80. kernel_uint_t udplite_RcvbufErrors;
  81. kernel_uint_t udplite_SndbufErrors;
  82. kernel_uint_t udplite_InCsumErrors;
  83. kernel_uint_t udplite_IgnoredMulti;
  84. } snmp_root = { 0 };
  85. static void parse_line_pair(procfile *ff_netstat, ARL_BASE *base, size_t header_line, size_t values_line) {
  86. size_t hwords = procfile_linewords(ff_netstat, header_line);
  87. size_t vwords = procfile_linewords(ff_netstat, values_line);
  88. size_t w;
  89. if(unlikely(vwords > hwords)) {
  90. collector_error("File /proc/net/netstat on header line %zu has %zu words, but on value line %zu has %zu words.", header_line, hwords, values_line, vwords);
  91. vwords = hwords;
  92. }
  93. for(w = 1; w < vwords ;w++) {
  94. if(unlikely(arl_check(base, procfile_lineword(ff_netstat, header_line, w), procfile_lineword(ff_netstat, values_line, w))))
  95. break;
  96. }
  97. }
  98. static void do_proc_net_snmp6(int update_every) {
  99. static bool do_snmp6 = true;
  100. if (!do_snmp6) {
  101. return;
  102. }
  103. static int do_ip6_packets = -1, do_ip6_fragsout = -1, do_ip6_fragsin = -1, do_ip6_errors = -1,
  104. do_ip6_udplite_packets = -1, do_ip6_udplite_errors = -1, do_ip6_udp_packets = -1, do_ip6_udp_errors = -1,
  105. do_ip6_bandwidth = -1, do_ip6_mcast = -1, do_ip6_bcast = -1, do_ip6_mcast_p = -1, do_ip6_icmp = -1,
  106. do_ip6_icmp_redir = -1, do_ip6_icmp_errors = -1, do_ip6_icmp_echos = -1, do_ip6_icmp_groupmemb = -1,
  107. do_ip6_icmp_router = -1, do_ip6_icmp_neighbor = -1, do_ip6_icmp_mldv2 = -1, do_ip6_icmp_types = -1,
  108. do_ip6_ect = -1;
  109. static procfile *ff_snmp6 = NULL;
  110. static ARL_BASE *arl_ipv6 = NULL;
  111. static unsigned long long Ip6InReceives = 0ULL;
  112. static unsigned long long Ip6InHdrErrors = 0ULL;
  113. static unsigned long long Ip6InTooBigErrors = 0ULL;
  114. static unsigned long long Ip6InNoRoutes = 0ULL;
  115. static unsigned long long Ip6InAddrErrors = 0ULL;
  116. static unsigned long long Ip6InUnknownProtos = 0ULL;
  117. static unsigned long long Ip6InTruncatedPkts = 0ULL;
  118. static unsigned long long Ip6InDiscards = 0ULL;
  119. static unsigned long long Ip6InDelivers = 0ULL;
  120. static unsigned long long Ip6OutForwDatagrams = 0ULL;
  121. static unsigned long long Ip6OutRequests = 0ULL;
  122. static unsigned long long Ip6OutDiscards = 0ULL;
  123. static unsigned long long Ip6OutNoRoutes = 0ULL;
  124. static unsigned long long Ip6ReasmTimeout = 0ULL;
  125. static unsigned long long Ip6ReasmReqds = 0ULL;
  126. static unsigned long long Ip6ReasmOKs = 0ULL;
  127. static unsigned long long Ip6ReasmFails = 0ULL;
  128. static unsigned long long Ip6FragOKs = 0ULL;
  129. static unsigned long long Ip6FragFails = 0ULL;
  130. static unsigned long long Ip6FragCreates = 0ULL;
  131. static unsigned long long Ip6InMcastPkts = 0ULL;
  132. static unsigned long long Ip6OutMcastPkts = 0ULL;
  133. static unsigned long long Ip6InOctets = 0ULL;
  134. static unsigned long long Ip6OutOctets = 0ULL;
  135. static unsigned long long Ip6InMcastOctets = 0ULL;
  136. static unsigned long long Ip6OutMcastOctets = 0ULL;
  137. static unsigned long long Ip6InBcastOctets = 0ULL;
  138. static unsigned long long Ip6OutBcastOctets = 0ULL;
  139. static unsigned long long Ip6InNoECTPkts = 0ULL;
  140. static unsigned long long Ip6InECT1Pkts = 0ULL;
  141. static unsigned long long Ip6InECT0Pkts = 0ULL;
  142. static unsigned long long Ip6InCEPkts = 0ULL;
  143. static unsigned long long Icmp6InMsgs = 0ULL;
  144. static unsigned long long Icmp6InErrors = 0ULL;
  145. static unsigned long long Icmp6OutMsgs = 0ULL;
  146. static unsigned long long Icmp6OutErrors = 0ULL;
  147. static unsigned long long Icmp6InCsumErrors = 0ULL;
  148. static unsigned long long Icmp6InDestUnreachs = 0ULL;
  149. static unsigned long long Icmp6InPktTooBigs = 0ULL;
  150. static unsigned long long Icmp6InTimeExcds = 0ULL;
  151. static unsigned long long Icmp6InParmProblems = 0ULL;
  152. static unsigned long long Icmp6InEchos = 0ULL;
  153. static unsigned long long Icmp6InEchoReplies = 0ULL;
  154. static unsigned long long Icmp6InGroupMembQueries = 0ULL;
  155. static unsigned long long Icmp6InGroupMembResponses = 0ULL;
  156. static unsigned long long Icmp6InGroupMembReductions = 0ULL;
  157. static unsigned long long Icmp6InRouterSolicits = 0ULL;
  158. static unsigned long long Icmp6InRouterAdvertisements = 0ULL;
  159. static unsigned long long Icmp6InNeighborSolicits = 0ULL;
  160. static unsigned long long Icmp6InNeighborAdvertisements = 0ULL;
  161. static unsigned long long Icmp6InRedirects = 0ULL;
  162. static unsigned long long Icmp6InMLDv2Reports = 0ULL;
  163. static unsigned long long Icmp6OutDestUnreachs = 0ULL;
  164. static unsigned long long Icmp6OutPktTooBigs = 0ULL;
  165. static unsigned long long Icmp6OutTimeExcds = 0ULL;
  166. static unsigned long long Icmp6OutParmProblems = 0ULL;
  167. static unsigned long long Icmp6OutEchos = 0ULL;
  168. static unsigned long long Icmp6OutEchoReplies = 0ULL;
  169. static unsigned long long Icmp6OutGroupMembQueries = 0ULL;
  170. static unsigned long long Icmp6OutGroupMembResponses = 0ULL;
  171. static unsigned long long Icmp6OutGroupMembReductions = 0ULL;
  172. static unsigned long long Icmp6OutRouterSolicits = 0ULL;
  173. static unsigned long long Icmp6OutRouterAdvertisements = 0ULL;
  174. static unsigned long long Icmp6OutNeighborSolicits = 0ULL;
  175. static unsigned long long Icmp6OutNeighborAdvertisements = 0ULL;
  176. static unsigned long long Icmp6OutRedirects = 0ULL;
  177. static unsigned long long Icmp6OutMLDv2Reports = 0ULL;
  178. static unsigned long long Icmp6InType1 = 0ULL;
  179. static unsigned long long Icmp6InType128 = 0ULL;
  180. static unsigned long long Icmp6InType129 = 0ULL;
  181. static unsigned long long Icmp6InType136 = 0ULL;
  182. static unsigned long long Icmp6OutType1 = 0ULL;
  183. static unsigned long long Icmp6OutType128 = 0ULL;
  184. static unsigned long long Icmp6OutType129 = 0ULL;
  185. static unsigned long long Icmp6OutType133 = 0ULL;
  186. static unsigned long long Icmp6OutType135 = 0ULL;
  187. static unsigned long long Icmp6OutType143 = 0ULL;
  188. static unsigned long long Udp6InDatagrams = 0ULL;
  189. static unsigned long long Udp6NoPorts = 0ULL;
  190. static unsigned long long Udp6InErrors = 0ULL;
  191. static unsigned long long Udp6OutDatagrams = 0ULL;
  192. static unsigned long long Udp6RcvbufErrors = 0ULL;
  193. static unsigned long long Udp6SndbufErrors = 0ULL;
  194. static unsigned long long Udp6InCsumErrors = 0ULL;
  195. static unsigned long long Udp6IgnoredMulti = 0ULL;
  196. static unsigned long long UdpLite6InDatagrams = 0ULL;
  197. static unsigned long long UdpLite6NoPorts = 0ULL;
  198. static unsigned long long UdpLite6InErrors = 0ULL;
  199. static unsigned long long UdpLite6OutDatagrams = 0ULL;
  200. static unsigned long long UdpLite6RcvbufErrors = 0ULL;
  201. static unsigned long long UdpLite6SndbufErrors = 0ULL;
  202. static unsigned long long UdpLite6InCsumErrors = 0ULL;
  203. // prepare for /proc/net/snmp6 parsing
  204. if(unlikely(!arl_ipv6)) {
  205. do_ip6_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "ipv6 packets", CONFIG_BOOLEAN_AUTO);
  206. do_ip6_fragsout = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "ipv6 fragments sent", CONFIG_BOOLEAN_AUTO);
  207. do_ip6_fragsin = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "ipv6 fragments assembly", CONFIG_BOOLEAN_AUTO);
  208. do_ip6_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "ipv6 errors", CONFIG_BOOLEAN_AUTO);
  209. do_ip6_udp_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "ipv6 UDP packets", CONFIG_BOOLEAN_AUTO);
  210. do_ip6_udp_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "ipv6 UDP errors", CONFIG_BOOLEAN_AUTO);
  211. do_ip6_udplite_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "ipv6 UDPlite packets", CONFIG_BOOLEAN_AUTO);
  212. do_ip6_udplite_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "ipv6 UDPlite errors", CONFIG_BOOLEAN_AUTO);
  213. do_ip6_bandwidth = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "bandwidth", CONFIG_BOOLEAN_AUTO);
  214. do_ip6_mcast = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "multicast bandwidth", CONFIG_BOOLEAN_AUTO);
  215. do_ip6_bcast = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "broadcast bandwidth", CONFIG_BOOLEAN_AUTO);
  216. do_ip6_mcast_p = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "multicast packets", CONFIG_BOOLEAN_AUTO);
  217. do_ip6_icmp = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "icmp", CONFIG_BOOLEAN_AUTO);
  218. do_ip6_icmp_redir = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "icmp redirects", CONFIG_BOOLEAN_AUTO);
  219. do_ip6_icmp_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "icmp errors", CONFIG_BOOLEAN_AUTO);
  220. do_ip6_icmp_echos = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "icmp echos", CONFIG_BOOLEAN_AUTO);
  221. do_ip6_icmp_groupmemb = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "icmp group membership", CONFIG_BOOLEAN_AUTO);
  222. do_ip6_icmp_router = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "icmp router", CONFIG_BOOLEAN_AUTO);
  223. do_ip6_icmp_neighbor = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "icmp neighbor", CONFIG_BOOLEAN_AUTO);
  224. do_ip6_icmp_mldv2 = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "icmp mldv2", CONFIG_BOOLEAN_AUTO);
  225. do_ip6_icmp_types = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "icmp types", CONFIG_BOOLEAN_AUTO);
  226. do_ip6_ect = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp6", "ect", CONFIG_BOOLEAN_AUTO);
  227. arl_ipv6 = arl_create("snmp6", NULL, 60);
  228. arl_expect(arl_ipv6, "Ip6InReceives", &Ip6InReceives);
  229. arl_expect(arl_ipv6, "Ip6InHdrErrors", &Ip6InHdrErrors);
  230. arl_expect(arl_ipv6, "Ip6InTooBigErrors", &Ip6InTooBigErrors);
  231. arl_expect(arl_ipv6, "Ip6InNoRoutes", &Ip6InNoRoutes);
  232. arl_expect(arl_ipv6, "Ip6InAddrErrors", &Ip6InAddrErrors);
  233. arl_expect(arl_ipv6, "Ip6InUnknownProtos", &Ip6InUnknownProtos);
  234. arl_expect(arl_ipv6, "Ip6InTruncatedPkts", &Ip6InTruncatedPkts);
  235. arl_expect(arl_ipv6, "Ip6InDiscards", &Ip6InDiscards);
  236. arl_expect(arl_ipv6, "Ip6InDelivers", &Ip6InDelivers);
  237. arl_expect(arl_ipv6, "Ip6OutForwDatagrams", &Ip6OutForwDatagrams);
  238. arl_expect(arl_ipv6, "Ip6OutRequests", &Ip6OutRequests);
  239. arl_expect(arl_ipv6, "Ip6OutDiscards", &Ip6OutDiscards);
  240. arl_expect(arl_ipv6, "Ip6OutNoRoutes", &Ip6OutNoRoutes);
  241. arl_expect(arl_ipv6, "Ip6ReasmTimeout", &Ip6ReasmTimeout);
  242. arl_expect(arl_ipv6, "Ip6ReasmReqds", &Ip6ReasmReqds);
  243. arl_expect(arl_ipv6, "Ip6ReasmOKs", &Ip6ReasmOKs);
  244. arl_expect(arl_ipv6, "Ip6ReasmFails", &Ip6ReasmFails);
  245. arl_expect(arl_ipv6, "Ip6FragOKs", &Ip6FragOKs);
  246. arl_expect(arl_ipv6, "Ip6FragFails", &Ip6FragFails);
  247. arl_expect(arl_ipv6, "Ip6FragCreates", &Ip6FragCreates);
  248. arl_expect(arl_ipv6, "Ip6InMcastPkts", &Ip6InMcastPkts);
  249. arl_expect(arl_ipv6, "Ip6OutMcastPkts", &Ip6OutMcastPkts);
  250. arl_expect(arl_ipv6, "Ip6InOctets", &Ip6InOctets);
  251. arl_expect(arl_ipv6, "Ip6OutOctets", &Ip6OutOctets);
  252. arl_expect(arl_ipv6, "Ip6InMcastOctets", &Ip6InMcastOctets);
  253. arl_expect(arl_ipv6, "Ip6OutMcastOctets", &Ip6OutMcastOctets);
  254. arl_expect(arl_ipv6, "Ip6InBcastOctets", &Ip6InBcastOctets);
  255. arl_expect(arl_ipv6, "Ip6OutBcastOctets", &Ip6OutBcastOctets);
  256. arl_expect(arl_ipv6, "Ip6InNoECTPkts", &Ip6InNoECTPkts);
  257. arl_expect(arl_ipv6, "Ip6InECT1Pkts", &Ip6InECT1Pkts);
  258. arl_expect(arl_ipv6, "Ip6InECT0Pkts", &Ip6InECT0Pkts);
  259. arl_expect(arl_ipv6, "Ip6InCEPkts", &Ip6InCEPkts);
  260. arl_expect(arl_ipv6, "Icmp6InMsgs", &Icmp6InMsgs);
  261. arl_expect(arl_ipv6, "Icmp6InErrors", &Icmp6InErrors);
  262. arl_expect(arl_ipv6, "Icmp6OutMsgs", &Icmp6OutMsgs);
  263. arl_expect(arl_ipv6, "Icmp6OutErrors", &Icmp6OutErrors);
  264. arl_expect(arl_ipv6, "Icmp6InCsumErrors", &Icmp6InCsumErrors);
  265. arl_expect(arl_ipv6, "Icmp6InDestUnreachs", &Icmp6InDestUnreachs);
  266. arl_expect(arl_ipv6, "Icmp6InPktTooBigs", &Icmp6InPktTooBigs);
  267. arl_expect(arl_ipv6, "Icmp6InTimeExcds", &Icmp6InTimeExcds);
  268. arl_expect(arl_ipv6, "Icmp6InParmProblems", &Icmp6InParmProblems);
  269. arl_expect(arl_ipv6, "Icmp6InEchos", &Icmp6InEchos);
  270. arl_expect(arl_ipv6, "Icmp6InEchoReplies", &Icmp6InEchoReplies);
  271. arl_expect(arl_ipv6, "Icmp6InGroupMembQueries", &Icmp6InGroupMembQueries);
  272. arl_expect(arl_ipv6, "Icmp6InGroupMembResponses", &Icmp6InGroupMembResponses);
  273. arl_expect(arl_ipv6, "Icmp6InGroupMembReductions", &Icmp6InGroupMembReductions);
  274. arl_expect(arl_ipv6, "Icmp6InRouterSolicits", &Icmp6InRouterSolicits);
  275. arl_expect(arl_ipv6, "Icmp6InRouterAdvertisements", &Icmp6InRouterAdvertisements);
  276. arl_expect(arl_ipv6, "Icmp6InNeighborSolicits", &Icmp6InNeighborSolicits);
  277. arl_expect(arl_ipv6, "Icmp6InNeighborAdvertisements", &Icmp6InNeighborAdvertisements);
  278. arl_expect(arl_ipv6, "Icmp6InRedirects", &Icmp6InRedirects);
  279. arl_expect(arl_ipv6, "Icmp6InMLDv2Reports", &Icmp6InMLDv2Reports);
  280. arl_expect(arl_ipv6, "Icmp6OutDestUnreachs", &Icmp6OutDestUnreachs);
  281. arl_expect(arl_ipv6, "Icmp6OutPktTooBigs", &Icmp6OutPktTooBigs);
  282. arl_expect(arl_ipv6, "Icmp6OutTimeExcds", &Icmp6OutTimeExcds);
  283. arl_expect(arl_ipv6, "Icmp6OutParmProblems", &Icmp6OutParmProblems);
  284. arl_expect(arl_ipv6, "Icmp6OutEchos", &Icmp6OutEchos);
  285. arl_expect(arl_ipv6, "Icmp6OutEchoReplies", &Icmp6OutEchoReplies);
  286. arl_expect(arl_ipv6, "Icmp6OutGroupMembQueries", &Icmp6OutGroupMembQueries);
  287. arl_expect(arl_ipv6, "Icmp6OutGroupMembResponses", &Icmp6OutGroupMembResponses);
  288. arl_expect(arl_ipv6, "Icmp6OutGroupMembReductions", &Icmp6OutGroupMembReductions);
  289. arl_expect(arl_ipv6, "Icmp6OutRouterSolicits", &Icmp6OutRouterSolicits);
  290. arl_expect(arl_ipv6, "Icmp6OutRouterAdvertisements", &Icmp6OutRouterAdvertisements);
  291. arl_expect(arl_ipv6, "Icmp6OutNeighborSolicits", &Icmp6OutNeighborSolicits);
  292. arl_expect(arl_ipv6, "Icmp6OutNeighborAdvertisements", &Icmp6OutNeighborAdvertisements);
  293. arl_expect(arl_ipv6, "Icmp6OutRedirects", &Icmp6OutRedirects);
  294. arl_expect(arl_ipv6, "Icmp6OutMLDv2Reports", &Icmp6OutMLDv2Reports);
  295. arl_expect(arl_ipv6, "Icmp6InType1", &Icmp6InType1);
  296. arl_expect(arl_ipv6, "Icmp6InType128", &Icmp6InType128);
  297. arl_expect(arl_ipv6, "Icmp6InType129", &Icmp6InType129);
  298. arl_expect(arl_ipv6, "Icmp6InType136", &Icmp6InType136);
  299. arl_expect(arl_ipv6, "Icmp6OutType1", &Icmp6OutType1);
  300. arl_expect(arl_ipv6, "Icmp6OutType128", &Icmp6OutType128);
  301. arl_expect(arl_ipv6, "Icmp6OutType129", &Icmp6OutType129);
  302. arl_expect(arl_ipv6, "Icmp6OutType133", &Icmp6OutType133);
  303. arl_expect(arl_ipv6, "Icmp6OutType135", &Icmp6OutType135);
  304. arl_expect(arl_ipv6, "Icmp6OutType143", &Icmp6OutType143);
  305. arl_expect(arl_ipv6, "Udp6InDatagrams", &Udp6InDatagrams);
  306. arl_expect(arl_ipv6, "Udp6NoPorts", &Udp6NoPorts);
  307. arl_expect(arl_ipv6, "Udp6InErrors", &Udp6InErrors);
  308. arl_expect(arl_ipv6, "Udp6OutDatagrams", &Udp6OutDatagrams);
  309. arl_expect(arl_ipv6, "Udp6RcvbufErrors", &Udp6RcvbufErrors);
  310. arl_expect(arl_ipv6, "Udp6SndbufErrors", &Udp6SndbufErrors);
  311. arl_expect(arl_ipv6, "Udp6InCsumErrors", &Udp6InCsumErrors);
  312. arl_expect(arl_ipv6, "Udp6IgnoredMulti", &Udp6IgnoredMulti);
  313. arl_expect(arl_ipv6, "UdpLite6InDatagrams", &UdpLite6InDatagrams);
  314. arl_expect(arl_ipv6, "UdpLite6NoPorts", &UdpLite6NoPorts);
  315. arl_expect(arl_ipv6, "UdpLite6InErrors", &UdpLite6InErrors);
  316. arl_expect(arl_ipv6, "UdpLite6OutDatagrams", &UdpLite6OutDatagrams);
  317. arl_expect(arl_ipv6, "UdpLite6RcvbufErrors", &UdpLite6RcvbufErrors);
  318. arl_expect(arl_ipv6, "UdpLite6SndbufErrors", &UdpLite6SndbufErrors);
  319. arl_expect(arl_ipv6, "UdpLite6InCsumErrors", &UdpLite6InCsumErrors);
  320. }
  321. // parse /proc/net/snmp
  322. if (unlikely(!ff_snmp6)) {
  323. char filename[FILENAME_MAX + 1];
  324. snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/snmp6");
  325. ff_snmp6 = procfile_open(
  326. config_get("plugin:proc:/proc/net/snmp6", "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
  327. if (unlikely(!ff_snmp6)) {
  328. do_snmp6 = false;
  329. return;
  330. }
  331. }
  332. ff_snmp6 = procfile_readall(ff_snmp6);
  333. if (unlikely(!ff_snmp6))
  334. return;
  335. size_t lines, l;
  336. lines = procfile_lines(ff_snmp6);
  337. arl_begin(arl_ipv6);
  338. for (l = 0; l < lines; l++) {
  339. size_t words = procfile_linewords(ff_snmp6, l);
  340. if (unlikely(words < 2)) {
  341. if (unlikely(words)) {
  342. collector_error("Cannot read /proc/net/snmp6 line %zu. Expected 2 params, read %zu.", l, words);
  343. continue;
  344. }
  345. }
  346. if (unlikely(arl_check(arl_ipv6, procfile_lineword(ff_snmp6, l, 0), procfile_lineword(ff_snmp6, l, 1))))
  347. break;
  348. }
  349. if(do_ip6_bandwidth == CONFIG_BOOLEAN_YES || (do_ip6_bandwidth == CONFIG_BOOLEAN_AUTO &&
  350. (Ip6InOctets ||
  351. Ip6OutOctets ||
  352. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  353. do_ip6_bandwidth = CONFIG_BOOLEAN_YES;
  354. static RRDSET *st = NULL;
  355. static RRDDIM *rd_received = NULL,
  356. *rd_sent = NULL;
  357. if(unlikely(!st)) {
  358. st = rrdset_create_localhost(
  359. "system"
  360. , "ipv6"
  361. , NULL
  362. , "network"
  363. , NULL
  364. , "IPv6 Bandwidth"
  365. , "kilobits/s"
  366. , PLUGIN_PROC_NAME
  367. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  368. , NETDATA_CHART_PRIO_SYSTEM_IPV6
  369. , update_every
  370. , RRDSET_TYPE_AREA
  371. );
  372. rd_received = rrddim_add(st, "InOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  373. rd_sent = rrddim_add(st, "OutOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  374. }
  375. rrddim_set_by_pointer(st, rd_received, Ip6InOctets);
  376. rrddim_set_by_pointer(st, rd_sent, Ip6OutOctets);
  377. rrdset_done(st);
  378. }
  379. if(do_ip6_packets == CONFIG_BOOLEAN_YES || (do_ip6_packets == CONFIG_BOOLEAN_AUTO &&
  380. (Ip6InReceives ||
  381. Ip6OutRequests ||
  382. Ip6InDelivers ||
  383. Ip6OutForwDatagrams ||
  384. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  385. do_ip6_packets = CONFIG_BOOLEAN_YES;
  386. static RRDSET *st = NULL;
  387. static RRDDIM *rd_received = NULL,
  388. *rd_sent = NULL,
  389. *rd_forwarded = NULL,
  390. *rd_delivers = NULL;
  391. if(unlikely(!st)) {
  392. st = rrdset_create_localhost(
  393. RRD_TYPE_NET_SNMP6
  394. , "packets"
  395. , NULL
  396. , "packets"
  397. , NULL
  398. , "IPv6 Packets"
  399. , "packets/s"
  400. , PLUGIN_PROC_NAME
  401. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  402. , NETDATA_CHART_PRIO_IPV6_PACKETS
  403. , update_every
  404. , RRDSET_TYPE_LINE
  405. );
  406. rd_received = rrddim_add(st, "InReceives", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  407. rd_sent = rrddim_add(st, "OutRequests", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  408. rd_forwarded = rrddim_add(st, "OutForwDatagrams", "forwarded", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  409. rd_delivers = rrddim_add(st, "InDelivers", "delivers", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  410. }
  411. rrddim_set_by_pointer(st, rd_received, Ip6InReceives);
  412. rrddim_set_by_pointer(st, rd_sent, Ip6OutRequests);
  413. rrddim_set_by_pointer(st, rd_forwarded, Ip6OutForwDatagrams);
  414. rrddim_set_by_pointer(st, rd_delivers, Ip6InDelivers);
  415. rrdset_done(st);
  416. }
  417. if(do_ip6_fragsout == CONFIG_BOOLEAN_YES || (do_ip6_fragsout == CONFIG_BOOLEAN_AUTO &&
  418. (Ip6FragOKs ||
  419. Ip6FragFails ||
  420. Ip6FragCreates ||
  421. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  422. do_ip6_fragsout = CONFIG_BOOLEAN_YES;
  423. static RRDSET *st = NULL;
  424. static RRDDIM *rd_ok = NULL,
  425. *rd_failed = NULL,
  426. *rd_all = NULL;
  427. if(unlikely(!st)) {
  428. st = rrdset_create_localhost(
  429. RRD_TYPE_NET_SNMP6
  430. , "fragsout"
  431. , NULL
  432. , "fragments6"
  433. , NULL
  434. , "IPv6 Fragments Sent"
  435. , "packets/s"
  436. , PLUGIN_PROC_NAME
  437. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  438. , NETDATA_CHART_PRIO_IPV6_FRAGSOUT
  439. , update_every
  440. , RRDSET_TYPE_LINE
  441. );
  442. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  443. rd_ok = rrddim_add(st, "FragOKs", "ok", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  444. rd_failed = rrddim_add(st, "FragFails", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  445. rd_all = rrddim_add(st, "FragCreates", "all", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  446. }
  447. rrddim_set_by_pointer(st, rd_ok, Ip6FragOKs);
  448. rrddim_set_by_pointer(st, rd_failed, Ip6FragFails);
  449. rrddim_set_by_pointer(st, rd_all, Ip6FragCreates);
  450. rrdset_done(st);
  451. }
  452. if(do_ip6_fragsin == CONFIG_BOOLEAN_YES || (do_ip6_fragsin == CONFIG_BOOLEAN_AUTO &&
  453. (Ip6ReasmOKs ||
  454. Ip6ReasmFails ||
  455. Ip6ReasmTimeout ||
  456. Ip6ReasmReqds ||
  457. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  458. do_ip6_fragsin = CONFIG_BOOLEAN_YES;
  459. static RRDSET *st = NULL;
  460. static RRDDIM *rd_ok = NULL,
  461. *rd_failed = NULL,
  462. *rd_timeout = NULL,
  463. *rd_all = NULL;
  464. if(unlikely(!st)) {
  465. st = rrdset_create_localhost(
  466. RRD_TYPE_NET_SNMP6
  467. , "fragsin"
  468. , NULL
  469. , "fragments6"
  470. , NULL
  471. , "IPv6 Fragments Reassembly"
  472. , "packets/s"
  473. , PLUGIN_PROC_NAME
  474. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  475. , NETDATA_CHART_PRIO_IPV6_FRAGSIN
  476. , update_every
  477. , RRDSET_TYPE_LINE);
  478. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  479. rd_ok = rrddim_add(st, "ReasmOKs", "ok", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  480. rd_failed = rrddim_add(st, "ReasmFails", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  481. rd_timeout = rrddim_add(st, "ReasmTimeout", "timeout", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  482. rd_all = rrddim_add(st, "ReasmReqds", "all", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  483. }
  484. rrddim_set_by_pointer(st, rd_ok, Ip6ReasmOKs);
  485. rrddim_set_by_pointer(st, rd_failed, Ip6ReasmFails);
  486. rrddim_set_by_pointer(st, rd_timeout, Ip6ReasmTimeout);
  487. rrddim_set_by_pointer(st, rd_all, Ip6ReasmReqds);
  488. rrdset_done(st);
  489. }
  490. if(do_ip6_errors == CONFIG_BOOLEAN_YES || (do_ip6_errors == CONFIG_BOOLEAN_AUTO &&
  491. (Ip6InDiscards ||
  492. Ip6OutDiscards ||
  493. Ip6InHdrErrors ||
  494. Ip6InAddrErrors ||
  495. Ip6InUnknownProtos ||
  496. Ip6InTooBigErrors ||
  497. Ip6InTruncatedPkts ||
  498. Ip6InNoRoutes ||
  499. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  500. do_ip6_errors = CONFIG_BOOLEAN_YES;
  501. static RRDSET *st = NULL;
  502. static RRDDIM *rd_InDiscards = NULL,
  503. *rd_OutDiscards = NULL,
  504. *rd_InHdrErrors = NULL,
  505. *rd_InAddrErrors = NULL,
  506. *rd_InUnknownProtos = NULL,
  507. *rd_InTooBigErrors = NULL,
  508. *rd_InTruncatedPkts = NULL,
  509. *rd_InNoRoutes = NULL,
  510. *rd_OutNoRoutes = NULL;
  511. if(unlikely(!st)) {
  512. st = rrdset_create_localhost(
  513. RRD_TYPE_NET_SNMP6
  514. , "errors"
  515. , NULL
  516. , "errors"
  517. , NULL
  518. , "IPv6 Errors"
  519. , "packets/s"
  520. , PLUGIN_PROC_NAME
  521. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  522. , NETDATA_CHART_PRIO_IPV6_ERRORS
  523. , update_every
  524. , RRDSET_TYPE_LINE
  525. );
  526. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  527. rd_InDiscards = rrddim_add(st, "InDiscards", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  528. rd_OutDiscards = rrddim_add(st, "OutDiscards", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  529. rd_InHdrErrors = rrddim_add(st, "InHdrErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  530. rd_InAddrErrors = rrddim_add(st, "InAddrErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  531. rd_InUnknownProtos = rrddim_add(st, "InUnknownProtos", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  532. rd_InTooBigErrors = rrddim_add(st, "InTooBigErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  533. rd_InTruncatedPkts = rrddim_add(st, "InTruncatedPkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  534. rd_InNoRoutes = rrddim_add(st, "InNoRoutes", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  535. rd_OutNoRoutes = rrddim_add(st, "OutNoRoutes", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  536. }
  537. rrddim_set_by_pointer(st, rd_InDiscards, Ip6InDiscards);
  538. rrddim_set_by_pointer(st, rd_OutDiscards, Ip6OutDiscards);
  539. rrddim_set_by_pointer(st, rd_InHdrErrors, Ip6InHdrErrors);
  540. rrddim_set_by_pointer(st, rd_InAddrErrors, Ip6InAddrErrors);
  541. rrddim_set_by_pointer(st, rd_InUnknownProtos, Ip6InUnknownProtos);
  542. rrddim_set_by_pointer(st, rd_InTooBigErrors, Ip6InTooBigErrors);
  543. rrddim_set_by_pointer(st, rd_InTruncatedPkts, Ip6InTruncatedPkts);
  544. rrddim_set_by_pointer(st, rd_InNoRoutes, Ip6InNoRoutes);
  545. rrddim_set_by_pointer(st, rd_OutNoRoutes, Ip6OutNoRoutes);
  546. rrdset_done(st);
  547. }
  548. if(do_ip6_udp_packets == CONFIG_BOOLEAN_YES || (do_ip6_udp_packets == CONFIG_BOOLEAN_AUTO &&
  549. (Udp6InDatagrams ||
  550. Udp6OutDatagrams ||
  551. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  552. static RRDSET *st = NULL;
  553. static RRDDIM *rd_received = NULL,
  554. *rd_sent = NULL;
  555. if(unlikely(!st)) {
  556. st = rrdset_create_localhost(
  557. RRD_TYPE_NET_SNMP6
  558. , "udppackets"
  559. , NULL
  560. , "udp6"
  561. , NULL
  562. , "IPv6 UDP Packets"
  563. , "packets/s"
  564. , PLUGIN_PROC_NAME
  565. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  566. , NETDATA_CHART_PRIO_IPV6_UDP_PACKETS
  567. , update_every
  568. , RRDSET_TYPE_LINE
  569. );
  570. rd_received = rrddim_add(st, "InDatagrams", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  571. rd_sent = rrddim_add(st, "OutDatagrams", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  572. }
  573. rrddim_set_by_pointer(st, rd_received, Udp6InDatagrams);
  574. rrddim_set_by_pointer(st, rd_sent, Udp6OutDatagrams);
  575. rrdset_done(st);
  576. }
  577. if(do_ip6_udp_errors == CONFIG_BOOLEAN_YES || (do_ip6_udp_errors == CONFIG_BOOLEAN_AUTO &&
  578. (Udp6InErrors ||
  579. Udp6NoPorts ||
  580. Udp6RcvbufErrors ||
  581. Udp6SndbufErrors ||
  582. Udp6InCsumErrors ||
  583. Udp6IgnoredMulti ||
  584. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  585. do_ip6_udp_errors = CONFIG_BOOLEAN_YES;
  586. static RRDSET *st = NULL;
  587. static RRDDIM *rd_RcvbufErrors = NULL,
  588. *rd_SndbufErrors = NULL,
  589. *rd_InErrors = NULL,
  590. *rd_NoPorts = NULL,
  591. *rd_InCsumErrors = NULL,
  592. *rd_IgnoredMulti = NULL;
  593. if(unlikely(!st)) {
  594. st = rrdset_create_localhost(
  595. RRD_TYPE_NET_SNMP6
  596. , "udperrors"
  597. , NULL
  598. , "udp6"
  599. , NULL
  600. , "IPv6 UDP Errors"
  601. , "events/s"
  602. , PLUGIN_PROC_NAME
  603. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  604. , NETDATA_CHART_PRIO_IPV6_UDP_ERRORS
  605. , update_every
  606. , RRDSET_TYPE_LINE
  607. );
  608. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  609. rd_RcvbufErrors = rrddim_add(st, "RcvbufErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  610. rd_SndbufErrors = rrddim_add(st, "SndbufErrors", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  611. rd_InErrors = rrddim_add(st, "InErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  612. rd_NoPorts = rrddim_add(st, "NoPorts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  613. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  614. rd_IgnoredMulti = rrddim_add(st, "IgnoredMulti", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  615. }
  616. rrddim_set_by_pointer(st, rd_RcvbufErrors, Udp6RcvbufErrors);
  617. rrddim_set_by_pointer(st, rd_SndbufErrors, Udp6SndbufErrors);
  618. rrddim_set_by_pointer(st, rd_InErrors, Udp6InErrors);
  619. rrddim_set_by_pointer(st, rd_NoPorts, Udp6NoPorts);
  620. rrddim_set_by_pointer(st, rd_InCsumErrors, Udp6InCsumErrors);
  621. rrddim_set_by_pointer(st, rd_IgnoredMulti, Udp6IgnoredMulti);
  622. rrdset_done(st);
  623. }
  624. if(do_ip6_udplite_packets == CONFIG_BOOLEAN_YES || (do_ip6_udplite_packets == CONFIG_BOOLEAN_AUTO &&
  625. (UdpLite6InDatagrams ||
  626. UdpLite6OutDatagrams ||
  627. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  628. static RRDSET *st = NULL;
  629. static RRDDIM *rd_received = NULL,
  630. *rd_sent = NULL;
  631. if(unlikely(!st)) {
  632. st = rrdset_create_localhost(
  633. RRD_TYPE_NET_SNMP6
  634. , "udplitepackets"
  635. , NULL
  636. , "udplite6"
  637. , NULL
  638. , "IPv6 UDPlite Packets"
  639. , "packets/s"
  640. , PLUGIN_PROC_NAME
  641. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  642. , NETDATA_CHART_PRIO_IPV6_UDPLITE_PACKETS
  643. , update_every
  644. , RRDSET_TYPE_LINE
  645. );
  646. rd_received = rrddim_add(st, "InDatagrams", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  647. rd_sent = rrddim_add(st, "OutDatagrams", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  648. }
  649. rrddim_set_by_pointer(st, rd_received, UdpLite6InDatagrams);
  650. rrddim_set_by_pointer(st, rd_sent, UdpLite6OutDatagrams);
  651. rrdset_done(st);
  652. }
  653. if(do_ip6_udplite_errors == CONFIG_BOOLEAN_YES || (do_ip6_udplite_errors == CONFIG_BOOLEAN_AUTO &&
  654. (UdpLite6InErrors ||
  655. UdpLite6NoPorts ||
  656. UdpLite6RcvbufErrors ||
  657. UdpLite6SndbufErrors ||
  658. Udp6InCsumErrors ||
  659. UdpLite6InCsumErrors ||
  660. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  661. do_ip6_udplite_errors = CONFIG_BOOLEAN_YES;
  662. static RRDSET *st = NULL;
  663. static RRDDIM *rd_RcvbufErrors = NULL,
  664. *rd_SndbufErrors = NULL,
  665. *rd_InErrors = NULL,
  666. *rd_NoPorts = NULL,
  667. *rd_InCsumErrors = NULL;
  668. if(unlikely(!st)) {
  669. st = rrdset_create_localhost(
  670. RRD_TYPE_NET_SNMP6
  671. , "udpliteerrors"
  672. , NULL
  673. , "udplite6"
  674. , NULL
  675. , "IPv6 UDP Lite Errors"
  676. , "events/s"
  677. , PLUGIN_PROC_NAME
  678. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  679. , NETDATA_CHART_PRIO_IPV6_UDPLITE_ERRORS
  680. , update_every
  681. , RRDSET_TYPE_LINE
  682. );
  683. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  684. rd_RcvbufErrors = rrddim_add(st, "RcvbufErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  685. rd_SndbufErrors = rrddim_add(st, "SndbufErrors", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  686. rd_InErrors = rrddim_add(st, "InErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  687. rd_NoPorts = rrddim_add(st, "NoPorts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  688. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  689. }
  690. rrddim_set_by_pointer(st, rd_InErrors, UdpLite6InErrors);
  691. rrddim_set_by_pointer(st, rd_NoPorts, UdpLite6NoPorts);
  692. rrddim_set_by_pointer(st, rd_RcvbufErrors, UdpLite6RcvbufErrors);
  693. rrddim_set_by_pointer(st, rd_SndbufErrors, UdpLite6SndbufErrors);
  694. rrddim_set_by_pointer(st, rd_InCsumErrors, UdpLite6InCsumErrors);
  695. rrdset_done(st);
  696. }
  697. if(do_ip6_mcast == CONFIG_BOOLEAN_YES || (do_ip6_mcast == CONFIG_BOOLEAN_AUTO &&
  698. (Ip6OutMcastOctets ||
  699. Ip6InMcastOctets ||
  700. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  701. do_ip6_mcast = CONFIG_BOOLEAN_YES;
  702. static RRDSET *st = NULL;
  703. static RRDDIM *rd_Ip6InMcastOctets = NULL,
  704. *rd_Ip6OutMcastOctets = NULL;
  705. if(unlikely(!st)) {
  706. st = rrdset_create_localhost(
  707. RRD_TYPE_NET_SNMP6
  708. , "mcast"
  709. , NULL
  710. , "multicast6"
  711. , NULL
  712. , "IPv6 Multicast Bandwidth"
  713. , "kilobits/s"
  714. , PLUGIN_PROC_NAME
  715. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  716. , NETDATA_CHART_PRIO_IPV6_MCAST
  717. , update_every
  718. , RRDSET_TYPE_AREA
  719. );
  720. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  721. rd_Ip6InMcastOctets = rrddim_add(st, "InMcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  722. rd_Ip6OutMcastOctets = rrddim_add(st, "OutMcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  723. }
  724. rrddim_set_by_pointer(st, rd_Ip6InMcastOctets, Ip6InMcastOctets);
  725. rrddim_set_by_pointer(st, rd_Ip6OutMcastOctets, Ip6OutMcastOctets);
  726. rrdset_done(st);
  727. }
  728. if(do_ip6_bcast == CONFIG_BOOLEAN_YES || (do_ip6_bcast == CONFIG_BOOLEAN_AUTO &&
  729. (Ip6OutBcastOctets ||
  730. Ip6InBcastOctets ||
  731. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  732. do_ip6_bcast = CONFIG_BOOLEAN_YES;
  733. static RRDSET *st = NULL;
  734. static RRDDIM *rd_Ip6InBcastOctets = NULL,
  735. *rd_Ip6OutBcastOctets = NULL;
  736. if(unlikely(!st)) {
  737. st = rrdset_create_localhost(
  738. RRD_TYPE_NET_SNMP6
  739. , "bcast"
  740. , NULL
  741. , "broadcast6"
  742. , NULL
  743. , "IPv6 Broadcast Bandwidth"
  744. , "kilobits/s"
  745. , PLUGIN_PROC_NAME
  746. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  747. , NETDATA_CHART_PRIO_IPV6_BCAST
  748. , update_every
  749. , RRDSET_TYPE_AREA
  750. );
  751. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  752. rd_Ip6InBcastOctets = rrddim_add(st, "InBcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  753. rd_Ip6OutBcastOctets = rrddim_add(st, "OutBcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  754. }
  755. rrddim_set_by_pointer(st, rd_Ip6InBcastOctets, Ip6InBcastOctets);
  756. rrddim_set_by_pointer(st, rd_Ip6OutBcastOctets, Ip6OutBcastOctets);
  757. rrdset_done(st);
  758. }
  759. if(do_ip6_mcast_p == CONFIG_BOOLEAN_YES || (do_ip6_mcast_p == CONFIG_BOOLEAN_AUTO &&
  760. (Ip6OutMcastPkts ||
  761. Ip6InMcastPkts ||
  762. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  763. do_ip6_mcast_p = CONFIG_BOOLEAN_YES;
  764. static RRDSET *st = NULL;
  765. static RRDDIM *rd_Ip6InMcastPkts = NULL,
  766. *rd_Ip6OutMcastPkts = NULL;
  767. if(unlikely(!st)) {
  768. st = rrdset_create_localhost(
  769. RRD_TYPE_NET_SNMP6
  770. , "mcastpkts"
  771. , NULL
  772. , "multicast6"
  773. , NULL
  774. , "IPv6 Multicast Packets"
  775. , "packets/s"
  776. , PLUGIN_PROC_NAME
  777. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  778. , NETDATA_CHART_PRIO_IPV6_MCAST_PACKETS
  779. , update_every
  780. , RRDSET_TYPE_LINE
  781. );
  782. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  783. rd_Ip6InMcastPkts = rrddim_add(st, "InMcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  784. rd_Ip6OutMcastPkts = rrddim_add(st, "OutMcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  785. }
  786. rrddim_set_by_pointer(st, rd_Ip6InMcastPkts, Ip6InMcastPkts);
  787. rrddim_set_by_pointer(st, rd_Ip6OutMcastPkts, Ip6OutMcastPkts);
  788. rrdset_done(st);
  789. }
  790. if(do_ip6_icmp == CONFIG_BOOLEAN_YES || (do_ip6_icmp == CONFIG_BOOLEAN_AUTO &&
  791. (Icmp6InMsgs ||
  792. Icmp6OutMsgs ||
  793. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  794. do_ip6_icmp = CONFIG_BOOLEAN_YES;
  795. static RRDSET *st = NULL;
  796. static RRDDIM *rd_Icmp6InMsgs = NULL,
  797. *rd_Icmp6OutMsgs = NULL;
  798. if(unlikely(!st)) {
  799. st = rrdset_create_localhost(
  800. RRD_TYPE_NET_SNMP6
  801. , "icmp"
  802. , NULL
  803. , "icmp6"
  804. , NULL
  805. , "IPv6 ICMP Messages"
  806. , "messages/s"
  807. , PLUGIN_PROC_NAME
  808. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  809. , NETDATA_CHART_PRIO_IPV6_ICMP
  810. , update_every
  811. , RRDSET_TYPE_LINE
  812. );
  813. rd_Icmp6InMsgs = rrddim_add(st, "InMsgs", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  814. rd_Icmp6OutMsgs = rrddim_add(st, "OutMsgs", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  815. }
  816. rrddim_set_by_pointer(st, rd_Icmp6InMsgs, Icmp6InMsgs);
  817. rrddim_set_by_pointer(st, rd_Icmp6OutMsgs, Icmp6OutMsgs);
  818. rrdset_done(st);
  819. }
  820. if(do_ip6_icmp_redir == CONFIG_BOOLEAN_YES || (do_ip6_icmp_redir == CONFIG_BOOLEAN_AUTO &&
  821. (Icmp6InRedirects ||
  822. Icmp6OutRedirects ||
  823. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  824. do_ip6_icmp_redir = CONFIG_BOOLEAN_YES;
  825. static RRDSET *st = NULL;
  826. static RRDDIM *rd_Icmp6InRedirects = NULL,
  827. *rd_Icmp6OutRedirects = NULL;
  828. if(unlikely(!st)) {
  829. st = rrdset_create_localhost(
  830. RRD_TYPE_NET_SNMP6
  831. , "icmpredir"
  832. , NULL
  833. , "icmp6"
  834. , NULL
  835. , "IPv6 ICMP Redirects"
  836. , "redirects/s"
  837. , PLUGIN_PROC_NAME
  838. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  839. , NETDATA_CHART_PRIO_IPV6_ICMP_REDIR
  840. , update_every
  841. , RRDSET_TYPE_LINE
  842. );
  843. rd_Icmp6InRedirects = rrddim_add(st, "InRedirects", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  844. rd_Icmp6OutRedirects = rrddim_add(st, "OutRedirects", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  845. }
  846. rrddim_set_by_pointer(st, rd_Icmp6InRedirects, Icmp6InRedirects);
  847. rrddim_set_by_pointer(st, rd_Icmp6OutRedirects, Icmp6OutRedirects);
  848. rrdset_done(st);
  849. }
  850. if(do_ip6_icmp_errors == CONFIG_BOOLEAN_YES || (do_ip6_icmp_errors == CONFIG_BOOLEAN_AUTO &&
  851. (Icmp6InErrors ||
  852. Icmp6OutErrors ||
  853. Icmp6InCsumErrors ||
  854. Icmp6InDestUnreachs ||
  855. Icmp6InPktTooBigs ||
  856. Icmp6InTimeExcds ||
  857. Icmp6InParmProblems ||
  858. Icmp6OutDestUnreachs ||
  859. Icmp6OutPktTooBigs ||
  860. Icmp6OutTimeExcds ||
  861. Icmp6OutParmProblems ||
  862. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  863. do_ip6_icmp_errors = CONFIG_BOOLEAN_YES;
  864. static RRDSET *st = NULL;
  865. static RRDDIM *rd_InErrors = NULL,
  866. *rd_OutErrors = NULL,
  867. *rd_InCsumErrors = NULL,
  868. *rd_InDestUnreachs = NULL,
  869. *rd_InPktTooBigs = NULL,
  870. *rd_InTimeExcds = NULL,
  871. *rd_InParmProblems = NULL,
  872. *rd_OutDestUnreachs = NULL,
  873. *rd_OutPktTooBigs = NULL,
  874. *rd_OutTimeExcds = NULL,
  875. *rd_OutParmProblems = NULL;
  876. if(unlikely(!st)) {
  877. st = rrdset_create_localhost(
  878. RRD_TYPE_NET_SNMP6
  879. , "icmperrors"
  880. , NULL
  881. , "icmp6"
  882. , NULL
  883. , "IPv6 ICMP Errors"
  884. , "errors/s"
  885. , PLUGIN_PROC_NAME
  886. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  887. , NETDATA_CHART_PRIO_IPV6_ICMP_ERRORS
  888. , update_every
  889. , RRDSET_TYPE_LINE
  890. );
  891. rd_InErrors = rrddim_add(st, "InErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  892. rd_OutErrors = rrddim_add(st, "OutErrors", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  893. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  894. rd_InDestUnreachs = rrddim_add(st, "InDestUnreachs", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  895. rd_InPktTooBigs = rrddim_add(st, "InPktTooBigs", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  896. rd_InTimeExcds = rrddim_add(st, "InTimeExcds", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  897. rd_InParmProblems = rrddim_add(st, "InParmProblems", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  898. rd_OutDestUnreachs = rrddim_add(st, "OutDestUnreachs", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  899. rd_OutPktTooBigs = rrddim_add(st, "OutPktTooBigs", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  900. rd_OutTimeExcds = rrddim_add(st, "OutTimeExcds", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  901. rd_OutParmProblems = rrddim_add(st, "OutParmProblems", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  902. }
  903. rrddim_set_by_pointer(st, rd_InErrors, Icmp6InErrors);
  904. rrddim_set_by_pointer(st, rd_OutErrors, Icmp6OutErrors);
  905. rrddim_set_by_pointer(st, rd_InCsumErrors, Icmp6InCsumErrors);
  906. rrddim_set_by_pointer(st, rd_InDestUnreachs, Icmp6InDestUnreachs);
  907. rrddim_set_by_pointer(st, rd_InPktTooBigs, Icmp6InPktTooBigs);
  908. rrddim_set_by_pointer(st, rd_InTimeExcds, Icmp6InTimeExcds);
  909. rrddim_set_by_pointer(st, rd_InParmProblems, Icmp6InParmProblems);
  910. rrddim_set_by_pointer(st, rd_OutDestUnreachs, Icmp6OutDestUnreachs);
  911. rrddim_set_by_pointer(st, rd_OutPktTooBigs, Icmp6OutPktTooBigs);
  912. rrddim_set_by_pointer(st, rd_OutTimeExcds, Icmp6OutTimeExcds);
  913. rrddim_set_by_pointer(st, rd_OutParmProblems, Icmp6OutParmProblems);
  914. rrdset_done(st);
  915. }
  916. if(do_ip6_icmp_echos == CONFIG_BOOLEAN_YES || (do_ip6_icmp_echos == CONFIG_BOOLEAN_AUTO &&
  917. (Icmp6InEchos ||
  918. Icmp6OutEchos ||
  919. Icmp6InEchoReplies ||
  920. Icmp6OutEchoReplies ||
  921. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  922. do_ip6_icmp_echos = CONFIG_BOOLEAN_YES;
  923. static RRDSET *st = NULL;
  924. static RRDDIM *rd_InEchos = NULL,
  925. *rd_OutEchos = NULL,
  926. *rd_InEchoReplies = NULL,
  927. *rd_OutEchoReplies = NULL;
  928. if(unlikely(!st)) {
  929. st = rrdset_create_localhost(
  930. RRD_TYPE_NET_SNMP6
  931. , "icmpechos"
  932. , NULL
  933. , "icmp6"
  934. , NULL
  935. , "IPv6 ICMP Echo"
  936. , "messages/s"
  937. , PLUGIN_PROC_NAME
  938. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  939. , NETDATA_CHART_PRIO_IPV6_ICMP_ECHOS
  940. , update_every
  941. , RRDSET_TYPE_LINE
  942. );
  943. rd_InEchos = rrddim_add(st, "InEchos", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  944. rd_OutEchos = rrddim_add(st, "OutEchos", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  945. rd_InEchoReplies = rrddim_add(st, "InEchoReplies", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  946. rd_OutEchoReplies = rrddim_add(st, "OutEchoReplies", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  947. }
  948. rrddim_set_by_pointer(st, rd_InEchos, Icmp6InEchos);
  949. rrddim_set_by_pointer(st, rd_OutEchos, Icmp6OutEchos);
  950. rrddim_set_by_pointer(st, rd_InEchoReplies, Icmp6InEchoReplies);
  951. rrddim_set_by_pointer(st, rd_OutEchoReplies, Icmp6OutEchoReplies);
  952. rrdset_done(st);
  953. }
  954. if(do_ip6_icmp_groupmemb == CONFIG_BOOLEAN_YES || (do_ip6_icmp_groupmemb == CONFIG_BOOLEAN_AUTO &&
  955. (Icmp6InGroupMembQueries ||
  956. Icmp6OutGroupMembQueries ||
  957. Icmp6InGroupMembResponses ||
  958. Icmp6OutGroupMembResponses ||
  959. Icmp6InGroupMembReductions ||
  960. Icmp6OutGroupMembReductions ||
  961. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  962. do_ip6_icmp_groupmemb = CONFIG_BOOLEAN_YES;
  963. static RRDSET *st = NULL;
  964. static RRDDIM *rd_InQueries = NULL,
  965. *rd_OutQueries = NULL,
  966. *rd_InResponses = NULL,
  967. *rd_OutResponses = NULL,
  968. *rd_InReductions = NULL,
  969. *rd_OutReductions = NULL;
  970. if(unlikely(!st)) {
  971. st = rrdset_create_localhost(
  972. RRD_TYPE_NET_SNMP6
  973. , "groupmemb"
  974. , NULL
  975. , "icmp6"
  976. , NULL
  977. , "IPv6 ICMP Group Membership"
  978. , "messages/s"
  979. , PLUGIN_PROC_NAME
  980. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  981. , NETDATA_CHART_PRIO_IPV6_ICMP_GROUPMEMB
  982. , update_every
  983. , RRDSET_TYPE_LINE);
  984. rd_InQueries = rrddim_add(st, "InQueries", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  985. rd_OutQueries = rrddim_add(st, "OutQueries", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  986. rd_InResponses = rrddim_add(st, "InResponses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  987. rd_OutResponses = rrddim_add(st, "OutResponses", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  988. rd_InReductions = rrddim_add(st, "InReductions", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  989. rd_OutReductions = rrddim_add(st, "OutReductions", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  990. }
  991. rrddim_set_by_pointer(st, rd_InQueries, Icmp6InGroupMembQueries);
  992. rrddim_set_by_pointer(st, rd_OutQueries, Icmp6OutGroupMembQueries);
  993. rrddim_set_by_pointer(st, rd_InResponses, Icmp6InGroupMembResponses);
  994. rrddim_set_by_pointer(st, rd_OutResponses, Icmp6OutGroupMembResponses);
  995. rrddim_set_by_pointer(st, rd_InReductions, Icmp6InGroupMembReductions);
  996. rrddim_set_by_pointer(st, rd_OutReductions, Icmp6OutGroupMembReductions);
  997. rrdset_done(st);
  998. }
  999. if(do_ip6_icmp_router == CONFIG_BOOLEAN_YES || (do_ip6_icmp_router == CONFIG_BOOLEAN_AUTO &&
  1000. (Icmp6InRouterSolicits ||
  1001. Icmp6OutRouterSolicits ||
  1002. Icmp6InRouterAdvertisements ||
  1003. Icmp6OutRouterAdvertisements ||
  1004. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1005. do_ip6_icmp_router = CONFIG_BOOLEAN_YES;
  1006. static RRDSET *st = NULL;
  1007. static RRDDIM *rd_InSolicits = NULL,
  1008. *rd_OutSolicits = NULL,
  1009. *rd_InAdvertisements = NULL,
  1010. *rd_OutAdvertisements = NULL;
  1011. if(unlikely(!st)) {
  1012. st = rrdset_create_localhost(
  1013. RRD_TYPE_NET_SNMP6
  1014. , "icmprouter"
  1015. , NULL
  1016. , "icmp6"
  1017. , NULL
  1018. , "IPv6 Router Messages"
  1019. , "messages/s"
  1020. , PLUGIN_PROC_NAME
  1021. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1022. , NETDATA_CHART_PRIO_IPV6_ICMP_ROUTER
  1023. , update_every
  1024. , RRDSET_TYPE_LINE
  1025. );
  1026. rd_InSolicits = rrddim_add(st, "InSolicits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1027. rd_OutSolicits = rrddim_add(st, "OutSolicits", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1028. rd_InAdvertisements = rrddim_add(st, "InAdvertisements", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1029. rd_OutAdvertisements = rrddim_add(st, "OutAdvertisements", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1030. }
  1031. rrddim_set_by_pointer(st, rd_InSolicits, Icmp6InRouterSolicits);
  1032. rrddim_set_by_pointer(st, rd_OutSolicits, Icmp6OutRouterSolicits);
  1033. rrddim_set_by_pointer(st, rd_InAdvertisements, Icmp6InRouterAdvertisements);
  1034. rrddim_set_by_pointer(st, rd_OutAdvertisements, Icmp6OutRouterAdvertisements);
  1035. rrdset_done(st);
  1036. }
  1037. if(do_ip6_icmp_neighbor == CONFIG_BOOLEAN_YES || (do_ip6_icmp_neighbor == CONFIG_BOOLEAN_AUTO &&
  1038. (Icmp6InNeighborSolicits ||
  1039. Icmp6OutNeighborSolicits ||
  1040. Icmp6InNeighborAdvertisements ||
  1041. Icmp6OutNeighborAdvertisements ||
  1042. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1043. do_ip6_icmp_neighbor = CONFIG_BOOLEAN_YES;
  1044. static RRDSET *st = NULL;
  1045. static RRDDIM *rd_InSolicits = NULL,
  1046. *rd_OutSolicits = NULL,
  1047. *rd_InAdvertisements = NULL,
  1048. *rd_OutAdvertisements = NULL;
  1049. if(unlikely(!st)) {
  1050. st = rrdset_create_localhost(
  1051. RRD_TYPE_NET_SNMP6
  1052. , "icmpneighbor"
  1053. , NULL
  1054. , "icmp6"
  1055. , NULL
  1056. , "IPv6 Neighbor Messages"
  1057. , "messages/s"
  1058. , PLUGIN_PROC_NAME
  1059. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1060. , NETDATA_CHART_PRIO_IPV6_ICMP_NEIGHBOR
  1061. , update_every
  1062. , RRDSET_TYPE_LINE
  1063. );
  1064. rd_InSolicits = rrddim_add(st, "InSolicits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1065. rd_OutSolicits = rrddim_add(st, "OutSolicits", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1066. rd_InAdvertisements = rrddim_add(st, "InAdvertisements", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1067. rd_OutAdvertisements = rrddim_add(st, "OutAdvertisements", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1068. }
  1069. rrddim_set_by_pointer(st, rd_InSolicits, Icmp6InNeighborSolicits);
  1070. rrddim_set_by_pointer(st, rd_OutSolicits, Icmp6OutNeighborSolicits);
  1071. rrddim_set_by_pointer(st, rd_InAdvertisements, Icmp6InNeighborAdvertisements);
  1072. rrddim_set_by_pointer(st, rd_OutAdvertisements, Icmp6OutNeighborAdvertisements);
  1073. rrdset_done(st);
  1074. }
  1075. if(do_ip6_icmp_mldv2 == CONFIG_BOOLEAN_YES || (do_ip6_icmp_mldv2 == CONFIG_BOOLEAN_AUTO &&
  1076. (Icmp6InMLDv2Reports ||
  1077. Icmp6OutMLDv2Reports ||
  1078. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1079. do_ip6_icmp_mldv2 = CONFIG_BOOLEAN_YES;
  1080. static RRDSET *st = NULL;
  1081. static RRDDIM *rd_InMLDv2Reports = NULL,
  1082. *rd_OutMLDv2Reports = NULL;
  1083. if(unlikely(!st)) {
  1084. st = rrdset_create_localhost(
  1085. RRD_TYPE_NET_SNMP6
  1086. , "icmpmldv2"
  1087. , NULL
  1088. , "icmp6"
  1089. , NULL
  1090. , "IPv6 ICMP MLDv2 Reports"
  1091. , "reports/s"
  1092. , PLUGIN_PROC_NAME
  1093. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1094. , NETDATA_CHART_PRIO_IPV6_ICMP_LDV2
  1095. , update_every
  1096. , RRDSET_TYPE_LINE
  1097. );
  1098. rd_InMLDv2Reports = rrddim_add(st, "InMLDv2Reports", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1099. rd_OutMLDv2Reports = rrddim_add(st, "OutMLDv2Reports", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1100. }
  1101. rrddim_set_by_pointer(st, rd_InMLDv2Reports, Icmp6InMLDv2Reports);
  1102. rrddim_set_by_pointer(st, rd_OutMLDv2Reports, Icmp6OutMLDv2Reports);
  1103. rrdset_done(st);
  1104. }
  1105. if(do_ip6_icmp_types == CONFIG_BOOLEAN_YES || (do_ip6_icmp_types == CONFIG_BOOLEAN_AUTO &&
  1106. (Icmp6InType1 ||
  1107. Icmp6InType128 ||
  1108. Icmp6InType129 ||
  1109. Icmp6InType136 ||
  1110. Icmp6OutType1 ||
  1111. Icmp6OutType128 ||
  1112. Icmp6OutType129 ||
  1113. Icmp6OutType133 ||
  1114. Icmp6OutType135 ||
  1115. Icmp6OutType143 ||
  1116. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1117. do_ip6_icmp_types = CONFIG_BOOLEAN_YES;
  1118. static RRDSET *st = NULL;
  1119. static RRDDIM *rd_InType1 = NULL,
  1120. *rd_InType128 = NULL,
  1121. *rd_InType129 = NULL,
  1122. *rd_InType136 = NULL,
  1123. *rd_OutType1 = NULL,
  1124. *rd_OutType128 = NULL,
  1125. *rd_OutType129 = NULL,
  1126. *rd_OutType133 = NULL,
  1127. *rd_OutType135 = NULL,
  1128. *rd_OutType143 = NULL;
  1129. if(unlikely(!st)) {
  1130. st = rrdset_create_localhost(
  1131. RRD_TYPE_NET_SNMP6
  1132. , "icmptypes"
  1133. , NULL
  1134. , "icmp6"
  1135. , NULL
  1136. , "IPv6 ICMP Types"
  1137. , "messages/s"
  1138. , PLUGIN_PROC_NAME
  1139. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1140. , NETDATA_CHART_PRIO_IPV6_ICMP_TYPES
  1141. , update_every
  1142. , RRDSET_TYPE_LINE
  1143. );
  1144. rd_InType1 = rrddim_add(st, "InType1", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1145. rd_InType128 = rrddim_add(st, "InType128", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1146. rd_InType129 = rrddim_add(st, "InType129", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1147. rd_InType136 = rrddim_add(st, "InType136", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1148. rd_OutType1 = rrddim_add(st, "OutType1", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1149. rd_OutType128 = rrddim_add(st, "OutType128", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1150. rd_OutType129 = rrddim_add(st, "OutType129", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1151. rd_OutType133 = rrddim_add(st, "OutType133", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1152. rd_OutType135 = rrddim_add(st, "OutType135", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1153. rd_OutType143 = rrddim_add(st, "OutType143", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1154. }
  1155. rrddim_set_by_pointer(st, rd_InType1, Icmp6InType1);
  1156. rrddim_set_by_pointer(st, rd_InType128, Icmp6InType128);
  1157. rrddim_set_by_pointer(st, rd_InType129, Icmp6InType129);
  1158. rrddim_set_by_pointer(st, rd_InType136, Icmp6InType136);
  1159. rrddim_set_by_pointer(st, rd_OutType1, Icmp6OutType1);
  1160. rrddim_set_by_pointer(st, rd_OutType128, Icmp6OutType128);
  1161. rrddim_set_by_pointer(st, rd_OutType129, Icmp6OutType129);
  1162. rrddim_set_by_pointer(st, rd_OutType133, Icmp6OutType133);
  1163. rrddim_set_by_pointer(st, rd_OutType135, Icmp6OutType135);
  1164. rrddim_set_by_pointer(st, rd_OutType143, Icmp6OutType143);
  1165. rrdset_done(st);
  1166. }
  1167. if (do_ip6_ect == CONFIG_BOOLEAN_YES ||
  1168. (do_ip6_ect == CONFIG_BOOLEAN_AUTO && (Ip6InNoECTPkts || Ip6InECT1Pkts || Ip6InECT0Pkts || Ip6InCEPkts ||
  1169. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1170. do_ip6_ect = CONFIG_BOOLEAN_YES;
  1171. static RRDSET *st = NULL;
  1172. static RRDDIM *rd_InNoECTPkts = NULL, *rd_InECT1Pkts = NULL, *rd_InECT0Pkts = NULL, *rd_InCEPkts = NULL;
  1173. if (unlikely(!st)) {
  1174. st = rrdset_create_localhost(
  1175. RRD_TYPE_NET_SNMP6,
  1176. "ect",
  1177. NULL,
  1178. "packets",
  1179. NULL,
  1180. "IPv6 ECT Packets",
  1181. "packets/s",
  1182. PLUGIN_PROC_NAME,
  1183. PLUGIN_PROC_MODULE_NETSTAT_NAME,
  1184. NETDATA_CHART_PRIO_IPV6_ECT,
  1185. update_every,
  1186. RRDSET_TYPE_LINE);
  1187. rd_InNoECTPkts = rrddim_add(st, "InNoECTPkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1188. rd_InECT1Pkts = rrddim_add(st, "InECT1Pkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1189. rd_InECT0Pkts = rrddim_add(st, "InECT0Pkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1190. rd_InCEPkts = rrddim_add(st, "InCEPkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1191. }
  1192. rrddim_set_by_pointer(st, rd_InNoECTPkts, Ip6InNoECTPkts);
  1193. rrddim_set_by_pointer(st, rd_InECT1Pkts, Ip6InECT1Pkts);
  1194. rrddim_set_by_pointer(st, rd_InECT0Pkts, Ip6InECT0Pkts);
  1195. rrddim_set_by_pointer(st, rd_InCEPkts, Ip6InCEPkts);
  1196. rrdset_done(st);
  1197. }
  1198. }
  1199. int do_proc_net_netstat(int update_every, usec_t dt) {
  1200. (void)dt;
  1201. static int do_bandwidth = -1, do_inerrors = -1, do_mcast = -1, do_bcast = -1, do_mcast_p = -1, do_bcast_p = -1, do_ecn = -1, \
  1202. do_tcpext_reorder = -1, do_tcpext_syscookies = -1, do_tcpext_ofo = -1, do_tcpext_connaborts = -1, do_tcpext_memory = -1,
  1203. do_tcpext_syn_queue = -1, do_tcpext_accept_queue = -1;
  1204. static int do_ip_packets = -1, do_ip_fragsout = -1, do_ip_fragsin = -1, do_ip_errors = -1,
  1205. do_tcp_sockets = -1, do_tcp_packets = -1, do_tcp_errors = -1, do_tcp_handshake = -1, do_tcp_opens = -1,
  1206. do_udp_packets = -1, do_udp_errors = -1, do_icmp_packets = -1, do_icmpmsg = -1, do_udplite_packets = -1;
  1207. static uint32_t hash_ipext = 0, hash_tcpext = 0;
  1208. static uint32_t hash_ip = 0, hash_icmp = 0, hash_tcp = 0, hash_udp = 0, hash_icmpmsg = 0, hash_udplite = 0;
  1209. static procfile *ff_netstat = NULL;
  1210. static procfile *ff_snmp = NULL;
  1211. static ARL_BASE *arl_tcpext = NULL;
  1212. static ARL_BASE *arl_ipext = NULL;
  1213. static ARL_BASE *arl_ip = NULL;
  1214. static ARL_BASE *arl_icmp = NULL;
  1215. static ARL_BASE *arl_icmpmsg = NULL;
  1216. static ARL_BASE *arl_tcp = NULL;
  1217. static ARL_BASE *arl_udp = NULL;
  1218. static ARL_BASE *arl_udplite = NULL;
  1219. static const RRDVAR_ACQUIRED *tcp_max_connections_var = NULL;
  1220. // --------------------------------------------------------------------
  1221. // IP
  1222. // IP bandwidth
  1223. static unsigned long long ipext_InOctets = 0;
  1224. static unsigned long long ipext_OutOctets = 0;
  1225. // IP input errors
  1226. static unsigned long long ipext_InNoRoutes = 0;
  1227. static unsigned long long ipext_InTruncatedPkts = 0;
  1228. static unsigned long long ipext_InCsumErrors = 0;
  1229. // IP multicast bandwidth
  1230. static unsigned long long ipext_InMcastOctets = 0;
  1231. static unsigned long long ipext_OutMcastOctets = 0;
  1232. // IP multicast packets
  1233. static unsigned long long ipext_InMcastPkts = 0;
  1234. static unsigned long long ipext_OutMcastPkts = 0;
  1235. // IP broadcast bandwidth
  1236. static unsigned long long ipext_InBcastOctets = 0;
  1237. static unsigned long long ipext_OutBcastOctets = 0;
  1238. // IP broadcast packets
  1239. static unsigned long long ipext_InBcastPkts = 0;
  1240. static unsigned long long ipext_OutBcastPkts = 0;
  1241. // IP ECN
  1242. static unsigned long long ipext_InNoECTPkts = 0;
  1243. static unsigned long long ipext_InECT1Pkts = 0;
  1244. static unsigned long long ipext_InECT0Pkts = 0;
  1245. static unsigned long long ipext_InCEPkts = 0;
  1246. // --------------------------------------------------------------------
  1247. // IP TCP
  1248. // IP TCP Reordering
  1249. static unsigned long long tcpext_TCPRenoReorder = 0;
  1250. static unsigned long long tcpext_TCPFACKReorder = 0;
  1251. static unsigned long long tcpext_TCPSACKReorder = 0;
  1252. static unsigned long long tcpext_TCPTSReorder = 0;
  1253. // IP TCP SYN Cookies
  1254. static unsigned long long tcpext_SyncookiesSent = 0;
  1255. static unsigned long long tcpext_SyncookiesRecv = 0;
  1256. static unsigned long long tcpext_SyncookiesFailed = 0;
  1257. // IP TCP Out Of Order Queue
  1258. // http://www.spinics.net/lists/netdev/msg204696.html
  1259. static unsigned long long tcpext_TCPOFOQueue = 0; // Number of packets queued in OFO queue
  1260. static unsigned long long tcpext_TCPOFODrop = 0; // Number of packets meant to be queued in OFO but dropped because socket rcvbuf limit hit.
  1261. static unsigned long long tcpext_TCPOFOMerge = 0; // Number of packets in OFO that were merged with other packets.
  1262. static unsigned long long tcpext_OfoPruned = 0; // packets dropped from out-of-order queue because of socket buffer overrun
  1263. // IP TCP connection resets
  1264. // https://github.com/ecki/net-tools/blob/bd8bceaed2311651710331a7f8990c3e31be9840/statistics.c
  1265. static unsigned long long tcpext_TCPAbortOnData = 0; // connections reset due to unexpected data
  1266. static unsigned long long tcpext_TCPAbortOnClose = 0; // connections reset due to early user close
  1267. static unsigned long long tcpext_TCPAbortOnMemory = 0; // connections aborted due to memory pressure
  1268. static unsigned long long tcpext_TCPAbortOnTimeout = 0; // connections aborted due to timeout
  1269. static unsigned long long tcpext_TCPAbortOnLinger = 0; // connections aborted after user close in linger timeout
  1270. static unsigned long long tcpext_TCPAbortFailed = 0; // times unable to send RST due to no memory
  1271. // https://perfchron.com/2015/12/26/investigating-linux-network-issues-with-netstat-and-nstat/
  1272. static unsigned long long tcpext_ListenOverflows = 0; // times the listen queue of a socket overflowed
  1273. static unsigned long long tcpext_ListenDrops = 0; // SYNs to LISTEN sockets ignored
  1274. // IP TCP memory pressures
  1275. static unsigned long long tcpext_TCPMemoryPressures = 0;
  1276. static unsigned long long tcpext_TCPReqQFullDrop = 0;
  1277. static unsigned long long tcpext_TCPReqQFullDoCookies = 0;
  1278. static unsigned long long tcpext_TCPSynRetrans = 0;
  1279. // prepare for /proc/net/netstat parsing
  1280. if(unlikely(!arl_ipext)) {
  1281. hash_ipext = simple_hash("IpExt");
  1282. hash_tcpext = simple_hash("TcpExt");
  1283. do_bandwidth = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "bandwidth", CONFIG_BOOLEAN_AUTO);
  1284. do_inerrors = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "input errors", CONFIG_BOOLEAN_AUTO);
  1285. do_mcast = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "multicast bandwidth", CONFIG_BOOLEAN_AUTO);
  1286. do_bcast = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "broadcast bandwidth", CONFIG_BOOLEAN_AUTO);
  1287. do_mcast_p = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "multicast packets", CONFIG_BOOLEAN_AUTO);
  1288. do_bcast_p = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "broadcast packets", CONFIG_BOOLEAN_AUTO);
  1289. do_ecn = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "ECN packets", CONFIG_BOOLEAN_AUTO);
  1290. do_tcpext_reorder = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP reorders", CONFIG_BOOLEAN_AUTO);
  1291. do_tcpext_syscookies = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP SYN cookies", CONFIG_BOOLEAN_AUTO);
  1292. do_tcpext_ofo = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP out-of-order queue", CONFIG_BOOLEAN_AUTO);
  1293. do_tcpext_connaborts = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP connection aborts", CONFIG_BOOLEAN_AUTO);
  1294. do_tcpext_memory = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP memory pressures", CONFIG_BOOLEAN_AUTO);
  1295. do_tcpext_syn_queue = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP SYN queue", CONFIG_BOOLEAN_AUTO);
  1296. do_tcpext_accept_queue = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "TCP accept queue", CONFIG_BOOLEAN_AUTO);
  1297. arl_ipext = arl_create("netstat/ipext", NULL, 60);
  1298. arl_tcpext = arl_create("netstat/tcpext", NULL, 60);
  1299. // --------------------------------------------------------------------
  1300. // IP
  1301. if(do_bandwidth != CONFIG_BOOLEAN_NO) {
  1302. arl_expect(arl_ipext, "InOctets", &ipext_InOctets);
  1303. arl_expect(arl_ipext, "OutOctets", &ipext_OutOctets);
  1304. }
  1305. if(do_inerrors != CONFIG_BOOLEAN_NO) {
  1306. arl_expect(arl_ipext, "InNoRoutes", &ipext_InNoRoutes);
  1307. arl_expect(arl_ipext, "InTruncatedPkts", &ipext_InTruncatedPkts);
  1308. arl_expect(arl_ipext, "InCsumErrors", &ipext_InCsumErrors);
  1309. }
  1310. if(do_mcast != CONFIG_BOOLEAN_NO) {
  1311. arl_expect(arl_ipext, "InMcastOctets", &ipext_InMcastOctets);
  1312. arl_expect(arl_ipext, "OutMcastOctets", &ipext_OutMcastOctets);
  1313. }
  1314. if(do_mcast_p != CONFIG_BOOLEAN_NO) {
  1315. arl_expect(arl_ipext, "InMcastPkts", &ipext_InMcastPkts);
  1316. arl_expect(arl_ipext, "OutMcastPkts", &ipext_OutMcastPkts);
  1317. }
  1318. if(do_bcast != CONFIG_BOOLEAN_NO) {
  1319. arl_expect(arl_ipext, "InBcastPkts", &ipext_InBcastPkts);
  1320. arl_expect(arl_ipext, "OutBcastPkts", &ipext_OutBcastPkts);
  1321. }
  1322. if(do_bcast_p != CONFIG_BOOLEAN_NO) {
  1323. arl_expect(arl_ipext, "InBcastOctets", &ipext_InBcastOctets);
  1324. arl_expect(arl_ipext, "OutBcastOctets", &ipext_OutBcastOctets);
  1325. }
  1326. if(do_ecn != CONFIG_BOOLEAN_NO) {
  1327. arl_expect(arl_ipext, "InNoECTPkts", &ipext_InNoECTPkts);
  1328. arl_expect(arl_ipext, "InECT1Pkts", &ipext_InECT1Pkts);
  1329. arl_expect(arl_ipext, "InECT0Pkts", &ipext_InECT0Pkts);
  1330. arl_expect(arl_ipext, "InCEPkts", &ipext_InCEPkts);
  1331. }
  1332. // --------------------------------------------------------------------
  1333. // IP TCP
  1334. if(do_tcpext_reorder != CONFIG_BOOLEAN_NO) {
  1335. arl_expect(arl_tcpext, "TCPFACKReorder", &tcpext_TCPFACKReorder);
  1336. arl_expect(arl_tcpext, "TCPSACKReorder", &tcpext_TCPSACKReorder);
  1337. arl_expect(arl_tcpext, "TCPRenoReorder", &tcpext_TCPRenoReorder);
  1338. arl_expect(arl_tcpext, "TCPTSReorder", &tcpext_TCPTSReorder);
  1339. }
  1340. if(do_tcpext_syscookies != CONFIG_BOOLEAN_NO) {
  1341. arl_expect(arl_tcpext, "SyncookiesSent", &tcpext_SyncookiesSent);
  1342. arl_expect(arl_tcpext, "SyncookiesRecv", &tcpext_SyncookiesRecv);
  1343. arl_expect(arl_tcpext, "SyncookiesFailed", &tcpext_SyncookiesFailed);
  1344. }
  1345. if(do_tcpext_ofo != CONFIG_BOOLEAN_NO) {
  1346. arl_expect(arl_tcpext, "TCPOFOQueue", &tcpext_TCPOFOQueue);
  1347. arl_expect(arl_tcpext, "TCPOFODrop", &tcpext_TCPOFODrop);
  1348. arl_expect(arl_tcpext, "TCPOFOMerge", &tcpext_TCPOFOMerge);
  1349. arl_expect(arl_tcpext, "OfoPruned", &tcpext_OfoPruned);
  1350. }
  1351. if(do_tcpext_connaborts != CONFIG_BOOLEAN_NO) {
  1352. arl_expect(arl_tcpext, "TCPAbortOnData", &tcpext_TCPAbortOnData);
  1353. arl_expect(arl_tcpext, "TCPAbortOnClose", &tcpext_TCPAbortOnClose);
  1354. arl_expect(arl_tcpext, "TCPAbortOnMemory", &tcpext_TCPAbortOnMemory);
  1355. arl_expect(arl_tcpext, "TCPAbortOnTimeout", &tcpext_TCPAbortOnTimeout);
  1356. arl_expect(arl_tcpext, "TCPAbortOnLinger", &tcpext_TCPAbortOnLinger);
  1357. arl_expect(arl_tcpext, "TCPAbortFailed", &tcpext_TCPAbortFailed);
  1358. }
  1359. if(do_tcpext_memory != CONFIG_BOOLEAN_NO) {
  1360. arl_expect(arl_tcpext, "TCPMemoryPressures", &tcpext_TCPMemoryPressures);
  1361. }
  1362. if(do_tcpext_accept_queue != CONFIG_BOOLEAN_NO) {
  1363. arl_expect(arl_tcpext, "ListenOverflows", &tcpext_ListenOverflows);
  1364. arl_expect(arl_tcpext, "ListenDrops", &tcpext_ListenDrops);
  1365. }
  1366. if(do_tcpext_syn_queue != CONFIG_BOOLEAN_NO) {
  1367. arl_expect(arl_tcpext, "TCPReqQFullDrop", &tcpext_TCPReqQFullDrop);
  1368. arl_expect(arl_tcpext, "TCPReqQFullDoCookies", &tcpext_TCPReqQFullDoCookies);
  1369. }
  1370. arl_expect(arl_tcpext, "TCPSynRetrans", &tcpext_TCPSynRetrans);
  1371. }
  1372. // prepare for /proc/net/snmp parsing
  1373. if(unlikely(!arl_ip)) {
  1374. do_ip_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 packets", CONFIG_BOOLEAN_AUTO);
  1375. do_ip_fragsout = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 fragments sent", CONFIG_BOOLEAN_AUTO);
  1376. do_ip_fragsin = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 fragments assembly", CONFIG_BOOLEAN_AUTO);
  1377. do_ip_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 errors", CONFIG_BOOLEAN_AUTO);
  1378. do_tcp_sockets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP connections", CONFIG_BOOLEAN_AUTO);
  1379. do_tcp_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP packets", CONFIG_BOOLEAN_AUTO);
  1380. do_tcp_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP errors", CONFIG_BOOLEAN_AUTO);
  1381. do_tcp_opens = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP opens", CONFIG_BOOLEAN_AUTO);
  1382. do_tcp_handshake = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 TCP handshake issues", CONFIG_BOOLEAN_AUTO);
  1383. do_udp_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 UDP packets", CONFIG_BOOLEAN_AUTO);
  1384. do_udp_errors = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 UDP errors", CONFIG_BOOLEAN_AUTO);
  1385. do_icmp_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 ICMP packets", CONFIG_BOOLEAN_AUTO);
  1386. do_icmpmsg = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 ICMP messages", CONFIG_BOOLEAN_AUTO);
  1387. do_udplite_packets = config_get_boolean_ondemand("plugin:proc:/proc/net/snmp", "ipv4 UDPLite packets", CONFIG_BOOLEAN_AUTO);
  1388. hash_ip = simple_hash("Ip");
  1389. hash_tcp = simple_hash("Tcp");
  1390. hash_udp = simple_hash("Udp");
  1391. hash_icmp = simple_hash("Icmp");
  1392. hash_icmpmsg = simple_hash("IcmpMsg");
  1393. hash_udplite = simple_hash("UdpLite");
  1394. arl_ip = arl_create("snmp/Ip", arl_callback_str2kernel_uint_t, 60);
  1395. // arl_expect(arl_ip, "Forwarding", &snmp_root.ip_Forwarding);
  1396. arl_expect(arl_ip, "DefaultTTL", &snmp_root.ip_DefaultTTL);
  1397. arl_expect(arl_ip, "InReceives", &snmp_root.ip_InReceives);
  1398. arl_expect(arl_ip, "InHdrErrors", &snmp_root.ip_InHdrErrors);
  1399. arl_expect(arl_ip, "InAddrErrors", &snmp_root.ip_InAddrErrors);
  1400. arl_expect(arl_ip, "ForwDatagrams", &snmp_root.ip_ForwDatagrams);
  1401. arl_expect(arl_ip, "InUnknownProtos", &snmp_root.ip_InUnknownProtos);
  1402. arl_expect(arl_ip, "InDiscards", &snmp_root.ip_InDiscards);
  1403. arl_expect(arl_ip, "InDelivers", &snmp_root.ip_InDelivers);
  1404. arl_expect(arl_ip, "OutRequests", &snmp_root.ip_OutRequests);
  1405. arl_expect(arl_ip, "OutDiscards", &snmp_root.ip_OutDiscards);
  1406. arl_expect(arl_ip, "OutNoRoutes", &snmp_root.ip_OutNoRoutes);
  1407. arl_expect(arl_ip, "ReasmTimeout", &snmp_root.ip_ReasmTimeout);
  1408. arl_expect(arl_ip, "ReasmReqds", &snmp_root.ip_ReasmReqds);
  1409. arl_expect(arl_ip, "ReasmOKs", &snmp_root.ip_ReasmOKs);
  1410. arl_expect(arl_ip, "ReasmFails", &snmp_root.ip_ReasmFails);
  1411. arl_expect(arl_ip, "FragOKs", &snmp_root.ip_FragOKs);
  1412. arl_expect(arl_ip, "FragFails", &snmp_root.ip_FragFails);
  1413. arl_expect(arl_ip, "FragCreates", &snmp_root.ip_FragCreates);
  1414. arl_icmp = arl_create("snmp/Icmp", arl_callback_str2kernel_uint_t, 60);
  1415. arl_expect(arl_icmp, "InMsgs", &snmp_root.icmp_InMsgs);
  1416. arl_expect(arl_icmp, "OutMsgs", &snmp_root.icmp_OutMsgs);
  1417. arl_expect(arl_icmp, "InErrors", &snmp_root.icmp_InErrors);
  1418. arl_expect(arl_icmp, "OutErrors", &snmp_root.icmp_OutErrors);
  1419. arl_expect(arl_icmp, "InCsumErrors", &snmp_root.icmp_InCsumErrors);
  1420. arl_icmpmsg = arl_create("snmp/Icmpmsg", arl_callback_str2kernel_uint_t, 60);
  1421. arl_expect(arl_icmpmsg, "InType0", &snmp_root.icmpmsg_InEchoReps);
  1422. arl_expect(arl_icmpmsg, "OutType0", &snmp_root.icmpmsg_OutEchoReps);
  1423. arl_expect(arl_icmpmsg, "InType3", &snmp_root.icmpmsg_InDestUnreachs);
  1424. arl_expect(arl_icmpmsg, "OutType3", &snmp_root.icmpmsg_OutDestUnreachs);
  1425. arl_expect(arl_icmpmsg, "InType5", &snmp_root.icmpmsg_InRedirects);
  1426. arl_expect(arl_icmpmsg, "OutType5", &snmp_root.icmpmsg_OutRedirects);
  1427. arl_expect(arl_icmpmsg, "InType8", &snmp_root.icmpmsg_InEchos);
  1428. arl_expect(arl_icmpmsg, "OutType8", &snmp_root.icmpmsg_OutEchos);
  1429. arl_expect(arl_icmpmsg, "InType9", &snmp_root.icmpmsg_InRouterAdvert);
  1430. arl_expect(arl_icmpmsg, "OutType9", &snmp_root.icmpmsg_OutRouterAdvert);
  1431. arl_expect(arl_icmpmsg, "InType10", &snmp_root.icmpmsg_InRouterSelect);
  1432. arl_expect(arl_icmpmsg, "OutType10", &snmp_root.icmpmsg_OutRouterSelect);
  1433. arl_expect(arl_icmpmsg, "InType11", &snmp_root.icmpmsg_InTimeExcds);
  1434. arl_expect(arl_icmpmsg, "OutType11", &snmp_root.icmpmsg_OutTimeExcds);
  1435. arl_expect(arl_icmpmsg, "InType12", &snmp_root.icmpmsg_InParmProbs);
  1436. arl_expect(arl_icmpmsg, "OutType12", &snmp_root.icmpmsg_OutParmProbs);
  1437. arl_expect(arl_icmpmsg, "InType13", &snmp_root.icmpmsg_InTimestamps);
  1438. arl_expect(arl_icmpmsg, "OutType13", &snmp_root.icmpmsg_OutTimestamps);
  1439. arl_expect(arl_icmpmsg, "InType14", &snmp_root.icmpmsg_InTimestampReps);
  1440. arl_expect(arl_icmpmsg, "OutType14", &snmp_root.icmpmsg_OutTimestampReps);
  1441. arl_tcp = arl_create("snmp/Tcp", arl_callback_str2kernel_uint_t, 60);
  1442. // arl_expect(arl_tcp, "RtoAlgorithm", &snmp_root.tcp_RtoAlgorithm);
  1443. // arl_expect(arl_tcp, "RtoMin", &snmp_root.tcp_RtoMin);
  1444. // arl_expect(arl_tcp, "RtoMax", &snmp_root.tcp_RtoMax);
  1445. arl_expect_custom(arl_tcp, "MaxConn", arl_callback_ssize_t, &snmp_root.tcp_MaxConn);
  1446. arl_expect(arl_tcp, "ActiveOpens", &snmp_root.tcp_ActiveOpens);
  1447. arl_expect(arl_tcp, "PassiveOpens", &snmp_root.tcp_PassiveOpens);
  1448. arl_expect(arl_tcp, "AttemptFails", &snmp_root.tcp_AttemptFails);
  1449. arl_expect(arl_tcp, "EstabResets", &snmp_root.tcp_EstabResets);
  1450. arl_expect(arl_tcp, "CurrEstab", &snmp_root.tcp_CurrEstab);
  1451. arl_expect(arl_tcp, "InSegs", &snmp_root.tcp_InSegs);
  1452. arl_expect(arl_tcp, "OutSegs", &snmp_root.tcp_OutSegs);
  1453. arl_expect(arl_tcp, "RetransSegs", &snmp_root.tcp_RetransSegs);
  1454. arl_expect(arl_tcp, "InErrs", &snmp_root.tcp_InErrs);
  1455. arl_expect(arl_tcp, "OutRsts", &snmp_root.tcp_OutRsts);
  1456. arl_expect(arl_tcp, "InCsumErrors", &snmp_root.tcp_InCsumErrors);
  1457. arl_udp = arl_create("snmp/Udp", arl_callback_str2kernel_uint_t, 60);
  1458. arl_expect(arl_udp, "InDatagrams", &snmp_root.udp_InDatagrams);
  1459. arl_expect(arl_udp, "NoPorts", &snmp_root.udp_NoPorts);
  1460. arl_expect(arl_udp, "InErrors", &snmp_root.udp_InErrors);
  1461. arl_expect(arl_udp, "OutDatagrams", &snmp_root.udp_OutDatagrams);
  1462. arl_expect(arl_udp, "RcvbufErrors", &snmp_root.udp_RcvbufErrors);
  1463. arl_expect(arl_udp, "SndbufErrors", &snmp_root.udp_SndbufErrors);
  1464. arl_expect(arl_udp, "InCsumErrors", &snmp_root.udp_InCsumErrors);
  1465. arl_expect(arl_udp, "IgnoredMulti", &snmp_root.udp_IgnoredMulti);
  1466. arl_udplite = arl_create("snmp/Udplite", arl_callback_str2kernel_uint_t, 60);
  1467. arl_expect(arl_udplite, "InDatagrams", &snmp_root.udplite_InDatagrams);
  1468. arl_expect(arl_udplite, "NoPorts", &snmp_root.udplite_NoPorts);
  1469. arl_expect(arl_udplite, "InErrors", &snmp_root.udplite_InErrors);
  1470. arl_expect(arl_udplite, "OutDatagrams", &snmp_root.udplite_OutDatagrams);
  1471. arl_expect(arl_udplite, "RcvbufErrors", &snmp_root.udplite_RcvbufErrors);
  1472. arl_expect(arl_udplite, "SndbufErrors", &snmp_root.udplite_SndbufErrors);
  1473. arl_expect(arl_udplite, "InCsumErrors", &snmp_root.udplite_InCsumErrors);
  1474. arl_expect(arl_udplite, "IgnoredMulti", &snmp_root.udplite_IgnoredMulti);
  1475. tcp_max_connections_var = rrdvar_custom_host_variable_add_and_acquire(localhost, "tcp_max_connections");
  1476. }
  1477. size_t lines, l, words;
  1478. // parse /proc/net/netstat
  1479. if(unlikely(!ff_netstat)) {
  1480. char filename[FILENAME_MAX + 1];
  1481. snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/netstat");
  1482. ff_netstat = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_NETSTAT, "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
  1483. if(unlikely(!ff_netstat)) return 1;
  1484. }
  1485. ff_netstat = procfile_readall(ff_netstat);
  1486. if(unlikely(!ff_netstat)) return 0; // we return 0, so that we will retry to open it next time
  1487. lines = procfile_lines(ff_netstat);
  1488. arl_begin(arl_ipext);
  1489. arl_begin(arl_tcpext);
  1490. for(l = 0; l < lines ;l++) {
  1491. char *key = procfile_lineword(ff_netstat, l, 0);
  1492. uint32_t hash = simple_hash(key);
  1493. if(unlikely(hash == hash_ipext && strcmp(key, "IpExt") == 0)) {
  1494. size_t h = l++;
  1495. words = procfile_linewords(ff_netstat, l);
  1496. if(unlikely(words < 2)) {
  1497. collector_error("Cannot read /proc/net/netstat IpExt line. Expected 2+ params, read %zu.", words);
  1498. continue;
  1499. }
  1500. parse_line_pair(ff_netstat, arl_ipext, h, l);
  1501. }
  1502. else if(unlikely(hash == hash_tcpext && strcmp(key, "TcpExt") == 0)) {
  1503. size_t h = l++;
  1504. words = procfile_linewords(ff_netstat, l);
  1505. if(unlikely(words < 2)) {
  1506. collector_error("Cannot read /proc/net/netstat TcpExt line. Expected 2+ params, read %zu.", words);
  1507. continue;
  1508. }
  1509. parse_line_pair(ff_netstat, arl_tcpext, h, l);
  1510. }
  1511. }
  1512. // parse /proc/net/snmp
  1513. if(unlikely(!ff_snmp)) {
  1514. char filename[FILENAME_MAX + 1];
  1515. snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/snmp");
  1516. ff_snmp = procfile_open(config_get("plugin:proc:/proc/net/snmp", "filename to monitor", filename), " \t:", PROCFILE_FLAG_DEFAULT);
  1517. if(unlikely(!ff_snmp)) return 1;
  1518. }
  1519. ff_snmp = procfile_readall(ff_snmp);
  1520. if(unlikely(!ff_snmp)) return 0; // we return 0, so that we will retry to open it next time
  1521. lines = procfile_lines(ff_snmp);
  1522. size_t w;
  1523. for(l = 0; l < lines ;l++) {
  1524. char *key = procfile_lineword(ff_snmp, l, 0);
  1525. uint32_t hash = simple_hash(key);
  1526. if(unlikely(hash == hash_ip && strcmp(key, "Ip") == 0)) {
  1527. size_t h = l++;
  1528. if(strcmp(procfile_lineword(ff_snmp, l, 0), "Ip") != 0) {
  1529. collector_error("Cannot read Ip line from /proc/net/snmp.");
  1530. break;
  1531. }
  1532. words = procfile_linewords(ff_snmp, l);
  1533. if(words < 3) {
  1534. collector_error("Cannot read /proc/net/snmp Ip line. Expected 3+ params, read %zu.", words);
  1535. continue;
  1536. }
  1537. arl_begin(arl_ip);
  1538. for(w = 1; w < words ; w++) {
  1539. if (unlikely(arl_check(arl_ip, procfile_lineword(ff_snmp, h, w), procfile_lineword(ff_snmp, l, w)) != 0))
  1540. break;
  1541. }
  1542. }
  1543. else if(unlikely(hash == hash_icmp && strcmp(key, "Icmp") == 0)) {
  1544. size_t h = l++;
  1545. if(strcmp(procfile_lineword(ff_snmp, l, 0), "Icmp") != 0) {
  1546. collector_error("Cannot read Icmp line from /proc/net/snmp.");
  1547. break;
  1548. }
  1549. words = procfile_linewords(ff_snmp, l);
  1550. if(words < 3) {
  1551. collector_error("Cannot read /proc/net/snmp Icmp line. Expected 3+ params, read %zu.", words);
  1552. continue;
  1553. }
  1554. arl_begin(arl_icmp);
  1555. for(w = 1; w < words ; w++) {
  1556. if (unlikely(arl_check(arl_icmp, procfile_lineword(ff_snmp, h, w), procfile_lineword(ff_snmp, l, w)) != 0))
  1557. break;
  1558. }
  1559. }
  1560. else if(unlikely(hash == hash_icmpmsg && strcmp(key, "IcmpMsg") == 0)) {
  1561. size_t h = l++;
  1562. if(strcmp(procfile_lineword(ff_snmp, l, 0), "IcmpMsg") != 0) {
  1563. collector_error("Cannot read IcmpMsg line from /proc/net/snmp.");
  1564. break;
  1565. }
  1566. words = procfile_linewords(ff_snmp, l);
  1567. if(words < 2) {
  1568. collector_error("Cannot read /proc/net/snmp IcmpMsg line. Expected 2+ params, read %zu.", words);
  1569. continue;
  1570. }
  1571. arl_begin(arl_icmpmsg);
  1572. for(w = 1; w < words ; w++) {
  1573. if (unlikely(arl_check(arl_icmpmsg, procfile_lineword(ff_snmp, h, w), procfile_lineword(ff_snmp, l, w)) != 0))
  1574. break;
  1575. }
  1576. }
  1577. else if(unlikely(hash == hash_tcp && strcmp(key, "Tcp") == 0)) {
  1578. size_t h = l++;
  1579. if(strcmp(procfile_lineword(ff_snmp, l, 0), "Tcp") != 0) {
  1580. collector_error("Cannot read Tcp line from /proc/net/snmp.");
  1581. break;
  1582. }
  1583. words = procfile_linewords(ff_snmp, l);
  1584. if(words < 3) {
  1585. collector_error("Cannot read /proc/net/snmp Tcp line. Expected 3+ params, read %zu.", words);
  1586. continue;
  1587. }
  1588. arl_begin(arl_tcp);
  1589. for(w = 1; w < words ; w++) {
  1590. if (unlikely(arl_check(arl_tcp, procfile_lineword(ff_snmp, h, w), procfile_lineword(ff_snmp, l, w)) != 0))
  1591. break;
  1592. }
  1593. }
  1594. else if(unlikely(hash == hash_udp && strcmp(key, "Udp") == 0)) {
  1595. size_t h = l++;
  1596. if(strcmp(procfile_lineword(ff_snmp, l, 0), "Udp") != 0) {
  1597. collector_error("Cannot read Udp line from /proc/net/snmp.");
  1598. break;
  1599. }
  1600. words = procfile_linewords(ff_snmp, l);
  1601. if(words < 3) {
  1602. collector_error("Cannot read /proc/net/snmp Udp line. Expected 3+ params, read %zu.", words);
  1603. continue;
  1604. }
  1605. arl_begin(arl_udp);
  1606. for(w = 1; w < words ; w++) {
  1607. if (unlikely(arl_check(arl_udp, procfile_lineword(ff_snmp, h, w), procfile_lineword(ff_snmp, l, w)) != 0))
  1608. break;
  1609. }
  1610. }
  1611. else if(unlikely(hash == hash_udplite && strcmp(key, "UdpLite") == 0)) {
  1612. size_t h = l++;
  1613. if(strcmp(procfile_lineword(ff_snmp, l, 0), "UdpLite") != 0) {
  1614. collector_error("Cannot read UdpLite line from /proc/net/snmp.");
  1615. break;
  1616. }
  1617. words = procfile_linewords(ff_snmp, l);
  1618. if(words < 3) {
  1619. collector_error("Cannot read /proc/net/snmp UdpLite line. Expected 3+ params, read %zu.", words);
  1620. continue;
  1621. }
  1622. arl_begin(arl_udplite);
  1623. for(w = 1; w < words ; w++) {
  1624. if (unlikely(arl_check(arl_udplite, procfile_lineword(ff_snmp, h, w), procfile_lineword(ff_snmp, l, w)) != 0))
  1625. break;
  1626. }
  1627. }
  1628. }
  1629. // netstat IpExt charts
  1630. if(do_bandwidth == CONFIG_BOOLEAN_YES || (do_bandwidth == CONFIG_BOOLEAN_AUTO &&
  1631. (ipext_InOctets ||
  1632. ipext_OutOctets ||
  1633. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1634. do_bandwidth = CONFIG_BOOLEAN_YES;
  1635. static RRDSET *st_system_ip = NULL;
  1636. static RRDDIM *rd_in = NULL, *rd_out = NULL;
  1637. if(unlikely(!st_system_ip)) {
  1638. st_system_ip = rrdset_create_localhost(
  1639. "system"
  1640. , RRD_TYPE_NET_NETSTAT
  1641. , NULL
  1642. , "network"
  1643. , NULL
  1644. , "IP Bandwidth"
  1645. , "kilobits/s"
  1646. , PLUGIN_PROC_NAME
  1647. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1648. , NETDATA_CHART_PRIO_SYSTEM_IP
  1649. , update_every
  1650. , RRDSET_TYPE_AREA
  1651. );
  1652. rd_in = rrddim_add(st_system_ip, "InOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1653. rd_out = rrddim_add(st_system_ip, "OutOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1654. }
  1655. rrddim_set_by_pointer(st_system_ip, rd_in, ipext_InOctets);
  1656. rrddim_set_by_pointer(st_system_ip, rd_out, ipext_OutOctets);
  1657. rrdset_done(st_system_ip);
  1658. }
  1659. if(do_inerrors == CONFIG_BOOLEAN_YES || (do_inerrors == CONFIG_BOOLEAN_AUTO &&
  1660. (ipext_InNoRoutes ||
  1661. ipext_InTruncatedPkts ||
  1662. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1663. do_inerrors = CONFIG_BOOLEAN_YES;
  1664. static RRDSET *st_ip_inerrors = NULL;
  1665. static RRDDIM *rd_noroutes = NULL, *rd_truncated = NULL, *rd_checksum = NULL;
  1666. if(unlikely(!st_ip_inerrors)) {
  1667. st_ip_inerrors = rrdset_create_localhost(
  1668. RRD_TYPE_NET_NETSTAT
  1669. , "inerrors"
  1670. , NULL
  1671. , "errors"
  1672. , NULL
  1673. , "IP Input Errors"
  1674. , "packets/s"
  1675. , PLUGIN_PROC_NAME
  1676. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1677. , NETDATA_CHART_PRIO_IP_ERRORS
  1678. , update_every
  1679. , RRDSET_TYPE_LINE
  1680. );
  1681. rrdset_flag_set(st_ip_inerrors, RRDSET_FLAG_DETAIL);
  1682. rd_noroutes = rrddim_add(st_ip_inerrors, "InNoRoutes", "noroutes", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1683. rd_truncated = rrddim_add(st_ip_inerrors, "InTruncatedPkts", "truncated", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1684. rd_checksum = rrddim_add(st_ip_inerrors, "InCsumErrors", "checksum", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1685. }
  1686. rrddim_set_by_pointer(st_ip_inerrors, rd_noroutes, ipext_InNoRoutes);
  1687. rrddim_set_by_pointer(st_ip_inerrors, rd_truncated, ipext_InTruncatedPkts);
  1688. rrddim_set_by_pointer(st_ip_inerrors, rd_checksum, ipext_InCsumErrors);
  1689. rrdset_done(st_ip_inerrors);
  1690. }
  1691. if(do_mcast == CONFIG_BOOLEAN_YES || (do_mcast == CONFIG_BOOLEAN_AUTO &&
  1692. (ipext_InMcastOctets ||
  1693. ipext_OutMcastOctets ||
  1694. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1695. do_mcast = CONFIG_BOOLEAN_YES;
  1696. static RRDSET *st_ip_mcast = NULL;
  1697. static RRDDIM *rd_in = NULL, *rd_out = NULL;
  1698. if(unlikely(!st_ip_mcast)) {
  1699. st_ip_mcast = rrdset_create_localhost(
  1700. RRD_TYPE_NET_NETSTAT
  1701. , "mcast"
  1702. , NULL
  1703. , "multicast"
  1704. , NULL
  1705. , "IP Multicast Bandwidth"
  1706. , "kilobits/s"
  1707. , PLUGIN_PROC_NAME
  1708. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1709. , NETDATA_CHART_PRIO_IP_MCAST
  1710. , update_every
  1711. , RRDSET_TYPE_AREA
  1712. );
  1713. rrdset_flag_set(st_ip_mcast, RRDSET_FLAG_DETAIL);
  1714. rd_in = rrddim_add(st_ip_mcast, "InMcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1715. rd_out = rrddim_add(st_ip_mcast, "OutMcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1716. }
  1717. rrddim_set_by_pointer(st_ip_mcast, rd_in, ipext_InMcastOctets);
  1718. rrddim_set_by_pointer(st_ip_mcast, rd_out, ipext_OutMcastOctets);
  1719. rrdset_done(st_ip_mcast);
  1720. }
  1721. // --------------------------------------------------------------------
  1722. if(do_bcast == CONFIG_BOOLEAN_YES || (do_bcast == CONFIG_BOOLEAN_AUTO &&
  1723. (ipext_InBcastOctets ||
  1724. ipext_OutBcastOctets ||
  1725. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1726. do_bcast = CONFIG_BOOLEAN_YES;
  1727. static RRDSET *st_ip_bcast = NULL;
  1728. static RRDDIM *rd_in = NULL, *rd_out = NULL;
  1729. if(unlikely(!st_ip_bcast)) {
  1730. st_ip_bcast = rrdset_create_localhost(
  1731. RRD_TYPE_NET_NETSTAT
  1732. , "bcast"
  1733. , NULL
  1734. , "broadcast"
  1735. , NULL
  1736. , "IP Broadcast Bandwidth"
  1737. , "kilobits/s"
  1738. , PLUGIN_PROC_NAME
  1739. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1740. , NETDATA_CHART_PRIO_IP_BCAST
  1741. , update_every
  1742. , RRDSET_TYPE_AREA
  1743. );
  1744. rrdset_flag_set(st_ip_bcast, RRDSET_FLAG_DETAIL);
  1745. rd_in = rrddim_add(st_ip_bcast, "InBcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1746. rd_out = rrddim_add(st_ip_bcast, "OutBcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1747. }
  1748. rrddim_set_by_pointer(st_ip_bcast, rd_in, ipext_InBcastOctets);
  1749. rrddim_set_by_pointer(st_ip_bcast, rd_out, ipext_OutBcastOctets);
  1750. rrdset_done(st_ip_bcast);
  1751. }
  1752. // --------------------------------------------------------------------
  1753. if(do_mcast_p == CONFIG_BOOLEAN_YES || (do_mcast_p == CONFIG_BOOLEAN_AUTO &&
  1754. (ipext_InMcastPkts ||
  1755. ipext_OutMcastPkts ||
  1756. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1757. do_mcast_p = CONFIG_BOOLEAN_YES;
  1758. static RRDSET *st_ip_mcastpkts = NULL;
  1759. static RRDDIM *rd_in = NULL, *rd_out = NULL;
  1760. if(unlikely(!st_ip_mcastpkts)) {
  1761. st_ip_mcastpkts = rrdset_create_localhost(
  1762. RRD_TYPE_NET_NETSTAT
  1763. , "mcastpkts"
  1764. , NULL
  1765. , "multicast"
  1766. , NULL
  1767. , "IP Multicast Packets"
  1768. , "packets/s"
  1769. , PLUGIN_PROC_NAME
  1770. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1771. , NETDATA_CHART_PRIO_IP_MCAST_PACKETS
  1772. , update_every
  1773. , RRDSET_TYPE_LINE
  1774. );
  1775. rrdset_flag_set(st_ip_mcastpkts, RRDSET_FLAG_DETAIL);
  1776. rd_in = rrddim_add(st_ip_mcastpkts, "InMcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1777. rd_out = rrddim_add(st_ip_mcastpkts, "OutMcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1778. }
  1779. rrddim_set_by_pointer(st_ip_mcastpkts, rd_in, ipext_InMcastPkts);
  1780. rrddim_set_by_pointer(st_ip_mcastpkts, rd_out, ipext_OutMcastPkts);
  1781. rrdset_done(st_ip_mcastpkts);
  1782. }
  1783. if(do_bcast_p == CONFIG_BOOLEAN_YES || (do_bcast_p == CONFIG_BOOLEAN_AUTO &&
  1784. (ipext_InBcastPkts ||
  1785. ipext_OutBcastPkts ||
  1786. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1787. do_bcast_p = CONFIG_BOOLEAN_YES;
  1788. static RRDSET *st_ip_bcastpkts = NULL;
  1789. static RRDDIM *rd_in = NULL, *rd_out = NULL;
  1790. if(unlikely(!st_ip_bcastpkts)) {
  1791. st_ip_bcastpkts = rrdset_create_localhost(
  1792. RRD_TYPE_NET_NETSTAT
  1793. , "bcastpkts"
  1794. , NULL
  1795. , "broadcast"
  1796. , NULL
  1797. , "IP Broadcast Packets"
  1798. , "packets/s"
  1799. , PLUGIN_PROC_NAME
  1800. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1801. , NETDATA_CHART_PRIO_IP_BCAST_PACKETS
  1802. , update_every
  1803. , RRDSET_TYPE_LINE
  1804. );
  1805. rrdset_flag_set(st_ip_bcastpkts, RRDSET_FLAG_DETAIL);
  1806. rd_in = rrddim_add(st_ip_bcastpkts, "InBcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1807. rd_out = rrddim_add(st_ip_bcastpkts, "OutBcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1808. }
  1809. rrddim_set_by_pointer(st_ip_bcastpkts, rd_in, ipext_InBcastPkts);
  1810. rrddim_set_by_pointer(st_ip_bcastpkts, rd_out, ipext_OutBcastPkts);
  1811. rrdset_done(st_ip_bcastpkts);
  1812. }
  1813. if(do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO &&
  1814. (ipext_InCEPkts ||
  1815. ipext_InECT0Pkts ||
  1816. ipext_InECT1Pkts ||
  1817. ipext_InNoECTPkts ||
  1818. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1819. do_ecn = CONFIG_BOOLEAN_YES;
  1820. static RRDSET *st_ecnpkts = NULL;
  1821. static RRDDIM *rd_cep = NULL, *rd_noectp = NULL, *rd_ectp0 = NULL, *rd_ectp1 = NULL;
  1822. if(unlikely(!st_ecnpkts)) {
  1823. st_ecnpkts = rrdset_create_localhost(
  1824. RRD_TYPE_NET_NETSTAT
  1825. , "ecnpkts"
  1826. , NULL
  1827. , "ecn"
  1828. , NULL
  1829. , "IP ECN Statistics"
  1830. , "packets/s"
  1831. , PLUGIN_PROC_NAME
  1832. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1833. , NETDATA_CHART_PRIO_IP_ECN
  1834. , update_every
  1835. , RRDSET_TYPE_LINE
  1836. );
  1837. rrdset_flag_set(st_ecnpkts, RRDSET_FLAG_DETAIL);
  1838. rd_cep = rrddim_add(st_ecnpkts, "InCEPkts", "CEP", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1839. rd_noectp = rrddim_add(st_ecnpkts, "InNoECTPkts", "NoECTP", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1840. rd_ectp0 = rrddim_add(st_ecnpkts, "InECT0Pkts", "ECTP0", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1841. rd_ectp1 = rrddim_add(st_ecnpkts, "InECT1Pkts", "ECTP1", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1842. }
  1843. rrddim_set_by_pointer(st_ecnpkts, rd_cep, ipext_InCEPkts);
  1844. rrddim_set_by_pointer(st_ecnpkts, rd_noectp, ipext_InNoECTPkts);
  1845. rrddim_set_by_pointer(st_ecnpkts, rd_ectp0, ipext_InECT0Pkts);
  1846. rrddim_set_by_pointer(st_ecnpkts, rd_ectp1, ipext_InECT1Pkts);
  1847. rrdset_done(st_ecnpkts);
  1848. }
  1849. // netstat TcpExt charts
  1850. if(do_tcpext_memory == CONFIG_BOOLEAN_YES || (do_tcpext_memory == CONFIG_BOOLEAN_AUTO &&
  1851. (tcpext_TCPMemoryPressures ||
  1852. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1853. do_tcpext_memory = CONFIG_BOOLEAN_YES;
  1854. static RRDSET *st_tcpmemorypressures = NULL;
  1855. static RRDDIM *rd_pressures = NULL;
  1856. if(unlikely(!st_tcpmemorypressures)) {
  1857. st_tcpmemorypressures = rrdset_create_localhost(
  1858. RRD_TYPE_NET_NETSTAT
  1859. , "tcpmemorypressures"
  1860. , NULL
  1861. , "tcp"
  1862. , NULL
  1863. , "TCP Memory Pressures"
  1864. , "events/s"
  1865. , PLUGIN_PROC_NAME
  1866. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1867. , NETDATA_CHART_PRIO_IP_TCP_MEM
  1868. , update_every
  1869. , RRDSET_TYPE_LINE
  1870. );
  1871. rd_pressures = rrddim_add(st_tcpmemorypressures, "TCPMemoryPressures", "pressures", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1872. }
  1873. rrddim_set_by_pointer(st_tcpmemorypressures, rd_pressures, tcpext_TCPMemoryPressures);
  1874. rrdset_done(st_tcpmemorypressures);
  1875. }
  1876. if(do_tcpext_connaborts == CONFIG_BOOLEAN_YES || (do_tcpext_connaborts == CONFIG_BOOLEAN_AUTO &&
  1877. (tcpext_TCPAbortOnData ||
  1878. tcpext_TCPAbortOnClose ||
  1879. tcpext_TCPAbortOnMemory ||
  1880. tcpext_TCPAbortOnTimeout ||
  1881. tcpext_TCPAbortOnLinger ||
  1882. tcpext_TCPAbortFailed ||
  1883. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1884. do_tcpext_connaborts = CONFIG_BOOLEAN_YES;
  1885. static RRDSET *st_tcpconnaborts = NULL;
  1886. static RRDDIM *rd_baddata = NULL, *rd_userclosed = NULL, *rd_nomemory = NULL, *rd_timeout = NULL, *rd_linger = NULL, *rd_failed = NULL;
  1887. if(unlikely(!st_tcpconnaborts)) {
  1888. st_tcpconnaborts = rrdset_create_localhost(
  1889. RRD_TYPE_NET_NETSTAT
  1890. , "tcpconnaborts"
  1891. , NULL
  1892. , "tcp"
  1893. , NULL
  1894. , "TCP Connection Aborts"
  1895. , "connections/s"
  1896. , PLUGIN_PROC_NAME
  1897. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1898. , NETDATA_CHART_PRIO_IP_TCP_CONNABORTS
  1899. , update_every
  1900. , RRDSET_TYPE_LINE
  1901. );
  1902. rd_baddata = rrddim_add(st_tcpconnaborts, "TCPAbortOnData", "baddata", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1903. rd_userclosed = rrddim_add(st_tcpconnaborts, "TCPAbortOnClose", "userclosed", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1904. rd_nomemory = rrddim_add(st_tcpconnaborts, "TCPAbortOnMemory", "nomemory", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1905. rd_timeout = rrddim_add(st_tcpconnaborts, "TCPAbortOnTimeout", "timeout", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1906. rd_linger = rrddim_add(st_tcpconnaborts, "TCPAbortOnLinger", "linger", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1907. rd_failed = rrddim_add(st_tcpconnaborts, "TCPAbortFailed", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1908. }
  1909. rrddim_set_by_pointer(st_tcpconnaborts, rd_baddata, tcpext_TCPAbortOnData);
  1910. rrddim_set_by_pointer(st_tcpconnaborts, rd_userclosed, tcpext_TCPAbortOnClose);
  1911. rrddim_set_by_pointer(st_tcpconnaborts, rd_nomemory, tcpext_TCPAbortOnMemory);
  1912. rrddim_set_by_pointer(st_tcpconnaborts, rd_timeout, tcpext_TCPAbortOnTimeout);
  1913. rrddim_set_by_pointer(st_tcpconnaborts, rd_linger, tcpext_TCPAbortOnLinger);
  1914. rrddim_set_by_pointer(st_tcpconnaborts, rd_failed, tcpext_TCPAbortFailed);
  1915. rrdset_done(st_tcpconnaborts);
  1916. }
  1917. if(do_tcpext_reorder == CONFIG_BOOLEAN_YES || (do_tcpext_reorder == CONFIG_BOOLEAN_AUTO &&
  1918. (tcpext_TCPRenoReorder ||
  1919. tcpext_TCPFACKReorder ||
  1920. tcpext_TCPSACKReorder ||
  1921. tcpext_TCPTSReorder ||
  1922. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1923. do_tcpext_reorder = CONFIG_BOOLEAN_YES;
  1924. static RRDSET *st_tcpreorders = NULL;
  1925. static RRDDIM *rd_timestamp = NULL, *rd_sack = NULL, *rd_fack = NULL, *rd_reno = NULL;
  1926. if(unlikely(!st_tcpreorders)) {
  1927. st_tcpreorders = rrdset_create_localhost(
  1928. RRD_TYPE_NET_NETSTAT
  1929. , "tcpreorders"
  1930. , NULL
  1931. , "tcp"
  1932. , NULL
  1933. , "TCP Reordered Packets by Detection Method"
  1934. , "packets/s"
  1935. , PLUGIN_PROC_NAME
  1936. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1937. , NETDATA_CHART_PRIO_IP_TCP_REORDERS
  1938. , update_every
  1939. , RRDSET_TYPE_LINE
  1940. );
  1941. rd_timestamp = rrddim_add(st_tcpreorders, "TCPTSReorder", "timestamp", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1942. rd_sack = rrddim_add(st_tcpreorders, "TCPSACKReorder", "sack", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1943. rd_fack = rrddim_add(st_tcpreorders, "TCPFACKReorder", "fack", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1944. rd_reno = rrddim_add(st_tcpreorders, "TCPRenoReorder", "reno", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1945. }
  1946. rrddim_set_by_pointer(st_tcpreorders, rd_timestamp, tcpext_TCPTSReorder);
  1947. rrddim_set_by_pointer(st_tcpreorders, rd_sack, tcpext_TCPSACKReorder);
  1948. rrddim_set_by_pointer(st_tcpreorders, rd_fack, tcpext_TCPFACKReorder);
  1949. rrddim_set_by_pointer(st_tcpreorders, rd_reno, tcpext_TCPRenoReorder);
  1950. rrdset_done(st_tcpreorders);
  1951. }
  1952. // --------------------------------------------------------------------
  1953. if(do_tcpext_ofo == CONFIG_BOOLEAN_YES || (do_tcpext_ofo == CONFIG_BOOLEAN_AUTO &&
  1954. (tcpext_TCPOFOQueue ||
  1955. tcpext_TCPOFODrop ||
  1956. tcpext_TCPOFOMerge ||
  1957. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1958. do_tcpext_ofo = CONFIG_BOOLEAN_YES;
  1959. static RRDSET *st_ip_tcpofo = NULL;
  1960. static RRDDIM *rd_inqueue = NULL, *rd_dropped = NULL, *rd_merged = NULL, *rd_pruned = NULL;
  1961. if(unlikely(!st_ip_tcpofo)) {
  1962. st_ip_tcpofo = rrdset_create_localhost(
  1963. RRD_TYPE_NET_NETSTAT
  1964. , "tcpofo"
  1965. , NULL
  1966. , "tcp"
  1967. , NULL
  1968. , "TCP Out-Of-Order Queue"
  1969. , "packets/s"
  1970. , PLUGIN_PROC_NAME
  1971. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1972. , NETDATA_CHART_PRIO_IP_TCP_OFO
  1973. , update_every
  1974. , RRDSET_TYPE_LINE
  1975. );
  1976. rd_inqueue = rrddim_add(st_ip_tcpofo, "TCPOFOQueue", "inqueue", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1977. rd_dropped = rrddim_add(st_ip_tcpofo, "TCPOFODrop", "dropped", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1978. rd_merged = rrddim_add(st_ip_tcpofo, "TCPOFOMerge", "merged", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1979. rd_pruned = rrddim_add(st_ip_tcpofo, "OfoPruned", "pruned", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1980. }
  1981. rrddim_set_by_pointer(st_ip_tcpofo, rd_inqueue, tcpext_TCPOFOQueue);
  1982. rrddim_set_by_pointer(st_ip_tcpofo, rd_dropped, tcpext_TCPOFODrop);
  1983. rrddim_set_by_pointer(st_ip_tcpofo, rd_merged, tcpext_TCPOFOMerge);
  1984. rrddim_set_by_pointer(st_ip_tcpofo, rd_pruned, tcpext_OfoPruned);
  1985. rrdset_done(st_ip_tcpofo);
  1986. }
  1987. if(do_tcpext_syscookies == CONFIG_BOOLEAN_YES || (do_tcpext_syscookies == CONFIG_BOOLEAN_AUTO &&
  1988. (tcpext_SyncookiesSent ||
  1989. tcpext_SyncookiesRecv ||
  1990. tcpext_SyncookiesFailed ||
  1991. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1992. do_tcpext_syscookies = CONFIG_BOOLEAN_YES;
  1993. static RRDSET *st_syncookies = NULL;
  1994. static RRDDIM *rd_received = NULL, *rd_sent = NULL, *rd_failed = NULL;
  1995. if(unlikely(!st_syncookies)) {
  1996. st_syncookies = rrdset_create_localhost(
  1997. RRD_TYPE_NET_NETSTAT
  1998. , "tcpsyncookies"
  1999. , NULL
  2000. , "tcp"
  2001. , NULL
  2002. , "TCP SYN Cookies"
  2003. , "packets/s"
  2004. , PLUGIN_PROC_NAME
  2005. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2006. , NETDATA_CHART_PRIO_IP_TCP_SYNCOOKIES
  2007. , update_every
  2008. , RRDSET_TYPE_LINE
  2009. );
  2010. rd_received = rrddim_add(st_syncookies, "SyncookiesRecv", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2011. rd_sent = rrddim_add(st_syncookies, "SyncookiesSent", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2012. rd_failed = rrddim_add(st_syncookies, "SyncookiesFailed", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2013. }
  2014. rrddim_set_by_pointer(st_syncookies, rd_received, tcpext_SyncookiesRecv);
  2015. rrddim_set_by_pointer(st_syncookies, rd_sent, tcpext_SyncookiesSent);
  2016. rrddim_set_by_pointer(st_syncookies, rd_failed, tcpext_SyncookiesFailed);
  2017. rrdset_done(st_syncookies);
  2018. }
  2019. if(do_tcpext_syn_queue == CONFIG_BOOLEAN_YES || (do_tcpext_syn_queue == CONFIG_BOOLEAN_AUTO &&
  2020. (tcpext_TCPReqQFullDrop ||
  2021. tcpext_TCPReqQFullDoCookies ||
  2022. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2023. do_tcpext_syn_queue = CONFIG_BOOLEAN_YES;
  2024. static RRDSET *st_syn_queue = NULL;
  2025. static RRDDIM
  2026. *rd_TCPReqQFullDrop = NULL,
  2027. *rd_TCPReqQFullDoCookies = NULL;
  2028. if(unlikely(!st_syn_queue)) {
  2029. st_syn_queue = rrdset_create_localhost(
  2030. RRD_TYPE_NET_NETSTAT
  2031. , "tcp_syn_queue"
  2032. , NULL
  2033. , "tcp"
  2034. , NULL
  2035. , "TCP SYN Queue Issues"
  2036. , "packets/s"
  2037. , PLUGIN_PROC_NAME
  2038. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2039. , NETDATA_CHART_PRIO_IP_TCP_SYN_QUEUE
  2040. , update_every
  2041. , RRDSET_TYPE_LINE
  2042. );
  2043. rd_TCPReqQFullDrop = rrddim_add(st_syn_queue, "TCPReqQFullDrop", "drops", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2044. rd_TCPReqQFullDoCookies = rrddim_add(st_syn_queue, "TCPReqQFullDoCookies", "cookies", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2045. }
  2046. rrddim_set_by_pointer(st_syn_queue, rd_TCPReqQFullDrop, tcpext_TCPReqQFullDrop);
  2047. rrddim_set_by_pointer(st_syn_queue, rd_TCPReqQFullDoCookies, tcpext_TCPReqQFullDoCookies);
  2048. rrdset_done(st_syn_queue);
  2049. }
  2050. if(do_tcpext_accept_queue == CONFIG_BOOLEAN_YES || (do_tcpext_accept_queue == CONFIG_BOOLEAN_AUTO &&
  2051. (tcpext_ListenOverflows ||
  2052. tcpext_ListenDrops ||
  2053. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2054. do_tcpext_accept_queue = CONFIG_BOOLEAN_YES;
  2055. static RRDSET *st_accept_queue = NULL;
  2056. static RRDDIM *rd_overflows = NULL,
  2057. *rd_drops = NULL;
  2058. if(unlikely(!st_accept_queue)) {
  2059. st_accept_queue = rrdset_create_localhost(
  2060. RRD_TYPE_NET_NETSTAT
  2061. , "tcp_accept_queue"
  2062. , NULL
  2063. , "tcp"
  2064. , NULL
  2065. , "TCP Accept Queue Issues"
  2066. , "packets/s"
  2067. , PLUGIN_PROC_NAME
  2068. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2069. , NETDATA_CHART_PRIO_IP_TCP_ACCEPT_QUEUE
  2070. , update_every
  2071. , RRDSET_TYPE_LINE
  2072. );
  2073. rd_overflows = rrddim_add(st_accept_queue, "ListenOverflows", "overflows", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2074. rd_drops = rrddim_add(st_accept_queue, "ListenDrops", "drops", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2075. }
  2076. rrddim_set_by_pointer(st_accept_queue, rd_overflows, tcpext_ListenOverflows);
  2077. rrddim_set_by_pointer(st_accept_queue, rd_drops, tcpext_ListenDrops);
  2078. rrdset_done(st_accept_queue);
  2079. }
  2080. // snmp Ip charts
  2081. if(do_ip_packets == CONFIG_BOOLEAN_YES || (do_ip_packets == CONFIG_BOOLEAN_AUTO &&
  2082. (snmp_root.ip_OutRequests ||
  2083. snmp_root.ip_InReceives ||
  2084. snmp_root.ip_ForwDatagrams ||
  2085. snmp_root.ip_InDelivers ||
  2086. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2087. do_ip_packets = CONFIG_BOOLEAN_YES;
  2088. static RRDSET *st = NULL;
  2089. static RRDDIM *rd_InReceives = NULL,
  2090. *rd_OutRequests = NULL,
  2091. *rd_ForwDatagrams = NULL,
  2092. *rd_InDelivers = NULL;
  2093. if(unlikely(!st)) {
  2094. st = rrdset_create_localhost(
  2095. RRD_TYPE_NET_SNMP
  2096. , "packets"
  2097. , NULL
  2098. , "packets"
  2099. , NULL
  2100. , "IPv4 Packets"
  2101. , "packets/s"
  2102. , PLUGIN_PROC_NAME
  2103. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2104. , NETDATA_CHART_PRIO_IPV4_PACKETS
  2105. , update_every
  2106. , RRDSET_TYPE_LINE
  2107. );
  2108. rd_InReceives = rrddim_add(st, "InReceives", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2109. rd_OutRequests = rrddim_add(st, "OutRequests", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2110. rd_ForwDatagrams = rrddim_add(st, "ForwDatagrams", "forwarded", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2111. rd_InDelivers = rrddim_add(st, "InDelivers", "delivered", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2112. }
  2113. rrddim_set_by_pointer(st, rd_OutRequests, (collected_number)snmp_root.ip_OutRequests);
  2114. rrddim_set_by_pointer(st, rd_InReceives, (collected_number)snmp_root.ip_InReceives);
  2115. rrddim_set_by_pointer(st, rd_ForwDatagrams, (collected_number)snmp_root.ip_ForwDatagrams);
  2116. rrddim_set_by_pointer(st, rd_InDelivers, (collected_number)snmp_root.ip_InDelivers);
  2117. rrdset_done(st);
  2118. }
  2119. if(do_ip_fragsout == CONFIG_BOOLEAN_YES || (do_ip_fragsout == CONFIG_BOOLEAN_AUTO &&
  2120. (snmp_root.ip_FragOKs ||
  2121. snmp_root.ip_FragFails ||
  2122. snmp_root.ip_FragCreates ||
  2123. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2124. do_ip_fragsout = CONFIG_BOOLEAN_YES;
  2125. static RRDSET *st = NULL;
  2126. static RRDDIM *rd_FragOKs = NULL,
  2127. *rd_FragFails = NULL,
  2128. *rd_FragCreates = NULL;
  2129. if(unlikely(!st)) {
  2130. st = rrdset_create_localhost(
  2131. RRD_TYPE_NET_SNMP
  2132. , "fragsout"
  2133. , NULL
  2134. , "fragments"
  2135. , NULL
  2136. , "IPv4 Fragments Sent"
  2137. , "packets/s"
  2138. , PLUGIN_PROC_NAME
  2139. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2140. , NETDATA_CHART_PRIO_IPV4_FRAGMENTS
  2141. , update_every
  2142. , RRDSET_TYPE_LINE
  2143. );
  2144. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2145. rd_FragOKs = rrddim_add(st, "FragOKs", "ok", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2146. rd_FragFails = rrddim_add(st, "FragFails", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2147. rd_FragCreates = rrddim_add(st, "FragCreates", "created", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2148. }
  2149. rrddim_set_by_pointer(st, rd_FragOKs, (collected_number)snmp_root.ip_FragOKs);
  2150. rrddim_set_by_pointer(st, rd_FragFails, (collected_number)snmp_root.ip_FragFails);
  2151. rrddim_set_by_pointer(st, rd_FragCreates, (collected_number)snmp_root.ip_FragCreates);
  2152. rrdset_done(st);
  2153. }
  2154. if(do_ip_fragsin == CONFIG_BOOLEAN_YES || (do_ip_fragsin == CONFIG_BOOLEAN_AUTO &&
  2155. (snmp_root.ip_ReasmOKs ||
  2156. snmp_root.ip_ReasmFails ||
  2157. snmp_root.ip_ReasmReqds ||
  2158. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2159. do_ip_fragsin = CONFIG_BOOLEAN_YES;
  2160. static RRDSET *st = NULL;
  2161. static RRDDIM *rd_ReasmOKs = NULL,
  2162. *rd_ReasmFails = NULL,
  2163. *rd_ReasmReqds = NULL;
  2164. if(unlikely(!st)) {
  2165. st = rrdset_create_localhost(
  2166. RRD_TYPE_NET_SNMP
  2167. , "fragsin"
  2168. , NULL
  2169. , "fragments"
  2170. , NULL
  2171. , "IPv4 Fragments Reassembly"
  2172. , "packets/s"
  2173. , PLUGIN_PROC_NAME
  2174. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2175. , NETDATA_CHART_PRIO_IPV4_FRAGMENTS + 1
  2176. , update_every
  2177. , RRDSET_TYPE_LINE
  2178. );
  2179. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2180. rd_ReasmOKs = rrddim_add(st, "ReasmOKs", "ok", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2181. rd_ReasmFails = rrddim_add(st, "ReasmFails", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2182. rd_ReasmReqds = rrddim_add(st, "ReasmReqds", "all", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2183. }
  2184. rrddim_set_by_pointer(st, rd_ReasmOKs, (collected_number)snmp_root.ip_ReasmOKs);
  2185. rrddim_set_by_pointer(st, rd_ReasmFails, (collected_number)snmp_root.ip_ReasmFails);
  2186. rrddim_set_by_pointer(st, rd_ReasmReqds, (collected_number)snmp_root.ip_ReasmReqds);
  2187. rrdset_done(st);
  2188. }
  2189. if(do_ip_errors == CONFIG_BOOLEAN_YES || (do_ip_errors == CONFIG_BOOLEAN_AUTO &&
  2190. (snmp_root.ip_InDiscards ||
  2191. snmp_root.ip_OutDiscards ||
  2192. snmp_root.ip_InHdrErrors ||
  2193. snmp_root.ip_InAddrErrors ||
  2194. snmp_root.ip_InUnknownProtos ||
  2195. snmp_root.ip_OutNoRoutes ||
  2196. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2197. do_ip_errors = CONFIG_BOOLEAN_YES;
  2198. static RRDSET *st = NULL;
  2199. static RRDDIM *rd_InDiscards = NULL,
  2200. *rd_OutDiscards = NULL,
  2201. *rd_InHdrErrors = NULL,
  2202. *rd_OutNoRoutes = NULL,
  2203. *rd_InAddrErrors = NULL,
  2204. *rd_InUnknownProtos = NULL;
  2205. if(unlikely(!st)) {
  2206. st = rrdset_create_localhost(
  2207. RRD_TYPE_NET_SNMP
  2208. , "errors"
  2209. , NULL
  2210. , "errors"
  2211. , NULL
  2212. , "IPv4 Errors"
  2213. , "packets/s"
  2214. , PLUGIN_PROC_NAME
  2215. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2216. , NETDATA_CHART_PRIO_IPV4_ERRORS
  2217. , update_every
  2218. , RRDSET_TYPE_LINE
  2219. );
  2220. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2221. rd_InDiscards = rrddim_add(st, "InDiscards", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2222. rd_OutDiscards = rrddim_add(st, "OutDiscards", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2223. rd_InHdrErrors = rrddim_add(st, "InHdrErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2224. rd_OutNoRoutes = rrddim_add(st, "OutNoRoutes", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2225. rd_InAddrErrors = rrddim_add(st, "InAddrErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2226. rd_InUnknownProtos = rrddim_add(st, "InUnknownProtos", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2227. }
  2228. rrddim_set_by_pointer(st, rd_InDiscards, (collected_number)snmp_root.ip_InDiscards);
  2229. rrddim_set_by_pointer(st, rd_OutDiscards, (collected_number)snmp_root.ip_OutDiscards);
  2230. rrddim_set_by_pointer(st, rd_InHdrErrors, (collected_number)snmp_root.ip_InHdrErrors);
  2231. rrddim_set_by_pointer(st, rd_InAddrErrors, (collected_number)snmp_root.ip_InAddrErrors);
  2232. rrddim_set_by_pointer(st, rd_InUnknownProtos, (collected_number)snmp_root.ip_InUnknownProtos);
  2233. rrddim_set_by_pointer(st, rd_OutNoRoutes, (collected_number)snmp_root.ip_OutNoRoutes);
  2234. rrdset_done(st);
  2235. }
  2236. // snmp Icmp charts
  2237. if(do_icmp_packets == CONFIG_BOOLEAN_YES || (do_icmp_packets == CONFIG_BOOLEAN_AUTO &&
  2238. (snmp_root.icmp_InMsgs ||
  2239. snmp_root.icmp_OutMsgs ||
  2240. snmp_root.icmp_InErrors ||
  2241. snmp_root.icmp_OutErrors ||
  2242. snmp_root.icmp_InCsumErrors ||
  2243. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2244. do_icmp_packets = CONFIG_BOOLEAN_YES;
  2245. {
  2246. static RRDSET *st_packets = NULL;
  2247. static RRDDIM *rd_InMsgs = NULL,
  2248. *rd_OutMsgs = NULL;
  2249. if(unlikely(!st_packets)) {
  2250. st_packets = rrdset_create_localhost(
  2251. RRD_TYPE_NET_SNMP
  2252. , "icmp"
  2253. , NULL
  2254. , "icmp"
  2255. , NULL
  2256. , "IPv4 ICMP Packets"
  2257. , "packets/s"
  2258. , PLUGIN_PROC_NAME
  2259. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2260. , NETDATA_CHART_PRIO_IPV4_ICMP
  2261. , update_every
  2262. , RRDSET_TYPE_LINE
  2263. );
  2264. rd_InMsgs = rrddim_add(st_packets, "InMsgs", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2265. rd_OutMsgs = rrddim_add(st_packets, "OutMsgs", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2266. }
  2267. rrddim_set_by_pointer(st_packets, rd_InMsgs, (collected_number)snmp_root.icmp_InMsgs);
  2268. rrddim_set_by_pointer(st_packets, rd_OutMsgs, (collected_number)snmp_root.icmp_OutMsgs);
  2269. rrdset_done(st_packets);
  2270. }
  2271. {
  2272. static RRDSET *st_errors = NULL;
  2273. static RRDDIM *rd_InErrors = NULL,
  2274. *rd_OutErrors = NULL,
  2275. *rd_InCsumErrors = NULL;
  2276. if(unlikely(!st_errors)) {
  2277. st_errors = rrdset_create_localhost(
  2278. RRD_TYPE_NET_SNMP
  2279. , "icmp_errors"
  2280. , NULL
  2281. , "icmp"
  2282. , NULL
  2283. , "IPv4 ICMP Errors"
  2284. , "packets/s"
  2285. , PLUGIN_PROC_NAME
  2286. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2287. , NETDATA_CHART_PRIO_IPV4_ICMP + 1
  2288. , update_every
  2289. , RRDSET_TYPE_LINE
  2290. );
  2291. rd_InErrors = rrddim_add(st_errors, "InErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2292. rd_OutErrors = rrddim_add(st_errors, "OutErrors", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2293. rd_InCsumErrors = rrddim_add(st_errors, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2294. }
  2295. rrddim_set_by_pointer(st_errors, rd_InErrors, (collected_number)snmp_root.icmp_InErrors);
  2296. rrddim_set_by_pointer(st_errors, rd_OutErrors, (collected_number)snmp_root.icmp_OutErrors);
  2297. rrddim_set_by_pointer(st_errors, rd_InCsumErrors, (collected_number)snmp_root.icmp_InCsumErrors);
  2298. rrdset_done(st_errors);
  2299. }
  2300. }
  2301. // snmp IcmpMsg charts
  2302. if(do_icmpmsg == CONFIG_BOOLEAN_YES || (do_icmpmsg == CONFIG_BOOLEAN_AUTO &&
  2303. (snmp_root.icmpmsg_InEchoReps ||
  2304. snmp_root.icmpmsg_OutEchoReps ||
  2305. snmp_root.icmpmsg_InDestUnreachs ||
  2306. snmp_root.icmpmsg_OutDestUnreachs ||
  2307. snmp_root.icmpmsg_InRedirects ||
  2308. snmp_root.icmpmsg_OutRedirects ||
  2309. snmp_root.icmpmsg_InEchos ||
  2310. snmp_root.icmpmsg_OutEchos ||
  2311. snmp_root.icmpmsg_InRouterAdvert ||
  2312. snmp_root.icmpmsg_OutRouterAdvert ||
  2313. snmp_root.icmpmsg_InRouterSelect ||
  2314. snmp_root.icmpmsg_OutRouterSelect ||
  2315. snmp_root.icmpmsg_InTimeExcds ||
  2316. snmp_root.icmpmsg_OutTimeExcds ||
  2317. snmp_root.icmpmsg_InParmProbs ||
  2318. snmp_root.icmpmsg_OutParmProbs ||
  2319. snmp_root.icmpmsg_InTimestamps ||
  2320. snmp_root.icmpmsg_OutTimestamps ||
  2321. snmp_root.icmpmsg_InTimestampReps ||
  2322. snmp_root.icmpmsg_OutTimestampReps ||
  2323. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2324. do_icmpmsg = CONFIG_BOOLEAN_YES;
  2325. static RRDSET *st = NULL;
  2326. static RRDDIM *rd_InEchoReps = NULL,
  2327. *rd_OutEchoReps = NULL,
  2328. *rd_InDestUnreachs = NULL,
  2329. *rd_OutDestUnreachs = NULL,
  2330. *rd_InRedirects = NULL,
  2331. *rd_OutRedirects = NULL,
  2332. *rd_InEchos = NULL,
  2333. *rd_OutEchos = NULL,
  2334. *rd_InRouterAdvert = NULL,
  2335. *rd_OutRouterAdvert = NULL,
  2336. *rd_InRouterSelect = NULL,
  2337. *rd_OutRouterSelect = NULL,
  2338. *rd_InTimeExcds = NULL,
  2339. *rd_OutTimeExcds = NULL,
  2340. *rd_InParmProbs = NULL,
  2341. *rd_OutParmProbs = NULL,
  2342. *rd_InTimestamps = NULL,
  2343. *rd_OutTimestamps = NULL,
  2344. *rd_InTimestampReps = NULL,
  2345. *rd_OutTimestampReps = NULL;
  2346. if(unlikely(!st)) {
  2347. st = rrdset_create_localhost(
  2348. RRD_TYPE_NET_SNMP
  2349. , "icmpmsg"
  2350. , NULL
  2351. , "icmp"
  2352. , NULL
  2353. , "IPv4 ICMP Messages"
  2354. , "packets/s"
  2355. , PLUGIN_PROC_NAME
  2356. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2357. , NETDATA_CHART_PRIO_IPV4_ICMP + 2
  2358. , update_every
  2359. , RRDSET_TYPE_LINE
  2360. );
  2361. rd_InEchoReps = rrddim_add(st, "InType0", "InEchoReps", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2362. rd_OutEchoReps = rrddim_add(st, "OutType0", "OutEchoReps", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2363. rd_InDestUnreachs = rrddim_add(st, "InType3", "InDestUnreachs", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2364. rd_OutDestUnreachs = rrddim_add(st, "OutType3", "OutDestUnreachs", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2365. rd_InRedirects = rrddim_add(st, "InType5", "InRedirects", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2366. rd_OutRedirects = rrddim_add(st, "OutType5", "OutRedirects", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2367. rd_InEchos = rrddim_add(st, "InType8", "InEchos", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2368. rd_OutEchos = rrddim_add(st, "OutType8", "OutEchos", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2369. rd_InRouterAdvert = rrddim_add(st, "InType9", "InRouterAdvert", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2370. rd_OutRouterAdvert = rrddim_add(st, "OutType9", "OutRouterAdvert", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2371. rd_InRouterSelect = rrddim_add(st, "InType10", "InRouterSelect", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2372. rd_OutRouterSelect = rrddim_add(st, "OutType10", "OutRouterSelect", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2373. rd_InTimeExcds = rrddim_add(st, "InType11", "InTimeExcds", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2374. rd_OutTimeExcds = rrddim_add(st, "OutType11", "OutTimeExcds", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2375. rd_InParmProbs = rrddim_add(st, "InType12", "InParmProbs", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2376. rd_OutParmProbs = rrddim_add(st, "OutType12", "OutParmProbs", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2377. rd_InTimestamps = rrddim_add(st, "InType13", "InTimestamps", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2378. rd_OutTimestamps = rrddim_add(st, "OutType13", "OutTimestamps", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2379. rd_InTimestampReps = rrddim_add(st, "InType14", "InTimestampReps", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2380. rd_OutTimestampReps = rrddim_add(st, "OutType14", "OutTimestampReps", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2381. }
  2382. rrddim_set_by_pointer(st, rd_InEchoReps, (collected_number)snmp_root.icmpmsg_InEchoReps);
  2383. rrddim_set_by_pointer(st, rd_OutEchoReps, (collected_number)snmp_root.icmpmsg_OutEchoReps);
  2384. rrddim_set_by_pointer(st, rd_InDestUnreachs, (collected_number)snmp_root.icmpmsg_InDestUnreachs);
  2385. rrddim_set_by_pointer(st, rd_OutDestUnreachs, (collected_number)snmp_root.icmpmsg_OutDestUnreachs);
  2386. rrddim_set_by_pointer(st, rd_InRedirects, (collected_number)snmp_root.icmpmsg_InRedirects);
  2387. rrddim_set_by_pointer(st, rd_OutRedirects, (collected_number)snmp_root.icmpmsg_OutRedirects);
  2388. rrddim_set_by_pointer(st, rd_InEchos, (collected_number)snmp_root.icmpmsg_InEchos);
  2389. rrddim_set_by_pointer(st, rd_OutEchos, (collected_number)snmp_root.icmpmsg_OutEchos);
  2390. rrddim_set_by_pointer(st, rd_InRouterAdvert, (collected_number)snmp_root.icmpmsg_InRouterAdvert);
  2391. rrddim_set_by_pointer(st, rd_OutRouterAdvert, (collected_number)snmp_root.icmpmsg_OutRouterAdvert);
  2392. rrddim_set_by_pointer(st, rd_InRouterSelect, (collected_number)snmp_root.icmpmsg_InRouterSelect);
  2393. rrddim_set_by_pointer(st, rd_OutRouterSelect, (collected_number)snmp_root.icmpmsg_OutRouterSelect);
  2394. rrddim_set_by_pointer(st, rd_InTimeExcds, (collected_number)snmp_root.icmpmsg_InTimeExcds);
  2395. rrddim_set_by_pointer(st, rd_OutTimeExcds, (collected_number)snmp_root.icmpmsg_OutTimeExcds);
  2396. rrddim_set_by_pointer(st, rd_InParmProbs, (collected_number)snmp_root.icmpmsg_InParmProbs);
  2397. rrddim_set_by_pointer(st, rd_OutParmProbs, (collected_number)snmp_root.icmpmsg_OutParmProbs);
  2398. rrddim_set_by_pointer(st, rd_InTimestamps, (collected_number)snmp_root.icmpmsg_InTimestamps);
  2399. rrddim_set_by_pointer(st, rd_OutTimestamps, (collected_number)snmp_root.icmpmsg_OutTimestamps);
  2400. rrddim_set_by_pointer(st, rd_InTimestampReps, (collected_number)snmp_root.icmpmsg_InTimestampReps);
  2401. rrddim_set_by_pointer(st, rd_OutTimestampReps, (collected_number)snmp_root.icmpmsg_OutTimestampReps);
  2402. rrdset_done(st);
  2403. }
  2404. // snmp Tcp charts
  2405. // this is smart enough to update it, only when it is changed
  2406. rrdvar_custom_host_variable_set(localhost, tcp_max_connections_var, snmp_root.tcp_MaxConn);
  2407. // see http://net-snmp.sourceforge.net/docs/mibs/tcp.html
  2408. if(do_tcp_sockets == CONFIG_BOOLEAN_YES || (do_tcp_sockets == CONFIG_BOOLEAN_AUTO &&
  2409. (snmp_root.tcp_CurrEstab ||
  2410. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2411. do_tcp_sockets = CONFIG_BOOLEAN_YES;
  2412. static RRDSET *st = NULL;
  2413. static RRDDIM *rd_CurrEstab = NULL;
  2414. if(unlikely(!st)) {
  2415. st = rrdset_create_localhost(
  2416. RRD_TYPE_NET_SNMP
  2417. , "tcpsock"
  2418. , NULL
  2419. , "tcp"
  2420. , NULL
  2421. , "IPv4 TCP Connections"
  2422. , "active connections"
  2423. , PLUGIN_PROC_NAME
  2424. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2425. , NETDATA_CHART_PRIO_IPV4_TCP
  2426. , update_every
  2427. , RRDSET_TYPE_LINE
  2428. );
  2429. rd_CurrEstab = rrddim_add(st, "CurrEstab", "connections", 1, 1, RRD_ALGORITHM_ABSOLUTE);
  2430. }
  2431. rrddim_set_by_pointer(st, rd_CurrEstab, (collected_number)snmp_root.tcp_CurrEstab);
  2432. rrdset_done(st);
  2433. }
  2434. if(do_tcp_packets == CONFIG_BOOLEAN_YES || (do_tcp_packets == CONFIG_BOOLEAN_AUTO &&
  2435. (snmp_root.tcp_InSegs ||
  2436. snmp_root.tcp_OutSegs ||
  2437. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2438. do_tcp_packets = CONFIG_BOOLEAN_YES;
  2439. static RRDSET *st = NULL;
  2440. static RRDDIM *rd_InSegs = NULL,
  2441. *rd_OutSegs = NULL;
  2442. if(unlikely(!st)) {
  2443. st = rrdset_create_localhost(
  2444. RRD_TYPE_NET_SNMP
  2445. , "tcppackets"
  2446. , NULL
  2447. , "tcp"
  2448. , NULL
  2449. , "IPv4 TCP Packets"
  2450. , "packets/s"
  2451. , PLUGIN_PROC_NAME
  2452. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2453. , NETDATA_CHART_PRIO_IPV4_TCP + 4
  2454. , update_every
  2455. , RRDSET_TYPE_LINE
  2456. );
  2457. rd_InSegs = rrddim_add(st, "InSegs", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2458. rd_OutSegs = rrddim_add(st, "OutSegs", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2459. }
  2460. rrddim_set_by_pointer(st, rd_InSegs, (collected_number)snmp_root.tcp_InSegs);
  2461. rrddim_set_by_pointer(st, rd_OutSegs, (collected_number)snmp_root.tcp_OutSegs);
  2462. rrdset_done(st);
  2463. }
  2464. // --------------------------------------------------------------------
  2465. if(do_tcp_errors == CONFIG_BOOLEAN_YES || (do_tcp_errors == CONFIG_BOOLEAN_AUTO &&
  2466. (snmp_root.tcp_InErrs ||
  2467. snmp_root.tcp_InCsumErrors ||
  2468. snmp_root.tcp_RetransSegs ||
  2469. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2470. do_tcp_errors = CONFIG_BOOLEAN_YES;
  2471. static RRDSET *st = NULL;
  2472. static RRDDIM *rd_InErrs = NULL,
  2473. *rd_InCsumErrors = NULL,
  2474. *rd_RetransSegs = NULL;
  2475. if(unlikely(!st)) {
  2476. st = rrdset_create_localhost(
  2477. RRD_TYPE_NET_SNMP
  2478. , "tcperrors"
  2479. , NULL
  2480. , "tcp"
  2481. , NULL
  2482. , "IPv4 TCP Errors"
  2483. , "packets/s"
  2484. , PLUGIN_PROC_NAME
  2485. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2486. , NETDATA_CHART_PRIO_IPV4_TCP + 20
  2487. , update_every
  2488. , RRDSET_TYPE_LINE
  2489. );
  2490. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2491. rd_InErrs = rrddim_add(st, "InErrs", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2492. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2493. rd_RetransSegs = rrddim_add(st, "RetransSegs", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2494. }
  2495. rrddim_set_by_pointer(st, rd_InErrs, (collected_number)snmp_root.tcp_InErrs);
  2496. rrddim_set_by_pointer(st, rd_InCsumErrors, (collected_number)snmp_root.tcp_InCsumErrors);
  2497. rrddim_set_by_pointer(st, rd_RetransSegs, (collected_number)snmp_root.tcp_RetransSegs);
  2498. rrdset_done(st);
  2499. }
  2500. if(do_tcp_opens == CONFIG_BOOLEAN_YES || (do_tcp_opens == CONFIG_BOOLEAN_AUTO &&
  2501. (snmp_root.tcp_ActiveOpens ||
  2502. snmp_root.tcp_PassiveOpens ||
  2503. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2504. do_tcp_opens = CONFIG_BOOLEAN_YES;
  2505. static RRDSET *st = NULL;
  2506. static RRDDIM *rd_ActiveOpens = NULL,
  2507. *rd_PassiveOpens = NULL;
  2508. if(unlikely(!st)) {
  2509. st = rrdset_create_localhost(
  2510. RRD_TYPE_NET_SNMP
  2511. , "tcpopens"
  2512. , NULL
  2513. , "tcp"
  2514. , NULL
  2515. , "IPv4 TCP Opens"
  2516. , "connections/s"
  2517. , PLUGIN_PROC_NAME
  2518. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2519. , NETDATA_CHART_PRIO_IPV4_TCP + 5
  2520. , update_every
  2521. , RRDSET_TYPE_LINE
  2522. );
  2523. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2524. rd_ActiveOpens = rrddim_add(st, "ActiveOpens", "active", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2525. rd_PassiveOpens = rrddim_add(st, "PassiveOpens", "passive", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2526. }
  2527. rrddim_set_by_pointer(st, rd_ActiveOpens, (collected_number)snmp_root.tcp_ActiveOpens);
  2528. rrddim_set_by_pointer(st, rd_PassiveOpens, (collected_number)snmp_root.tcp_PassiveOpens);
  2529. rrdset_done(st);
  2530. }
  2531. if(do_tcp_handshake == CONFIG_BOOLEAN_YES || (do_tcp_handshake == CONFIG_BOOLEAN_AUTO &&
  2532. (snmp_root.tcp_EstabResets ||
  2533. snmp_root.tcp_OutRsts ||
  2534. snmp_root.tcp_AttemptFails ||
  2535. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2536. do_tcp_handshake = CONFIG_BOOLEAN_YES;
  2537. static RRDSET *st = NULL;
  2538. static RRDDIM *rd_EstabResets = NULL,
  2539. *rd_OutRsts = NULL,
  2540. *rd_AttemptFails = NULL,
  2541. *rd_TCPSynRetrans = NULL;
  2542. if(unlikely(!st)) {
  2543. st = rrdset_create_localhost(
  2544. RRD_TYPE_NET_SNMP
  2545. , "tcphandshake"
  2546. , NULL
  2547. , "tcp"
  2548. , NULL
  2549. , "IPv4 TCP Handshake Issues"
  2550. , "events/s"
  2551. , PLUGIN_PROC_NAME
  2552. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2553. , NETDATA_CHART_PRIO_IPV4_TCP + 30
  2554. , update_every
  2555. , RRDSET_TYPE_LINE
  2556. );
  2557. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2558. rd_EstabResets = rrddim_add(st, "EstabResets", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2559. rd_OutRsts = rrddim_add(st, "OutRsts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2560. rd_AttemptFails = rrddim_add(st, "AttemptFails", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2561. rd_TCPSynRetrans = rrddim_add(st, "TCPSynRetrans", "SynRetrans", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2562. }
  2563. rrddim_set_by_pointer(st, rd_EstabResets, (collected_number)snmp_root.tcp_EstabResets);
  2564. rrddim_set_by_pointer(st, rd_OutRsts, (collected_number)snmp_root.tcp_OutRsts);
  2565. rrddim_set_by_pointer(st, rd_AttemptFails, (collected_number)snmp_root.tcp_AttemptFails);
  2566. rrddim_set_by_pointer(st, rd_TCPSynRetrans, tcpext_TCPSynRetrans);
  2567. rrdset_done(st);
  2568. }
  2569. // snmp Udp charts
  2570. // see http://net-snmp.sourceforge.net/docs/mibs/udp.html
  2571. if(do_udp_packets == CONFIG_BOOLEAN_YES || (do_udp_packets == CONFIG_BOOLEAN_AUTO &&
  2572. (snmp_root.udp_InDatagrams ||
  2573. snmp_root.udp_OutDatagrams ||
  2574. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2575. do_udp_packets = CONFIG_BOOLEAN_YES;
  2576. static RRDSET *st = NULL;
  2577. static RRDDIM *rd_InDatagrams = NULL,
  2578. *rd_OutDatagrams = NULL;
  2579. if(unlikely(!st)) {
  2580. st = rrdset_create_localhost(
  2581. RRD_TYPE_NET_SNMP
  2582. , "udppackets"
  2583. , NULL
  2584. , "udp"
  2585. , NULL
  2586. , "IPv4 UDP Packets"
  2587. , "packets/s"
  2588. , PLUGIN_PROC_NAME
  2589. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2590. , NETDATA_CHART_PRIO_IPV4_UDP
  2591. , update_every
  2592. , RRDSET_TYPE_LINE
  2593. );
  2594. rd_InDatagrams = rrddim_add(st, "InDatagrams", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2595. rd_OutDatagrams = rrddim_add(st, "OutDatagrams", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2596. }
  2597. rrddim_set_by_pointer(st, rd_InDatagrams, (collected_number)snmp_root.udp_InDatagrams);
  2598. rrddim_set_by_pointer(st, rd_OutDatagrams, (collected_number)snmp_root.udp_OutDatagrams);
  2599. rrdset_done(st);
  2600. }
  2601. // --------------------------------------------------------------------
  2602. if(do_udp_errors == CONFIG_BOOLEAN_YES || (do_udp_errors == CONFIG_BOOLEAN_AUTO &&
  2603. (snmp_root.udp_InErrors ||
  2604. snmp_root.udp_NoPorts ||
  2605. snmp_root.udp_RcvbufErrors ||
  2606. snmp_root.udp_SndbufErrors ||
  2607. snmp_root.udp_InCsumErrors ||
  2608. snmp_root.udp_IgnoredMulti ||
  2609. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2610. do_udp_errors = CONFIG_BOOLEAN_YES;
  2611. static RRDSET *st = NULL;
  2612. static RRDDIM *rd_RcvbufErrors = NULL,
  2613. *rd_SndbufErrors = NULL,
  2614. *rd_InErrors = NULL,
  2615. *rd_NoPorts = NULL,
  2616. *rd_InCsumErrors = NULL,
  2617. *rd_IgnoredMulti = NULL;
  2618. if(unlikely(!st)) {
  2619. st = rrdset_create_localhost(
  2620. RRD_TYPE_NET_SNMP
  2621. , "udperrors"
  2622. , NULL
  2623. , "udp"
  2624. , NULL
  2625. , "IPv4 UDP Errors"
  2626. , "events/s"
  2627. , PLUGIN_PROC_NAME
  2628. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2629. , NETDATA_CHART_PRIO_IPV4_UDP + 10
  2630. , update_every
  2631. , RRDSET_TYPE_LINE
  2632. );
  2633. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2634. rd_RcvbufErrors = rrddim_add(st, "RcvbufErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2635. rd_SndbufErrors = rrddim_add(st, "SndbufErrors", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2636. rd_InErrors = rrddim_add(st, "InErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2637. rd_NoPorts = rrddim_add(st, "NoPorts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2638. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2639. rd_IgnoredMulti = rrddim_add(st, "IgnoredMulti", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2640. }
  2641. rrddim_set_by_pointer(st, rd_InErrors, (collected_number)snmp_root.udp_InErrors);
  2642. rrddim_set_by_pointer(st, rd_NoPorts, (collected_number)snmp_root.udp_NoPorts);
  2643. rrddim_set_by_pointer(st, rd_RcvbufErrors, (collected_number)snmp_root.udp_RcvbufErrors);
  2644. rrddim_set_by_pointer(st, rd_SndbufErrors, (collected_number)snmp_root.udp_SndbufErrors);
  2645. rrddim_set_by_pointer(st, rd_InCsumErrors, (collected_number)snmp_root.udp_InCsumErrors);
  2646. rrddim_set_by_pointer(st, rd_IgnoredMulti, (collected_number)snmp_root.udp_IgnoredMulti);
  2647. rrdset_done(st);
  2648. }
  2649. // snmp UdpLite charts
  2650. if(do_udplite_packets == CONFIG_BOOLEAN_YES || (do_udplite_packets == CONFIG_BOOLEAN_AUTO &&
  2651. (snmp_root.udplite_InDatagrams ||
  2652. snmp_root.udplite_OutDatagrams ||
  2653. snmp_root.udplite_NoPorts ||
  2654. snmp_root.udplite_InErrors ||
  2655. snmp_root.udplite_InCsumErrors ||
  2656. snmp_root.udplite_RcvbufErrors ||
  2657. snmp_root.udplite_SndbufErrors ||
  2658. snmp_root.udplite_IgnoredMulti ||
  2659. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2660. do_udplite_packets = CONFIG_BOOLEAN_YES;
  2661. {
  2662. static RRDSET *st = NULL;
  2663. static RRDDIM *rd_InDatagrams = NULL,
  2664. *rd_OutDatagrams = NULL;
  2665. if(unlikely(!st)) {
  2666. st = rrdset_create_localhost(
  2667. RRD_TYPE_NET_SNMP
  2668. , "udplite"
  2669. , NULL
  2670. , "udplite"
  2671. , NULL
  2672. , "IPv4 UDPLite Packets"
  2673. , "packets/s"
  2674. , PLUGIN_PROC_NAME
  2675. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2676. , NETDATA_CHART_PRIO_IPV4_UDPLITE
  2677. , update_every
  2678. , RRDSET_TYPE_LINE
  2679. );
  2680. rd_InDatagrams = rrddim_add(st, "InDatagrams", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2681. rd_OutDatagrams = rrddim_add(st, "OutDatagrams", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2682. }
  2683. rrddim_set_by_pointer(st, rd_InDatagrams, (collected_number)snmp_root.udplite_InDatagrams);
  2684. rrddim_set_by_pointer(st, rd_OutDatagrams, (collected_number)snmp_root.udplite_OutDatagrams);
  2685. rrdset_done(st);
  2686. }
  2687. {
  2688. static RRDSET *st = NULL;
  2689. static RRDDIM *rd_RcvbufErrors = NULL,
  2690. *rd_SndbufErrors = NULL,
  2691. *rd_InErrors = NULL,
  2692. *rd_NoPorts = NULL,
  2693. *rd_InCsumErrors = NULL,
  2694. *rd_IgnoredMulti = NULL;
  2695. if(unlikely(!st)) {
  2696. st = rrdset_create_localhost(
  2697. RRD_TYPE_NET_SNMP
  2698. , "udplite_errors"
  2699. , NULL
  2700. , "udplite"
  2701. , NULL
  2702. , "IPv4 UDPLite Errors"
  2703. , "packets/s"
  2704. , PLUGIN_PROC_NAME
  2705. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2706. , NETDATA_CHART_PRIO_IPV4_UDPLITE + 10
  2707. , update_every
  2708. , RRDSET_TYPE_LINE);
  2709. rd_RcvbufErrors = rrddim_add(st, "RcvbufErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2710. rd_SndbufErrors = rrddim_add(st, "SndbufErrors", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2711. rd_InErrors = rrddim_add(st, "InErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2712. rd_NoPorts = rrddim_add(st, "NoPorts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2713. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2714. rd_IgnoredMulti = rrddim_add(st, "IgnoredMulti", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2715. }
  2716. rrddim_set_by_pointer(st, rd_NoPorts, (collected_number)snmp_root.udplite_NoPorts);
  2717. rrddim_set_by_pointer(st, rd_InErrors, (collected_number)snmp_root.udplite_InErrors);
  2718. rrddim_set_by_pointer(st, rd_InCsumErrors, (collected_number)snmp_root.udplite_InCsumErrors);
  2719. rrddim_set_by_pointer(st, rd_RcvbufErrors, (collected_number)snmp_root.udplite_RcvbufErrors);
  2720. rrddim_set_by_pointer(st, rd_SndbufErrors, (collected_number)snmp_root.udplite_SndbufErrors);
  2721. rrddim_set_by_pointer(st, rd_IgnoredMulti, (collected_number)snmp_root.udplite_IgnoredMulti);
  2722. rrdset_done(st);
  2723. }
  2724. }
  2725. do_proc_net_snmp6(update_every);
  2726. return 0;
  2727. }