@cryptotaxi247 / netdata-1 / commits / a09357c46

added more charts for conntrack, /proc/stat, ip, tcp, udp

Costa Tsaousis (ktsaou) committed Apr 13, 2014 at 20:04 UTC a09357c46f69e6af34d5e17e3fc6e4439b80ed42
2 files changed +267 -45
netdata.c
+263 -44
@@ -2731,6 +2731,68 @@ int do_proc_net_snmp() {
2731 rrd_stats_dimension_set(st, "received", &InReceives, NULL);
2732 rrd_stats_dimension_set(st, "forwarded", &ForwDatagrams, NULL);
2733 rrd_stats_done(st);
2734 +
2735 + // --------------------------------------------------------------------
2736 +
2737 + st = rrd_stats_find(RRD_TYPE_NET_SNMP ".fragsout");
2738 + if(!st) {
2739 + st = rrd_stats_create(RRD_TYPE_NET_SNMP, "fragsout", NULL, RRD_TYPE_NET_SNMP, "IPv4 Fragments Sent", "packets/s", save_history);
2740 + st->isdetail = 1;
2741 +
2742 + rrd_stats_dimension_add(st, "ok", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2743 + rrd_stats_dimension_add(st, "failed", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2744 + rrd_stats_dimension_add(st, "all", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2745 + }
2746 + else rrd_stats_next(st);
2747 +
2748 + rrd_stats_dimension_set(st, "ok", &FragOKs, NULL);
2749 + rrd_stats_dimension_set(st, "failed", &FragFails, NULL);
2750 + rrd_stats_dimension_set(st, "all", &FragCreates, NULL);
2751 + rrd_stats_done(st);
2752 +
2753 + // --------------------------------------------------------------------
2754 +
2755 + st = rrd_stats_find(RRD_TYPE_NET_SNMP ".fragsin");
2756 + if(!st) {
2757 + st = rrd_stats_create(RRD_TYPE_NET_SNMP, "fragsin", NULL, RRD_TYPE_NET_SNMP, "IPv4 Fragments Reassembly", "packets/s", save_history);
2758 + st->isdetail = 1;
2759 +
2760 + rrd_stats_dimension_add(st, "ok", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2761 + rrd_stats_dimension_add(st, "failed", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2762 + rrd_stats_dimension_add(st, "all", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2763 + }
2764 + else rrd_stats_next(st);
2765 +
2766 + rrd_stats_dimension_set(st, "ok", &ReasmOKs, NULL);
2767 + rrd_stats_dimension_set(st, "failed", &ReasmFails, NULL);
2768 + rrd_stats_dimension_set(st, "all", &ReasmReqds, NULL);
2769 + rrd_stats_done(st);
2770 +
2771 + // --------------------------------------------------------------------
2772 +
2773 + st = rrd_stats_find(RRD_TYPE_NET_SNMP ".errors");
2774 + if(!st) {
2775 + st = rrd_stats_create(RRD_TYPE_NET_SNMP, "errors", NULL, RRD_TYPE_NET_SNMP, "IPv4 Errors", "packets/s", save_history);
2776 + st->isdetail = 1;
2777 +
2778 + rrd_stats_dimension_add(st, "InDiscards", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2779 + rrd_stats_dimension_add(st, "OutDiscards", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2780 +
2781 + rrd_stats_dimension_add(st, "InHdrErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2782 + rrd_stats_dimension_add(st, "InAddrErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2783 + rrd_stats_dimension_add(st, "InUnknownProtos", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2784 +
2785 + rrd_stats_dimension_add(st, "OutNoRoutes", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2786 + }
2787 + else rrd_stats_next(st);
2788 +
2789 + rrd_stats_dimension_set(st, "InDiscards", &InDiscards, NULL);
2790 + rrd_stats_dimension_set(st, "OutDiscards", &OutDiscards, NULL);
2791 + rrd_stats_dimension_set(st, "InHdrErrors", &InHdrErrors, NULL);
2792 + rrd_stats_dimension_set(st, "InAddrErrors", &InAddrErrors, NULL);
2793 + rrd_stats_dimension_set(st, "InUnknownProtos", &InUnknownProtos, NULL);
2794 + rrd_stats_dimension_set(st, "OutNoRoutes", &OutNoRoutes, NULL);
2795 + rrd_stats_done(st);
2796 }
2797 else if(strncmp(p, "Tcp: ", 5) == 0) {
2798 // skip the header line, read the data
@@ -2742,7 +2804,8 @@ int do_proc_net_snmp() {
2804 break;
2805 }
2806
2745 - unsigned long long RtoAlgorithm, RtoMin, RtoMax, MaxConn, ActiveOpens, PassiveOpens, AttemptFails, EstabResets, CurrEstab, InSegs, OutSegs, RetransSegs, InErrs, OutRsts;
2807 + unsigned long long RtoAlgorithm, RtoMin, RtoMax, MaxConn, ActiveOpens, PassiveOpens, AttemptFails, EstabResets,
2808 + CurrEstab, InSegs, OutSegs, RetransSegs, InErrs, OutRsts;
2809
2810 int r = sscanf(&buffer[5], "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
2811 &RtoAlgorithm, &RtoMin, &RtoMax, &MaxConn, &ActiveOpens, &PassiveOpens, &AttemptFails, &EstabResets, &CurrEstab, &InSegs, &OutSegs, &RetransSegs, &InErrs, &OutRsts);
@@ -2755,7 +2818,7 @@ int do_proc_net_snmp() {
2818 // see http://net-snmp.sourceforge.net/docs/mibs/tcp.html
2819 RRD_STATS *st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcpsock");
2820 if(!st) {
2758 - st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcpsock", NULL, RRD_TYPE_NET_SNMP, "IPv4 TCP Connections", "active connections", save_history);
2821 + st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcpsock", NULL, "tcp", "IPv4 TCP Connections", "active connections", save_history);
2822
2823 rrd_stats_dimension_add(st, "connections", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
2824 }
@@ -2768,7 +2831,7 @@ int do_proc_net_snmp() {
2831
2832 st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcppackets");
2833 if(!st) {
2771 - st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcppackets", NULL, RRD_TYPE_NET_SNMP, "IPv4 TCP Packets", "packets/s", save_history);
2834 + st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcppackets", NULL, "tcp", "IPv4 TCP Packets", "packets/s", save_history);
2835
2836 rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2837 rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
@@ -2778,6 +2841,44 @@ int do_proc_net_snmp() {
2841 rrd_stats_dimension_set(st, "received", &InSegs, NULL);
2842 rrd_stats_dimension_set(st, "sent", &OutSegs, NULL);
2843 rrd_stats_done(st);
2844 +
2845 + // --------------------------------------------------------------------
2846 +
2847 + st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcperrors");
2848 + if(!st) {
2849 + st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcperrors", NULL, "tcp", "IPv4 TCP Errors", "packets/s", save_history);
2850 + st->isdetail = 1;
2851 +
2852 + rrd_stats_dimension_add(st, "InErrs", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2853 + rrd_stats_dimension_add(st, "RetransSegs", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2854 + }
2855 + else rrd_stats_next(st);
2856 +
2857 + rrd_stats_dimension_set(st, "InErrs", &InErrs, NULL);
2858 + rrd_stats_dimension_set(st, "RetransSegs", &RetransSegs, NULL);
2859 + rrd_stats_done(st);
2860 +
2861 + // --------------------------------------------------------------------
2862 +
2863 + st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcphandshake");
2864 + if(!st) {
2865 + st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcphandshake", NULL, "tcp", "IPv4 TCP Handshake Issues", "events/s", save_history);
2866 + st->isdetail = 1;
2867 +
2868 + rrd_stats_dimension_add(st, "EstabResets", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2869 + rrd_stats_dimension_add(st, "OutRsts", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2870 + rrd_stats_dimension_add(st, "ActiveOpens", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2871 + rrd_stats_dimension_add(st, "PassiveOpens", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2872 + rrd_stats_dimension_add(st, "AttemptFails", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2873 + }
2874 + else rrd_stats_next(st);
2875 +
2876 + rrd_stats_dimension_set(st, "EstabResets", &EstabResets, NULL);
2877 + rrd_stats_dimension_set(st, "OutRsts", &OutRsts, NULL);
2878 + rrd_stats_dimension_set(st, "ActiveOpens", &ActiveOpens, NULL);
2879 + rrd_stats_dimension_set(st, "PassiveOpens", &PassiveOpens, NULL);
2880 + rrd_stats_dimension_set(st, "AttemptFails", &AttemptFails, NULL);
2881 + rrd_stats_done(st);
2882 }
2883 else if(strncmp(p, "Udp: ", 5) == 0) {
2884 // skip the header line, read the data
@@ -2802,7 +2903,7 @@ int do_proc_net_snmp() {
2903 // see http://net-snmp.sourceforge.net/docs/mibs/udp.html
2904 RRD_STATS *st = rrd_stats_find(RRD_TYPE_NET_SNMP ".udppackets");
2905 if(!st) {
2805 - st = rrd_stats_create(RRD_TYPE_NET_SNMP, "udppackets", NULL, RRD_TYPE_NET_SNMP, "IPv4 UDP Packets", "packets/s", save_history);
2906 + st = rrd_stats_create(RRD_TYPE_NET_SNMP, "udppackets", NULL, "udp", "IPv4 UDP Packets", "packets/s", save_history);
2907
2908 rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2909 rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
@@ -2812,6 +2913,26 @@ int do_proc_net_snmp() {
2913 rrd_stats_dimension_set(st, "received", &InDatagrams, NULL);
2914 rrd_stats_dimension_set(st, "sent", &OutDatagrams, NULL);
2915 rrd_stats_done(st);
2916 +
2917 + // --------------------------------------------------------------------
2918 +
2919 + st = rrd_stats_find(RRD_TYPE_NET_SNMP ".udperrors");
2920 + if(!st) {
2921 + st = rrd_stats_create(RRD_TYPE_NET_SNMP, "udperrors", NULL, "udp", "IPv4 UDP Errors", "events/s", save_history);
2922 + st->isdetail = 1;
2923 +
2924 + rrd_stats_dimension_add(st, "RcvbufErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2925 + rrd_stats_dimension_add(st, "SndbufErrors", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2926 + rrd_stats_dimension_add(st, "InErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2927 + rrd_stats_dimension_add(st, "NoPorts", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2928 + }
2929 + else rrd_stats_next(st);
2930 +
2931 + rrd_stats_dimension_set(st, "InErrors", &InErrors, NULL);
2932 + rrd_stats_dimension_set(st, "NoPorts", &NoPorts, NULL);
2933 + rrd_stats_dimension_set(st, "RcvbufErrors", &RcvbufErrors, NULL);
2934 + rrd_stats_dimension_set(st, "SndbufErrors", &SndbufErrors, NULL);
2935 + rrd_stats_done(st);
2936 }
2937 }
2938
@@ -2973,7 +3094,7 @@ int do_proc_net_stat_conntrack() {
3094 return 1;
3095 }
3096
2976 - // read the discard the header
3097 + // read and discard the header
3098 char *p = fgets(buffer, MAX_PROC_NET_STAT_CONNTRACK_LINE, fp);
3099
3100 unsigned long long aentries = 0, asearched = 0, afound = 0, anew = 0, ainvalid = 0, aignore = 0, adelete = 0, adelete_list = 0,
@@ -2994,22 +3115,22 @@ int do_proc_net_stat_conntrack() {
3115 if(!aentries) aentries = tentries;
3116
3117 // sum all the cpus together
2997 - asearched += tsearched;
2998 - afound += tfound;
2999 - anew += tnew;
3000 - ainvalid += tinvalid;
3001 - aignore += tignore;
3002 - adelete += tdelete;
3003 - adelete_list += tdelete_list;
3004 - ainsert += tinsert;
3005 - ainsert_failed += tinsert_failed;
3006 - adrop += tdrop;
3007 - aearly_drop += tearly_drop;
3008 - aicmp_error += ticmp_error;
3009 - aexpect_new += texpect_new;
3010 - aexpect_create += texpect_create;
3011 - aexpect_delete += texpect_delete;
3012 - asearch_restart += tsearch_restart;
3118 + asearched += tsearched; // conntrack.search
3119 + afound += tfound; // conntrack.search
3120 + anew += tnew; // conntrack.new
3121 + ainvalid += tinvalid; // conntrack.new
3122 + aignore += tignore; // conntrack.new
3123 + adelete += tdelete; // conntrack.changes
3124 + adelete_list += tdelete_list; // conntrack.changes
3125 + ainsert += tinsert; // conntrack.changes
3126 + ainsert_failed += tinsert_failed; // conntrack.errors
3127 + adrop += tdrop; // conntrack.errors
3128 + aearly_drop += tearly_drop; // conntrack.errors
3129 + aicmp_error += ticmp_error; // conntrack.errors
3130 + aexpect_new += texpect_new; // conntrack.expect
3131 + aexpect_create += texpect_create; // conntrack.expect
3132 + aexpect_delete += texpect_delete; // conntrack.expect
3133 + asearch_restart += tsearch_restart; // conntrack.search
3134 }
3135 fclose(fp);
3136
@@ -3033,28 +3154,88 @@ int do_proc_net_stat_conntrack() {
3154 st = rrd_stats_create(RRD_TYPE_NET_STAT_CONNTRACK, "new", NULL, RRD_TYPE_NET_STAT_CONNTRACK, "Netfilter New Connections", "connections/s", save_history);
3155
3156 rrd_stats_dimension_add(st, "new", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3036 - rrd_stats_dimension_add(st, "dropped", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3157 + rrd_stats_dimension_add(st, "ignore", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3158 + rrd_stats_dimension_add(st, "invalid", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3159 }
3160 else rrd_stats_next(st);
3161
3162 rrd_stats_dimension_set(st, "new", &anew, NULL);
3041 - rrd_stats_dimension_set(st, "dropped", &adrop, NULL);
3163 + rrd_stats_dimension_set(st, "ignore", &aignore, NULL);
3164 + rrd_stats_dimension_set(st, "invalid", &ainvalid, NULL);
3165 rrd_stats_done(st);
3166
3167 // --------------------------------------------------------------------
3168
3169 st = rrd_stats_find(RRD_TYPE_NET_STAT_CONNTRACK ".changes");
3170 if(!st) {
3048 - st = rrd_stats_create(RRD_TYPE_NET_STAT_CONNTRACK, "changes", NULL, RRD_TYPE_NET_STAT_CONNTRACK, "Netfilter Connection Changes", "connections/s", save_history);
3171 + st = rrd_stats_create(RRD_TYPE_NET_STAT_CONNTRACK, "changes", NULL, RRD_TYPE_NET_STAT_CONNTRACK, "Netfilter Connection Changes", "changes/s", save_history);
3172 st->isdetail = 1;
3173
3174 rrd_stats_dimension_add(st, "inserted", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3175 rrd_stats_dimension_add(st, "deleted", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3176 + rrd_stats_dimension_add(st, "delete_list", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3177 }
3178 else rrd_stats_next(st);
3179
3180 rrd_stats_dimension_set(st, "inserted", &ainsert, NULL);
3181 rrd_stats_dimension_set(st, "deleted", &adelete, NULL);
3182 + rrd_stats_dimension_set(st, "delete_list", &adelete_list, NULL);
3183 + rrd_stats_done(st);
3184 +
3185 + // --------------------------------------------------------------------
3186 +
3187 + st = rrd_stats_find(RRD_TYPE_NET_STAT_CONNTRACK ".expect");
3188 + if(!st) {
3189 + st = rrd_stats_create(RRD_TYPE_NET_STAT_CONNTRACK, "expect", NULL, RRD_TYPE_NET_STAT_CONNTRACK, "Netfilter Connection Expectations", "expectations/s", save_history);
3190 + st->isdetail = 1;
3191 +
3192 + rrd_stats_dimension_add(st, "created", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3193 + rrd_stats_dimension_add(st, "deleted", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3194 + rrd_stats_dimension_add(st, "new", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3195 + }
3196 + else rrd_stats_next(st);
3197 +
3198 + rrd_stats_dimension_set(st, "created", &aexpect_create, NULL);
3199 + rrd_stats_dimension_set(st, "deleted", &aexpect_delete, NULL);
3200 + rrd_stats_dimension_set(st, "new", &aexpect_new, NULL);
3201 + rrd_stats_done(st);
3202 +
3203 + // --------------------------------------------------------------------
3204 +
3205 + st = rrd_stats_find(RRD_TYPE_NET_STAT_CONNTRACK ".search");
3206 + if(!st) {
3207 + st = rrd_stats_create(RRD_TYPE_NET_STAT_CONNTRACK, "search", NULL, RRD_TYPE_NET_STAT_CONNTRACK, "Netfilter Connection Searches", "searches/s", save_history);
3208 + st->isdetail = 1;
3209 +
3210 + rrd_stats_dimension_add(st, "searched", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3211 + rrd_stats_dimension_add(st, "restarted", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3212 + rrd_stats_dimension_add(st, "found", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3213 + }
3214 + else rrd_stats_next(st);
3215 +
3216 + rrd_stats_dimension_set(st, "searched", &asearched, NULL);
3217 + rrd_stats_dimension_set(st, "restarted", &asearch_restart, NULL);
3218 + rrd_stats_dimension_set(st, "found", &afound, NULL);
3219 + rrd_stats_done(st);
3220 +
3221 + // --------------------------------------------------------------------
3222 +
3223 + st = rrd_stats_find(RRD_TYPE_NET_STAT_CONNTRACK ".errors");
3224 + if(!st) {
3225 + st = rrd_stats_create(RRD_TYPE_NET_STAT_CONNTRACK, "errors", NULL, RRD_TYPE_NET_STAT_CONNTRACK, "Netfilter Errors", "events/s", save_history);
3226 + st->isdetail = 1;
3227 +
3228 + rrd_stats_dimension_add(st, "icmp_error", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3229 + rrd_stats_dimension_add(st, "insert_failed", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3230 + rrd_stats_dimension_add(st, "drop", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3231 + rrd_stats_dimension_add(st, "early_drop", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3232 + }
3233 + else rrd_stats_next(st);
3234 +
3235 + rrd_stats_dimension_set(st, "icmp_error", &aicmp_error, NULL);
3236 + rrd_stats_dimension_set(st, "insert_failed", &ainsert_failed, NULL);
3237 + rrd_stats_dimension_set(st, "drop", &adrop, NULL);
3238 + rrd_stats_dimension_set(st, "early_drop", &aearly_drop, NULL);
3239 rrd_stats_done(st);
3240
3241 return 0;
@@ -3103,6 +3284,8 @@ int do_proc_net_ip_vs_stats() {
3284
3285 fclose(fp);
3286
3287 + // --------------------------------------------------------------------
3288 +
3289 RRD_STATS *st = rrd_stats_find(RRD_TYPE_NET_IPVS ".sockets");
3290 if(!st) {
3291 st = rrd_stats_create(RRD_TYPE_NET_IPVS, "sockets", NULL, RRD_TYPE_NET_IPVS, "IPVS New Connections", "connections/s", save_history);
@@ -3114,6 +3297,8 @@ int do_proc_net_ip_vs_stats() {
3297 rrd_stats_dimension_set(st, "connections", &entries, NULL);
3298 rrd_stats_done(st);
3299
3300 + // --------------------------------------------------------------------
3301 +
3302 st = rrd_stats_find(RRD_TYPE_NET_IPVS ".packets");
3303 if(!st) {
3304 st = rrd_stats_create(RRD_TYPE_NET_IPVS, "packets", NULL, RRD_TYPE_NET_IPVS, "IPVS Packets", "packets/s", save_history);
@@ -3127,6 +3312,8 @@ int do_proc_net_ip_vs_stats() {
3312 rrd_stats_dimension_set(st, "sent", &OutPackets, NULL);
3313 rrd_stats_done(st);
3314
3315 + // --------------------------------------------------------------------
3316 +
3317 st = rrd_stats_find(RRD_TYPE_NET_IPVS ".net");
3318 if(!st) {
3319 st = rrd_stats_create(RRD_TYPE_NET_IPVS, "net", NULL, RRD_TYPE_NET_IPVS, "IPVS Bandwidth", "kilobits/s", save_history);
@@ -3152,6 +3339,8 @@ int do_proc_stat() {
3339 return 1;
3340 }
3341
3342 + unsigned long long processes = 0, running = 0 , blocked = 0;
3343 +
3344 for(;1;) {
3345 char *p = fgets(buffer, MAX_PROC_STAT_LINE, fp);
3346 if(!p) break;
@@ -3216,6 +3405,8 @@ int do_proc_stat() {
3405 if(r == EOF) break;
3406 if(r != 2) error("Cannot read /proc/stat intr line. Expected 2 params, read %d.", r);
3407
3408 + // --------------------------------------------------------------------
3409 +
3410 RRD_STATS *st = rrd_stats_find_bytype("system", id);
3411 if(!st) {
3412 st = rrd_stats_create("system", id, NULL, "cpu", "CPU Interrupts", "interrupts/s", save_history);
@@ -3236,6 +3427,8 @@ int do_proc_stat() {
3427 if(r == EOF) break;
3428 if(r != 2) error("Cannot read /proc/stat ctxt line. Expected 2 params, read %d.", r);
3429
3430 + // --------------------------------------------------------------------
3431 +
3432 RRD_STATS *st = rrd_stats_find_bytype("system", id);
3433 if(!st) {
3434 st = rrd_stats_create("system", id, NULL, "cpu", "CPU Context Switches", "context switches/s", save_history);
@@ -3256,16 +3449,7 @@ int do_proc_stat() {
3449 if(r == EOF) break;
3450 if(r != 2) error("Cannot read /proc/stat processes line. Expected 2 params, read %d.", r);
3451
3259 - RRD_STATS *st = rrd_stats_find_bytype("system", id);
3260 - if(!st) {
3261 - st = rrd_stats_create("system", id, NULL, "cpu", "New Processes", "new processes/s", save_history);
3262 -
3263 - rrd_stats_dimension_add(st, "started", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3264 - }
3265 - else rrd_stats_next(st);
3266 -
3267 - rrd_stats_dimension_set(st, "started", &value, NULL);
3268 - rrd_stats_done(st);
3452 + processes = value;
3453 }
3454 else if(strncmp(p, "procs_running ", 14) == 0) {
3455 char id[MAX_PROC_STAT_NAME + 1] = "";
@@ -3274,22 +3458,51 @@ int do_proc_stat() {
3458
3459 int r = sscanf(buffer, "%s %llu ", id, &value);
3460 if(r == EOF) break;
3277 - if(r != 2) error("Cannot read /proc/stat processes line. Expected 2 params, read %d.", r);
3461 + if(r != 2) error("Cannot read /proc/stat procs_running line. Expected 2 params, read %d.", r);
3462
3279 - RRD_STATS *st = rrd_stats_find_bytype("system", id);
3280 - if(!st) {
3281 - st = rrd_stats_create("system", id, NULL, "cpu", "CPU Running Processes", "processes running", save_history);
3463 + running = value;
3464 + }
3465 + else if(strncmp(p, "procs_blocked ", 14) == 0) {
3466 + char id[MAX_PROC_STAT_NAME + 1] = "procs_running";
3467
3283 - rrd_stats_dimension_add(st, "running", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
3284 - }
3285 - else rrd_stats_next(st);
3468 + unsigned long long value;
3469
3287 - rrd_stats_dimension_set(st, "running", &value, NULL);
3288 - rrd_stats_done(st);
3470 + int r = sscanf(buffer, "%s %llu ", id, &value);
3471 + if(r == EOF) break;
3472 + if(r != 2) error("Cannot read /proc/stat procs_blocked line. Expected 2 params, read %d.", r);
3473 +
3474 + blocked = value;
3475 }
3476 }
3291 -
3477 fclose(fp);
3478 +
3479 + // --------------------------------------------------------------------
3480 +
3481 + RRD_STATS *st = rrd_stats_find_bytype("system", "forks");
3482 + if(!st) {
3483 + st = rrd_stats_create("system", "forks", NULL, "cpu", "New Processes", "processes/s", save_history);
3484 +
3485 + rrd_stats_dimension_add(st, "started", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3486 + }
3487 + else rrd_stats_next(st);
3488 +
3489 + rrd_stats_dimension_set(st, "started", &processes, NULL);
3490 + rrd_stats_done(st);
3491 +
3492 + // --------------------------------------------------------------------
3493 +
3494 + st = rrd_stats_find_bytype("system", "processes");
3495 + if(!st) {
3496 + st = rrd_stats_create("system", "processes", NULL, "cpu", "Processes", "processes", save_history);
3497 +
3498 + rrd_stats_dimension_add(st, "running", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
3499 + rrd_stats_dimension_add(st, "blocked", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
3500 + }
3501 + else rrd_stats_next(st);
3502 +
3503 + rrd_stats_dimension_set(st, "running", &running, NULL);
3504 + rrd_stats_dimension_set(st, "blocked", &blocked, NULL);
3505 + rrd_stats_done(st);
3506 return 0;
3507 }
3508
@@ -3377,6 +3590,8 @@ int do_proc_meminfo() {
3590 }
3591 fclose(fp);
3592
3593 + // --------------------------------------------------------------------
3594 +
3595 // http://stackoverflow.com/questions/3019748/how-to-reliably-measure-available-memory-in-linux
3596 MemUsed = MemTotal - MemFree - Cached - Buffers;
3597
@@ -3539,6 +3754,8 @@ int do_proc_vmstat() {
3754 }
3755 fclose(fp);
3756
3757 + // --------------------------------------------------------------------
3758 +
3759 RRD_STATS *st = rrd_stats_find("system.swapio");
3760 if(!st) {
3761 st = rrd_stats_create("system", "swapio", NULL, "mem", "Swap I/O", "kilobytes/s", save_history);
@@ -3552,6 +3769,8 @@ int do_proc_vmstat() {
3769 rrd_stats_dimension_set(st, "out", &pswpout, NULL);
3770 rrd_stats_done(st);
3771
3772 + // --------------------------------------------------------------------
3773 +
3774 st = rrd_stats_find("system.io");
3775 if(!st) {
3776 st = rrd_stats_create("system", "io", NULL, "disk", "Disk I/O", "kilobytes/s", save_history);
web/index.html
+4 -1
@@ -56,6 +56,9 @@
56 function showChartIsLoading(id, width, height) { document.getElementById(id).innerHTML = chartIsLoadingHTML(width, height); }
57
58 function thumbChartActions(i, c, nogroup) {
59 + var name = c.name;
60 + if(!nogroup) name = c.group_tag;
61 +
62 var refinfo = "the chart is drawing ";
63 if(c.group == 1) refinfo += "every single point collected.";
64 else refinfo += ((c.group_method == "average")?"the average":"the max") + " value for every " + (c.group * c.update_every) + " seconds of data";
@@ -63,7 +66,7 @@
66 var html = "<div class=\"btn-group btn-group\" data-toggle=\"tooltip\" title=\"" + refinfo + "\">"
67 + "<button type=\"button\" class=\"btn btn-default\" onclick=\"javascript: return;\"><span class=\"glyphicon glyphicon-info-sign\"></span></button>"
68 + "</div>"
66 - + "<div class=\"btn-group btn-group\"><button type=\"button\" class=\"btn btn-default disabled\"><small>&nbsp;&nbsp; " + c.name + "</small></button>";
69 + + "<div class=\"btn-group btn-group\"><button type=\"button\" class=\"btn btn-default disabled\"><small>&nbsp;&nbsp; " + name + "</small></button>";
70
71 if(!nogroup) {
72 var ingroup = 0;