more config options
Costa Tsaousis (ktsaou) committed
Apr 27, 2014 at 06:20 UTC
a2a9e9154fdffaaca15a94af7c937c1568e5c53a
2 files changed
+505
-339
netdata.c
+504
-338
@@ -151,6 +151,16 @@ unsigned long long usecdiff(struct timeval *now, struct timeval *last) {
151
return ((((now->tv_sec * 1000000L) + now->tv_usec) - ((last->tv_sec * 1000000L) + last->tv_usec)));
152
}
153
154
+unsigned long simple_hash(const char *name)
155
+{
156
+ int i, len = strlen(name);
157
+ unsigned long hash = 0;
158
+
159
+ for(i = 0; i < len ;i++) hash += (i * name[i]) + i + name[i];
160
+
161
+ return hash;
162
+}
163
+
164
// ----------------------------------------------------------------------------
165
// LOG
166
@@ -357,6 +367,9 @@ struct config_value {
367
char name[CONFIG_MAX_NAME + 1];
368
char value[CONFIG_MAX_VALUE + 1];
369
370
+ unsigned long hash; // a simple hash to speed up searching
371
+ // we first compare hashes, and only if the hashes are equal we do string comparisons
372
+
373
int used;
374
375
struct config_value *next;
@@ -365,12 +378,14 @@ struct config_value {
378
struct config {
379
char name[CONFIG_MAX_NAME + 1];
380
381
+ unsigned long hash; // a simple hash to speed up searching
382
+ // we first compare hashes, and only if the hashes are equal we do string comparisons
383
+
384
struct config_value *values;
385
386
struct config *next;
387
} *config_root = NULL;
388
373
-
389
struct config_value *config_value_create(struct config *co, char *name, char *value)
390
{
391
debug(D_CONFIG, "Creating config entry for name '%s', value '%s', in section '%s'.", name, value, co->name);
@@ -380,6 +395,7 @@ struct config_value *config_value_create(struct config *co, char *name, char *va
395
396
strncpy(cv->name, name, CONFIG_MAX_NAME);
397
strncpy(cv->value, value, CONFIG_MAX_VALUE);
398
+ cv->hash = simple_hash(cv->name);
399
400
// no need for string termination, due to calloc()
401
@@ -401,6 +417,7 @@ struct config *config_create(char *section)
417
if(!co) fatal("Cannot allocate config");
418
419
strncpy(co->name, section, CONFIG_MAX_NAME);
420
+ co->hash = simple_hash(co->name);
421
422
// no need for string termination, due to calloc()
423
@@ -417,9 +434,12 @@ struct config *config_create(char *section)
434
struct config *config_find_section(char *section)
435
{
436
struct config *co;
437
+ unsigned long hash = simple_hash(section);
438
439
for(co = config_root; co ; co = co->next)
422
- if(strcmp(co->name, section) == 0) break;
440
+ if(hash == co->hash)
441
+ if(strcmp(co->name, section) == 0)
442
+ break;
443
444
return co;
445
}
@@ -533,13 +553,18 @@ char *config_get(char *section, char *name, char *default_value)
553
{
554
struct config_value *cv;
555
556
+ debug(D_CONFIG, "request to get config in section '%s', name '%s', default_value '%s'", section, name, default_value);
557
+
558
pthread_mutex_lock(&config_mutex);
559
560
struct config *co = config_find_section(section);
561
if(!co) co = config_create(section);
562
563
+ unsigned long hash = simple_hash(name);
564
for(cv = co->values; cv ; cv = cv->next)
542
- if(strcmp(cv->name, name) == 0) break;
565
+ if(hash == cv->hash)
566
+ if(strcmp(cv->name, name) == 0)
567
+ break;
568
569
if(!cv) cv = config_value_create(co, name, default_value);
570
cv->used = 1;
@@ -579,13 +604,18 @@ void config_set(char *section, char *name, char *value)
604
{
605
struct config_value *cv;
606
607
+ debug(D_CONFIG, "request to set config in section '%s', name '%s', value '%s'", section, name, value);
608
+
609
pthread_mutex_lock(&config_mutex);
610
611
struct config *co = config_find_section(section);
612
if(!co) co = config_create(section);
613
614
+ unsigned long hash = simple_hash(name);
615
for(cv = co->values; cv ; cv = cv->next)
588
- if(strcmp(cv->name, name) == 0) break;
616
+ if(hash == cv->hash)
617
+ if(strcmp(cv->name, name) == 0)
618
+ break;
619
620
if(!cv) cv = config_value_create(co, name, value);
621
cv->used = 1;
@@ -625,6 +655,9 @@ struct rrd_dimension {
655
char id[RRD_STATS_NAME_MAX + 1]; // the id of this dimension (for internal identification)
656
char name[RRD_STATS_NAME_MAX + 1]; // the name of this dimension (as presented to user)
657
658
+ unsigned long hash; // a simple hash on the id, to speed up searching
659
+ // we first compare hashes, and only if the hashes are equal we do string comparisons
660
+
661
int issigned; // if true, the values are signed
662
663
size_t bytes; // how many bytes each value has, e.g. sizeof(long)
@@ -655,6 +688,9 @@ struct rrd_stats {
688
char id[RRD_STATS_NAME_MAX + 1]; // id of the data set
689
char name[RRD_STATS_NAME_MAX + 1]; // name of the data set
690
691
+ unsigned long hash; // a simple hash on the id, to speed up searching
692
+ // we first compare hashes, and only if the hashes are equal we do string comparisons
693
+
694
char type[RRD_STATS_NAME_MAX + 1]; // the type of graph RRD_TYPE_* (a category, for determining graphing options)
695
char group[RRD_STATS_NAME_MAX + 1]; // the group of this data set (for grouping them together)
696
@@ -710,6 +746,7 @@ RRD_STATS *rrd_stats_create(const char *type, const char *id, const char *name,
746
strcat(st->id, ".");
747
int len = strlen(st->id);
748
strncpy(&st->id[len], id, RRD_STATS_NAME_MAX - len);
749
+ st->hash = simple_hash(st->id);
750
751
if(name) {
752
strncpy(st->name, type, RRD_STATS_NAME_MAX - 1);
@@ -807,6 +844,7 @@ RRD_DIMENSION *rrd_stats_dimension_add(RRD_STATS *st, const char *id, const char
844
// no need to terminate the strings after strncpy(), because of calloc()
845
846
strncpy(rd->id, id, RRD_STATS_NAME_MAX);
847
+ rd->hash = simple_hash(rd->id);
848
849
if(name) strncpy(rd->name, name, RRD_STATS_NAME_MAX);
850
else strncpy(rd->name, id, RRD_STATS_NAME_MAX);
@@ -836,13 +874,16 @@ void rrd_stats_dimension_free(RRD_DIMENSION *rd)
874
875
RRD_STATS *rrd_stats_find(const char *id)
876
{
877
+ unsigned long hash = simple_hash(id);
878
+
879
pthread_mutex_lock(&root_mutex);
880
881
RRD_STATS *st = root;
882
843
- for ( ; st ; st = st->next ) {
844
- if(strcmp(st->id, id) == 0) break;
845
- }
883
+ for ( ; st ; st = st->next )
884
+ if(hash == st->hash)
885
+ if(strcmp(st->id, id) == 0)
886
+ break;
887
888
pthread_mutex_unlock(&root_mutex);
889
return(st);
@@ -878,11 +919,14 @@ RRD_STATS *rrd_stats_find_byname(const char *name)
919
920
RRD_DIMENSION *rrd_stats_dimension_find(RRD_STATS *st, const char *id)
921
{
922
+ unsigned long hash = simple_hash(id);
923
+
924
RRD_DIMENSION *rd = st->dimensions;
925
883
- for ( ; rd ; rd = rd->next ) {
884
- if(strcmp(rd->id, id) == 0) break;
885
- }
926
+ for ( ; rd ; rd = rd->next )
927
+ if(hash == rd->hash)
928
+ if(strcmp(rd->id, id) == 0)
929
+ break;
930
931
return(rd);
932
}
@@ -2817,6 +2861,14 @@ void *socket_listen_main(void *ptr)
2861
#define MAX_PROC_NET_DEV_IFACE_NAME 1024
2862
2863
int do_proc_net_dev() {
2864
+ static int do_bandwidth = -1, do_packets = -1, do_errors = -1, do_fifo = -1, do_compressed = -1;
2865
+
2866
+ if(do_bandwidth == -1) do_bandwidth = config_get_boolean("plugin:proc:/proc/net/dev", "bandwidth", 1);
2867
+ if(do_packets == -1) do_packets = config_get_boolean("plugin:proc:/proc/net/dev", "packets", 1);
2868
+ if(do_errors == -1) do_errors = config_get_boolean("plugin:proc:/proc/net/dev", "errors", 1);
2869
+ if(do_fifo == -1) do_fifo = config_get_boolean("plugin:proc:/proc/net/dev", "fifo", 1);
2870
+ if(do_compressed == -1) do_compressed = config_get_boolean("plugin:proc:/proc/net/dev", "compressed", 1);
2871
+
2872
char buffer[MAX_PROC_NET_DEV_LINE+1] = "";
2873
char iface[MAX_PROC_NET_DEV_IFACE_NAME + 1] = "";
2874
unsigned long long rbytes, rpackets, rerrors, rdrops, rfifo, rframe, rcompressed, rmulticast;
@@ -2854,84 +2906,103 @@ int do_proc_net_dev() {
2906
continue;
2907
}
2908
2909
+ // check if it is enabled
2910
+ {
2911
+ char var_name[4096 + 1];
2912
+ snprintf(var_name, 4096, "interface %s", iface);
2913
+ if(!config_get_boolean("plugin:proc:/proc/net/dev", var_name, 1)) continue;
2914
+ }
2915
+
2916
+ RRD_STATS *st;
2917
+
2918
// --------------------------------------------------------------------
2919
2859
- RRD_STATS *st = rrd_stats_find_bytype(RRD_TYPE_NET, iface);
2860
- if(!st) {
2861
- st = rrd_stats_create(RRD_TYPE_NET, iface, NULL, iface, "Bandwidth", "kilobits/s", 1000);
2920
+ if(do_bandwidth) {
2921
+ st = rrd_stats_find_bytype(RRD_TYPE_NET, iface);
2922
+ if(!st) {
2923
+ st = rrd_stats_create(RRD_TYPE_NET, iface, NULL, iface, "Bandwidth", "kilobits/s", 1000);
2924
2863
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
2864
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
2865
- }
2866
- else rrd_stats_next(st);
2925
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
2926
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
2927
+ }
2928
+ else rrd_stats_next(st);
2929
2868
- rrd_stats_dimension_set(st, "received", &rbytes, NULL);
2869
- rrd_stats_dimension_set(st, "sent", &tbytes, NULL);
2870
- rrd_stats_done(st);
2930
+ rrd_stats_dimension_set(st, "received", &rbytes, NULL);
2931
+ rrd_stats_dimension_set(st, "sent", &tbytes, NULL);
2932
+ rrd_stats_done(st);
2933
+ }
2934
2935
// --------------------------------------------------------------------
2936
2874
- st = rrd_stats_find_bytype("net_packets", iface);
2875
- if(!st) {
2876
- st = rrd_stats_create("net_packets", iface, NULL, iface, "Packets", "packets/s", 1001);
2877
- st->isdetail = 1;
2937
+ if(do_packets) {
2938
+ st = rrd_stats_find_bytype("net_packets", iface);
2939
+ if(!st) {
2940
+ st = rrd_stats_create("net_packets", iface, NULL, iface, "Packets", "packets/s", 1001);
2941
+ st->isdetail = 1;
2942
2879
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2880
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2881
- }
2882
- else rrd_stats_next(st);
2943
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2944
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2945
+ }
2946
+ else rrd_stats_next(st);
2947
2884
- rrd_stats_dimension_set(st, "received", &rpackets, NULL);
2885
- rrd_stats_dimension_set(st, "sent", &tpackets, NULL);
2886
- rrd_stats_done(st);
2948
+ rrd_stats_dimension_set(st, "received", &rpackets, NULL);
2949
+ rrd_stats_dimension_set(st, "sent", &tpackets, NULL);
2950
+ rrd_stats_done(st);
2951
+ }
2952
2953
// --------------------------------------------------------------------
2954
2890
- st = rrd_stats_find_bytype("net_errors", iface);
2891
- if(!st) {
2892
- st = rrd_stats_create("net_errors", iface, NULL, iface, "Interface Errors", "errors/s", 1002);
2893
- st->isdetail = 1;
2955
+ if(do_errors) {
2956
+ st = rrd_stats_find_bytype("net_errors", iface);
2957
+ if(!st) {
2958
+ st = rrd_stats_create("net_errors", iface, NULL, iface, "Interface Errors", "errors/s", 1002);
2959
+ st->isdetail = 1;
2960
2895
- rrd_stats_dimension_add(st, "receive", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2896
- rrd_stats_dimension_add(st, "transmit", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2897
- }
2898
- else rrd_stats_next(st);
2961
+ rrd_stats_dimension_add(st, "receive", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2962
+ rrd_stats_dimension_add(st, "transmit", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2963
+ }
2964
+ else rrd_stats_next(st);
2965
2900
- rrd_stats_dimension_set(st, "receive", &rerrors, NULL);
2901
- rrd_stats_dimension_set(st, "transmit", &terrors, NULL);
2902
- rrd_stats_done(st);
2966
+ rrd_stats_dimension_set(st, "receive", &rerrors, NULL);
2967
+ rrd_stats_dimension_set(st, "transmit", &terrors, NULL);
2968
+ rrd_stats_done(st);
2969
+ }
2970
2971
// --------------------------------------------------------------------
2972
2906
- st = rrd_stats_find_bytype("net_fifo", iface);
2907
- if(!st) {
2908
- st = rrd_stats_create("net_fifo", iface, NULL, iface, "Interface Queue", "packets", 1100);
2909
- st->isdetail = 1;
2973
+ if(do_fifo) {
2974
+ st = rrd_stats_find_bytype("net_fifo", iface);
2975
+ if(!st) {
2976
+ st = rrd_stats_create("net_fifo", iface, NULL, iface, "Interface Queue", "packets", 1100);
2977
+ st->isdetail = 1;
2978
2911
- rrd_stats_dimension_add(st, "receive", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
2912
- rrd_stats_dimension_add(st, "transmit", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
2913
- }
2914
- else rrd_stats_next(st);
2979
+ rrd_stats_dimension_add(st, "receive", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
2980
+ rrd_stats_dimension_add(st, "transmit", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
2981
+ }
2982
+ else rrd_stats_next(st);
2983
2916
- rrd_stats_dimension_set(st, "receive", &rfifo, NULL);
2917
- rrd_stats_dimension_set(st, "transmit", &tfifo, NULL);
2918
- rrd_stats_done(st);
2984
+ rrd_stats_dimension_set(st, "receive", &rfifo, NULL);
2985
+ rrd_stats_dimension_set(st, "transmit", &tfifo, NULL);
2986
+ rrd_stats_done(st);
2987
+ }
2988
2989
// --------------------------------------------------------------------
2990
2922
- st = rrd_stats_find_bytype("net_compressed", iface);
2923
- if(!st) {
2924
- st = rrd_stats_create("net_compressed", iface, NULL, iface, "Compressed Packets", "packets/s", 1200);
2925
- st->isdetail = 1;
2991
+ if(do_compressed) {
2992
+ st = rrd_stats_find_bytype("net_compressed", iface);
2993
+ if(!st) {
2994
+ st = rrd_stats_create("net_compressed", iface, NULL, iface, "Compressed Packets", "packets/s", 1200);
2995
+ st->isdetail = 1;
2996
2927
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2928
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2929
- }
2930
- else rrd_stats_next(st);
2997
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2998
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
2999
+ }
3000
+ else rrd_stats_next(st);
3001
2932
- rrd_stats_dimension_set(st, "received", &rcompressed, NULL);
2933
- rrd_stats_dimension_set(st, "sent", &tcompressed, NULL);
2934
- rrd_stats_done(st);
3002
+ rrd_stats_dimension_set(st, "received", &rcompressed, NULL);
3003
+ rrd_stats_dimension_set(st, "sent", &tcompressed, NULL);
3004
+ rrd_stats_done(st);
3005
+ }
3006
}
3007
3008
fclose(fp);
@@ -2945,6 +3016,14 @@ int do_proc_net_dev() {
3016
#define MAX_PROC_DISKSTATS_DISK_NAME 1024
3017
3018
int do_proc_diskstats() {
3019
+ static int do_io = -1, do_ops = -1, do_merged_ops = -1, do_iotime = -1, do_cur_ops = -1;
3020
+
3021
+ if(do_io == -1) do_io = config_get_boolean("plugin:proc:/proc/diskstats", "bandwidth", 1);
3022
+ if(do_ops == -1) do_ops = config_get_boolean("plugin:proc:/proc/diskstats", "operations", 1);
3023
+ if(do_merged_ops == -1) do_merged_ops = config_get_boolean("plugin:proc:/proc/diskstats", "merged operations", 1);
3024
+ if(do_iotime == -1) do_iotime = config_get_boolean("plugin:proc:/proc/diskstats", "i/o time", 1);
3025
+ if(do_cur_ops == -1) do_cur_ops = config_get_boolean("plugin:proc:/proc/diskstats", "current operations", 1);
3026
+
3027
char buffer[MAX_PROC_DISKSTATS_LINE+1] = "";
3028
char disk[MAX_PROC_DISKSTATS_DISK_NAME + 1] = "";
3029
@@ -2976,6 +3055,8 @@ int do_proc_diskstats() {
3055
continue;
3056
}
3057
3058
+ int def_enabled = 0;
3059
+
3060
switch(major) {
3061
case 9: // MDs
3062
case 43: // network block
@@ -2985,6 +3066,7 @@ int do_proc_diskstats() {
3066
case 199: // veritas
3067
case 201: // veritas
3068
case 251: // dm
3069
+ def_enabled = 1;
3070
break;
3071
3072
case 48: // RAID
@@ -3006,7 +3088,8 @@ int do_proc_diskstats() {
3088
case 143: // RAID
3089
case 179: // MMC
3090
case 180: // USB
3009
- if(minor % 8) continue; // partitions
3091
+ if(minor % 8) def_enabled = 0; // partitions
3092
+ else def_enabled = 1;
3093
break;
3094
3095
case 8: // scsi disks
@@ -3057,12 +3140,14 @@ int do_proc_diskstats() {
3140
case 202: // xen
3141
case 256: // flash
3142
case 257: // flash
3060
- if(minor % 16) continue; // partitions
3143
+ if(minor % 16) def_enabled = 0; // partitions
3144
+ else def_enabled = 1;
3145
break;
3146
3147
case 160: // raid
3148
case 161: // raid
3065
- if(minor % 32) continue; // partitions
3149
+ if(minor % 32) def_enabled = 0; // partitions
3150
+ else def_enabled = 1;
3151
break;
3152
3153
case 3: // ide
@@ -3076,115 +3161,136 @@ int do_proc_diskstats() {
3161
case 89: // ide
3162
case 90: // ide
3163
case 91: // ide
3079
- if(minor % 64) continue; // partitions
3164
+ if(minor % 64) def_enabled = 0; // partitions
3165
+ else def_enabled = 1;
3166
break;
3167
3168
default:
3083
- continue;
3169
+ def_enabled = 0;
3170
+ break;
3171
+ }
3172
+
3173
+ // check if it is enabled
3174
+ {
3175
+ char var_name[4096 + 1];
3176
+ snprintf(var_name, 4096, "disk %s", disk);
3177
+ if(!config_get_boolean("plugin:proc:/proc/diskstats", var_name, def_enabled)) continue;
3178
}
3179
3180
+ RRD_STATS *st;
3181
+
3182
// --------------------------------------------------------------------
3183
3088
- RRD_STATS *st = rrd_stats_find_bytype(RRD_TYPE_DISK, disk);
3089
- if(!st) {
3090
- char ssfilename[FILENAME_MAX + 1];
3091
- int sector_size = 512;
3092
-
3093
- sprintf(ssfilename, "/sys/block/%s/queue/hw_sector_size", disk);
3094
- FILE *fpss = fopen(ssfilename, "r");
3095
- if(fpss) {
3096
- char ssbuffer[1025];
3097
- char *tmp = fgets(ssbuffer, 1024, fpss);
3098
-
3099
- if(tmp) {
3100
- sector_size = atoi(tmp);
3101
- if(sector_size <= 0) {
3102
- error("Invalid sector size %d for device %s in %s. Assuming 512.", sector_size, disk, ssfilename);
3103
- sector_size = 512;
3184
+ if(do_io) {
3185
+ st = rrd_stats_find_bytype(RRD_TYPE_DISK, disk);
3186
+ if(!st) {
3187
+ char ssfilename[FILENAME_MAX + 1];
3188
+ int sector_size = 512;
3189
+
3190
+ sprintf(ssfilename, "/sys/block/%s/queue/hw_sector_size", disk);
3191
+ FILE *fpss = fopen(ssfilename, "r");
3192
+ if(fpss) {
3193
+ char ssbuffer[1025];
3194
+ char *tmp = fgets(ssbuffer, 1024, fpss);
3195
+
3196
+ if(tmp) {
3197
+ sector_size = atoi(tmp);
3198
+ if(sector_size <= 0) {
3199
+ error("Invalid sector size %d for device %s in %s. Assuming 512.", sector_size, disk, ssfilename);
3200
+ sector_size = 512;
3201
+ }
3202
}
3203
+ else error("Cannot read data for sector size for device %s from %s. Assuming 512.", disk, ssfilename);
3204
+
3205
+ fclose(fpss);
3206
}
3106
- else error("Cannot read data for sector size for device %s from %s. Assuming 512.", disk, ssfilename);
3207
+ else error("Cannot read sector size for device %s from %s. Assuming 512.", disk, ssfilename);
3208
3108
- fclose(fpss);
3109
- }
3110
- else error("Cannot read sector size for device %s from %s. Assuming 512.", disk, ssfilename);
3209
+ st = rrd_stats_create(RRD_TYPE_DISK, disk, NULL, disk, "Disk I/O", "kilobytes/s", 2000);
3210
3112
- st = rrd_stats_create(RRD_TYPE_DISK, disk, NULL, disk, "Disk I/O", "kilobytes/s", 2000);
3211
+ rrd_stats_dimension_add(st, "reads", NULL, sizeof(unsigned long long), 0, sector_size, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3212
+ rrd_stats_dimension_add(st, "writes", NULL, sizeof(unsigned long long), 0, sector_size * -1, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3213
+ }
3214
+ else rrd_stats_next(st);
3215
3114
- rrd_stats_dimension_add(st, "reads", NULL, sizeof(unsigned long long), 0, sector_size, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3115
- rrd_stats_dimension_add(st, "writes", NULL, sizeof(unsigned long long), 0, sector_size * -1, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3216
+ rrd_stats_dimension_set(st, "reads", &readsectors, NULL);
3217
+ rrd_stats_dimension_set(st, "writes", &writesectors, NULL);
3218
+ rrd_stats_done(st);
3219
}
3117
- else rrd_stats_next(st);
3118
-
3119
- rrd_stats_dimension_set(st, "reads", &readsectors, NULL);
3120
- rrd_stats_dimension_set(st, "writes", &writesectors, NULL);
3121
- rrd_stats_done(st);
3220
3221
// --------------------------------------------------------------------
3222
3125
- st = rrd_stats_find_bytype("disk_ops", disk);
3126
- if(!st) {
3127
- st = rrd_stats_create("disk_ops", disk, NULL, disk, "Disk Operations", "operations/s", 2001);
3128
- st->isdetail = 1;
3129
-
3130
- rrd_stats_dimension_add(st, "reads", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3131
- rrd_stats_dimension_add(st, "writes", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3132
- }
3133
- else rrd_stats_next(st);
3223
+ if(do_ops) {
3224
+ st = rrd_stats_find_bytype("disk_ops", disk);
3225
+ if(!st) {
3226
+ st = rrd_stats_create("disk_ops", disk, NULL, disk, "Disk Operations", "operations/s", 2001);
3227
+ st->isdetail = 1;
3228
3135
- rrd_stats_dimension_set(st, "reads", &reads, NULL);
3136
- rrd_stats_dimension_set(st, "writes", &writes, NULL);
3137
- rrd_stats_done(st);
3229
+ rrd_stats_dimension_add(st, "reads", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3230
+ rrd_stats_dimension_add(st, "writes", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3231
+ }
3232
+ else rrd_stats_next(st);
3233
3234
+ rrd_stats_dimension_set(st, "reads", &reads, NULL);
3235
+ rrd_stats_dimension_set(st, "writes", &writes, NULL);
3236
+ rrd_stats_done(st);
3237
+ }
3238
+
3239
// --------------------------------------------------------------------
3240
3141
- st = rrd_stats_find_bytype("disk_merged_ops", disk);
3142
- if(!st) {
3143
- st = rrd_stats_create("disk_merged_ops", disk, NULL, disk, "Merged Disk Operations", "operations/s", 2010);
3144
- st->isdetail = 1;
3241
+ if(do_merged_ops) {
3242
+ st = rrd_stats_find_bytype("disk_merged_ops", disk);
3243
+ if(!st) {
3244
+ st = rrd_stats_create("disk_merged_ops", disk, NULL, disk, "Merged Disk Operations", "operations/s", 2010);
3245
+ st->isdetail = 1;
3246
3146
- rrd_stats_dimension_add(st, "reads", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3147
- rrd_stats_dimension_add(st, "writes", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3148
- }
3149
- else rrd_stats_next(st);
3247
+ rrd_stats_dimension_add(st, "reads", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3248
+ rrd_stats_dimension_add(st, "writes", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3249
+ }
3250
+ else rrd_stats_next(st);
3251
3151
- rrd_stats_dimension_set(st, "reads", &reads_merged, NULL);
3152
- rrd_stats_dimension_set(st, "writes", &writes_merged, NULL);
3153
- rrd_stats_done(st);
3252
+ rrd_stats_dimension_set(st, "reads", &reads_merged, NULL);
3253
+ rrd_stats_dimension_set(st, "writes", &writes_merged, NULL);
3254
+ rrd_stats_done(st);
3255
+ }
3256
3257
// --------------------------------------------------------------------
3258
3157
- st = rrd_stats_find_bytype("disk_iotime", disk);
3158
- if(!st) {
3159
- st = rrd_stats_create("disk_iotime", disk, NULL, disk, "Disk I/O Time", "milliseconds/s", 2005);
3160
- st->isdetail = 1;
3259
+ if(do_iotime) {
3260
+ st = rrd_stats_find_bytype("disk_iotime", disk);
3261
+ if(!st) {
3262
+ st = rrd_stats_create("disk_iotime", disk, NULL, disk, "Disk I/O Time", "milliseconds/s", 2005);
3263
+ st->isdetail = 1;
3264
3162
- rrd_stats_dimension_add(st, "reads", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3163
- rrd_stats_dimension_add(st, "writes", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3164
- rrd_stats_dimension_add(st, "latency", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3165
- rrd_stats_dimension_add(st, "weighted", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3166
- }
3167
- else rrd_stats_next(st);
3265
+ rrd_stats_dimension_add(st, "reads", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3266
+ rrd_stats_dimension_add(st, "writes", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3267
+ rrd_stats_dimension_add(st, "latency", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3268
+ rrd_stats_dimension_add(st, "weighted", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3269
+ }
3270
+ else rrd_stats_next(st);
3271
3169
- rrd_stats_dimension_set(st, "reads", &readms, NULL);
3170
- rrd_stats_dimension_set(st, "writes", &writems, NULL);
3171
- rrd_stats_dimension_set(st, "latency", &iosms, NULL);
3172
- rrd_stats_dimension_set(st, "weighted", &wiosms, NULL);
3173
- rrd_stats_done(st);
3272
+ rrd_stats_dimension_set(st, "reads", &readms, NULL);
3273
+ rrd_stats_dimension_set(st, "writes", &writems, NULL);
3274
+ rrd_stats_dimension_set(st, "latency", &iosms, NULL);
3275
+ rrd_stats_dimension_set(st, "weighted", &wiosms, NULL);
3276
+ rrd_stats_done(st);
3277
+ }
3278
3279
// --------------------------------------------------------------------
3280
3177
- st = rrd_stats_find_bytype("disk_cur_ops", disk);
3178
- if(!st) {
3179
- st = rrd_stats_create("disk_cur_ops", disk, NULL, disk, "Current Disk I/O operations", "operations", 2004);
3180
- st->isdetail = 1;
3281
+ if(do_cur_ops) {
3282
+ st = rrd_stats_find_bytype("disk_cur_ops", disk);
3283
+ if(!st) {
3284
+ st = rrd_stats_create("disk_cur_ops", disk, NULL, disk, "Current Disk I/O operations", "operations", 2004);
3285
+ st->isdetail = 1;
3286
3182
- rrd_stats_dimension_add(st, "operations", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
3183
- }
3184
- else rrd_stats_next(st);
3287
+ rrd_stats_dimension_add(st, "operations", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
3288
+ }
3289
+ else rrd_stats_next(st);
3290
3186
- rrd_stats_dimension_set(st, "operations", ¤tios, NULL);
3187
- rrd_stats_done(st);
3291
+ rrd_stats_dimension_set(st, "operations", ¤tios, NULL);
3292
+ rrd_stats_done(st);
3293
+ }
3294
}
3295
3296
fclose(fp);
@@ -3195,6 +3301,21 @@ int do_proc_diskstats() {
3301
// /proc/net/snmp processor
3302
3303
int do_proc_net_snmp() {
3304
+ static int do_ip_packets = -1, do_ip_fragsout = -1, do_ip_fragsin = -1, do_ip_errors = -1,
3305
+ do_tcp_sockets = -1, do_tcp_packets = -1, do_tcp_errors = -1, do_tcp_handshake = -1,
3306
+ do_udp_packets = -1, do_udp_errors = -1;
3307
+
3308
+ if(do_ip_packets == -1) do_ip_packets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 packets", 1);
3309
+ if(do_ip_fragsout == -1) do_ip_fragsout = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 fragrments sent", 1);
3310
+ if(do_ip_fragsin == -1) do_ip_fragsin = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 fragments assembly", 1);
3311
+ if(do_ip_errors == -1) do_ip_errors = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 errors", 1);
3312
+ if(do_tcp_sockets == -1) do_tcp_sockets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 TCP connections", 1);
3313
+ if(do_tcp_packets == -1) do_tcp_packets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 TCP packets", 1);
3314
+ if(do_tcp_errors == -1) do_tcp_errors = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 TCP errors", 1);
3315
+ if(do_tcp_handshake == -1) do_tcp_handshake = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 TCP handshake issues", 1);
3316
+ if(do_udp_packets == -1) do_udp_packets = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 UDP packets", 1);
3317
+ if(do_udp_errors == -1) do_udp_errors = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 UDP errors", 1);
3318
+
3319
char buffer[MAX_PROC_NET_SNMP_LINE+1] = "";
3320
3321
FILE *fp = fopen("/proc/net/snmp", "r");
@@ -3203,6 +3324,8 @@ int do_proc_net_snmp() {
3324
return 1;
3325
}
3326
3327
+ RRD_STATS *st;
3328
+
3329
for(;1;) {
3330
char *p = fgets(buffer, MAX_PROC_NET_SNMP_LINE, fp);
3331
if(!p) break;
@@ -3230,82 +3353,90 @@ int do_proc_net_snmp() {
3353
3354
// --------------------------------------------------------------------
3355
3233
- RRD_STATS *st = rrd_stats_find(RRD_TYPE_NET_SNMP ".packets");
3234
- if(!st) {
3235
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "packets", NULL, RRD_TYPE_NET_SNMP, "IPv4 Packets", "packets/s", 3000);
3356
+ if(do_ip_packets) {
3357
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".packets");
3358
+ if(!st) {
3359
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "packets", NULL, RRD_TYPE_NET_SNMP, "IPv4 Packets", "packets/s", 3000);
3360
3237
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3238
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3239
- rrd_stats_dimension_add(st, "forwarded", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3240
- }
3241
- else rrd_stats_next(st);
3361
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3362
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3363
+ rrd_stats_dimension_add(st, "forwarded", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3364
+ }
3365
+ else rrd_stats_next(st);
3366
3243
- rrd_stats_dimension_set(st, "sent", &OutRequests, NULL);
3244
- rrd_stats_dimension_set(st, "received", &InReceives, NULL);
3245
- rrd_stats_dimension_set(st, "forwarded", &ForwDatagrams, NULL);
3246
- rrd_stats_done(st);
3367
+ rrd_stats_dimension_set(st, "sent", &OutRequests, NULL);
3368
+ rrd_stats_dimension_set(st, "received", &InReceives, NULL);
3369
+ rrd_stats_dimension_set(st, "forwarded", &ForwDatagrams, NULL);
3370
+ rrd_stats_done(st);
3371
+ }
3372
3373
// --------------------------------------------------------------------
3374
3250
- st = rrd_stats_find(RRD_TYPE_NET_SNMP ".fragsout");
3251
- if(!st) {
3252
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "fragsout", NULL, RRD_TYPE_NET_SNMP, "IPv4 Fragments Sent", "packets/s", 3010);
3253
- st->isdetail = 1;
3375
+ if(do_ip_fragsout) {
3376
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".fragsout");
3377
+ if(!st) {
3378
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "fragsout", NULL, RRD_TYPE_NET_SNMP, "IPv4 Fragments Sent", "packets/s", 3010);
3379
+ st->isdetail = 1;
3380
3255
- rrd_stats_dimension_add(st, "ok", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3256
- rrd_stats_dimension_add(st, "failed", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3257
- rrd_stats_dimension_add(st, "all", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3258
- }
3259
- else rrd_stats_next(st);
3381
+ rrd_stats_dimension_add(st, "ok", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3382
+ rrd_stats_dimension_add(st, "failed", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3383
+ rrd_stats_dimension_add(st, "all", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3384
+ }
3385
+ else rrd_stats_next(st);
3386
3261
- rrd_stats_dimension_set(st, "ok", &FragOKs, NULL);
3262
- rrd_stats_dimension_set(st, "failed", &FragFails, NULL);
3263
- rrd_stats_dimension_set(st, "all", &FragCreates, NULL);
3264
- rrd_stats_done(st);
3387
+ rrd_stats_dimension_set(st, "ok", &FragOKs, NULL);
3388
+ rrd_stats_dimension_set(st, "failed", &FragFails, NULL);
3389
+ rrd_stats_dimension_set(st, "all", &FragCreates, NULL);
3390
+ rrd_stats_done(st);
3391
+ }
3392
3393
// --------------------------------------------------------------------
3394
3268
- st = rrd_stats_find(RRD_TYPE_NET_SNMP ".fragsin");
3269
- if(!st) {
3270
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "fragsin", NULL, RRD_TYPE_NET_SNMP, "IPv4 Fragments Reassembly", "packets/s", 3011);
3271
- st->isdetail = 1;
3395
+ if(do_ip_fragsin) {
3396
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".fragsin");
3397
+ if(!st) {
3398
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "fragsin", NULL, RRD_TYPE_NET_SNMP, "IPv4 Fragments Reassembly", "packets/s", 3011);
3399
+ st->isdetail = 1;
3400
3273
- rrd_stats_dimension_add(st, "ok", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3274
- rrd_stats_dimension_add(st, "failed", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3275
- rrd_stats_dimension_add(st, "all", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3276
- }
3277
- else rrd_stats_next(st);
3401
+ rrd_stats_dimension_add(st, "ok", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3402
+ rrd_stats_dimension_add(st, "failed", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3403
+ rrd_stats_dimension_add(st, "all", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3404
+ }
3405
+ else rrd_stats_next(st);
3406
3279
- rrd_stats_dimension_set(st, "ok", &ReasmOKs, NULL);
3280
- rrd_stats_dimension_set(st, "failed", &ReasmFails, NULL);
3281
- rrd_stats_dimension_set(st, "all", &ReasmReqds, NULL);
3282
- rrd_stats_done(st);
3407
+ rrd_stats_dimension_set(st, "ok", &ReasmOKs, NULL);
3408
+ rrd_stats_dimension_set(st, "failed", &ReasmFails, NULL);
3409
+ rrd_stats_dimension_set(st, "all", &ReasmReqds, NULL);
3410
+ rrd_stats_done(st);
3411
+ }
3412
3413
// --------------------------------------------------------------------
3414
3286
- st = rrd_stats_find(RRD_TYPE_NET_SNMP ".errors");
3287
- if(!st) {
3288
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "errors", NULL, RRD_TYPE_NET_SNMP, "IPv4 Errors", "packets/s", 3002);
3289
- st->isdetail = 1;
3415
+ if(do_ip_errors) {
3416
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".errors");
3417
+ if(!st) {
3418
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "errors", NULL, RRD_TYPE_NET_SNMP, "IPv4 Errors", "packets/s", 3002);
3419
+ st->isdetail = 1;
3420
3291
- rrd_stats_dimension_add(st, "InDiscards", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3292
- rrd_stats_dimension_add(st, "OutDiscards", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3421
+ rrd_stats_dimension_add(st, "InDiscards", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3422
+ rrd_stats_dimension_add(st, "OutDiscards", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3423
3294
- rrd_stats_dimension_add(st, "InHdrErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3295
- rrd_stats_dimension_add(st, "InAddrErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3296
- rrd_stats_dimension_add(st, "InUnknownProtos", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3424
+ rrd_stats_dimension_add(st, "InHdrErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3425
+ rrd_stats_dimension_add(st, "InAddrErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3426
+ rrd_stats_dimension_add(st, "InUnknownProtos", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3427
3298
- rrd_stats_dimension_add(st, "OutNoRoutes", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3428
+ rrd_stats_dimension_add(st, "OutNoRoutes", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3429
+ }
3430
+ else rrd_stats_next(st);
3431
+
3432
+ rrd_stats_dimension_set(st, "InDiscards", &InDiscards, NULL);
3433
+ rrd_stats_dimension_set(st, "OutDiscards", &OutDiscards, NULL);
3434
+ rrd_stats_dimension_set(st, "InHdrErrors", &InHdrErrors, NULL);
3435
+ rrd_stats_dimension_set(st, "InAddrErrors", &InAddrErrors, NULL);
3436
+ rrd_stats_dimension_set(st, "InUnknownProtos", &InUnknownProtos, NULL);
3437
+ rrd_stats_dimension_set(st, "OutNoRoutes", &OutNoRoutes, NULL);
3438
+ rrd_stats_done(st);
3439
}
3300
- else rrd_stats_next(st);
3301
-
3302
- rrd_stats_dimension_set(st, "InDiscards", &InDiscards, NULL);
3303
- rrd_stats_dimension_set(st, "OutDiscards", &OutDiscards, NULL);
3304
- rrd_stats_dimension_set(st, "InHdrErrors", &InHdrErrors, NULL);
3305
- rrd_stats_dimension_set(st, "InAddrErrors", &InAddrErrors, NULL);
3306
- rrd_stats_dimension_set(st, "InUnknownProtos", &InUnknownProtos, NULL);
3307
- rrd_stats_dimension_set(st, "OutNoRoutes", &OutNoRoutes, NULL);
3308
- rrd_stats_done(st);
3440
}
3441
else if(strncmp(p, "Tcp: ", 5) == 0) {
3442
// skip the header line, read the data
@@ -3329,69 +3460,77 @@ int do_proc_net_snmp() {
3460
// --------------------------------------------------------------------
3461
3462
// see http://net-snmp.sourceforge.net/docs/mibs/tcp.html
3332
- RRD_STATS *st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcpsock");
3333
- if(!st) {
3334
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcpsock", NULL, "tcp", "IPv4 TCP Connections", "active connections", 2500);
3463
+ if(do_tcp_sockets) {
3464
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcpsock");
3465
+ if(!st) {
3466
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcpsock", NULL, "tcp", "IPv4 TCP Connections", "active connections", 2500);
3467
3336
- rrd_stats_dimension_add(st, "connections", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
3337
- }
3338
- else rrd_stats_next(st);
3468
+ rrd_stats_dimension_add(st, "connections", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_ABSOLUTE, NULL);
3469
+ }
3470
+ else rrd_stats_next(st);
3471
3340
- rrd_stats_dimension_set(st, "connections", &CurrEstab, NULL);
3341
- rrd_stats_done(st);
3472
+ rrd_stats_dimension_set(st, "connections", &CurrEstab, NULL);
3473
+ rrd_stats_done(st);
3474
+ }
3475
3476
// --------------------------------------------------------------------
3477
3345
- st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcppackets");
3346
- if(!st) {
3347
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcppackets", NULL, "tcp", "IPv4 TCP Packets", "packets/s", 2600);
3478
+ if(do_tcp_packets) {
3479
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcppackets");
3480
+ if(!st) {
3481
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcppackets", NULL, "tcp", "IPv4 TCP Packets", "packets/s", 2600);
3482
3349
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3350
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3351
- }
3352
- else rrd_stats_next(st);
3483
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3484
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3485
+ }
3486
+ else rrd_stats_next(st);
3487
3354
- rrd_stats_dimension_set(st, "received", &InSegs, NULL);
3355
- rrd_stats_dimension_set(st, "sent", &OutSegs, NULL);
3356
- rrd_stats_done(st);
3488
+ rrd_stats_dimension_set(st, "received", &InSegs, NULL);
3489
+ rrd_stats_dimension_set(st, "sent", &OutSegs, NULL);
3490
+ rrd_stats_done(st);
3491
+ }
3492
3493
// --------------------------------------------------------------------
3494
3360
- st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcperrors");
3361
- if(!st) {
3362
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcperrors", NULL, "tcp", "IPv4 TCP Errors", "packets/s", 2700);
3363
- st->isdetail = 1;
3495
+ if(do_tcp_errors) {
3496
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcperrors");
3497
+ if(!st) {
3498
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcperrors", NULL, "tcp", "IPv4 TCP Errors", "packets/s", 2700);
3499
+ st->isdetail = 1;
3500
3365
- rrd_stats_dimension_add(st, "InErrs", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3366
- rrd_stats_dimension_add(st, "RetransSegs", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3367
- }
3368
- else rrd_stats_next(st);
3501
+ rrd_stats_dimension_add(st, "InErrs", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3502
+ rrd_stats_dimension_add(st, "RetransSegs", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3503
+ }
3504
+ else rrd_stats_next(st);
3505
3370
- rrd_stats_dimension_set(st, "InErrs", &InErrs, NULL);
3371
- rrd_stats_dimension_set(st, "RetransSegs", &RetransSegs, NULL);
3372
- rrd_stats_done(st);
3506
+ rrd_stats_dimension_set(st, "InErrs", &InErrs, NULL);
3507
+ rrd_stats_dimension_set(st, "RetransSegs", &RetransSegs, NULL);
3508
+ rrd_stats_done(st);
3509
+ }
3510
3511
// --------------------------------------------------------------------
3512
3376
- st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcphandshake");
3377
- if(!st) {
3378
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcphandshake", NULL, "tcp", "IPv4 TCP Handshake Issues", "events/s", 2900);
3379
- st->isdetail = 1;
3380
-
3381
- rrd_stats_dimension_add(st, "EstabResets", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3382
- rrd_stats_dimension_add(st, "OutRsts", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3383
- rrd_stats_dimension_add(st, "ActiveOpens", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3384
- rrd_stats_dimension_add(st, "PassiveOpens", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3385
- rrd_stats_dimension_add(st, "AttemptFails", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3513
+ if(do_tcp_handshake) {
3514
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcphandshake");
3515
+ if(!st) {
3516
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "tcphandshake", NULL, "tcp", "IPv4 TCP Handshake Issues", "events/s", 2900);
3517
+ st->isdetail = 1;
3518
+
3519
+ rrd_stats_dimension_add(st, "EstabResets", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3520
+ rrd_stats_dimension_add(st, "OutRsts", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3521
+ rrd_stats_dimension_add(st, "ActiveOpens", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3522
+ rrd_stats_dimension_add(st, "PassiveOpens", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3523
+ rrd_stats_dimension_add(st, "AttemptFails", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3524
+ }
3525
+ else rrd_stats_next(st);
3526
+
3527
+ rrd_stats_dimension_set(st, "EstabResets", &EstabResets, NULL);
3528
+ rrd_stats_dimension_set(st, "OutRsts", &OutRsts, NULL);
3529
+ rrd_stats_dimension_set(st, "ActiveOpens", &ActiveOpens, NULL);
3530
+ rrd_stats_dimension_set(st, "PassiveOpens", &PassiveOpens, NULL);
3531
+ rrd_stats_dimension_set(st, "AttemptFails", &AttemptFails, NULL);
3532
+ rrd_stats_done(st);
3533
}
3387
- else rrd_stats_next(st);
3388
-
3389
- rrd_stats_dimension_set(st, "EstabResets", &EstabResets, NULL);
3390
- rrd_stats_dimension_set(st, "OutRsts", &OutRsts, NULL);
3391
- rrd_stats_dimension_set(st, "ActiveOpens", &ActiveOpens, NULL);
3392
- rrd_stats_dimension_set(st, "PassiveOpens", &PassiveOpens, NULL);
3393
- rrd_stats_dimension_set(st, "AttemptFails", &AttemptFails, NULL);
3394
- rrd_stats_done(st);
3534
}
3535
else if(strncmp(p, "Udp: ", 5) == 0) {
3536
// skip the header line, read the data
@@ -3414,38 +3553,42 @@ int do_proc_net_snmp() {
3553
// --------------------------------------------------------------------
3554
3555
// see http://net-snmp.sourceforge.net/docs/mibs/udp.html
3417
- RRD_STATS *st = rrd_stats_find(RRD_TYPE_NET_SNMP ".udppackets");
3418
- if(!st) {
3419
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "udppackets", NULL, "udp", "IPv4 UDP Packets", "packets/s", 2601);
3556
+ if(do_udp_packets) {
3557
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".udppackets");
3558
+ if(!st) {
3559
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "udppackets", NULL, "udp", "IPv4 UDP Packets", "packets/s", 2601);
3560
3421
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3422
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3423
- }
3424
- else rrd_stats_next(st);
3561
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3562
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3563
+ }
3564
+ else rrd_stats_next(st);
3565
3426
- rrd_stats_dimension_set(st, "received", &InDatagrams, NULL);
3427
- rrd_stats_dimension_set(st, "sent", &OutDatagrams, NULL);
3428
- rrd_stats_done(st);
3566
+ rrd_stats_dimension_set(st, "received", &InDatagrams, NULL);
3567
+ rrd_stats_dimension_set(st, "sent", &OutDatagrams, NULL);
3568
+ rrd_stats_done(st);
3569
+ }
3570
3571
// --------------------------------------------------------------------
3572
3432
- st = rrd_stats_find(RRD_TYPE_NET_SNMP ".udperrors");
3433
- if(!st) {
3434
- st = rrd_stats_create(RRD_TYPE_NET_SNMP, "udperrors", NULL, "udp", "IPv4 UDP Errors", "events/s", 2701);
3435
- st->isdetail = 1;
3573
+ if(do_udp_errors) {
3574
+ st = rrd_stats_find(RRD_TYPE_NET_SNMP ".udperrors");
3575
+ if(!st) {
3576
+ st = rrd_stats_create(RRD_TYPE_NET_SNMP, "udperrors", NULL, "udp", "IPv4 UDP Errors", "events/s", 2701);
3577
+ st->isdetail = 1;
3578
3437
- rrd_stats_dimension_add(st, "RcvbufErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3438
- rrd_stats_dimension_add(st, "SndbufErrors", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3439
- rrd_stats_dimension_add(st, "InErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3440
- rrd_stats_dimension_add(st, "NoPorts", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3441
- }
3442
- else rrd_stats_next(st);
3579
+ rrd_stats_dimension_add(st, "RcvbufErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3580
+ rrd_stats_dimension_add(st, "SndbufErrors", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3581
+ rrd_stats_dimension_add(st, "InErrors", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3582
+ rrd_stats_dimension_add(st, "NoPorts", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3583
+ }
3584
+ else rrd_stats_next(st);
3585
3444
- rrd_stats_dimension_set(st, "InErrors", &InErrors, NULL);
3445
- rrd_stats_dimension_set(st, "NoPorts", &NoPorts, NULL);
3446
- rrd_stats_dimension_set(st, "RcvbufErrors", &RcvbufErrors, NULL);
3447
- rrd_stats_dimension_set(st, "SndbufErrors", &SndbufErrors, NULL);
3448
- rrd_stats_done(st);
3586
+ rrd_stats_dimension_set(st, "InErrors", &InErrors, NULL);
3587
+ rrd_stats_dimension_set(st, "NoPorts", &NoPorts, NULL);
3588
+ rrd_stats_dimension_set(st, "RcvbufErrors", &RcvbufErrors, NULL);
3589
+ rrd_stats_dimension_set(st, "SndbufErrors", &SndbufErrors, NULL);
3590
+ rrd_stats_done(st);
3591
+ }
3592
}
3593
}
3594
@@ -3457,6 +3600,15 @@ int do_proc_net_snmp() {
3600
// /proc/net/netstat processor
3601
3602
int do_proc_net_netstat() {
3603
+ static int do_bandwidth = -1, do_inerrors = -1, do_mcast = -1, do_bcast = -1, do_mcast_p = -1, do_bcast_p = -1;
3604
+
3605
+ if(do_bandwidth == -1) do_bandwidth = config_get_boolean("plugin:proc:/proc/net/netstat", "bandwidth", 1);
3606
+ if(do_inerrors == -1) do_inerrors = config_get_boolean("plugin:proc:/proc/net/netstat", "input errors", 1);
3607
+ if(do_mcast == -1) do_mcast = config_get_boolean("plugin:proc:/proc/net/netstat", "multicast bandwidth", 1);
3608
+ if(do_bcast == -1) do_bcast = config_get_boolean("plugin:proc:/proc/net/netstat", "broadcast bandwidth", 1);
3609
+ if(do_mcast_p == -1) do_mcast_p = config_get_boolean("plugin:proc:/proc/net/netstat", "multicast packets", 1);
3610
+ if(do_bcast_p == -1) do_bcast_p = config_get_boolean("plugin:proc:/proc/net/netstat", "broadcast packets", 1);
3611
+
3612
char buffer[MAX_PROC_NET_SNMP_LINE+1] = "";
3613
3614
FILE *fp = fopen("/proc/net/netstat", "r");
@@ -3494,100 +3646,114 @@ int do_proc_net_netstat() {
3646
continue;
3647
}
3648
3649
+ RRD_STATS *st;
3650
+
3651
// --------------------------------------------------------------------
3652
3499
- RRD_STATS *st = rrd_stats_find("system.ipv4");
3500
- if(!st) {
3501
- st = rrd_stats_create("system", "ipv4", NULL, "ipv4", "IPv4 Bandwidth", "kilobits/s", 2000);
3653
+ if(do_bandwidth) {
3654
+ st = rrd_stats_find("system.ipv4");
3655
+ if(!st) {
3656
+ st = rrd_stats_create("system", "ipv4", NULL, "ipv4", "IPv4 Bandwidth", "kilobits/s", 2000);
3657
3503
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3504
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3505
- }
3506
- else rrd_stats_next(st);
3658
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3659
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3660
+ }
3661
+ else rrd_stats_next(st);
3662
3508
- rrd_stats_dimension_set(st, "sent", &OutOctets, NULL);
3509
- rrd_stats_dimension_set(st, "received", &InOctets, NULL);
3510
- rrd_stats_done(st);
3663
+ rrd_stats_dimension_set(st, "sent", &OutOctets, NULL);
3664
+ rrd_stats_dimension_set(st, "received", &InOctets, NULL);
3665
+ rrd_stats_done(st);
3666
+ }
3667
3668
// --------------------------------------------------------------------
3669
3514
- st = rrd_stats_find("ipv4.inerrors");
3515
- if(!st) {
3516
- st = rrd_stats_create("ipv4", "inerrors", NULL, "ipv4", "IPv4 Input Errors", "packets/s", 4000);
3517
- st->isdetail = 1;
3670
+ if(do_inerrors) {
3671
+ st = rrd_stats_find("ipv4.inerrors");
3672
+ if(!st) {
3673
+ st = rrd_stats_create("ipv4", "inerrors", NULL, "ipv4", "IPv4 Input Errors", "packets/s", 4000);
3674
+ st->isdetail = 1;
3675
3519
- rrd_stats_dimension_add(st, "noroutes", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3520
- rrd_stats_dimension_add(st, "trunkated", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3521
- }
3522
- else rrd_stats_next(st);
3676
+ rrd_stats_dimension_add(st, "noroutes", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3677
+ rrd_stats_dimension_add(st, "trunkated", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3678
+ }
3679
+ else rrd_stats_next(st);
3680
3524
- rrd_stats_dimension_set(st, "noroutes", &InNoRoutes, NULL);
3525
- rrd_stats_dimension_set(st, "trunkated", &InTruncatedPkts, NULL);
3526
- rrd_stats_done(st);
3681
+ rrd_stats_dimension_set(st, "noroutes", &InNoRoutes, NULL);
3682
+ rrd_stats_dimension_set(st, "trunkated", &InTruncatedPkts, NULL);
3683
+ rrd_stats_done(st);
3684
+ }
3685
3686
// --------------------------------------------------------------------
3687
3530
- st = rrd_stats_find("ipv4.mcast");
3531
- if(!st) {
3532
- st = rrd_stats_create("ipv4", "mcast", NULL, "ipv4", "IPv4 Multicast Bandwidth", "kilobits/s", 9000);
3533
- st->isdetail = 1;
3688
+ if(do_mcast) {
3689
+ st = rrd_stats_find("ipv4.mcast");
3690
+ if(!st) {
3691
+ st = rrd_stats_create("ipv4", "mcast", NULL, "ipv4", "IPv4 Multicast Bandwidth", "kilobits/s", 9000);
3692
+ st->isdetail = 1;
3693
3535
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3536
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3537
- }
3538
- else rrd_stats_next(st);
3694
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3695
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3696
+ }
3697
+ else rrd_stats_next(st);
3698
3540
- rrd_stats_dimension_set(st, "sent", &OutMcastOctets, NULL);
3541
- rrd_stats_dimension_set(st, "received", &InMcastOctets, NULL);
3542
- rrd_stats_done(st);
3699
+ rrd_stats_dimension_set(st, "sent", &OutMcastOctets, NULL);
3700
+ rrd_stats_dimension_set(st, "received", &InMcastOctets, NULL);
3701
+ rrd_stats_done(st);
3702
+ }
3703
3704
// --------------------------------------------------------------------
3705
3546
- st = rrd_stats_find("ipv4.bcast");
3547
- if(!st) {
3548
- st = rrd_stats_create("ipv4", "bcast", NULL, "ipv4", "IPv4 Broadcast Bandwidth", "kilobits/s", 8000);
3549
- st->isdetail = 1;
3706
+ if(do_bcast) {
3707
+ st = rrd_stats_find("ipv4.bcast");
3708
+ if(!st) {
3709
+ st = rrd_stats_create("ipv4", "bcast", NULL, "ipv4", "IPv4 Broadcast Bandwidth", "kilobits/s", 8000);
3710
+ st->isdetail = 1;
3711
3551
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3552
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3553
- }
3554
- else rrd_stats_next(st);
3712
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3713
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -8, 1024, RRD_DIMENSION_INCREMENTAL, NULL);
3714
+ }
3715
+ else rrd_stats_next(st);
3716
3556
- rrd_stats_dimension_set(st, "sent", &OutBcastOctets, NULL);
3557
- rrd_stats_dimension_set(st, "received", &InBcastOctets, NULL);
3558
- rrd_stats_done(st);
3717
+ rrd_stats_dimension_set(st, "sent", &OutBcastOctets, NULL);
3718
+ rrd_stats_dimension_set(st, "received", &InBcastOctets, NULL);
3719
+ rrd_stats_done(st);
3720
+ }
3721
3722
// --------------------------------------------------------------------
3723
3562
- st = rrd_stats_find("ipv4.mcastpkts");
3563
- if(!st) {
3564
- st = rrd_stats_create("ipv4", "mcastpkts", NULL, "ipv4", "IPv4 Multicast Packets", "packets/s", 9500);
3565
- st->isdetail = 1;
3724
+ if(do_mcast_p) {
3725
+ st = rrd_stats_find("ipv4.mcastpkts");
3726
+ if(!st) {
3727
+ st = rrd_stats_create("ipv4", "mcastpkts", NULL, "ipv4", "IPv4 Multicast Packets", "packets/s", 9500);
3728
+ st->isdetail = 1;
3729
3567
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3568
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3569
- }
3570
- else rrd_stats_next(st);
3730
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3731
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3732
+ }
3733
+ else rrd_stats_next(st);
3734
3572
- rrd_stats_dimension_set(st, "sent", &OutMcastPkts, NULL);
3573
- rrd_stats_dimension_set(st, "received", &InMcastPkts, NULL);
3574
- rrd_stats_done(st);
3735
+ rrd_stats_dimension_set(st, "sent", &OutMcastPkts, NULL);
3736
+ rrd_stats_dimension_set(st, "received", &InMcastPkts, NULL);
3737
+ rrd_stats_done(st);
3738
+ }
3739
3740
// --------------------------------------------------------------------
3741
3578
- st = rrd_stats_find("ipv4.bcastpkts");
3579
- if(!st) {
3580
- st = rrd_stats_create("ipv4", "bcastpkts", NULL, "ipv4", "IPv4 Broadcast Packets", "packets/s", 8500);
3581
- st->isdetail = 1;
3742
+ if(do_bcast_p) {
3743
+ st = rrd_stats_find("ipv4.bcastpkts");
3744
+ if(!st) {
3745
+ st = rrd_stats_create("ipv4", "bcastpkts", NULL, "ipv4", "IPv4 Broadcast Packets", "packets/s", 8500);
3746
+ st->isdetail = 1;
3747
3583
- rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3584
- rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3585
- }
3586
- else rrd_stats_next(st);
3748
+ rrd_stats_dimension_add(st, "received", NULL, sizeof(unsigned long long), 0, 1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3749
+ rrd_stats_dimension_add(st, "sent", NULL, sizeof(unsigned long long), 0, -1, 1, RRD_DIMENSION_INCREMENTAL, NULL);
3750
+ }
3751
+ else rrd_stats_next(st);
3752
3588
- rrd_stats_dimension_set(st, "sent", &OutBcastPkts, NULL);
3589
- rrd_stats_dimension_set(st, "received", &InBcastPkts, NULL);
3590
- rrd_stats_done(st);
3753
+ rrd_stats_dimension_set(st, "sent", &OutBcastPkts, NULL);
3754
+ rrd_stats_dimension_set(st, "received", &InBcastPkts, NULL);
3755
+ rrd_stats_done(st);
3756
+ }
3757
}
3758
}
3759
netdata.start
+1
-1
@@ -44,7 +44,7 @@ if [ $NETDATA_CONFIG_DEBUG -eq 1 ]
44
then
45
ulimit -c unlimited
46
gcc -Wall -ggdb -o netdata netdata.c -lpthread -lz || exit 1
47
- debug_opts="-df 0xfffffedf -dl netdata.log"
47
+ debug_opts="-df 0xfffffadf -dl netdata.log"
48
else
49
gcc -Wall -O3 -o netdata netdata.c -lpthread -lz || exit 1
50
debug_opts=