proc_net_netstat.c 151 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #include "plugin_proc.h"
  3. #define RRD_TYPE_NET_IP "ip"
  4. #define RRD_TYPE_NET_IP4 "ipv4"
  5. #define RRD_TYPE_NET_IP6 "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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6
  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_IP6,
  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. , "ip" // FIXME: this is ipv4. Not changing it because it will require to do changes in cloud-frontend too
  1641. , NULL
  1642. , "network"
  1643. , NULL
  1644. , "IPv4 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_mcast == CONFIG_BOOLEAN_YES || (do_mcast == CONFIG_BOOLEAN_AUTO &&
  1660. (ipext_InMcastOctets ||
  1661. ipext_OutMcastOctets ||
  1662. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1663. do_mcast = CONFIG_BOOLEAN_YES;
  1664. static RRDSET *st_ip_mcast = NULL;
  1665. static RRDDIM *rd_in = NULL, *rd_out = NULL;
  1666. if(unlikely(!st_ip_mcast)) {
  1667. st_ip_mcast = rrdset_create_localhost(
  1668. RRD_TYPE_NET_IP4
  1669. , "mcast"
  1670. , NULL
  1671. , "multicast"
  1672. , NULL
  1673. , "IP Multicast Bandwidth"
  1674. , "kilobits/s"
  1675. , PLUGIN_PROC_NAME
  1676. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1677. , NETDATA_CHART_PRIO_IPV4_MCAST
  1678. , update_every
  1679. , RRDSET_TYPE_AREA
  1680. );
  1681. rrdset_flag_set(st_ip_mcast, RRDSET_FLAG_DETAIL);
  1682. rd_in = rrddim_add(st_ip_mcast, "InMcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1683. rd_out = rrddim_add(st_ip_mcast, "OutMcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1684. }
  1685. rrddim_set_by_pointer(st_ip_mcast, rd_in, ipext_InMcastOctets);
  1686. rrddim_set_by_pointer(st_ip_mcast, rd_out, ipext_OutMcastOctets);
  1687. rrdset_done(st_ip_mcast);
  1688. }
  1689. // --------------------------------------------------------------------
  1690. if(do_bcast == CONFIG_BOOLEAN_YES || (do_bcast == CONFIG_BOOLEAN_AUTO &&
  1691. (ipext_InBcastOctets ||
  1692. ipext_OutBcastOctets ||
  1693. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1694. do_bcast = CONFIG_BOOLEAN_YES;
  1695. static RRDSET *st_ip_bcast = NULL;
  1696. static RRDDIM *rd_in = NULL, *rd_out = NULL;
  1697. if(unlikely(!st_ip_bcast)) {
  1698. st_ip_bcast = rrdset_create_localhost(
  1699. RRD_TYPE_NET_IP4
  1700. , "bcast"
  1701. , NULL
  1702. , "broadcast"
  1703. , NULL
  1704. , "IPv4 Broadcast Bandwidth"
  1705. , "kilobits/s"
  1706. , PLUGIN_PROC_NAME
  1707. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1708. , NETDATA_CHART_PRIO_IPV4_BCAST
  1709. , update_every
  1710. , RRDSET_TYPE_AREA
  1711. );
  1712. rrdset_flag_set(st_ip_bcast, RRDSET_FLAG_DETAIL);
  1713. rd_in = rrddim_add(st_ip_bcast, "InBcastOctets", "received", 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1714. rd_out = rrddim_add(st_ip_bcast, "OutBcastOctets", "sent", -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
  1715. }
  1716. rrddim_set_by_pointer(st_ip_bcast, rd_in, ipext_InBcastOctets);
  1717. rrddim_set_by_pointer(st_ip_bcast, rd_out, ipext_OutBcastOctets);
  1718. rrdset_done(st_ip_bcast);
  1719. }
  1720. // --------------------------------------------------------------------
  1721. if(do_mcast_p == CONFIG_BOOLEAN_YES || (do_mcast_p == CONFIG_BOOLEAN_AUTO &&
  1722. (ipext_InMcastPkts ||
  1723. ipext_OutMcastPkts ||
  1724. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1725. do_mcast_p = CONFIG_BOOLEAN_YES;
  1726. static RRDSET *st_ip_mcastpkts = NULL;
  1727. static RRDDIM *rd_in = NULL, *rd_out = NULL;
  1728. if(unlikely(!st_ip_mcastpkts)) {
  1729. st_ip_mcastpkts = rrdset_create_localhost(
  1730. RRD_TYPE_NET_IP4
  1731. , "mcastpkts"
  1732. , NULL
  1733. , "multicast"
  1734. , NULL
  1735. , "IPv4 Multicast Packets"
  1736. , "packets/s"
  1737. , PLUGIN_PROC_NAME
  1738. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1739. , NETDATA_CHART_PRIO_IPV4_MCAST_PACKETS
  1740. , update_every
  1741. , RRDSET_TYPE_LINE
  1742. );
  1743. rrdset_flag_set(st_ip_mcastpkts, RRDSET_FLAG_DETAIL);
  1744. rd_in = rrddim_add(st_ip_mcastpkts, "InMcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1745. rd_out = rrddim_add(st_ip_mcastpkts, "OutMcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1746. }
  1747. rrddim_set_by_pointer(st_ip_mcastpkts, rd_in, ipext_InMcastPkts);
  1748. rrddim_set_by_pointer(st_ip_mcastpkts, rd_out, ipext_OutMcastPkts);
  1749. rrdset_done(st_ip_mcastpkts);
  1750. }
  1751. if(do_bcast_p == CONFIG_BOOLEAN_YES || (do_bcast_p == CONFIG_BOOLEAN_AUTO &&
  1752. (ipext_InBcastPkts ||
  1753. ipext_OutBcastPkts ||
  1754. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1755. do_bcast_p = CONFIG_BOOLEAN_YES;
  1756. static RRDSET *st_ip_bcastpkts = NULL;
  1757. static RRDDIM *rd_in = NULL, *rd_out = NULL;
  1758. if(unlikely(!st_ip_bcastpkts)) {
  1759. st_ip_bcastpkts = rrdset_create_localhost(
  1760. RRD_TYPE_NET_IP4
  1761. , "bcastpkts"
  1762. , NULL
  1763. , "broadcast"
  1764. , NULL
  1765. , "IPv4 Broadcast Packets"
  1766. , "packets/s"
  1767. , PLUGIN_PROC_NAME
  1768. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1769. , NETDATA_CHART_PRIO_IPV4_BCAST_PACKETS
  1770. , update_every
  1771. , RRDSET_TYPE_LINE
  1772. );
  1773. rrdset_flag_set(st_ip_bcastpkts, RRDSET_FLAG_DETAIL);
  1774. rd_in = rrddim_add(st_ip_bcastpkts, "InBcastPkts", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1775. rd_out = rrddim_add(st_ip_bcastpkts, "OutBcastPkts", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1776. }
  1777. rrddim_set_by_pointer(st_ip_bcastpkts, rd_in, ipext_InBcastPkts);
  1778. rrddim_set_by_pointer(st_ip_bcastpkts, rd_out, ipext_OutBcastPkts);
  1779. rrdset_done(st_ip_bcastpkts);
  1780. }
  1781. if(do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO &&
  1782. (ipext_InCEPkts ||
  1783. ipext_InECT0Pkts ||
  1784. ipext_InECT1Pkts ||
  1785. ipext_InNoECTPkts ||
  1786. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1787. do_ecn = CONFIG_BOOLEAN_YES;
  1788. static RRDSET *st_ecnpkts = NULL;
  1789. static RRDDIM *rd_cep = NULL, *rd_noectp = NULL, *rd_ectp0 = NULL, *rd_ectp1 = NULL;
  1790. if(unlikely(!st_ecnpkts)) {
  1791. st_ecnpkts = rrdset_create_localhost(
  1792. RRD_TYPE_NET_IP4
  1793. , "ecnpkts"
  1794. , NULL
  1795. , "ecn"
  1796. , NULL
  1797. , "IPv4 ECN Statistics"
  1798. , "packets/s"
  1799. , PLUGIN_PROC_NAME
  1800. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1801. , NETDATA_CHART_PRIO_IPV4_ECN
  1802. , update_every
  1803. , RRDSET_TYPE_LINE
  1804. );
  1805. rrdset_flag_set(st_ecnpkts, RRDSET_FLAG_DETAIL);
  1806. rd_cep = rrddim_add(st_ecnpkts, "InCEPkts", "CEP", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1807. rd_noectp = rrddim_add(st_ecnpkts, "InNoECTPkts", "NoECTP", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1808. rd_ectp0 = rrddim_add(st_ecnpkts, "InECT0Pkts", "ECTP0", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1809. rd_ectp1 = rrddim_add(st_ecnpkts, "InECT1Pkts", "ECTP1", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1810. }
  1811. rrddim_set_by_pointer(st_ecnpkts, rd_cep, ipext_InCEPkts);
  1812. rrddim_set_by_pointer(st_ecnpkts, rd_noectp, ipext_InNoECTPkts);
  1813. rrddim_set_by_pointer(st_ecnpkts, rd_ectp0, ipext_InECT0Pkts);
  1814. rrddim_set_by_pointer(st_ecnpkts, rd_ectp1, ipext_InECT1Pkts);
  1815. rrdset_done(st_ecnpkts);
  1816. }
  1817. // netstat TcpExt charts
  1818. if(do_tcpext_memory == CONFIG_BOOLEAN_YES || (do_tcpext_memory == CONFIG_BOOLEAN_AUTO &&
  1819. (tcpext_TCPMemoryPressures ||
  1820. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1821. do_tcpext_memory = CONFIG_BOOLEAN_YES;
  1822. static RRDSET *st_tcpmemorypressures = NULL;
  1823. static RRDDIM *rd_pressures = NULL;
  1824. if(unlikely(!st_tcpmemorypressures)) {
  1825. st_tcpmemorypressures = rrdset_create_localhost(
  1826. RRD_TYPE_NET_IP
  1827. , "tcpmemorypressures"
  1828. , NULL
  1829. , "tcp"
  1830. , NULL
  1831. , "TCP Memory Pressures"
  1832. , "events/s"
  1833. , PLUGIN_PROC_NAME
  1834. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1835. , NETDATA_CHART_PRIO_IP_TCP_MEM_PRESSURE
  1836. , update_every
  1837. , RRDSET_TYPE_LINE
  1838. );
  1839. rd_pressures = rrddim_add(st_tcpmemorypressures, "TCPMemoryPressures", "pressures", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1840. }
  1841. rrddim_set_by_pointer(st_tcpmemorypressures, rd_pressures, tcpext_TCPMemoryPressures);
  1842. rrdset_done(st_tcpmemorypressures);
  1843. }
  1844. if(do_tcpext_connaborts == CONFIG_BOOLEAN_YES || (do_tcpext_connaborts == CONFIG_BOOLEAN_AUTO &&
  1845. (tcpext_TCPAbortOnData ||
  1846. tcpext_TCPAbortOnClose ||
  1847. tcpext_TCPAbortOnMemory ||
  1848. tcpext_TCPAbortOnTimeout ||
  1849. tcpext_TCPAbortOnLinger ||
  1850. tcpext_TCPAbortFailed ||
  1851. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1852. do_tcpext_connaborts = CONFIG_BOOLEAN_YES;
  1853. static RRDSET *st_tcpconnaborts = NULL;
  1854. static RRDDIM *rd_baddata = NULL, *rd_userclosed = NULL, *rd_nomemory = NULL, *rd_timeout = NULL, *rd_linger = NULL, *rd_failed = NULL;
  1855. if(unlikely(!st_tcpconnaborts)) {
  1856. st_tcpconnaborts = rrdset_create_localhost(
  1857. RRD_TYPE_NET_IP
  1858. , "tcpconnaborts"
  1859. , NULL
  1860. , "tcp"
  1861. , NULL
  1862. , "TCP Connection Aborts"
  1863. , "connections/s"
  1864. , PLUGIN_PROC_NAME
  1865. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1866. , NETDATA_CHART_PRIO_IP_TCP_CONNABORTS
  1867. , update_every
  1868. , RRDSET_TYPE_LINE
  1869. );
  1870. rd_baddata = rrddim_add(st_tcpconnaborts, "TCPAbortOnData", "baddata", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1871. rd_userclosed = rrddim_add(st_tcpconnaborts, "TCPAbortOnClose", "userclosed", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1872. rd_nomemory = rrddim_add(st_tcpconnaborts, "TCPAbortOnMemory", "nomemory", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1873. rd_timeout = rrddim_add(st_tcpconnaborts, "TCPAbortOnTimeout", "timeout", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1874. rd_linger = rrddim_add(st_tcpconnaborts, "TCPAbortOnLinger", "linger", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1875. rd_failed = rrddim_add(st_tcpconnaborts, "TCPAbortFailed", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1876. }
  1877. rrddim_set_by_pointer(st_tcpconnaborts, rd_baddata, tcpext_TCPAbortOnData);
  1878. rrddim_set_by_pointer(st_tcpconnaborts, rd_userclosed, tcpext_TCPAbortOnClose);
  1879. rrddim_set_by_pointer(st_tcpconnaborts, rd_nomemory, tcpext_TCPAbortOnMemory);
  1880. rrddim_set_by_pointer(st_tcpconnaborts, rd_timeout, tcpext_TCPAbortOnTimeout);
  1881. rrddim_set_by_pointer(st_tcpconnaborts, rd_linger, tcpext_TCPAbortOnLinger);
  1882. rrddim_set_by_pointer(st_tcpconnaborts, rd_failed, tcpext_TCPAbortFailed);
  1883. rrdset_done(st_tcpconnaborts);
  1884. }
  1885. if(do_tcpext_reorder == CONFIG_BOOLEAN_YES || (do_tcpext_reorder == CONFIG_BOOLEAN_AUTO &&
  1886. (tcpext_TCPRenoReorder ||
  1887. tcpext_TCPFACKReorder ||
  1888. tcpext_TCPSACKReorder ||
  1889. tcpext_TCPTSReorder ||
  1890. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1891. do_tcpext_reorder = CONFIG_BOOLEAN_YES;
  1892. static RRDSET *st_tcpreorders = NULL;
  1893. static RRDDIM *rd_timestamp = NULL, *rd_sack = NULL, *rd_fack = NULL, *rd_reno = NULL;
  1894. if(unlikely(!st_tcpreorders)) {
  1895. st_tcpreorders = rrdset_create_localhost(
  1896. RRD_TYPE_NET_IP
  1897. , "tcpreorders"
  1898. , NULL
  1899. , "tcp"
  1900. , NULL
  1901. , "TCP Reordered Packets by Detection Method"
  1902. , "packets/s"
  1903. , PLUGIN_PROC_NAME
  1904. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1905. , NETDATA_CHART_PRIO_IP_TCP_REORDERS
  1906. , update_every
  1907. , RRDSET_TYPE_LINE
  1908. );
  1909. rd_timestamp = rrddim_add(st_tcpreorders, "TCPTSReorder", "timestamp", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1910. rd_sack = rrddim_add(st_tcpreorders, "TCPSACKReorder", "sack", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1911. rd_fack = rrddim_add(st_tcpreorders, "TCPFACKReorder", "fack", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1912. rd_reno = rrddim_add(st_tcpreorders, "TCPRenoReorder", "reno", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1913. }
  1914. rrddim_set_by_pointer(st_tcpreorders, rd_timestamp, tcpext_TCPTSReorder);
  1915. rrddim_set_by_pointer(st_tcpreorders, rd_sack, tcpext_TCPSACKReorder);
  1916. rrddim_set_by_pointer(st_tcpreorders, rd_fack, tcpext_TCPFACKReorder);
  1917. rrddim_set_by_pointer(st_tcpreorders, rd_reno, tcpext_TCPRenoReorder);
  1918. rrdset_done(st_tcpreorders);
  1919. }
  1920. // --------------------------------------------------------------------
  1921. if(do_tcpext_ofo == CONFIG_BOOLEAN_YES || (do_tcpext_ofo == CONFIG_BOOLEAN_AUTO &&
  1922. (tcpext_TCPOFOQueue ||
  1923. tcpext_TCPOFODrop ||
  1924. tcpext_TCPOFOMerge ||
  1925. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1926. do_tcpext_ofo = CONFIG_BOOLEAN_YES;
  1927. static RRDSET *st_ip_tcpofo = NULL;
  1928. static RRDDIM *rd_inqueue = NULL, *rd_dropped = NULL, *rd_merged = NULL, *rd_pruned = NULL;
  1929. if(unlikely(!st_ip_tcpofo)) {
  1930. st_ip_tcpofo = rrdset_create_localhost(
  1931. RRD_TYPE_NET_IP
  1932. , "tcpofo"
  1933. , NULL
  1934. , "tcp"
  1935. , NULL
  1936. , "TCP Out-Of-Order Queue"
  1937. , "packets/s"
  1938. , PLUGIN_PROC_NAME
  1939. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1940. , NETDATA_CHART_PRIO_IP_TCP_OFO
  1941. , update_every
  1942. , RRDSET_TYPE_LINE
  1943. );
  1944. rd_inqueue = rrddim_add(st_ip_tcpofo, "TCPOFOQueue", "inqueue", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1945. rd_dropped = rrddim_add(st_ip_tcpofo, "TCPOFODrop", "dropped", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1946. rd_merged = rrddim_add(st_ip_tcpofo, "TCPOFOMerge", "merged", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1947. rd_pruned = rrddim_add(st_ip_tcpofo, "OfoPruned", "pruned", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1948. }
  1949. rrddim_set_by_pointer(st_ip_tcpofo, rd_inqueue, tcpext_TCPOFOQueue);
  1950. rrddim_set_by_pointer(st_ip_tcpofo, rd_dropped, tcpext_TCPOFODrop);
  1951. rrddim_set_by_pointer(st_ip_tcpofo, rd_merged, tcpext_TCPOFOMerge);
  1952. rrddim_set_by_pointer(st_ip_tcpofo, rd_pruned, tcpext_OfoPruned);
  1953. rrdset_done(st_ip_tcpofo);
  1954. }
  1955. if(do_tcpext_syscookies == CONFIG_BOOLEAN_YES || (do_tcpext_syscookies == CONFIG_BOOLEAN_AUTO &&
  1956. (tcpext_SyncookiesSent ||
  1957. tcpext_SyncookiesRecv ||
  1958. tcpext_SyncookiesFailed ||
  1959. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1960. do_tcpext_syscookies = CONFIG_BOOLEAN_YES;
  1961. static RRDSET *st_syncookies = NULL;
  1962. static RRDDIM *rd_received = NULL, *rd_sent = NULL, *rd_failed = NULL;
  1963. if(unlikely(!st_syncookies)) {
  1964. st_syncookies = rrdset_create_localhost(
  1965. RRD_TYPE_NET_IP
  1966. , "tcpsyncookies"
  1967. , NULL
  1968. , "tcp"
  1969. , NULL
  1970. , "TCP SYN Cookies"
  1971. , "packets/s"
  1972. , PLUGIN_PROC_NAME
  1973. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  1974. , NETDATA_CHART_PRIO_IP_TCP_SYNCOOKIES
  1975. , update_every
  1976. , RRDSET_TYPE_LINE
  1977. );
  1978. rd_received = rrddim_add(st_syncookies, "SyncookiesRecv", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  1979. rd_sent = rrddim_add(st_syncookies, "SyncookiesSent", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1980. rd_failed = rrddim_add(st_syncookies, "SyncookiesFailed", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  1981. }
  1982. rrddim_set_by_pointer(st_syncookies, rd_received, tcpext_SyncookiesRecv);
  1983. rrddim_set_by_pointer(st_syncookies, rd_sent, tcpext_SyncookiesSent);
  1984. rrddim_set_by_pointer(st_syncookies, rd_failed, tcpext_SyncookiesFailed);
  1985. rrdset_done(st_syncookies);
  1986. }
  1987. if(do_tcpext_syn_queue == CONFIG_BOOLEAN_YES || (do_tcpext_syn_queue == CONFIG_BOOLEAN_AUTO &&
  1988. (tcpext_TCPReqQFullDrop ||
  1989. tcpext_TCPReqQFullDoCookies ||
  1990. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  1991. do_tcpext_syn_queue = CONFIG_BOOLEAN_YES;
  1992. static RRDSET *st_syn_queue = NULL;
  1993. static RRDDIM
  1994. *rd_TCPReqQFullDrop = NULL,
  1995. *rd_TCPReqQFullDoCookies = NULL;
  1996. if(unlikely(!st_syn_queue)) {
  1997. st_syn_queue = rrdset_create_localhost(
  1998. RRD_TYPE_NET_IP
  1999. , "tcp_syn_queue"
  2000. , NULL
  2001. , "tcp"
  2002. , NULL
  2003. , "TCP SYN Queue Issues"
  2004. , "packets/s"
  2005. , PLUGIN_PROC_NAME
  2006. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2007. , NETDATA_CHART_PRIO_IP_TCP_SYN_QUEUE
  2008. , update_every
  2009. , RRDSET_TYPE_LINE
  2010. );
  2011. rd_TCPReqQFullDrop = rrddim_add(st_syn_queue, "TCPReqQFullDrop", "drops", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2012. rd_TCPReqQFullDoCookies = rrddim_add(st_syn_queue, "TCPReqQFullDoCookies", "cookies", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2013. }
  2014. rrddim_set_by_pointer(st_syn_queue, rd_TCPReqQFullDrop, tcpext_TCPReqQFullDrop);
  2015. rrddim_set_by_pointer(st_syn_queue, rd_TCPReqQFullDoCookies, tcpext_TCPReqQFullDoCookies);
  2016. rrdset_done(st_syn_queue);
  2017. }
  2018. if(do_tcpext_accept_queue == CONFIG_BOOLEAN_YES || (do_tcpext_accept_queue == CONFIG_BOOLEAN_AUTO &&
  2019. (tcpext_ListenOverflows ||
  2020. tcpext_ListenDrops ||
  2021. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2022. do_tcpext_accept_queue = CONFIG_BOOLEAN_YES;
  2023. static RRDSET *st_accept_queue = NULL;
  2024. static RRDDIM *rd_overflows = NULL,
  2025. *rd_drops = NULL;
  2026. if(unlikely(!st_accept_queue)) {
  2027. st_accept_queue = rrdset_create_localhost(
  2028. RRD_TYPE_NET_IP
  2029. , "tcp_accept_queue"
  2030. , NULL
  2031. , "tcp"
  2032. , NULL
  2033. , "TCP Accept Queue Issues"
  2034. , "packets/s"
  2035. , PLUGIN_PROC_NAME
  2036. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2037. , NETDATA_CHART_PRIO_IP_TCP_ACCEPT_QUEUE
  2038. , update_every
  2039. , RRDSET_TYPE_LINE
  2040. );
  2041. rd_overflows = rrddim_add(st_accept_queue, "ListenOverflows", "overflows", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2042. rd_drops = rrddim_add(st_accept_queue, "ListenDrops", "drops", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2043. }
  2044. rrddim_set_by_pointer(st_accept_queue, rd_overflows, tcpext_ListenOverflows);
  2045. rrddim_set_by_pointer(st_accept_queue, rd_drops, tcpext_ListenDrops);
  2046. rrdset_done(st_accept_queue);
  2047. }
  2048. // snmp Ip charts
  2049. if(do_ip_packets == CONFIG_BOOLEAN_YES || (do_ip_packets == CONFIG_BOOLEAN_AUTO &&
  2050. (snmp_root.ip_OutRequests ||
  2051. snmp_root.ip_InReceives ||
  2052. snmp_root.ip_ForwDatagrams ||
  2053. snmp_root.ip_InDelivers ||
  2054. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2055. do_ip_packets = CONFIG_BOOLEAN_YES;
  2056. static RRDSET *st = NULL;
  2057. static RRDDIM *rd_InReceives = NULL,
  2058. *rd_OutRequests = NULL,
  2059. *rd_ForwDatagrams = NULL,
  2060. *rd_InDelivers = NULL;
  2061. if(unlikely(!st)) {
  2062. st = rrdset_create_localhost(
  2063. RRD_TYPE_NET_IP4
  2064. , "packets"
  2065. , NULL
  2066. , "packets"
  2067. , NULL
  2068. , "IPv4 Packets"
  2069. , "packets/s"
  2070. , PLUGIN_PROC_NAME
  2071. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2072. , NETDATA_CHART_PRIO_IPV4_PACKETS
  2073. , update_every
  2074. , RRDSET_TYPE_LINE
  2075. );
  2076. rd_InReceives = rrddim_add(st, "InReceives", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2077. rd_OutRequests = rrddim_add(st, "OutRequests", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2078. rd_ForwDatagrams = rrddim_add(st, "ForwDatagrams", "forwarded", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2079. rd_InDelivers = rrddim_add(st, "InDelivers", "delivered", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2080. }
  2081. rrddim_set_by_pointer(st, rd_OutRequests, (collected_number)snmp_root.ip_OutRequests);
  2082. rrddim_set_by_pointer(st, rd_InReceives, (collected_number)snmp_root.ip_InReceives);
  2083. rrddim_set_by_pointer(st, rd_ForwDatagrams, (collected_number)snmp_root.ip_ForwDatagrams);
  2084. rrddim_set_by_pointer(st, rd_InDelivers, (collected_number)snmp_root.ip_InDelivers);
  2085. rrdset_done(st);
  2086. }
  2087. if(do_ip_fragsout == CONFIG_BOOLEAN_YES || (do_ip_fragsout == CONFIG_BOOLEAN_AUTO &&
  2088. (snmp_root.ip_FragOKs ||
  2089. snmp_root.ip_FragFails ||
  2090. snmp_root.ip_FragCreates ||
  2091. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2092. do_ip_fragsout = CONFIG_BOOLEAN_YES;
  2093. static RRDSET *st = NULL;
  2094. static RRDDIM *rd_FragOKs = NULL,
  2095. *rd_FragFails = NULL,
  2096. *rd_FragCreates = NULL;
  2097. if(unlikely(!st)) {
  2098. st = rrdset_create_localhost(
  2099. RRD_TYPE_NET_IP4
  2100. , "fragsout"
  2101. , NULL
  2102. , "fragments"
  2103. , NULL
  2104. , "IPv4 Fragments Sent"
  2105. , "packets/s"
  2106. , PLUGIN_PROC_NAME
  2107. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2108. , NETDATA_CHART_PRIO_IPV4_FRAGMENTS_OUT
  2109. , update_every
  2110. , RRDSET_TYPE_LINE
  2111. );
  2112. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2113. rd_FragOKs = rrddim_add(st, "FragOKs", "ok", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2114. rd_FragFails = rrddim_add(st, "FragFails", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2115. rd_FragCreates = rrddim_add(st, "FragCreates", "created", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2116. }
  2117. rrddim_set_by_pointer(st, rd_FragOKs, (collected_number)snmp_root.ip_FragOKs);
  2118. rrddim_set_by_pointer(st, rd_FragFails, (collected_number)snmp_root.ip_FragFails);
  2119. rrddim_set_by_pointer(st, rd_FragCreates, (collected_number)snmp_root.ip_FragCreates);
  2120. rrdset_done(st);
  2121. }
  2122. if(do_ip_fragsin == CONFIG_BOOLEAN_YES || (do_ip_fragsin == CONFIG_BOOLEAN_AUTO &&
  2123. (snmp_root.ip_ReasmOKs ||
  2124. snmp_root.ip_ReasmFails ||
  2125. snmp_root.ip_ReasmReqds ||
  2126. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2127. do_ip_fragsin = CONFIG_BOOLEAN_YES;
  2128. static RRDSET *st = NULL;
  2129. static RRDDIM *rd_ReasmOKs = NULL,
  2130. *rd_ReasmFails = NULL,
  2131. *rd_ReasmReqds = NULL;
  2132. if(unlikely(!st)) {
  2133. st = rrdset_create_localhost(
  2134. RRD_TYPE_NET_IP4
  2135. , "fragsin"
  2136. , NULL
  2137. , "fragments"
  2138. , NULL
  2139. , "IPv4 Fragments Reassembly"
  2140. , "packets/s"
  2141. , PLUGIN_PROC_NAME
  2142. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2143. , NETDATA_CHART_PRIO_IPV4_FRAGMENTS_IN
  2144. , update_every
  2145. , RRDSET_TYPE_LINE
  2146. );
  2147. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2148. rd_ReasmOKs = rrddim_add(st, "ReasmOKs", "ok", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2149. rd_ReasmFails = rrddim_add(st, "ReasmFails", "failed", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2150. rd_ReasmReqds = rrddim_add(st, "ReasmReqds", "all", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2151. }
  2152. rrddim_set_by_pointer(st, rd_ReasmOKs, (collected_number)snmp_root.ip_ReasmOKs);
  2153. rrddim_set_by_pointer(st, rd_ReasmFails, (collected_number)snmp_root.ip_ReasmFails);
  2154. rrddim_set_by_pointer(st, rd_ReasmReqds, (collected_number)snmp_root.ip_ReasmReqds);
  2155. rrdset_done(st);
  2156. }
  2157. if(do_ip_errors == CONFIG_BOOLEAN_YES || (do_ip_errors == CONFIG_BOOLEAN_AUTO &&
  2158. (snmp_root.ip_InDiscards ||
  2159. snmp_root.ip_OutDiscards ||
  2160. snmp_root.ip_InHdrErrors ||
  2161. snmp_root.ip_InAddrErrors ||
  2162. snmp_root.ip_InUnknownProtos ||
  2163. snmp_root.ip_OutNoRoutes ||
  2164. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2165. do_ip_errors = CONFIG_BOOLEAN_YES;
  2166. static RRDSET *st = NULL;
  2167. static RRDDIM *rd_InDiscards = NULL,
  2168. *rd_OutDiscards = NULL,
  2169. *rd_InHdrErrors = NULL,
  2170. *rd_InNoRoutes = NULL,
  2171. *rd_OutNoRoutes = NULL,
  2172. *rd_InAddrErrors = NULL,
  2173. *rd_InTruncatedPkts = NULL,
  2174. *rd_InCsumErrors = NULL,
  2175. *rd_InUnknownProtos = NULL;
  2176. if(unlikely(!st)) {
  2177. st = rrdset_create_localhost(
  2178. RRD_TYPE_NET_IP4
  2179. , "errors"
  2180. , NULL
  2181. , "errors"
  2182. , NULL
  2183. , "IPv4 Errors"
  2184. , "packets/s"
  2185. , PLUGIN_PROC_NAME
  2186. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2187. , NETDATA_CHART_PRIO_IPV4_ERRORS
  2188. , update_every
  2189. , RRDSET_TYPE_LINE
  2190. );
  2191. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2192. rd_InDiscards = rrddim_add(st, "InDiscards", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2193. rd_OutDiscards = rrddim_add(st, "OutDiscards", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2194. rd_InNoRoutes = rrddim_add(st, "InNoRoutes", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2195. rd_OutNoRoutes = rrddim_add(st, "OutNoRoutes", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2196. rd_InHdrErrors = rrddim_add(st, "InHdrErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2197. rd_InAddrErrors = rrddim_add(st, "InAddrErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2198. rd_InUnknownProtos = rrddim_add(st, "InUnknownProtos", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2199. rd_InTruncatedPkts = rrddim_add(st, "InTruncatedPkts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2200. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2201. }
  2202. rrddim_set_by_pointer(st, rd_InDiscards, (collected_number)snmp_root.ip_InDiscards);
  2203. rrddim_set_by_pointer(st, rd_OutDiscards, (collected_number)snmp_root.ip_OutDiscards);
  2204. rrddim_set_by_pointer(st, rd_InHdrErrors, (collected_number)snmp_root.ip_InHdrErrors);
  2205. rrddim_set_by_pointer(st, rd_InAddrErrors, (collected_number)snmp_root.ip_InAddrErrors);
  2206. rrddim_set_by_pointer(st, rd_InUnknownProtos, (collected_number)snmp_root.ip_InUnknownProtos);
  2207. rrddim_set_by_pointer(st, rd_InNoRoutes, (collected_number)ipext_InNoRoutes);
  2208. rrddim_set_by_pointer(st, rd_OutNoRoutes, (collected_number)snmp_root.ip_OutNoRoutes);
  2209. rrddim_set_by_pointer(st, rd_InTruncatedPkts, (collected_number)ipext_InTruncatedPkts);
  2210. rrddim_set_by_pointer(st, rd_InCsumErrors, (collected_number)ipext_InCsumErrors);
  2211. rrdset_done(st);
  2212. }
  2213. // snmp Icmp charts
  2214. if(do_icmp_packets == CONFIG_BOOLEAN_YES || (do_icmp_packets == CONFIG_BOOLEAN_AUTO &&
  2215. (snmp_root.icmp_InMsgs ||
  2216. snmp_root.icmp_OutMsgs ||
  2217. snmp_root.icmp_InErrors ||
  2218. snmp_root.icmp_OutErrors ||
  2219. snmp_root.icmp_InCsumErrors ||
  2220. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2221. do_icmp_packets = CONFIG_BOOLEAN_YES;
  2222. {
  2223. static RRDSET *st_packets = NULL;
  2224. static RRDDIM *rd_InMsgs = NULL,
  2225. *rd_OutMsgs = NULL;
  2226. if(unlikely(!st_packets)) {
  2227. st_packets = rrdset_create_localhost(
  2228. RRD_TYPE_NET_IP4
  2229. , "icmp"
  2230. , NULL
  2231. , "icmp"
  2232. , NULL
  2233. , "IPv4 ICMP Packets"
  2234. , "packets/s"
  2235. , PLUGIN_PROC_NAME
  2236. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2237. , NETDATA_CHART_PRIO_IPV4_ICMP_PACKETS
  2238. , update_every
  2239. , RRDSET_TYPE_LINE
  2240. );
  2241. rd_InMsgs = rrddim_add(st_packets, "InMsgs", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2242. rd_OutMsgs = rrddim_add(st_packets, "OutMsgs", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2243. }
  2244. rrddim_set_by_pointer(st_packets, rd_InMsgs, (collected_number)snmp_root.icmp_InMsgs);
  2245. rrddim_set_by_pointer(st_packets, rd_OutMsgs, (collected_number)snmp_root.icmp_OutMsgs);
  2246. rrdset_done(st_packets);
  2247. }
  2248. {
  2249. static RRDSET *st_errors = NULL;
  2250. static RRDDIM *rd_InErrors = NULL,
  2251. *rd_OutErrors = NULL,
  2252. *rd_InCsumErrors = NULL;
  2253. if(unlikely(!st_errors)) {
  2254. st_errors = rrdset_create_localhost(
  2255. RRD_TYPE_NET_IP4
  2256. , "icmp_errors"
  2257. , NULL
  2258. , "icmp"
  2259. , NULL
  2260. , "IPv4 ICMP Errors"
  2261. , "packets/s"
  2262. , PLUGIN_PROC_NAME
  2263. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2264. , NETDATA_CHART_PRIO_IPV4_ICMP_ERRORS
  2265. , update_every
  2266. , RRDSET_TYPE_LINE
  2267. );
  2268. rd_InErrors = rrddim_add(st_errors, "InErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2269. rd_OutErrors = rrddim_add(st_errors, "OutErrors", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2270. rd_InCsumErrors = rrddim_add(st_errors, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2271. }
  2272. rrddim_set_by_pointer(st_errors, rd_InErrors, (collected_number)snmp_root.icmp_InErrors);
  2273. rrddim_set_by_pointer(st_errors, rd_OutErrors, (collected_number)snmp_root.icmp_OutErrors);
  2274. rrddim_set_by_pointer(st_errors, rd_InCsumErrors, (collected_number)snmp_root.icmp_InCsumErrors);
  2275. rrdset_done(st_errors);
  2276. }
  2277. }
  2278. // snmp IcmpMsg charts
  2279. if(do_icmpmsg == CONFIG_BOOLEAN_YES || (do_icmpmsg == CONFIG_BOOLEAN_AUTO &&
  2280. (snmp_root.icmpmsg_InEchoReps ||
  2281. snmp_root.icmpmsg_OutEchoReps ||
  2282. snmp_root.icmpmsg_InDestUnreachs ||
  2283. snmp_root.icmpmsg_OutDestUnreachs ||
  2284. snmp_root.icmpmsg_InRedirects ||
  2285. snmp_root.icmpmsg_OutRedirects ||
  2286. snmp_root.icmpmsg_InEchos ||
  2287. snmp_root.icmpmsg_OutEchos ||
  2288. snmp_root.icmpmsg_InRouterAdvert ||
  2289. snmp_root.icmpmsg_OutRouterAdvert ||
  2290. snmp_root.icmpmsg_InRouterSelect ||
  2291. snmp_root.icmpmsg_OutRouterSelect ||
  2292. snmp_root.icmpmsg_InTimeExcds ||
  2293. snmp_root.icmpmsg_OutTimeExcds ||
  2294. snmp_root.icmpmsg_InParmProbs ||
  2295. snmp_root.icmpmsg_OutParmProbs ||
  2296. snmp_root.icmpmsg_InTimestamps ||
  2297. snmp_root.icmpmsg_OutTimestamps ||
  2298. snmp_root.icmpmsg_InTimestampReps ||
  2299. snmp_root.icmpmsg_OutTimestampReps ||
  2300. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2301. do_icmpmsg = CONFIG_BOOLEAN_YES;
  2302. static RRDSET *st = NULL;
  2303. static RRDDIM *rd_InEchoReps = NULL,
  2304. *rd_OutEchoReps = NULL,
  2305. *rd_InDestUnreachs = NULL,
  2306. *rd_OutDestUnreachs = NULL,
  2307. *rd_InRedirects = NULL,
  2308. *rd_OutRedirects = NULL,
  2309. *rd_InEchos = NULL,
  2310. *rd_OutEchos = NULL,
  2311. *rd_InRouterAdvert = NULL,
  2312. *rd_OutRouterAdvert = NULL,
  2313. *rd_InRouterSelect = NULL,
  2314. *rd_OutRouterSelect = NULL,
  2315. *rd_InTimeExcds = NULL,
  2316. *rd_OutTimeExcds = NULL,
  2317. *rd_InParmProbs = NULL,
  2318. *rd_OutParmProbs = NULL,
  2319. *rd_InTimestamps = NULL,
  2320. *rd_OutTimestamps = NULL,
  2321. *rd_InTimestampReps = NULL,
  2322. *rd_OutTimestampReps = NULL;
  2323. if(unlikely(!st)) {
  2324. st = rrdset_create_localhost(
  2325. RRD_TYPE_NET_IP4
  2326. , "icmpmsg"
  2327. , NULL
  2328. , "icmp"
  2329. , NULL
  2330. , "IPv4 ICMP Messages"
  2331. , "packets/s"
  2332. , PLUGIN_PROC_NAME
  2333. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2334. , NETDATA_CHART_PRIO_IPV4_ICMP_MESSAGES
  2335. , update_every
  2336. , RRDSET_TYPE_LINE
  2337. );
  2338. rd_InEchoReps = rrddim_add(st, "InType0", "InEchoReps", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2339. rd_OutEchoReps = rrddim_add(st, "OutType0", "OutEchoReps", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2340. rd_InDestUnreachs = rrddim_add(st, "InType3", "InDestUnreachs", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2341. rd_OutDestUnreachs = rrddim_add(st, "OutType3", "OutDestUnreachs", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2342. rd_InRedirects = rrddim_add(st, "InType5", "InRedirects", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2343. rd_OutRedirects = rrddim_add(st, "OutType5", "OutRedirects", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2344. rd_InEchos = rrddim_add(st, "InType8", "InEchos", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2345. rd_OutEchos = rrddim_add(st, "OutType8", "OutEchos", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2346. rd_InRouterAdvert = rrddim_add(st, "InType9", "InRouterAdvert", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2347. rd_OutRouterAdvert = rrddim_add(st, "OutType9", "OutRouterAdvert", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2348. rd_InRouterSelect = rrddim_add(st, "InType10", "InRouterSelect", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2349. rd_OutRouterSelect = rrddim_add(st, "OutType10", "OutRouterSelect", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2350. rd_InTimeExcds = rrddim_add(st, "InType11", "InTimeExcds", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2351. rd_OutTimeExcds = rrddim_add(st, "OutType11", "OutTimeExcds", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2352. rd_InParmProbs = rrddim_add(st, "InType12", "InParmProbs", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2353. rd_OutParmProbs = rrddim_add(st, "OutType12", "OutParmProbs", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2354. rd_InTimestamps = rrddim_add(st, "InType13", "InTimestamps", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2355. rd_OutTimestamps = rrddim_add(st, "OutType13", "OutTimestamps", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2356. rd_InTimestampReps = rrddim_add(st, "InType14", "InTimestampReps", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2357. rd_OutTimestampReps = rrddim_add(st, "OutType14", "OutTimestampReps", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2358. }
  2359. rrddim_set_by_pointer(st, rd_InEchoReps, (collected_number)snmp_root.icmpmsg_InEchoReps);
  2360. rrddim_set_by_pointer(st, rd_OutEchoReps, (collected_number)snmp_root.icmpmsg_OutEchoReps);
  2361. rrddim_set_by_pointer(st, rd_InDestUnreachs, (collected_number)snmp_root.icmpmsg_InDestUnreachs);
  2362. rrddim_set_by_pointer(st, rd_OutDestUnreachs, (collected_number)snmp_root.icmpmsg_OutDestUnreachs);
  2363. rrddim_set_by_pointer(st, rd_InRedirects, (collected_number)snmp_root.icmpmsg_InRedirects);
  2364. rrddim_set_by_pointer(st, rd_OutRedirects, (collected_number)snmp_root.icmpmsg_OutRedirects);
  2365. rrddim_set_by_pointer(st, rd_InEchos, (collected_number)snmp_root.icmpmsg_InEchos);
  2366. rrddim_set_by_pointer(st, rd_OutEchos, (collected_number)snmp_root.icmpmsg_OutEchos);
  2367. rrddim_set_by_pointer(st, rd_InRouterAdvert, (collected_number)snmp_root.icmpmsg_InRouterAdvert);
  2368. rrddim_set_by_pointer(st, rd_OutRouterAdvert, (collected_number)snmp_root.icmpmsg_OutRouterAdvert);
  2369. rrddim_set_by_pointer(st, rd_InRouterSelect, (collected_number)snmp_root.icmpmsg_InRouterSelect);
  2370. rrddim_set_by_pointer(st, rd_OutRouterSelect, (collected_number)snmp_root.icmpmsg_OutRouterSelect);
  2371. rrddim_set_by_pointer(st, rd_InTimeExcds, (collected_number)snmp_root.icmpmsg_InTimeExcds);
  2372. rrddim_set_by_pointer(st, rd_OutTimeExcds, (collected_number)snmp_root.icmpmsg_OutTimeExcds);
  2373. rrddim_set_by_pointer(st, rd_InParmProbs, (collected_number)snmp_root.icmpmsg_InParmProbs);
  2374. rrddim_set_by_pointer(st, rd_OutParmProbs, (collected_number)snmp_root.icmpmsg_OutParmProbs);
  2375. rrddim_set_by_pointer(st, rd_InTimestamps, (collected_number)snmp_root.icmpmsg_InTimestamps);
  2376. rrddim_set_by_pointer(st, rd_OutTimestamps, (collected_number)snmp_root.icmpmsg_OutTimestamps);
  2377. rrddim_set_by_pointer(st, rd_InTimestampReps, (collected_number)snmp_root.icmpmsg_InTimestampReps);
  2378. rrddim_set_by_pointer(st, rd_OutTimestampReps, (collected_number)snmp_root.icmpmsg_OutTimestampReps);
  2379. rrdset_done(st);
  2380. }
  2381. // snmp Tcp charts
  2382. // this is smart enough to update it, only when it is changed
  2383. rrdvar_custom_host_variable_set(localhost, tcp_max_connections_var, snmp_root.tcp_MaxConn);
  2384. // see http://net-snmp.sourceforge.net/docs/mibs/tcp.html
  2385. if(do_tcp_sockets == CONFIG_BOOLEAN_YES || (do_tcp_sockets == CONFIG_BOOLEAN_AUTO &&
  2386. (snmp_root.tcp_CurrEstab ||
  2387. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2388. do_tcp_sockets = CONFIG_BOOLEAN_YES;
  2389. static RRDSET *st = NULL;
  2390. static RRDDIM *rd_CurrEstab = NULL;
  2391. if(unlikely(!st)) {
  2392. st = rrdset_create_localhost(
  2393. RRD_TYPE_NET_IP
  2394. , "tcpsock"
  2395. , NULL
  2396. , "tcp"
  2397. , NULL
  2398. , "TCP Connections"
  2399. , "active connections"
  2400. , PLUGIN_PROC_NAME
  2401. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2402. , NETDATA_CHART_PRIO_IP_TCP_ESTABLISHED_CONNS
  2403. , update_every
  2404. , RRDSET_TYPE_LINE
  2405. );
  2406. rd_CurrEstab = rrddim_add(st, "CurrEstab", "connections", 1, 1, RRD_ALGORITHM_ABSOLUTE);
  2407. }
  2408. rrddim_set_by_pointer(st, rd_CurrEstab, (collected_number)snmp_root.tcp_CurrEstab);
  2409. rrdset_done(st);
  2410. }
  2411. if(do_tcp_packets == CONFIG_BOOLEAN_YES || (do_tcp_packets == CONFIG_BOOLEAN_AUTO &&
  2412. (snmp_root.tcp_InSegs ||
  2413. snmp_root.tcp_OutSegs ||
  2414. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2415. do_tcp_packets = CONFIG_BOOLEAN_YES;
  2416. static RRDSET *st = NULL;
  2417. static RRDDIM *rd_InSegs = NULL,
  2418. *rd_OutSegs = NULL;
  2419. if(unlikely(!st)) {
  2420. st = rrdset_create_localhost(
  2421. RRD_TYPE_NET_IP
  2422. , "tcppackets"
  2423. , NULL
  2424. , "tcp"
  2425. , NULL
  2426. , "IPv4 TCP Packets"
  2427. , "packets/s"
  2428. , PLUGIN_PROC_NAME
  2429. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2430. , NETDATA_CHART_PRIO_IP_TCP_PACKETS
  2431. , update_every
  2432. , RRDSET_TYPE_LINE
  2433. );
  2434. rd_InSegs = rrddim_add(st, "InSegs", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2435. rd_OutSegs = rrddim_add(st, "OutSegs", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2436. }
  2437. rrddim_set_by_pointer(st, rd_InSegs, (collected_number)snmp_root.tcp_InSegs);
  2438. rrddim_set_by_pointer(st, rd_OutSegs, (collected_number)snmp_root.tcp_OutSegs);
  2439. rrdset_done(st);
  2440. }
  2441. // --------------------------------------------------------------------
  2442. if(do_tcp_errors == CONFIG_BOOLEAN_YES || (do_tcp_errors == CONFIG_BOOLEAN_AUTO &&
  2443. (snmp_root.tcp_InErrs ||
  2444. snmp_root.tcp_InCsumErrors ||
  2445. snmp_root.tcp_RetransSegs ||
  2446. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2447. do_tcp_errors = CONFIG_BOOLEAN_YES;
  2448. static RRDSET *st = NULL;
  2449. static RRDDIM *rd_InErrs = NULL,
  2450. *rd_InCsumErrors = NULL,
  2451. *rd_RetransSegs = NULL;
  2452. if(unlikely(!st)) {
  2453. st = rrdset_create_localhost(
  2454. RRD_TYPE_NET_IP
  2455. , "tcperrors"
  2456. , NULL
  2457. , "tcp"
  2458. , NULL
  2459. , "IPv4 TCP Errors"
  2460. , "packets/s"
  2461. , PLUGIN_PROC_NAME
  2462. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2463. , NETDATA_CHART_PRIO_IP_TCP_ERRORS
  2464. , update_every
  2465. , RRDSET_TYPE_LINE
  2466. );
  2467. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2468. rd_InErrs = rrddim_add(st, "InErrs", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2469. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2470. rd_RetransSegs = rrddim_add(st, "RetransSegs", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2471. }
  2472. rrddim_set_by_pointer(st, rd_InErrs, (collected_number)snmp_root.tcp_InErrs);
  2473. rrddim_set_by_pointer(st, rd_InCsumErrors, (collected_number)snmp_root.tcp_InCsumErrors);
  2474. rrddim_set_by_pointer(st, rd_RetransSegs, (collected_number)snmp_root.tcp_RetransSegs);
  2475. rrdset_done(st);
  2476. }
  2477. if(do_tcp_opens == CONFIG_BOOLEAN_YES || (do_tcp_opens == CONFIG_BOOLEAN_AUTO &&
  2478. (snmp_root.tcp_ActiveOpens ||
  2479. snmp_root.tcp_PassiveOpens ||
  2480. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2481. do_tcp_opens = CONFIG_BOOLEAN_YES;
  2482. static RRDSET *st = NULL;
  2483. static RRDDIM *rd_ActiveOpens = NULL,
  2484. *rd_PassiveOpens = NULL;
  2485. if(unlikely(!st)) {
  2486. st = rrdset_create_localhost(
  2487. RRD_TYPE_NET_IP
  2488. , "tcpopens"
  2489. , NULL
  2490. , "tcp"
  2491. , NULL
  2492. , "IPv4 TCP Opens"
  2493. , "connections/s"
  2494. , PLUGIN_PROC_NAME
  2495. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2496. , NETDATA_CHART_PRIO_IP_TCP_OPENS
  2497. , update_every
  2498. , RRDSET_TYPE_LINE
  2499. );
  2500. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2501. rd_ActiveOpens = rrddim_add(st, "ActiveOpens", "active", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2502. rd_PassiveOpens = rrddim_add(st, "PassiveOpens", "passive", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2503. }
  2504. rrddim_set_by_pointer(st, rd_ActiveOpens, (collected_number)snmp_root.tcp_ActiveOpens);
  2505. rrddim_set_by_pointer(st, rd_PassiveOpens, (collected_number)snmp_root.tcp_PassiveOpens);
  2506. rrdset_done(st);
  2507. }
  2508. if(do_tcp_handshake == CONFIG_BOOLEAN_YES || (do_tcp_handshake == CONFIG_BOOLEAN_AUTO &&
  2509. (snmp_root.tcp_EstabResets ||
  2510. snmp_root.tcp_OutRsts ||
  2511. snmp_root.tcp_AttemptFails ||
  2512. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2513. do_tcp_handshake = CONFIG_BOOLEAN_YES;
  2514. static RRDSET *st = NULL;
  2515. static RRDDIM *rd_EstabResets = NULL,
  2516. *rd_OutRsts = NULL,
  2517. *rd_AttemptFails = NULL,
  2518. *rd_TCPSynRetrans = NULL;
  2519. if(unlikely(!st)) {
  2520. st = rrdset_create_localhost(
  2521. RRD_TYPE_NET_IP
  2522. , "tcphandshake"
  2523. , NULL
  2524. , "tcp"
  2525. , NULL
  2526. , "IPv4 TCP Handshake Issues"
  2527. , "events/s"
  2528. , PLUGIN_PROC_NAME
  2529. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2530. , NETDATA_CHART_PRIO_IP_TCP_HANDSHAKE
  2531. , update_every
  2532. , RRDSET_TYPE_LINE
  2533. );
  2534. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2535. rd_EstabResets = rrddim_add(st, "EstabResets", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2536. rd_OutRsts = rrddim_add(st, "OutRsts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2537. rd_AttemptFails = rrddim_add(st, "AttemptFails", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2538. rd_TCPSynRetrans = rrddim_add(st, "TCPSynRetrans", "SynRetrans", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2539. }
  2540. rrddim_set_by_pointer(st, rd_EstabResets, (collected_number)snmp_root.tcp_EstabResets);
  2541. rrddim_set_by_pointer(st, rd_OutRsts, (collected_number)snmp_root.tcp_OutRsts);
  2542. rrddim_set_by_pointer(st, rd_AttemptFails, (collected_number)snmp_root.tcp_AttemptFails);
  2543. rrddim_set_by_pointer(st, rd_TCPSynRetrans, tcpext_TCPSynRetrans);
  2544. rrdset_done(st);
  2545. }
  2546. // snmp Udp charts
  2547. // see http://net-snmp.sourceforge.net/docs/mibs/udp.html
  2548. if(do_udp_packets == CONFIG_BOOLEAN_YES || (do_udp_packets == CONFIG_BOOLEAN_AUTO &&
  2549. (snmp_root.udp_InDatagrams ||
  2550. snmp_root.udp_OutDatagrams ||
  2551. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2552. do_udp_packets = CONFIG_BOOLEAN_YES;
  2553. static RRDSET *st = NULL;
  2554. static RRDDIM *rd_InDatagrams = NULL,
  2555. *rd_OutDatagrams = NULL;
  2556. if(unlikely(!st)) {
  2557. st = rrdset_create_localhost(
  2558. RRD_TYPE_NET_IP4
  2559. , "udppackets"
  2560. , NULL
  2561. , "udp"
  2562. , NULL
  2563. , "IPv4 UDP Packets"
  2564. , "packets/s"
  2565. , PLUGIN_PROC_NAME
  2566. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2567. , NETDATA_CHART_PRIO_IPV4_UDP_PACKETS
  2568. , update_every
  2569. , RRDSET_TYPE_LINE
  2570. );
  2571. rd_InDatagrams = rrddim_add(st, "InDatagrams", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2572. rd_OutDatagrams = rrddim_add(st, "OutDatagrams", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2573. }
  2574. rrddim_set_by_pointer(st, rd_InDatagrams, (collected_number)snmp_root.udp_InDatagrams);
  2575. rrddim_set_by_pointer(st, rd_OutDatagrams, (collected_number)snmp_root.udp_OutDatagrams);
  2576. rrdset_done(st);
  2577. }
  2578. // --------------------------------------------------------------------
  2579. if(do_udp_errors == CONFIG_BOOLEAN_YES || (do_udp_errors == CONFIG_BOOLEAN_AUTO &&
  2580. (snmp_root.udp_InErrors ||
  2581. snmp_root.udp_NoPorts ||
  2582. snmp_root.udp_RcvbufErrors ||
  2583. snmp_root.udp_SndbufErrors ||
  2584. snmp_root.udp_InCsumErrors ||
  2585. snmp_root.udp_IgnoredMulti ||
  2586. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2587. do_udp_errors = CONFIG_BOOLEAN_YES;
  2588. static RRDSET *st = NULL;
  2589. static RRDDIM *rd_RcvbufErrors = NULL,
  2590. *rd_SndbufErrors = NULL,
  2591. *rd_InErrors = NULL,
  2592. *rd_NoPorts = NULL,
  2593. *rd_InCsumErrors = NULL,
  2594. *rd_IgnoredMulti = NULL;
  2595. if(unlikely(!st)) {
  2596. st = rrdset_create_localhost(
  2597. RRD_TYPE_NET_IP4
  2598. , "udperrors"
  2599. , NULL
  2600. , "udp"
  2601. , NULL
  2602. , "IPv4 UDP Errors"
  2603. , "events/s"
  2604. , PLUGIN_PROC_NAME
  2605. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2606. , NETDATA_CHART_PRIO_IPV4_UDP_ERRORS
  2607. , update_every
  2608. , RRDSET_TYPE_LINE
  2609. );
  2610. rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
  2611. rd_RcvbufErrors = rrddim_add(st, "RcvbufErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2612. rd_SndbufErrors = rrddim_add(st, "SndbufErrors", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2613. rd_InErrors = rrddim_add(st, "InErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2614. rd_NoPorts = rrddim_add(st, "NoPorts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2615. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2616. rd_IgnoredMulti = rrddim_add(st, "IgnoredMulti", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2617. }
  2618. rrddim_set_by_pointer(st, rd_InErrors, (collected_number)snmp_root.udp_InErrors);
  2619. rrddim_set_by_pointer(st, rd_NoPorts, (collected_number)snmp_root.udp_NoPorts);
  2620. rrddim_set_by_pointer(st, rd_RcvbufErrors, (collected_number)snmp_root.udp_RcvbufErrors);
  2621. rrddim_set_by_pointer(st, rd_SndbufErrors, (collected_number)snmp_root.udp_SndbufErrors);
  2622. rrddim_set_by_pointer(st, rd_InCsumErrors, (collected_number)snmp_root.udp_InCsumErrors);
  2623. rrddim_set_by_pointer(st, rd_IgnoredMulti, (collected_number)snmp_root.udp_IgnoredMulti);
  2624. rrdset_done(st);
  2625. }
  2626. // snmp UdpLite charts
  2627. if(do_udplite_packets == CONFIG_BOOLEAN_YES || (do_udplite_packets == CONFIG_BOOLEAN_AUTO &&
  2628. (snmp_root.udplite_InDatagrams ||
  2629. snmp_root.udplite_OutDatagrams ||
  2630. snmp_root.udplite_NoPorts ||
  2631. snmp_root.udplite_InErrors ||
  2632. snmp_root.udplite_InCsumErrors ||
  2633. snmp_root.udplite_RcvbufErrors ||
  2634. snmp_root.udplite_SndbufErrors ||
  2635. snmp_root.udplite_IgnoredMulti ||
  2636. netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
  2637. do_udplite_packets = CONFIG_BOOLEAN_YES;
  2638. {
  2639. static RRDSET *st = NULL;
  2640. static RRDDIM *rd_InDatagrams = NULL,
  2641. *rd_OutDatagrams = NULL;
  2642. if(unlikely(!st)) {
  2643. st = rrdset_create_localhost(
  2644. RRD_TYPE_NET_IP4
  2645. , "udplite"
  2646. , NULL
  2647. , "udplite"
  2648. , NULL
  2649. , "IPv4 UDPLite Packets"
  2650. , "packets/s"
  2651. , PLUGIN_PROC_NAME
  2652. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2653. , NETDATA_CHART_PRIO_IPV4_UDPLITE_PACKETS
  2654. , update_every
  2655. , RRDSET_TYPE_LINE
  2656. );
  2657. rd_InDatagrams = rrddim_add(st, "InDatagrams", "received", 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2658. rd_OutDatagrams = rrddim_add(st, "OutDatagrams", "sent", -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2659. }
  2660. rrddim_set_by_pointer(st, rd_InDatagrams, (collected_number)snmp_root.udplite_InDatagrams);
  2661. rrddim_set_by_pointer(st, rd_OutDatagrams, (collected_number)snmp_root.udplite_OutDatagrams);
  2662. rrdset_done(st);
  2663. }
  2664. {
  2665. static RRDSET *st = NULL;
  2666. static RRDDIM *rd_RcvbufErrors = NULL,
  2667. *rd_SndbufErrors = NULL,
  2668. *rd_InErrors = NULL,
  2669. *rd_NoPorts = NULL,
  2670. *rd_InCsumErrors = NULL,
  2671. *rd_IgnoredMulti = NULL;
  2672. if(unlikely(!st)) {
  2673. st = rrdset_create_localhost(
  2674. RRD_TYPE_NET_IP4
  2675. , "udplite_errors"
  2676. , NULL
  2677. , "udplite"
  2678. , NULL
  2679. , "IPv4 UDPLite Errors"
  2680. , "packets/s"
  2681. , PLUGIN_PROC_NAME
  2682. , PLUGIN_PROC_MODULE_NETSTAT_NAME
  2683. , NETDATA_CHART_PRIO_IPV4_UDPLITE_ERRORS
  2684. , update_every
  2685. , RRDSET_TYPE_LINE);
  2686. rd_RcvbufErrors = rrddim_add(st, "RcvbufErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2687. rd_SndbufErrors = rrddim_add(st, "SndbufErrors", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
  2688. rd_InErrors = rrddim_add(st, "InErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2689. rd_NoPorts = rrddim_add(st, "NoPorts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2690. rd_InCsumErrors = rrddim_add(st, "InCsumErrors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2691. rd_IgnoredMulti = rrddim_add(st, "IgnoredMulti", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
  2692. }
  2693. rrddim_set_by_pointer(st, rd_NoPorts, (collected_number)snmp_root.udplite_NoPorts);
  2694. rrddim_set_by_pointer(st, rd_InErrors, (collected_number)snmp_root.udplite_InErrors);
  2695. rrddim_set_by_pointer(st, rd_InCsumErrors, (collected_number)snmp_root.udplite_InCsumErrors);
  2696. rrddim_set_by_pointer(st, rd_RcvbufErrors, (collected_number)snmp_root.udplite_RcvbufErrors);
  2697. rrddim_set_by_pointer(st, rd_SndbufErrors, (collected_number)snmp_root.udplite_SndbufErrors);
  2698. rrddim_set_by_pointer(st, rd_IgnoredMulti, (collected_number)snmp_root.udplite_IgnoredMulti);
  2699. rrdset_done(st);
  2700. }
  2701. }
  2702. do_proc_net_snmp6(update_every);
  2703. return 0;
  2704. }