]> arthur.barton.de Git - netdata.git/commitdiff
cleanup: remove trailing spaces
authorAlon Bar-Lev <alon.barlev@gmail.com>
Sun, 29 Nov 2015 22:34:46 +0000 (00:34 +0200)
committerAlon Bar-Lev <alon.barlev@gmail.com>
Sun, 29 Nov 2015 22:34:46 +0000 (00:34 +0200)
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
48 files changed:
README.md
charts.d/mysql.chart.sh
charts.d/opensips.chart.sh
charts.d/postfix.chart.sh
charts.d/sensors.chart.sh
charts.d/squid.chart.sh
conf.d/apps_groups.conf
plugins.d/README.md
plugins.d/charts.d.plugin
plugins.d/loopsleepms.sh.inc
plugins.d/tc-qos-helper.sh
src/apps_plugin.c
src/avl.h
src/daemon.c
src/main.c
src/old-and-tests/benchmark.c
src/old-and-tests/benchmark2.c
src/old-and-tests/netdata.c
src/plugin_checks.c
src/plugin_nfacct.c
src/plugin_proc.c
src/plugin_tc.c
src/plugins_d.c
src/popen.c
src/proc_diskstats.c
src/proc_meminfo.c
src/proc_net_ip_vs_stats.c
src/proc_net_netstat.c
src/proc_net_rpc_nfsd.c
src/proc_net_snmp.c
src/proc_net_stat_conntrack.c
src/proc_stat.c
src/proc_vmstat.c
src/procfile.c
src/procfile.h
src/rrd.c
src/rrd.h
src/rrd2json.c
src/storage_number.c
src/unit_test.c
src/url.c
src/web_buffer.c
src/web_client.c
web/dashboard.html
web/dashboard.js
web/index.html
web/index.js
web/netdata.js

index 64d89fa5cf7d870375b2f7b06b6e349392c13c8f..43b143fd92aa04fc7d8306f9bddeeba113a4c9c6 100755 (executable)
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Here is a screenshot:
 - **extremely lightweight**
 
   It only needs a few megabytes of memory to store all its round robin database.
-  
+
   Although `netdata` does all its calculation using `long double` (128 bit) arithmetics, it stores all values using a **custom-made 32-bit number**. This custom-made number can store in 29 bits values from -167772150000000.0 to  167772150000000.0 with a precision of 0.00001 (yes, it is a floating point number, meaning that higher integer values have less decimal precision) and 3 bits for flags (2 are currently used and 1 is reserved for future use). This provides an extremely optimized memory footprint with just 0.0001% max accuracy loss (run: `./netdata --unittest` to see it in action).
 
 - **per second data collection**
@@ -112,7 +112,7 @@ Here is a screenshot:
 
 1. You run a daemon on your linux: netdata.
  This deamon is written in C and is extremely lightweight.
+
  netdata:
 
   - Spawns threads to collect all the data for all sources
@@ -121,18 +121,18 @@ Here is a screenshot:
   - Is a standalone web server.
 
  For example, you can access JSON data by using:
+
  ```
  http://127.0.0.1:19999/data/net.eth0
  ```
+
  This will give you the JSON file for traffic on eth0.
  The above is equivalent to:
+
  ```
  http://127.0.0.1:19999/data/net.eth0/3600/1/average/0/0
  ```
+
  where:
 
   - 3600 is the number of entries to generate.
@@ -182,7 +182,7 @@ You can edit this file to set options. To apply the changes you made, you have t
 
 - You can stop netdata by killing it with `killall netdata`.
     You can stop and start netdata at any point. Netdata saves on exit its round robbin
-    database to `/var/cache/netdata` so that it will continue from where it stopped the last time. 
+    database to `/var/cache/netdata` so that it will continue from where it stopped the last time.
 
 To access the web site for all graphs, go to:
 
index dd7b3620a496693ef0fa2a4f9ac1a68757fa5381..8d0ac228fc3aa7a2f9dc08535a4bcfd72b147c11 100755 (executable)
@@ -13,7 +13,7 @@ declare -A mysql_cmds=() mysql_opts=() mysql_ids=()
 
 mysql_exec() {
        local ret
-       
+
        "${@}" -s -e "show global status;"
        ret=$?
 
index e6ae7a8a73e5afa09d8b436bfa9ec3d3c5887beb..2e4e59b3a9a8efe8e124e6fa531815c4a11d9057 100755 (executable)
@@ -136,7 +136,7 @@ DIMENSION shmem_free_size free absolute 1 1024
 CHART opensips.shmem_fragments '' "OpenSIPS Shared Memory Fragmentation" "fragments" opensips '' line 20019 $opensips_update_every
 DIMENSION shmem_fragments fragments absolute 1 1
 EOF
-       
+
        return 0
 }
 
index 3762e822d82222d96ff4fa5e373338bdde8fc1d2..6df54ac5277a0307a2bbe7e84b75ee9097c06a5c 100755 (executable)
@@ -70,7 +70,7 @@ postfix_update() {
        # even if something goes wrong, no other code can be executed
        postfix_q_emails=0
        postfix_q_size=0
-       
+
        eval "`$postfix_postqueue -p |\
                grep "^--" |\
                sed -e "s/-- \([0-9]\+\) Kbytes in \([0-9]\+\) Requests.$/local postfix_q_size=\1\nlocal postfix_q_emails=\2/g" |\
index f4ab1b240a12eb8d367b4d77c6189d2844ae5543..83783215073a3486c7eb2080079edf4fbb63fbf4 100755 (executable)
@@ -54,7 +54,7 @@ sensors_check_files() {
                v="$( cat $f )"
                v=$(( v + 1 - 1 ))
                [ $v -ne 0 ] && echo "$f" && continue
-               
+
                echo >&2 "$PROGRAM_NAME: sensors: $f gives zero values"
        done
 }
index 08a61ed754d39f1b5eb094df8268a469fbf092c5..9df57613efffc7fe43e151ed1918b10b3766ae0a 100755 (executable)
@@ -87,7 +87,7 @@ CHART squid.servers_requests '' "Squid Server Requests" "requests / sec" squid '
 DIMENSION server_all_requests requests incremental 1 1
 DIMENSION server_all_errors errors incremental -1 1
 EOF
-       
+
        return 0
 }
 
index e59ce16002aa19fe0ae463bf77af9e7dcfb67f57..e5e563b1acd24fd1049da684414ab834fe31cc03 100644 (file)
@@ -1,6 +1,6 @@
 #
 # apps.plugin process grouping
-# 
+#
 # The apps.plugin displays charts with information about the processes running.
 # This config allows grouping processes together, so that several processes
 # will be reported together.
@@ -41,7 +41,7 @@ samba: smbd nmbd winbindd
 nfs: rpcbind rpc.statd rpc.idmapd rpc.mountd nfsd4 nfsd4_callbacks nfsd nfsiod
 ssh: ssh sshd scp
 X: X lightdm xdm pulseaudio gkrellm
-xfce: xfwm4 xfdesktop xfce4-appfinder Thunar xfsettingsd xfce4-panel 
+xfce: xfwm4 xfdesktop xfce4-appfinder Thunar xfsettingsd xfce4-panel
 gnome: gnome-session gdm gconfd-2 gnome-terminal gnome-screensaver gnome-settings-daemon
 named: named rncd
 clam: clamd freshclam
index ada2b3f5f48be26921ea0d6b684e23cc5d3aab99..35b9a2d99591e6b4e3272f9448d8476fcf070751 100644 (file)
@@ -59,7 +59,7 @@ the template is:
 
  where:
   - `type.id`
-   
+
     uniquely identifies the chart,
     this is what will be needed to add values to the chart
 
index 2ea78717e5b54f9eaa7bbb14d396cbbd4f3672fd..9214b3091fde680ff5cbe4f4647ecce9699e981f 100755 (executable)
@@ -14,12 +14,12 @@ echo >&2 "$PROGRAM_NAME: started from '$PROGRAM_FILE' with options: $*"
 
 if [ $(( ${BASH_VERSINFO[0]} )) -lt 4 ]
 then
-       echo >&2 
+       echo >&2
        echo >&2 "$PROGRAM_NAME: ERROR"
        echo >&2 "BASH version 4 or later is required."
        echo >&2 "You are running version: ${BASH_VERSION}"
        echo >&2 "Please upgrade."
-       echo >&2 
+       echo >&2
        exit 1
 fi
 
index c0bbb5fdfadeb288abd47b1c67a4de98bc9f6c1e..2e22de3d832e13e43d0e82917fdb57aebf463198 100644 (file)
@@ -70,7 +70,7 @@ loopsleepms() {
        # calculate ms to sleep
        mstosleep=$(( t - LOOPSLEEPMS_LASTWORK ))
        # echo "# mstosleep is $mstosleep ms"
-       
+
        # if we are too slow, sleep some time
        test $mstosleep -lt 200 && mstosleep=200
 
index 16577f4fadf3122cb5884a794ee7c836454befac..29e31ec5028e04a72fe3d57e8e1a6870f18e0d01 100755 (executable)
@@ -41,9 +41,9 @@ show_tc() {
        local x="$1"
 
        echo "BEGIN $x"
-       
+
        $tc_cmd -s class show dev $x
-       
+
        # check FireQOS names for classes
        if [ ! -z "$fix_names" -a -f /var/run/fireqos/ifaces/$x ]
        then
@@ -56,7 +56,7 @@ show_tc() {
                do
                                setclassname $(echo $n | tr '|' ' ')
                done
-               
+
                echo "SETDEVICEGROUP $interface_dev"
        fi
        echo "END $x"
index c4ffa551838576c8d6eac4f611c706e1dee83de5..b22de453b9ca3ff849e8962b034bdd233aa06932 100755 (executable)
@@ -354,7 +354,7 @@ struct target *get_target(const char *id, struct target *target)
        struct target *w;
        for(w = target_root ; w ; w = w->next)
                if(strncmp(nid, w->id, MAX_NAME) == 0) return w;
-       
+
        w = calloc(sizeof(struct target), 1);
        if(!w) {
                error("Cannot allocate %lu bytes of memory", (unsigned long)sizeof(struct target));
@@ -1206,7 +1206,7 @@ void update_statistics(void)
        for(p = root_of_pids; p ; p = p->next) {
                if(p->ppid > 0 && p->ppid <= pid_max && all_pids[p->ppid]) {
                        if(debug || (p->target && p->target->debug)) fprintf(stderr, "apps.plugin: \tparent of %d %s is %d %s\n", p->pid, p->comm, p->ppid, all_pids[p->ppid]->comm);
-                       
+
                        p->parent = all_pids[p->ppid];
                        p->parent->childs++;
                }
@@ -1336,7 +1336,7 @@ void update_statistics(void)
                w->fds = calloc(sizeof(int), all_files_size);
                if(!w->fds)
                        error("Cannot allocate memory for fds in %s", w->name);
-       
+
                w->minflt = 0;
                w->majflt = 0;
                w->utime = 0;
@@ -1477,7 +1477,7 @@ void update_statistics(void)
        for(p = root_of_pids; p ;) {
                if(!p->updated) {
 //                     fprintf(stderr, "\tEXITED %d %s [parent %d %s, target %s] utime=%llu, stime=%llu, cutime=%llu, cstime=%llu, minflt=%llu, majflt=%llu, cminflt=%llu, cmajflt=%llu\n", p->pid, p->comm, p->parent->pid, p->parent->comm, p->target->name,  p->utime, p->stime, p->cutime, p->cstime, p->minflt, p->majflt, p->cminflt, p->cmajflt);
-                       
+
                        for(c = 0 ; c < p->fds_size ; c++) if(p->fds[c] > 0) {
                                file_descriptor_not_used(p->fds[c]);
                                p->fds[c] = 0;
@@ -1955,7 +1955,7 @@ int main(int argc, char **argv)
 
                usleep(susec);
                bcopy(&now, &last, sizeof(struct timeval));
-               
+
                current_t = time(NULL);
                if(current_t - started_t > 3600) exit(0);
        }
index 6db0bb469c6820a7181f7fdc019b7d92d783385b..8071a87d6ddd456ac4a974359b82bd4d99255ebd 100755 (executable)
--- a/src/avl.h
+++ b/src/avl.h
@@ -43,7 +43,7 @@ int avl_insert(avl_tree* t, avl* a);
 
 /* Remove an element a from the AVL tree t
  * returns -1 if the depth of the tree has shrunk
- * Warning: if the element is not present in the tree, 
+ * Warning: if the element is not present in the tree,
  *          returns 0 as if it had been removed succesfully.
  */
 int avl_remove(avl_tree* t, avl* a);
index 652cc8618f5478a0668619241db5a9633d8e5508..d73a3a46c38876ae54e47182ac6f8a6a46d07963 100755 (executable)
@@ -100,7 +100,7 @@ void prepare_rundir() {
                mkdir(rundir, 0775);
                snprintf(rundir, FILENAME_MAX, "/run/user/%d/netdata", getuid());
        }
-       
+
        snprintf(pidfile, FILENAME_MAX, "%s/netdata.pid", rundir);
 
        if(mkdir(rundir, 0775) != 0) {
@@ -204,7 +204,7 @@ int become_daemon(int dont_fork, int close_all_files, const char *user, const ch
                        }
                }
        }
-       
+
        if((dev_null = open("/dev/null", O_RDWR, 0666)) == -1) {
                perror("Cannot open /dev/null");
                if(input_fd != -1) close(input_fd);
@@ -264,7 +264,7 @@ int become_daemon(int dont_fork, int close_all_files, const char *user, const ch
        if(close_all_files) {
                int i;
                for(i = sysconf(_SC_OPEN_MAX); i > 0; i--)
-                       if(   
+                       if(
                                ((access_fd && i != *access_fd) || !access_fd)
                                && i != dev_null
                                && i != input_fd
@@ -289,7 +289,7 @@ int become_daemon(int dont_fork, int close_all_files, const char *user, const ch
                input_fd = -1;
        }
        else dup2(dev_null, STDIN_FILENO);
-       
+
        if(output_fd != -1) {
                if(output_fd != STDOUT_FILENO) {
                        dup2(output_fd, STDOUT_FILENO);
index 90064cfba319f55b2bf45d392453f990f60e9871..328d4ac4ea1933c3bdd298ff93587d13a863ff8c 100755 (executable)
@@ -74,7 +74,7 @@ int killpid(pid_t pid, int sig)
        errno = 0;
        if(kill(pid, 0) == -1) {
                switch(errno) {
-                       case ESRCH: 
+                       case ESRCH:
                                error("Request to kill pid %d, but it is not running.", pid);
                                break;
 
@@ -89,8 +89,8 @@ int killpid(pid_t pid, int sig)
        }
        else {
                errno = 0;
-               
-               void (*old)(int);               
+
+               void (*old)(int);
                old = signal(sig, SIG_IGN);
                if(old == SIG_ERR) {
                        error("Cannot overwrite signal handler for signal %d", sig);
@@ -104,7 +104,7 @@ int killpid(pid_t pid, int sig)
 
                if(ret == -1) {
                        switch(errno) {
-                               case ESRCH: 
+                               case ESRCH:
                                        error("Cannot kill pid %d, but it is not running.", pid);
                                        break;
 
@@ -133,7 +133,7 @@ void kill_childs()
                pthread_join(w->thread, NULL);
        }
 
-       int i;  
+       int i;
        for (i = 0; static_threads[i].name != NULL ; i++) {
                if(static_threads[i].thread) {
                        debug(D_EXIT, "Stopping %s thread", static_threads[i].name);
@@ -357,7 +357,7 @@ int main(int argc, char **argv)
                }
 
                // --------------------------------------------------------------------
-               
+
                for (i = 0; static_threads[i].name != NULL ; i++) {
                        struct netdata_static_thread *st = &static_threads[i];
 
index 7044489f6bc9c5670707b7fdf88976d4c952e714..bcf1b40fe7df0d1c24fd3a810b2e5a0f04a86b2c 100755 (executable)
@@ -91,7 +91,7 @@ char *fastfile_getline(fastfile *ff) {
 
        char *start = &ff->buffer[ff->cursor];
        char *s = start;
-       
+
        while(*s != '\n' && *s != '\0') s++;
        *s = '\0';
        ff->cursor += ( s - start + 1 );
index cdeb81ee96146041c17a02d95ad5a7a16347f2a2..69287c0f62b0198bd94e929a999985879d85b42d 100755 (executable)
@@ -19,7 +19,7 @@
 
 /*
  * This is a library for reading kernel files from /proc
- * 
+ *
  * The idea is this:
  *
  *  - every file is opened once.
@@ -201,7 +201,7 @@ fastfile *fastfile_parser(fastfile *ff) {
        char *s = ff->data, *e = ff->data, *t = ff->data;
        uint32_t l = 0, w = 0;
        e += ff->len;
-       
+
        ff->lines = fflines_add(ff->lines, w);
        if(!ff->lines) goto cleanup;
 
index 7f45f01ccc38326fb9b72aacf3adabb834f7c1b6..38aeccbe36e649da5d6e9ee6559adb9f8e1f5df0 100755 (executable)
@@ -405,7 +405,7 @@ FILE *mypopen(const char *command, pid_t *pidptr)
        fprintf(stdout, "MYPID %d\n", getpid());
        fflush(NULL);
 #endif
-       
+
        // ignore all signals
        for (i = 1 ; i < 65 ;i++) if(i != SIGSEGV) signal(i, SIG_DFL);
 
@@ -485,12 +485,12 @@ char *url_decode(char *str) {
 
                else
                        *pbuf++ = *pstr;
-               
+
                pstr++;
        }
-       
+
        *pbuf = '\0';
-       
+
        return buf;
 }
 
@@ -1163,7 +1163,7 @@ struct rrd_dimension {
        char id[RRD_STATS_NAME_MAX + 1];                // the id of this dimension (for internal identification)
        char *name;                                     // the name of this dimension (as presented to user)
        char cache_file[FILENAME_MAX+1];
-       
+
        unsigned long hash;                             // a simple hash on the id, to speed up searching
                                                        // we first compare hashes, and only if the hashes are equal we do string comparisons
 
@@ -1230,7 +1230,7 @@ struct rrd_stats {
        int update_every;                               // every how many seconds is this updated?
        unsigned long long first_entry_t;               // the timestamp (in microseconds) of the oldest entry in the db
        struct timeval last_updated;                    // when this data set was last updated (updated every time the rrd_stats_done() function)
-       struct timeval last_collected_time;             // 
+       struct timeval last_collected_time;             //
        unsigned long long usec_since_last_update;
 
        total_number collected_total;
@@ -1410,7 +1410,7 @@ RRD_STATS *rrd_stats_create(const char *type, const char *id, const char *name,
 
        st->priority = config_get_number(st->id, "priority", priority);
        st->enabled = enabled;
-       
+
        st->isdetail = 0;
        st->debug = 0;
 
@@ -1530,7 +1530,7 @@ RRD_DIMENSION *rrd_stats_dimension_add(RRD_STATS *st, const char *id, const char
 
        rd->entries = st->entries;
        rd->update_every = st->update_every;
-       
+
        // append this dimension
        if(!st->dimensions)
                st->dimensions = rd;
@@ -1705,7 +1705,7 @@ int rrd_stats_dimension_hide(RRD_STATS *st, const char *id)
 void rrd_stats_dimension_set_by_pointer(RRD_STATS *st, RRD_DIMENSION *rd, collected_number value)
 {
        if(st) {;}
-       
+
        gettimeofday(&rd->last_collected_time, NULL);
        rd->collected_value = value;
 }
@@ -2015,7 +2015,7 @@ unsigned long long rrd_stats_done(RRD_STATS *st)
                        // add the value we will overwrite
                        st->first_entry_t += st->update_every * 1000000ULL;
                }
-               
+
                st->counter++;
                st->current_entry = ((st->current_entry + 1) >= st->entries) ? 0 : st->current_entry + 1;
                if(!st->first_entry_t) st->first_entry_t = next_ut;
@@ -2240,7 +2240,7 @@ void web_buffer_increase(struct web_buffer *b, long free_size_required)
 
        b->buffer = realloc(b->buffer, b->size + increase);
        if(!b->buffer) fatal("Failed to increase data buffer from size %d to %d.", b->size, b->size + increase);
-       
+
        b->size += increase;
 }
 
@@ -2291,7 +2291,7 @@ struct web_client *web_client_create(int listener)
 {
        struct web_client *w;
        socklen_t addrlen;
-       
+
        w = calloc(1, sizeof(struct web_client));
        if(!w) {
                error("Cannot allocate new web_client memory.");
@@ -2316,7 +2316,7 @@ struct web_client *web_client_create(int listener)
        debug(D_WEB_CLIENT_ACCESS, "%llu: New web client from %s on socket %d.", w->id, w->client_ip, w->ifd);
 
        {
-               int flag = 1; 
+               int flag = 1;
                if(setsockopt(w->ifd, SOL_SOCKET, SO_KEEPALIVE, (char *) &flag, sizeof(int)) != 0) error("%llu: Cannot set SO_KEEPALIVE on socket.", w->id);
        }
 
@@ -2367,7 +2367,7 @@ struct web_client *web_client_free(struct web_client *w)
 time_t rrd_stats_first_entry_t(RRD_STATS *st)
 {
        if(!st->first_entry_t) return st->last_updated.tv_sec;
-       
+
        return st->first_entry_t / 1000000;
 }
 
@@ -2506,7 +2506,7 @@ void rrd_stats_all_json(struct web_buffer *wb)
                }
        }
        pthread_rwlock_unlock(&root_rwlock);
-       
+
        web_buffer_printf(wb, "\n\t],\n"
                "\t\"hostname\": \"%s\",\n"
                "\t\"update_every\": %d,\n"
@@ -2528,7 +2528,7 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
 
        // -------------------------------------------------------------------------
        // switch from JSON to google JSON
-       
+
        char kq[2] = "\"";
        char sq[2] = "\"";
        switch(type) {
@@ -2546,20 +2546,20 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
 
        // -------------------------------------------------------------------------
        // validate the parameters
-       
+
        if(entries_to_show < 1) entries_to_show = 1;
        if(group < 1) group = 1;
-       
+
        // make sure current_entry is within limits
        long current_entry = (long)st->current_entry - (long)1;
        if(current_entry < 0) current_entry = 0;
        else if(current_entry >= st->entries) current_entry = st->entries - 1;
-       
+
        // find the oldest entry of the round-robin
        long max_entries_init = (st->counter < (unsigned long)st->entries) ? st->counter : (unsigned long)st->entries;
-       
+
        time_t time_init = st->last_updated.tv_sec;
-       
+
        if(before == 0 || before > time_init) before = time_init;
        if(after  == 0) after = rrd_stats_first_entry_t(st);
 
@@ -2568,12 +2568,12 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
 
        // our return value (the last timestamp printed)
        // this is required to detect re-transmit in google JSONP
-       time_t last_timestamp = 0;                      
+       time_t last_timestamp = 0;
 
 
        // -------------------------------------------------------------------------
        // find how many dimensions we have
-       
+
        int dimensions = 0;
        RRD_DIMENSION *rd;
        for( rd = st->dimensions ; rd ; rd = rd->next) dimensions++;
@@ -2583,10 +2583,10 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
                return 0;
        }
 
-       
+
        // -------------------------------------------------------------------------
        // prepare various strings, to speed up the loop
-       
+
        char overflow_annotation[201]; snprintf(overflow_annotation, 200, ",{%sv%s:%sRESET OR OVERFLOW%s},{%sv%s:%sThe counters have been wrapped.%s}", kq, kq, sq, sq, kq, kq, sq, sq);
        char normal_annotation[201];   snprintf(normal_annotation,   200, ",{%sv%s:null},{%sv%s:null}", kq, kq, kq, kq);
        char pre_date[51];             snprintf(pre_date,             50, "             {%sc%s:[{%sv%s:%s", kq, kq, kq, kq, sq);
@@ -2597,7 +2597,7 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
 
        // -------------------------------------------------------------------------
        // checks for debuging
-       
+
        if(st->debug) {
                debug(D_RRD_STATS, "%s first_entry_t = %lu, last_entry_t = %lu, duration = %lu, after = %lu, before = %lu, duration = %lu, entries_to_show = %lu, group = %lu, max_entries = %ld"
                        , st->id
@@ -2622,7 +2622,7 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
 
        // -------------------------------------------------------------------------
        // temp arrays for keeping values per dimension
-       
+
        calculated_number group_values[dimensions]; // keep sums when grouping
        calculated_number print_values[dimensions]; // keep the final value to be printed
        int               print_hidden[dimensions]; // keep hidden flags
@@ -2645,7 +2645,7 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
 
                // -------------------------------------------------------------------------
                // print the JSON header
-               
+
                web_buffer_printf(wb, "{\n      %scols%s:\n     [\n", kq, kq);
                web_buffer_printf(wb, "         {%sid%s:%s%s,%slabel%s:%stime%s,%spattern%s:%s%s,%stype%s:%sdatetime%s},\n", kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq);
                web_buffer_printf(wb, "         {%sid%s:%s%s,%slabel%s:%s%s,%spattern%s:%s%s,%stype%s:%sstring%s,%sp%s:{%srole%s:%sannotation%s}},\n", kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, kq, kq, sq, sq);
@@ -2673,7 +2673,7 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
 
                int annotate_reset = 0;
                int annotation_count = 0;
-               
+
                // to allow grouping on the same values, we need a pad
                long pad = before % group;
 
@@ -2716,12 +2716,12 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
                                        // debug(D_RRD_STATS, "Already printed all rows. Stopping.");
                                        break;
                                }
-                               
+
                                if(group_count != group) {
                                        // this is an incomplete group, skip it.
                                        for( rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++)
                                                group_values[c] = 0;
-                                               
+
                                        group_count = 0;
                                        continue;
                                }
@@ -2744,7 +2744,7 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
 
                        for(rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++) {
                                calculated_number value = unpack_storage_number(rd->values[t]);
-                               
+
                                switch(group_method) {
                                        case GROUP_MAX:
                                                if(abs(value) > abs(group_values[c])) group_values[c] = value;
@@ -2769,7 +2769,7 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
 
                        if(print_this) {
                                group_count = 0;
-                               
+
                                if(annotate_reset) {
                                        annotation_count++;
                                        web_buffer_strcpy(wb, overflow_annotation);
@@ -2817,7 +2817,7 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, int
                        else break;
                }
                else break;
-               
+
        } // max_loop
 
        debug(D_RRD_STATS, "RRD_STATS_JSON: %s total %ld bytes", st->name, wb->bytes);
@@ -2836,7 +2836,7 @@ void generate_config(struct web_buffer *wb, int only_changed)
                web_buffer_increase(wb, 500);
                switch(i) {
                        case 0:
-                               web_buffer_printf(wb, 
+                               web_buffer_printf(wb,
                                        "# NetData Configuration\n"
                                        "# You can uncomment and change any of the options bellow.\n"
                                        "# The value shown in the commented settings, is the default value.\n"
@@ -2951,7 +2951,7 @@ int mysendfile(struct web_client *w, char *filename)
                        return 404;
                }
        }
-       
+
        // pick a Content-Type for the file
                 if(strstr(filename, ".html") != NULL)  w->data->contenttype = CT_TEXT_HTML;
        else if(strstr(filename, ".js")   != NULL)      w->data->contenttype = CT_APPLICATION_X_JAVASCRIPT;
@@ -2993,7 +2993,7 @@ void web_client_reset(struct web_client *w)
 
        long sent = w->zoutput?(long)w->zstream.total_out:((w->mode == WEB_CLIENT_MODE_FILECOPY)?w->data->rbytes:w->data->bytes);
        long size = (w->mode == WEB_CLIENT_MODE_FILECOPY)?w->data->rbytes:w->data->bytes;
-       
+
        if(w->last_url[0]) log_access("%llu: (sent/all = %ld/%ld bytes %0.0f%%, prep/sent/total = %0.2f/%0.2f/%0.2f ms) %s: '%s'",
                w->id,
                sent, size, -((size>0)?((float)(size-sent)/(float)size * 100.0):0.0),
@@ -3188,13 +3188,13 @@ int web_client_data_request(struct web_client *w, char *url, int datasource_type
 
                                                else if(strcmp(key, "sig") == 0)
                                                        google_sig = value;
-                                               
+
                                                else if(strcmp(key, "out") == 0)
                                                        google_out = value;
-                                               
+
                                                else if(strcmp(key, "responseHandler") == 0)
                                                        google_responseHandler = value;
-                                               
+
                                                else if(strcmp(key, "outFileName") == 0)
                                                        google_outFileName = value;
                                        }
@@ -3211,7 +3211,7 @@ int web_client_data_request(struct web_client *w, char *url, int datasource_type
 
                        // check the client wants json
                        if(strcmp(google_out, "json") != 0) {
-                               w->data->bytes = snprintf(w->data->buffer, w->data->size, 
+                               w->data->bytes = snprintf(w->data->buffer, w->data->size,
                                        "%s({version:'%s',reqId:'%s',status:'error',errors:[{reason:'invalid_query',message:'output format is not supported',detailed_message:'the format %s requested is not supported by netdata.'}]});",
                                        google_responseHandler, google_version, google_reqId, google_out);
                                        return 200;
@@ -3220,11 +3220,11 @@ int web_client_data_request(struct web_client *w, char *url, int datasource_type
        }
 
        if(datasource_type == DATASOURCE_GOOGLE_JSONP) {
-               w->data->bytes = snprintf(w->data->buffer, w->data->size, 
+               w->data->bytes = snprintf(w->data->buffer, w->data->size,
                        "%s({version:'%s',reqId:'%s',status:'ok',sig:'%lu',table:",
                        google_responseHandler, google_version, google_reqId, st->last_updated.tv_sec);
        }
-       
+
        debug(D_WEB_CLIENT_ACCESS, "%llu: Sending RRD data '%s' (id %s, %d lines, %d group, %d group_method, %lu after, %lu before).", w->id, st->name, st->id, lines, group_count, group_method, after, before);
        unsigned long timestamp_in_data = rrd_stats_json(datasource_type, st, w->data, lines, group_count, group_method, after, before, nonzero);
 
@@ -3234,7 +3234,7 @@ int web_client_data_request(struct web_client *w, char *url, int datasource_type
 
                else {
                        // the client already has the latest data
-                       w->data->bytes = snprintf(w->data->buffer, w->data->size, 
+                       w->data->bytes = snprintf(w->data->buffer, w->data->size,
                                "%s({version:'%s',reqId:'%s',status:'error',errors:[{reason:'not_modified',message:'Data not modified'}]});",
                                google_responseHandler, google_version, google_reqId);
                }
@@ -3422,7 +3422,7 @@ void web_client_process(struct web_client *w)
                        strcpy(w->data->buffer, "I don't understand you...\r\n");
                        w->data->bytes = strlen(w->data->buffer);
                }
-               
+
                // free url_decode() buffer
                if(pointer_to_free) free(pointer_to_free);
        }
@@ -3545,7 +3545,7 @@ void web_client_process(struct web_client *w)
        strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %Z", &tm);
 
        char custom_header[MAX_HTTP_HEADER_SIZE + 1] = "";
-       if(w->response_header[0]) 
+       if(w->response_header[0])
                strcpy(custom_header, w->response_header);
 
        int headerlen = 0;
@@ -3655,7 +3655,7 @@ void web_client_process(struct web_client *w)
 long web_client_send_chunk_header(struct web_client *w, int len)
 {
        debug(D_DEFLATE, "%llu: OPEN CHUNK of %d bytes (hex: %x).", w->id, len, len);
-       char buf[1024]; 
+       char buf[1024];
        sprintf(buf, "%X\r\n", len);
        int bytes = send(w->ofd, buf, strlen(buf), MSG_DONTWAIT);
 
@@ -4075,7 +4075,7 @@ void *socket_listen_main(void *ptr)
                                        error("%llu: Cannot request detach of newly created web client thread.", w->id);
                                        w->obsolete = 1;
                                }
-                               
+
                                log_access("%llu: %s connected", w->id, w->client_ip);
                        }
                        else debug(D_WEB_CLIENT, "LISTENER: select() didn't do anything.");
@@ -4128,10 +4128,10 @@ int do_proc_net_dev() {
        char iface[MAX_PROC_NET_DEV_IFACE_NAME + 1] = "";
        unsigned long long rbytes, rpackets, rerrors, rdrops, rfifo, rframe, rcompressed, rmulticast;
        unsigned long long tbytes, tpackets, terrors, tdrops, tfifo, tcollisions, tcarrier, tcompressed;
-       
+
        int r;
        char *p;
-       
+
        if(fp) {
                if(fseek(fp, 0, SEEK_SET) == -1) {
                        error("Re-opening file /proc/net/dev.");
@@ -4147,20 +4147,20 @@ int do_proc_net_dev() {
                        return 1;
                }
        }
-       
+
        // skip the first two lines
        p = fgets(buffer, MAX_PROC_NET_DEV_LINE, fp);
        p = fgets(buffer, MAX_PROC_NET_DEV_LINE, fp);
-       
+
        // read the rest of the lines
        for(;1;) {
                char *c;
                p = fgets(buffer, MAX_PROC_NET_DEV_LINE, fp);
                if(!p) break;
-               
+
                c = strchr(buffer, ':');
                if(c) *c = '\t';
-               
+
                r = sscanf(buffer, "%s %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
                        iface,
                        &rbytes, &rpackets, &rerrors, &rdrops, &rfifo, &rframe, &rcompressed, &rmulticast,
@@ -4269,7 +4269,7 @@ int do_proc_net_dev() {
                        rrd_stats_done(st);
                }
        }
-       
+
        return 0;
 }
 
@@ -4294,10 +4294,10 @@ int do_proc_diskstats() {
 
        char buffer[MAX_PROC_DISKSTATS_LINE+1] = "";
        char disk[MAX_PROC_DISKSTATS_DISK_NAME + 1] = "";
-       
+
        int r;
        char *p;
-       
+
        if(fp) {
                if(fseek(fp, 0, SEEK_SET) == -1) {
                        error("Re-opening file /proc/diskstats.");
@@ -4313,7 +4313,7 @@ int do_proc_diskstats() {
                        return 1;
                }
        }
-       
+
        for(;1;) {
                unsigned long long      major = 0, minor = 0,
                                                        reads = 0,  reads_merged = 0,  readsectors = 0,  readms = 0,
@@ -4322,7 +4322,7 @@ int do_proc_diskstats() {
 
                p = fgets(buffer, MAX_PROC_DISKSTATS_LINE, fp);
                if(!p) break;
-               
+
                r = sscanf(buffer, "%llu %llu %s %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
                        &major, &minor, disk,
                        &reads, &reads_merged, &readsectors, &readms, &writes, &writes_merged, &writesectors, &writems, &currentios, &iosms, &wiosms
@@ -4520,7 +4520,7 @@ int do_proc_diskstats() {
                        rrd_stats_dimension_set(st, "writes", writes);
                        rrd_stats_done(st);
                }
-               
+
                // --------------------------------------------------------------------
 
                if(do_merged_ops) {
@@ -4577,7 +4577,7 @@ int do_proc_diskstats() {
                        rrd_stats_done(st);
                }
        }
-       
+
        return 0;
 }
 
@@ -4586,7 +4586,7 @@ int do_proc_diskstats() {
 
 int do_proc_net_snmp() {
        static int do_ip_packets = -1, do_ip_fragsout = -1, do_ip_fragsin = -1, do_ip_errors = -1,
-               do_tcp_sockets = -1, do_tcp_packets = -1, do_tcp_errors = -1, do_tcp_handshake = -1, 
+               do_tcp_sockets = -1, do_tcp_packets = -1, do_tcp_errors = -1, do_tcp_handshake = -1,
                do_udp_packets = -1, do_udp_errors = -1;
        static FILE *fp = NULL;
 
@@ -4753,7 +4753,7 @@ int do_proc_net_snmp() {
                        if(r != 14) error("Cannot read /proc/net/snmp TCP line. Expected 14 params, read %d.", r);
 
                        // --------------------------------------------------------------------
-                       
+
                        // see http://net-snmp.sourceforge.net/docs/mibs/tcp.html
                        if(do_tcp_sockets) {
                                st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcpsock");
@@ -4769,7 +4769,7 @@ int do_proc_net_snmp() {
                        }
 
                        // --------------------------------------------------------------------
-                       
+
                        if(do_tcp_packets) {
                                st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcppackets");
                                if(!st) {
@@ -4786,7 +4786,7 @@ int do_proc_net_snmp() {
                        }
 
                        // --------------------------------------------------------------------
-                       
+
                        if(do_tcp_errors) {
                                st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcperrors");
                                if(!st) {
@@ -4804,7 +4804,7 @@ int do_proc_net_snmp() {
                        }
 
                        // --------------------------------------------------------------------
-                       
+
                        if(do_tcp_handshake) {
                                st = rrd_stats_find(RRD_TYPE_NET_SNMP ".tcphandshake");
                                if(!st) {
@@ -4846,7 +4846,7 @@ int do_proc_net_snmp() {
                        if(r != 6) error("Cannot read /proc/net/snmp UDP line. Expected 6 params, read %d.", r);
 
                        // --------------------------------------------------------------------
-                       
+
                        // see http://net-snmp.sourceforge.net/docs/mibs/udp.html
                        if(do_udp_packets) {
                                st = rrd_stats_find(RRD_TYPE_NET_SNMP ".udppackets");
@@ -4864,7 +4864,7 @@ int do_proc_net_snmp() {
                        }
 
                        // --------------------------------------------------------------------
-                       
+
                        if(do_udp_errors) {
                                st = rrd_stats_find(RRD_TYPE_NET_SNMP ".udperrors");
                                if(!st) {
@@ -4886,7 +4886,7 @@ int do_proc_net_snmp() {
                        }
                }
        }
-       
+
        return 0;
 }
 
@@ -4940,7 +4940,7 @@ int do_proc_net_netstat() {
                                InNoRoutes = 0, InTruncatedPkts = 0,
                                InOctets = 0,  InMcastPkts = 0,  InBcastPkts = 0,  InMcastOctets = 0,  InBcastOctets = 0,
                                OutOctets = 0, OutMcastPkts = 0, OutBcastPkts = 0, OutMcastOctets = 0, OutBcastOctets = 0;
-       
+
                        int r = sscanf(&buffer[7], "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
                                &InNoRoutes, &InTruncatedPkts, &InMcastPkts, &OutMcastPkts, &InBcastPkts, &OutBcastPkts,
                                &InOctets, &OutOctets, &InMcastOctets, &OutMcastOctets, &InBcastOctets, &OutBcastOctets);
@@ -5061,7 +5061,7 @@ int do_proc_net_netstat() {
                        }
                }
        }
-       
+
        return 0;
 }
 
@@ -5140,7 +5140,7 @@ int do_proc_net_stat_conntrack() {
        RRD_STATS *st;
 
        // --------------------------------------------------------------------
-       
+
        if(do_sockets) {
                st = rrd_stats_find(RRD_TYPE_NET_STAT_CONNTRACK ".sockets");
                if(!st) {
@@ -5334,7 +5334,7 @@ int do_proc_net_ip_vs_stats() {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_packets) {
                st = rrd_stats_find(RRD_TYPE_NET_IPVS ".packets");
                if(!st) {
@@ -5351,7 +5351,7 @@ int do_proc_net_ip_vs_stats() {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_bandwidth) {
                st = rrd_stats_find(RRD_TYPE_NET_IPVS ".net");
                if(!st) {
@@ -5473,7 +5473,7 @@ int do_proc_stat() {
                        if(r != 2) error("Cannot read /proc/stat intr line. Expected 2 params, read %d.", r);
 
                        // --------------------------------------------------------------------
-       
+
                        if(do_interrupts) {
                                st = rrd_stats_find_bytype("system", id);
                                if(!st) {
@@ -5498,7 +5498,7 @@ int do_proc_stat() {
                        if(r != 2) error("Cannot read /proc/stat ctxt line. Expected 2 params, read %d.", r);
 
                        // --------------------------------------------------------------------
-       
+
                        if(do_context) {
                                st = rrd_stats_find_bytype("system", id);
                                if(!st) {
@@ -5692,7 +5692,7 @@ int do_proc_meminfo() {
        RRD_STATS *st;
 
        // --------------------------------------------------------------------
-       
+
        // http://stackoverflow.com/questions/3019748/how-to-reliably-measure-available-memory-in-linux
        unsigned long long MemUsed = MemTotal - MemFree - Cached - Buffers;
 
@@ -5716,7 +5716,7 @@ int do_proc_meminfo() {
        }
 
        // --------------------------------------------------------------------
-       
+
        unsigned long long SwapUsed = SwapTotal - SwapFree;
 
        if(do_swap) {
@@ -5736,7 +5736,7 @@ int do_proc_meminfo() {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(hwcorrupted && do_hwcorrupt) {
                st = rrd_stats_find("mem.hwcorrupt");
                if(!st) {
@@ -5752,7 +5752,7 @@ int do_proc_meminfo() {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_committed) {
                st = rrd_stats_find("mem.committed");
                if(!st) {
@@ -5768,7 +5768,7 @@ int do_proc_meminfo() {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_writeback) {
                st = rrd_stats_find("mem.writeback");
                if(!st) {
@@ -5792,7 +5792,7 @@ int do_proc_meminfo() {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_kernel) {
                st = rrd_stats_find("mem.kernel");
                if(!st) {
@@ -5814,7 +5814,7 @@ int do_proc_meminfo() {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_slab) {
                st = rrd_stats_find("mem.slab");
                if(!st) {
@@ -5872,7 +5872,7 @@ int do_proc_vmstat() {
                nr_shmem = 0, nr_dirtied = 0, nr_written = 0, nr_anon_transparent_hugepages = 0, nr_dirty_threshold = 0, nr_dirty_background_threshold = 0,
                pgpgin = 0, pgpgout = 0, pswpin = 0, pswpout = 0, pgalloc_dma = 0, pgalloc_dma32 = 0, pgalloc_normal = 0, pgalloc_movable = 0, pgfree = 0, pgactivate = 0, pgdeactivate = 0,
                pgfault = 0, pgmajfault = 0, pgrefill_dma = 0, pgrefill_dma32 = 0, pgrefill_normal = 0, pgrefill_movable = 0, pgsteal_kswapd_dma = 0, pgsteal_kswapd_dma32 = 0,
-               pgsteal_kswapd_normal = 0, pgsteal_kswapd_movable = 0, pgsteal_direct_dma = 0, pgsteal_direct_dma32 = 0, pgsteal_direct_normal = 0, pgsteal_direct_movable = 0, 
+               pgsteal_kswapd_normal = 0, pgsteal_kswapd_movable = 0, pgsteal_direct_dma = 0, pgsteal_direct_dma32 = 0, pgsteal_direct_normal = 0, pgsteal_direct_movable = 0,
                pgscan_kswapd_dma = 0, pgscan_kswapd_dma32 = 0, pgscan_kswapd_normal = 0, pgscan_kswapd_movable = 0, pgscan_direct_dma = 0, pgscan_direct_dma32 = 0, pgscan_direct_normal = 0,
                pgscan_direct_movable = 0, pginodesteal = 0, slabs_scanned = 0, kswapd_inodesteal = 0, kswapd_low_wmark_hit_quickly = 0, kswapd_high_wmark_hit_quickly = 0,
                kswapd_skip_congestion_wait = 0, pageoutrun = 0, allocstall = 0, pgrotated = 0, compact_blocks_moved = 0, compact_pages_moved = 0, compact_pagemigrate_failed = 0,
@@ -5992,7 +5992,7 @@ int do_proc_vmstat() {
        RRD_STATS *st;
 
        // --------------------------------------------------------------------
-       
+
        if(do_swapio) {
                st = rrd_stats_find("system.swapio");
                if(!st) {
@@ -6009,7 +6009,7 @@ int do_proc_vmstat() {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_io) {
                st = rrd_stats_find("system.io");
                if(!st) {
@@ -6026,7 +6026,7 @@ int do_proc_vmstat() {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_pgfaults) {
                st = rrd_stats_find("system.pgfaults");
                if(!st) {
@@ -6064,7 +6064,7 @@ void *proc_main(void *ptr)
 
        gettimeofday(&last, NULL);
        last.tv_sec -= update_every;
-       
+
        // disable (by default) various interface that are not needed
        config_get_boolean("plugin:proc:/proc/net/dev", "interface lo", 0);
        config_get_boolean("plugin:proc:/proc/net/dev", "interface fireqos_monitor", 0);
@@ -6088,7 +6088,7 @@ void *proc_main(void *ptr)
 
        unsigned long long usec = 0, susec = 0;
        for(;1;) {
-               
+
                // BEGIN -- the job to be done
                if(!vdo_proc_net_dev)                   vdo_proc_net_dev                = do_proc_net_dev(usec);
                if(!vdo_proc_diskstats)                 vdo_proc_diskstats              = do_proc_diskstats(usec);
@@ -6100,19 +6100,19 @@ void *proc_main(void *ptr)
                if(!vdo_proc_meminfo)                   vdo_proc_meminfo                = do_proc_meminfo(usec);
                if(!vdo_proc_vmstat)                    vdo_proc_vmstat                 = do_proc_vmstat(usec);
                // END -- the job is done
-               
+
                // find the time to sleep in order to wait exactly update_every seconds
                gettimeofday(&now, NULL);
                usec = usecdiff(&now, &last) - susec;
                debug(D_PROCNETDEV_LOOP, "PROCNETDEV: last loop took %llu usec (worked for %llu, sleeped for %llu).", usec + susec, usec, susec);
-               
+
                if(usec < (update_every * 1000000ULL / 2ULL)) susec = (update_every * 1000000ULL) - usec;
                else susec = update_every * 1000000ULL / 2ULL;
-               
+
                // --------------------------------------------------------------------
 
                if(!vdo_cpu_netdata && getrusage(RUSAGE_SELF, &me) == 0) {
-               
+
                        unsigned long long cpuuser = me.ru_utime.tv_sec * 1000000ULL + me.ru_utime.tv_usec;
                        unsigned long long cpusyst = me.ru_stime.tv_sec * 1000000ULL + me.ru_stime.tv_usec;
 
@@ -6128,7 +6128,7 @@ void *proc_main(void *ptr)
                        rrd_stats_dimension_set(stcpu, "user", cpuuser);
                        rrd_stats_dimension_set(stcpu, "system", cpusyst);
                        rrd_stats_done(stcpu);
-                       
+
                        bcopy(&me, &me_last, sizeof(struct rusage));
 
                        // ----------------------------------------------------------------
@@ -6174,7 +6174,7 @@ void *proc_main(void *ptr)
                }
 
                usleep(susec);
-               
+
                // copy current to last
                bcopy(&now, &last, sizeof(struct timeval));
        }
@@ -6215,7 +6215,7 @@ void tc_device_commit(struct tc_device *d)
        static int enable_new_interfaces = -1;
 
        if(enable_new_interfaces == -1) enable_new_interfaces = config_get_boolean("plugin:tc", "enable new interfaces detected at runtime", 1);
-       
+
        // we only need to add leaf classes
        struct tc_class *c, *x;
 
@@ -6231,7 +6231,7 @@ void tc_device_commit(struct tc_device *d)
                        }
                }
        }
-       
+
        // debugging:
        /*
        for ( c = d->classes ; c ; c = c->next) {
@@ -6271,7 +6271,7 @@ void tc_device_commit(struct tc_device *d)
                for ( c = d->classes ; c ; c = c->next) {
                        if(c->isleaf && c->hasparent) {
                                if(rrd_stats_dimension_set(st, c->id, c->bytes) != 0) {
-                                       
+
                                        // new class, we have to add it
                                        rrd_stats_dimension_add(st, c->id, c->name, 8, 1024 * update_every, RRD_DIMENSION_INCREMENTAL);
                                        rrd_stats_dimension_set(st, c->id, c->bytes);
@@ -6599,7 +6599,7 @@ void *checks_main(void *ptr)
                loop_usec = usecdiff(&now, &last);
                usec = loop_usec - susec;
                debug(D_PROCNETDEV_LOOP, "CHECK: last loop took %llu usec (worked for %llu, sleeped for %llu).", loop_usec, usec, susec);
-               
+
                if(usec < (update_every * 1000000ULL / 2ULL)) susec = (update_every * 1000000ULL) - usec;
                else susec = update_every * 1000000ULL / 2ULL;
 
@@ -6674,7 +6674,7 @@ struct plugind {
 char *qstrsep(char **ptr)
 {
        if(!*ptr || !**ptr) return NULL;
-       
+
        char *s, *p = *ptr;
 
        // skip leading spaces
@@ -6736,7 +6736,7 @@ void *pluginsd_worker_thread(void *arg)
                        else if(!strcmp(s, "SET")) {
                                char *t;
                                while((t = strchr(p, '='))) *t = ' ';
-                               
+
                                char *dimension = qstrsep(&p);
                                char *value = qstrsep(&p);
 
@@ -7037,7 +7037,7 @@ void *pluginsd_main(void *ptr)
                                if(!cd) fatal("Cannot allocate memory for plugin.");
 
                                snprintf(cd->id, CONFIG_MAX_NAME, "plugin:%s", pluginname);
-                               
+
                                strncpy(cd->filename, file->d_name, FILENAME_MAX);
                                snprintf(cd->fullfilename, FILENAME_MAX, "%s/%s", dir_name, cd->filename);
 
@@ -7107,7 +7107,7 @@ void kill_childs()
                pthread_join(w->thread, NULL);
        }
 
-       int i;  
+       int i;
        for (i = 0; static_threads[i].name != NULL ; i++) {
                if(static_threads[i].thread) {
                        debug(D_EXIT, "Stopping %s thread", static_threads[i].name);
@@ -7158,7 +7158,7 @@ void process_childs(int wait)
                                error("pid %d killed by signal %d.", info.si_pid, info.si_status);
                                break;
 
-                       case CLD_DUMPED: 
+                       case CLD_DUMPED:
                                error("pid %d core dumped by signal %d.", info.si_pid, info.si_status);
                                break;
 
@@ -7234,7 +7234,7 @@ void prepare_rundir() {
                mkdir(rundir, 0775);
                snprintf(rundir, FILENAME_MAX, "/run/user/%d/netdata", getpid());
        }
-       
+
        snprintf(pidfile, FILENAME_MAX, "%s/netdata.pid", rundir);
 
        if(mkdir(rundir, 0775) != 0)
@@ -7332,7 +7332,7 @@ int become_daemon(int close_all_files, const char *input, const char *output, co
                        }
                }
        }
-       
+
        if((dev_null = open("/dev/null", O_RDWR, 0666)) == -1) {
                perror("Cannot open /dev/null");
                if(input_fd != -1) close(input_fd);
@@ -7385,7 +7385,7 @@ int become_daemon(int close_all_files, const char *input, const char *output, co
        // close all files
        if(close_all_files) {
                for(i = sysconf(_SC_OPEN_MAX); i > 0; i--)
-                       if(   
+                       if(
                                ((access_fd && i != *access_fd) || !access_fd)
                                && i != dev_null
                                && i != input_fd
@@ -7410,7 +7410,7 @@ int become_daemon(int close_all_files, const char *input, const char *output, co
                input_fd = -1;
        }
        else dup2(dev_null, STDIN_FILENO);
-       
+
        if(output_fd != -1) {
                if(output_fd != STDOUT_FILENO) {
                        dup2(output_fd, STDOUT_FILENO);
@@ -7557,8 +7557,8 @@ int unit_test(long delay, long shift)
                for(rd = st->dimensions ; rd ; rd = rd->next) {
                        fprintf(stderr, "\t %s " STORAGE_NUMBER_FORMAT "   ->   ", rd->id, rd->values[c]);
 
-                       if(rd == rdabs) v = 
-                               (         oincrement 
+                       if(rd == rdabs) v =
+                               (         oincrement
                                        + (increment * (1000000 - shift) / 1000000)
                                        + c * increment
                                ) * 10;
@@ -7768,7 +7768,7 @@ int main(int argc, char **argv)
 
        // catch all signals
        for (i = 1 ; i < 65 ;i++) if(i != SIGSEGV && i != SIGFPE) signal(i,  sig_handler);
-       
+
        for (i = 0; static_threads[i].name != NULL ; i++) {
                struct netdata_static_thread *st = &static_threads[i];
                int doit = 1;
index 5d204a8f0ff8935384a30739d2e58879186dedf1..d597e346a19a63aea7e49b3803920e9df96f07da 100755 (executable)
@@ -52,7 +52,7 @@ void *checks_main(void *ptr)
                loop_usec = usecdiff(&now, &last);
                usec = loop_usec - susec;
                debug(D_PROCNETDEV_LOOP, "CHECK: last loop took %llu usec (worked for %llu, sleeped for %llu).", loop_usec, usec, susec);
-               
+
                if(usec < (rrd_update_every * 1000000ULL / 2ULL)) susec = (rrd_update_every * 1000000ULL) - usec;
                else susec = rrd_update_every * 1000000ULL / 2ULL;
 
index 507db93f14c8a2f43c4c89b2bc32e52f002485f6..c088069a3284f11fa0a15f5ee94318a10b3365a6 100644 (file)
@@ -150,7 +150,7 @@ void *nfacct_main(void *ptr) {
                gettimeofday(&now, NULL);
                usec = usecdiff(&now, &last) - susec;
                debug(D_NFACCT_LOOP, "nfacct.plugin: last loop took %llu usec (worked for %llu, sleeped for %llu).", usec + susec, usec, susec);
-               
+
                if(usec < (rrd_update_every * 1000000ULL / 2ULL)) susec = (rrd_update_every * 1000000ULL) - usec;
                else susec = rrd_update_every * 1000000ULL / 2ULL;
 
@@ -175,7 +175,7 @@ void *nfacct_main(void *ptr) {
                                if(!rd) rd = rrddim_add(st, nfacct_list->data[i].name, NULL, 1, rrd_update_every, RRDDIM_INCREMENTAL);
                                if(rd) rrddim_set_by_pointer(st, rd, nfacct_list->data[i].pkts);
                        }
-                       
+
                        rrdset_done(st);
 
                        // ----------------------------------------------------------------
@@ -195,14 +195,14 @@ void *nfacct_main(void *ptr) {
                                if(!rd) rd = rrddim_add(st, nfacct_list->data[i].name, NULL, 1, 1000 * rrd_update_every, RRDDIM_INCREMENTAL);
                                if(rd) rrddim_set_by_pointer(st, rd, nfacct_list->data[i].bytes);
                        }
-                       
+
                        rrdset_done(st);
                }
 
                // --------------------------------------------------------------------
 
                usleep(susec);
-               
+
                // copy current to last
                bcopy(&now, &last, sizeof(struct timeval));
        }
index 91646eb719d422a8e8a8cc3c148900728b0b9468..40ec38aab647c0a3b393353a5d0a6b057ff89013 100755 (executable)
@@ -31,7 +31,7 @@ void *proc_main(void *ptr)
 
        gettimeofday(&last, NULL);
        last.tv_sec -= rrd_update_every;
-       
+
        // disable (by default) various interface that are not needed
        config_get_boolean("plugin:proc:/proc/net/dev", "interface lo", 0);
        config_get_boolean("plugin:proc:/proc/net/dev", "interface fireqos_monitor", 0);
@@ -57,9 +57,9 @@ void *proc_main(void *ptr)
 
        unsigned long long usec = 0, susec = 0;
        for(;1;) {
-               
+
                // BEGIN -- the job to be done
-               
+
                if(!vdo_proc_interrupts) {
                        debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_interrupts().");
                        vdo_proc_interrupts = do_proc_interrupts(rrd_update_every, usec+susec);
@@ -117,15 +117,15 @@ void *proc_main(void *ptr)
                }
 
                // END -- the job is done
-               
+
                // find the time to sleep in order to wait exactly update_every seconds
                gettimeofday(&now, NULL);
                usec = usecdiff(&now, &last) - susec;
                debug(D_PROCNETDEV_LOOP, "PROCNETDEV: last loop took %llu usec (worked for %llu, sleeped for %llu).", usec + susec, usec, susec);
-               
+
                if(usec < (rrd_update_every * 1000000ULL / 2ULL)) susec = (rrd_update_every * 1000000ULL) - usec;
                else susec = rrd_update_every * 1000000ULL / 2ULL;
-               
+
                // --------------------------------------------------------------------
 
                if(!vdo_cpu_netdata) {
@@ -203,7 +203,7 @@ void *proc_main(void *ptr)
                }
 
                usleep(susec);
-               
+
                // copy current to last
                bcopy(&now, &last, sizeof(struct timeval));
        }
index 1c1347fc280e9d20b87f9406d53c77e34b5d9ccc..817471dd369dca3141d45fe862ded25d1d4da87d 100755 (executable)
@@ -166,7 +166,7 @@ static void tc_device_commit(struct tc_device *d)
        static int enable_new_interfaces = -1;
 
        if(enable_new_interfaces == -1) enable_new_interfaces = config_get_boolean("plugin:tc", "enable new interfaces detected at runtime", 1);
-       
+
        // we only need to add leaf classes
        struct tc_class *c, *x;
 
@@ -194,7 +194,7 @@ static void tc_device_commit(struct tc_device *d)
                        }
                }
        }
-       
+
        // debugging:
        /*
        for ( c = d->classes ; c ; c = c->next) {
@@ -246,7 +246,7 @@ static void tc_device_commit(struct tc_device *d)
 
                                if(!rd) {
                                        debug(D_TC_LOOP, "TC: Adding to chart '%s', dimension '%s'", st->id, c->id, c->name);
-                                       
+
                                        // new class, we have to add it
                                        rd = rrddim_add(st, c->id, c->name?c->name:c->id, 8, 1024, RRDDIM_INCREMENTAL);
                                }
index 37b1ef57e91d27651472c922545993ef9c45d16e..f5cdc60a37882d0ee86e33ed736ccad7133040ed 100755 (executable)
@@ -468,7 +468,7 @@ void *pluginsd_main(void *ptr)
                                if(unlikely(!cd)) fatal("Cannot allocate memory for plugin.");
 
                                snprintf(cd->id, CONFIG_MAX_NAME, "plugin:%s", pluginname);
-                               
+
                                strncpy(cd->filename, file->d_name, FILENAME_MAX);
                                snprintf(cd->fullfilename, FILENAME_MAX, "%s/%s", dir_name, cd->filename);
 
index 343733eb1509a4a267e2fd7239760b58bce03fb3..58dc1f549e519317b391ebaa2c2251972443280a 100755 (executable)
@@ -112,7 +112,7 @@ FILE *mypopen(const char *command, pid_t *pidptr)
        fprintf(stdout, "MYPID %d\n", getpid());
        fflush(NULL);
 #endif
-       
+
        // reset all signals
        for (i = 1 ; i < 65 ;i++) if(i != SIGSEGV) signal(i, SIG_DFL);
 
@@ -123,7 +123,7 @@ FILE *mypopen(const char *command, pid_t *pidptr)
 
 void mypclose(FILE *fp, pid_t pid) {
        debug(D_EXIT, "Request to mypclose() on pid %d", pid);
-       
+
        /*mypopen_del(fp);*/
        fclose(fp);
 
@@ -138,7 +138,7 @@ void mypclose(FILE *fp, pid_t pid) {
                                error("pid %d killed by signal %d.", info.si_pid, info.si_status);
                                break;
 
-                       case CLD_DUMPED: 
+                       case CLD_DUMPED:
                                error("pid %d core dumped by signal %d.", info.si_pid, info.si_status);
                                break;
 
index 4d16fd26dc536fffe11038c76a6c4282e52ee1c0..0992abff49ee669bd211c028ef927d5f979f56a8 100755 (executable)
@@ -438,6 +438,6 @@ int do_proc_diskstats(int update_every, unsigned long long dt) {
                        }
                }
        }
-       
+
        return 0;
 }
index ceec23784dfaef61a60b79198c3c0a5f1ed64d50..a109e2365f79833cceba15038512c0d9e28bd660 100755 (executable)
@@ -108,7 +108,7 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
        RRDSET *st;
 
        // --------------------------------------------------------------------
-       
+
        // http://stackoverflow.com/questions/3019748/how-to-reliably-measure-available-memory-in-linux
        unsigned long long MemUsed = MemTotal - MemFree - Cached - Buffers;
 
@@ -132,7 +132,7 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        unsigned long long SwapUsed = SwapTotal - SwapFree;
 
        if(do_swap) {
@@ -152,7 +152,7 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(hwcorrupted && do_hwcorrupt) {
                st = rrdset_find("mem.hwcorrupt");
                if(!st) {
@@ -168,7 +168,7 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_committed) {
                st = rrdset_find("mem.committed");
                if(!st) {
@@ -184,7 +184,7 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_writeback) {
                st = rrdset_find("mem.writeback");
                if(!st) {
@@ -208,7 +208,7 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_kernel) {
                st = rrdset_find("mem.kernel");
                if(!st) {
@@ -230,7 +230,7 @@ int do_proc_meminfo(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_slab) {
                st = rrdset_find("mem.slab");
                if(!st) {
index b7fbec537fb121fd8704ec39a80820a17da61a30..280df962f96db1b3ca67facc3847fa91823bf9e9 100755 (executable)
@@ -65,7 +65,7 @@ int do_proc_net_ip_vs_stats(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_packets) {
                st = rrdset_find(RRD_TYPE_NET_IPVS ".packets");
                if(!st) {
@@ -82,7 +82,7 @@ int do_proc_net_ip_vs_stats(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_bandwidth) {
                st = rrdset_find(RRD_TYPE_NET_IPVS ".net");
                if(!st) {
index 8f46c92ee8b59c8a0ce3dcaabfde04331c3052fd..c99565c100de206cc7a59f6501fc6bbf85a62ddb 100755 (executable)
@@ -56,7 +56,7 @@ int do_proc_net_netstat(int update_every, unsigned long long dt) {
                                InNoRoutes = 0, InTruncatedPkts = 0,
                                InOctets = 0,  InMcastPkts = 0,  InBcastPkts = 0,  InMcastOctets = 0,  InBcastOctets = 0,
                                OutOctets = 0, OutMcastPkts = 0, OutBcastPkts = 0, OutMcastOctets = 0, OutBcastOctets = 0;
-                       
+
                        InNoRoutes                      = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
                        InTruncatedPkts         = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
                        InMcastPkts             = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
@@ -180,6 +180,6 @@ int do_proc_net_netstat(int update_every, unsigned long long dt) {
                        }
                }
        }
-       
+
        return 0;
 }
index ba3a8d47bbfbb4bd08b895e735bff81a121b9a9a..e111bd417042d175f651ca4233ffe6e142cf5e87 100644 (file)
@@ -199,7 +199,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                                error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 4);
                                continue;
                        }
-                       
+
                        rc_hits = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
                        rc_misses = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
                        rc_nocache = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
@@ -213,7 +213,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                                error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 6);
                                continue;
                        }
-                       
+
                        fh_stale = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
                        fh_total_lookups = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
                        fh_anonymous_lookups = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
@@ -229,7 +229,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                                error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 3);
                                continue;
                        }
-                       
+
                        io_read = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
                        io_write = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
 
@@ -242,7 +242,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                                error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 13);
                                continue;
                        }
-                       
+
                        th_threads = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
                        th_fullcnt = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
                        th_hist10 = (unsigned long long)(atof(procfile_lineword(ff, l, 3)) * 1000.0);
@@ -273,7 +273,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                                error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 13);
                                continue;
                        }
-                       
+
                        ra_size = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
                        ra_hist10 = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
                        ra_hist20 = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
@@ -302,7 +302,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                                error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 5);
                                continue;
                        }
-                       
+
                        net_count = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
                        net_udp_count = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
                        net_tcp_count = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
@@ -317,7 +317,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                                error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 6);
                                continue;
                        }
-                       
+
                        rpc_count = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
                        rpc_bad_format = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
                        rpc_bad_auth = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
@@ -628,7 +628,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
 
                for(i = 0; nfsd_proc_values[i].present2 ; i++)
                        rrddim_set(st, nfsd_proc_values[i].name, nfsd_proc_values[i].proc2);
-               
+
                rrdset_done(st);
        }
 
@@ -647,7 +647,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
 
                for(i = 0; nfsd_proc_values[i].present3 ; i++)
                        rrddim_set(st, nfsd_proc_values[i].name, nfsd_proc_values[i].proc3);
-               
+
                rrdset_done(st);
        }
 
@@ -666,7 +666,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
 
                for(i = 0; nfsd_proc_values[i].present4 ; i++)
                        rrddim_set(st, nfsd_proc_values[i].name, nfsd_proc_values[i].proc4);
-               
+
                rrdset_done(st);
        }
 
@@ -685,7 +685,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
 
                for(i = 0; nfsd4_ops_values[i].present ; i++)
                        rrddim_set(st, nfsd4_ops_values[i].name, nfsd4_ops_values[i].value);
-               
+
                rrdset_done(st);
        }
 
index 482fc94ae573d6d36b9cd0c7df2437a997ce53f3..9a7b988319d58272b16e5f02bef16c330303efea 100755 (executable)
@@ -18,7 +18,7 @@
 int do_proc_net_snmp(int update_every, unsigned long long dt) {
        static procfile *ff = NULL;
        static int do_ip_packets = -1, do_ip_fragsout = -1, do_ip_fragsin = -1, do_ip_errors = -1,
-               do_tcp_sockets = -1, do_tcp_packets = -1, do_tcp_errors = -1, do_tcp_handshake = -1, 
+               do_tcp_sockets = -1, do_tcp_packets = -1, do_tcp_errors = -1, do_tcp_handshake = -1,
                do_udp_packets = -1, do_udp_errors = -1;
 
        if(do_ip_packets == -1)         do_ip_packets           = config_get_boolean("plugin:proc:/proc/net/snmp", "ipv4 packets", 1);
@@ -87,7 +87,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
                        FragOKs                 = strtoull(procfile_lineword(ff, l, 17), NULL, 10);
                        FragFails               = strtoull(procfile_lineword(ff, l, 18), NULL, 10);
                        FragCreates             = strtoull(procfile_lineword(ff, l, 19), NULL, 10);
-                       
+
                        // these are not counters
                        if(Forwarding) {};              // is forwarding enabled?
                        if(DefaultTTL) {};              // the default ttl on packets
@@ -222,7 +222,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
                        if(MaxConn) {};
 
                        // --------------------------------------------------------------------
-                       
+
                        // see http://net-snmp.sourceforge.net/docs/mibs/tcp.html
                        if(do_tcp_sockets) {
                                st = rrdset_find(RRD_TYPE_NET_SNMP ".tcpsock");
@@ -238,7 +238,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
                        }
 
                        // --------------------------------------------------------------------
-                       
+
                        if(do_tcp_packets) {
                                st = rrdset_find(RRD_TYPE_NET_SNMP ".tcppackets");
                                if(!st) {
@@ -255,7 +255,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
                        }
 
                        // --------------------------------------------------------------------
-                       
+
                        if(do_tcp_errors) {
                                st = rrdset_find(RRD_TYPE_NET_SNMP ".tcperrors");
                                if(!st) {
@@ -273,7 +273,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
                        }
 
                        // --------------------------------------------------------------------
-                       
+
                        if(do_tcp_handshake) {
                                st = rrdset_find(RRD_TYPE_NET_SNMP ".tcphandshake");
                                if(!st) {
@@ -320,7 +320,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
                        SndbufErrors    = strtoull(procfile_lineword(ff, l, 6), NULL, 10);
 
                        // --------------------------------------------------------------------
-                       
+
                        // see http://net-snmp.sourceforge.net/docs/mibs/udp.html
                        if(do_udp_packets) {
                                st = rrdset_find(RRD_TYPE_NET_SNMP ".udppackets");
@@ -338,7 +338,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
                        }
 
                        // --------------------------------------------------------------------
-                       
+
                        if(do_udp_errors) {
                                st = rrdset_find(RRD_TYPE_NET_SNMP ".udperrors");
                                if(!st) {
@@ -360,7 +360,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
                        }
                }
        }
-       
+
        return 0;
 }
 
index feeaa853ad0815b0cdfb06cbc3b971b9bf26a81e..86b8643ba75c02899e7fcb4093fa44b5ebb5d3dc 100755 (executable)
@@ -95,7 +95,7 @@ int do_proc_net_stat_conntrack(int update_every, unsigned long long dt) {
        RRDSET *st;
 
        // --------------------------------------------------------------------
-       
+
        if(do_sockets) {
                st = rrdset_find(RRD_TYPE_NET_STAT_CONNTRACK ".sockets");
                if(!st) {
index b2364beccc86ec24ff0979b0232b4b1731abe425..d532ddf4bb78d0590f153ae5000c6b7e73595be8 100755 (executable)
@@ -118,7 +118,7 @@ int do_proc_stat(int update_every, unsigned long long dt) {
                        unsigned long long value = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
 
                        // --------------------------------------------------------------------
-       
+
                        if(do_interrupts) {
                                st = rrdset_find_bytype("system", "intr");
                                if(!st) {
@@ -137,7 +137,7 @@ int do_proc_stat(int update_every, unsigned long long dt) {
                        unsigned long long value = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
 
                        // --------------------------------------------------------------------
-       
+
                        if(do_context) {
                                st = rrdset_find_bytype("system", "ctxt");
                                if(!st) {
index 8ae1eb2691498d49263dccc8d447c4d2ef594698..560e99565b9f248ee5429005fab2f7e5a5a6f091 100755 (executable)
@@ -45,7 +45,7 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
                nr_shmem = 0, nr_dirtied = 0, nr_written = 0, nr_anon_transparent_hugepages = 0, nr_dirty_threshold = 0, nr_dirty_background_threshold = 0,
                pgpgin = 0, pgpgout = 0, pswpin = 0, pswpout = 0, pgalloc_dma = 0, pgalloc_dma32 = 0, pgalloc_normal = 0, pgalloc_movable = 0, pgfree = 0, pgactivate = 0, pgdeactivate = 0,
                pgfault = 0, pgmajfault = 0, pgrefill_dma = 0, pgrefill_dma32 = 0, pgrefill_normal = 0, pgrefill_movable = 0, pgsteal_kswapd_dma = 0, pgsteal_kswapd_dma32 = 0,
-               pgsteal_kswapd_normal = 0, pgsteal_kswapd_movable = 0, pgsteal_direct_dma = 0, pgsteal_direct_dma32 = 0, pgsteal_direct_normal = 0, pgsteal_direct_movable = 0, 
+               pgsteal_kswapd_normal = 0, pgsteal_kswapd_movable = 0, pgsteal_direct_dma = 0, pgsteal_direct_dma32 = 0, pgsteal_direct_normal = 0, pgsteal_direct_movable = 0,
                pgscan_kswapd_dma = 0, pgscan_kswapd_dma32 = 0, pgscan_kswapd_normal = 0, pgscan_kswapd_movable = 0, pgscan_direct_dma = 0, pgscan_direct_dma32 = 0, pgscan_direct_normal = 0,
                pgscan_direct_movable = 0, pginodesteal = 0, slabs_scanned = 0, kswapd_inodesteal = 0, kswapd_low_wmark_hit_quickly = 0, kswapd_high_wmark_hit_quickly = 0,
                kswapd_skip_congestion_wait = 0, pageoutrun = 0, allocstall = 0, pgrotated = 0, compact_blocks_moved = 0, compact_pages_moved = 0, compact_pagemigrate_failed = 0,
@@ -160,7 +160,7 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
        RRDSET *st;
 
        // --------------------------------------------------------------------
-       
+
        if(do_swapio) {
                st = rrdset_find("system.swapio");
                if(!st) {
@@ -177,7 +177,7 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_io) {
                st = rrdset_find("system.io");
                if(!st) {
@@ -194,7 +194,7 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
        }
 
        // --------------------------------------------------------------------
-       
+
        if(do_pgfaults) {
                st = rrdset_find("system.pgfaults");
                if(!st) {
index 31b97ae20e837814887eca87ff84d136f806afd4..b06b5adc770697e38fcb597e28dfed6faedf952b 100755 (executable)
@@ -159,7 +159,7 @@ procfile *procfile_parser(procfile *ff) {
        char *s = ff->data, *e = ff->data, *t = ff->data;
        uint32_t l = 0, w = 0;
        e += ff->len;
-       
+
        ff->lines = pflines_add(ff->lines, w);
        if(unlikely(!ff->lines)) goto cleanup;
 
index 73dfa19835813b45b210a8ba6e2f9a5018e2465b..ce2f9bc927276fb09a141e6b32e5daa0df121404 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * procfile is a library for reading kernel files from /proc
- * 
+ *
  * The idea is this:
  *
  *  - every file is opened once with procfile_open().
index b3215e2cbda5d1084075fdd790a5303394286a11..3b35b4aade352d4c4f01e82eb3d55d466b8afc4d 100755 (executable)
--- a/src/rrd.c
+++ b/src/rrd.c
@@ -421,7 +421,7 @@ RRDSET *rrdset_create(const char *type, const char *id, const char *name, const
 
        st->priority = config_get_number(st->id, "priority", priority);
        st->enabled = enabled;
-       
+
        st->isdetail = 0;
        st->debug = 0;
 
@@ -557,7 +557,7 @@ RRDDIM *rrddim_add(RRDSET *st, const char *id, const char *name, long multiplier
 
        rd->entries = st->entries;
        rd->update_every = st->update_every;
-       
+
        // prevent incremental calculation spikes
        rd->counter = 0;
 
@@ -758,7 +758,7 @@ int rrddim_unhide(RRDSET *st, const char *id)
 collected_number rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, collected_number value)
 {
        debug(D_RRD_CALLS, "rrddim_set_by_pointer() for chart %s, dimension %s, value " COLLECTED_NUMBER_FORMAT, st->name, rd->name, value);
-       
+
        gettimeofday(&rd->last_collected_time, NULL);
        rd->collected_value = value;
        rd->updated = 1;
index c1b16816d7d3bb8ad19edd0e6834de64d54a5f61..20754906f7d1a407736208507725496d8ff725a0 100755 (executable)
--- a/src/rrd.h
+++ b/src/rrd.h
@@ -99,7 +99,7 @@ struct rrddim {
                                                                                                        // this is a pointer to the config structure
                                                                                                        // since the config always has a higher priority
                                                                                                        // (the user overwrites the name of the charts)
-       
+
        int algorithm;                                                                  // the algorithm that is applied to add new collected values
        long multiplier;                                                                // the multiplier of the collected values
        long divisor;                                                                   // the divider of the collected values
index 0f43ad4fe73f6c4f9426c9cbe2385da951a67d49..339b75220177295368e088887b78a52c683cf8a5 100755 (executable)
@@ -241,7 +241,7 @@ void rrd_stats_all_json(BUFFER *wb)
                }
        }
        pthread_rwlock_unlock(&rrdset_root_rwlock);
-       
+
        buffer_sprintf(wb, "\n\t],\n"
                "\t\"hostname\": \"%s\",\n"
                "\t\"update_every\": %d,\n"
index fe8e4f1f70e6be8b6f6922cadf0445e2a712cb6a..2936c24b56750406ebd57fcdc3513bad2d6777ed 100755 (executable)
@@ -127,7 +127,7 @@ calculated_number unpack_storage_number(storage_number value)
 
 static char *print_calculated_number_lu_r(char *str, unsigned long uvalue) {
        char *wstr = str;
-       
+
        // print each digit
        do *wstr++ = (char)(48 + (uvalue % 10)); while(uvalue /= 10);
        return wstr;
index a0a412409e13172fa94e1537c7ddcb2300c71f06..c3d1e8357a49d49f77baaa3c3192dcd884430f4f 100755 (executable)
@@ -76,7 +76,7 @@ void benchmark_storage_number(int loop, int multiplier) {
 
        mine = (calculated_number)sizeof(storage_number) * (calculated_number)loop;
        their = (calculated_number)sizeof(calculated_number) * (calculated_number)loop;
-       
+
        if(mine > their) {
                fprintf(stderr, "\nNETDATA NEEDS %0.2Lf TIMES MORE MEMORY. Sorry!\n", (long double)(mine / their));
        }
@@ -115,7 +115,7 @@ void benchmark_storage_number(int loop, int multiplier) {
        mine = total;
 
        fprintf(stderr, "user %0.5Lf, system %0.5Lf, total %0.5Lf\n", (long double)(user / 1000000.0), (long double)(system / 1000000.0), (long double)(total / 1000000.0));
-       
+
        // ------------------------------------------------------------------------
 
        fprintf(stderr, "SYSTEM   LONG DOUBLE PRINTING: ");
@@ -313,8 +313,8 @@ int unit_test(long delay, long shift)
                for(rd = st->dimensions ; rd ; rd = rd->next) {
                        fprintf(stderr, "\t %s " STORAGE_NUMBER_FORMAT "   ->   ", rd->id, rd->values[c]);
 
-                       if(rd == rdabs) v = 
-                               (         oincrement 
+                       if(rd == rdabs) v =
+                               (         oincrement
                                        + (increment * (1000000 - shift) / 1000000)
                                        + c * increment
                                ) * 10;
index c9dbd41590940c54d586daada51b3b3cad8767dd..c4933b2051579156a2edbac694eb7bb19ec04c50 100755 (executable)
--- a/src/url.c
+++ b/src/url.c
@@ -70,12 +70,12 @@ char *url_decode(char *str) {
 
                else
                        *pbuf++ = *pstr;
-               
+
                pstr++;
        }
-       
+
        *pbuf = '\0';
-       
+
        return buf;
 }
 
index db350ea3836dd9e404004e66cdba9741236bb1c4..694f77afe2b50fe5def701af0ac1a384ba104a3b 100755 (executable)
@@ -324,7 +324,7 @@ void buffer_increase(BUFFER *b, long free_size_required)
 
        b->buffer = realloc(b->buffer, b->size + increase + sizeof(BUFFER_OVERFLOW_EOF) + 2);
        if(!b->buffer) fatal("Failed to increase data buffer from size %d to %d.", b->size + sizeof(BUFFER_OVERFLOW_EOF) + 2, b->size + increase + sizeof(BUFFER_OVERFLOW_EOF) + 2);
-       
+
        b->size += increase;
 
        buffer_overflow_init(b);
index e7595482ad59f4d44e8d0da03c78cacfa2dbd14d..7e028d3b32b3482a38c4d43c7c701e0411c290c5 100755 (executable)
@@ -40,7 +40,7 @@ unsigned long long web_clients_count = 0;
 struct web_client *web_client_create(int listener)
 {
        struct web_client *w;
-       
+
        w = calloc(1, sizeof(struct web_client));
        if(!w) {
                error("Cannot allocate new web_client memory.");
index 30a9c03f1980bed4a2058bbf73065edaa18232cb..2823214a24aa8a273693efbef81b1fb2609d7c78 100755 (executable)
@@ -1,5 +1,5 @@
 <html>
-<head> 
+<head>
        <title>NetData Dashboard</title>
        <style type="text/css">
                html{font-family:sans-serif;}
@@ -95,7 +95,7 @@ This is a template for building custom dashboards. To build a dashboard you just
                Sparkline charts stretch the values to show the variations between values in more detail.
                They also have mouse-hover support.
                <br/>
-               Sparklines are fantastic. You can inline charts in text. For example this 
+               Sparklines are fantastic. You can inline charts in text. For example this
                        <div    style="display: inline; position: relative;"
                                        data-netdata="system.cpu"
                                        data-chart-library="sparkline"
@@ -112,7 +112,7 @@ This is a template for building custom dashboards. To build a dashboard you just
                                        data-width="60"
                                        data-height="15"
                                        data-after="-30"
-                                       </div> is the bandwidth my netdata server is currently transmitting and this 
+                                       </div> is the bandwidth my netdata server is currently transmitting and this
 
                        <div    style="display: inline; position: relative;"
                                        data-netdata="netdata.requests"
index 1fe33615ca46caf3c49c9cf46988be015c3e8ec2..9f4945aff27968f07e246cf52f2ec3db7d02cea1 100755 (executable)
                if(typeof jQuery == 'undefined') {
                        var script = document.createElement('script');
                        script.type = 'text/javascript';
-                       script.async = true;            
+                       script.async = true;
                        script.src = NETDATA.jQuery;
-                       
+
                        // script.onabort = onError;
                        script.onerror = function(err, t) { NETDATA.error(101, NETDATA.jQuery); };
                        if(typeof callback == "function")
                                script.onload = callback;
-                       
+
                        var s = document.getElementsByTagName('script')[0];
                        s.parentNode.insertBefore(script, s);
                }
                                        NETDATA.loadCharts(targets, ++index, callback);
                                }
                                else {
-                                       var url = host + "/api/v1/chart?chart=" + id; 
+                                       var url = host + "/api/v1/chart?chart=" + id;
 
                                        $.ajax( {
                                                url:  url,
                        var self = $(this);
                        var lib = self.data('chart-library') || 'dygraph';
                        var method = lib + 'ChartCreate';
-                       
+
                        console.log('Calling ' + method + '()');
                        NETDATA[method].apply(this, arguments);
                })
                        var self = $(this);
                        var lib = self.data('chart-library') || 'dygraph';
                        var method = lib + 'ChartUpdate';
-                       
+
                        console.log('Calling ' + method + '()');
                        NETDATA[method].apply(this, arguments);
                });
                                        // get from the 3rd column the 'v' member
                                        //return item.c[3].v;
                                //});
-                               
+
                                // since we downloaded the data
                                // update the last-updated time to prevent
                                // another download too soon
                var numberDecimalMark = self.data('sparkline-numberDecimalMark') || undefined;
                var numberDigitGroupCount = self.data('sparkline-numberDigitGroupCount') || undefined;
                var animatedZooms = self.data('sparkline-animatedZooms') || false;
+
                var options = {
                        type: type,
                        lineColor: lineColor,
                else
                        console.log('not updating dygraphs');
        };
+
        NETDATA.dygraphChartCreate = function(event, data) {
                var self = $(this);
                var width = self.data('width') || NETDATA.chartDefaults.width;
                var drawYGrid = self.data('dygraph-drawYGrid') || undefined;
                var gridLinePattern = self.data('dygraph-gridLinePattern') || null;
                var gridLineWidth = self.data('dygraph-gridLineWidth') || 0.3;
-  
+
                var options = {
                        title: title,
                        titleHeight: titleHeight,
                var width = self.data('width') || NETDATA.chartDefaults.width;
                var height = self.data('height') || NETDATA.chartDefaults.height;
                var chart = self.data('chart');
-               
+
                self.html('<div id="morris-' + chart.id + '" style="width: ' + width + 'px; height: ' + height + 'px;"></div>');
 
                // remove the 'time' element from the labels
                var self = $(this);
                var width = self.data('width') || NETDATA.chartDefaults.width;
                var height = self.data('height') || NETDATA.chartDefaults.height;
-               
+
                self.raphael(data, {
                        width: width,
                        height: height
                var self = $(this);
                var width = self.data('width') || NETDATA.chartDefaults.width;
                var height = self.data('height') || NETDATA.chartDefaults.height;
-               
+
                self.raphael(data, {
                        width: width,
                        height: height
                var width = self.data('width') || NETDATA.chartDefaults.width;
                var height = self.data('height') || NETDATA.chartDefaults.height;
                var chart = self.data('chart');
-               
+
                var datatable = new google.visualization.DataTable(data);
                var gchart;
 
 
        NETDATA.errorReset();
 
-       NETDATA._loadjQuery(function() {                
+       NETDATA._loadjQuery(function() {
                NETDATA.raphaelInitialize(function() {
                        NETDATA.morrisInitialize(function() {
                                NETDATA.peityInitialize(function() {
index 1d596e3d307f1ab7a4ca97c8d9c01ff5c71c90e2..1175151a2993c2567931c0468df51c042989b33b 100644 (file)
@@ -9,7 +9,7 @@
     <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
     <meta name="description" content="">
     <meta name="author" content="costa@tsaousis.gr">
+
        <title>NetData</title>
 
        <!-- Bootstrap CSS -->
index e664737113e163f187500849af9f36edf74d2932..3a28daf738b4ef98076aa532b0f1e8ac1cb3fe89 100755 (executable)
@@ -168,7 +168,7 @@ function chartssort(a, b) {
                if(a.name < b.name) return -1;
        }
        else if(a.priority < b.priority) return -1;
-       
+
        return 1;
 }
 
@@ -349,7 +349,7 @@ function mainchartControlStateHandler() {
 }
 
 function initMainChartIndex(i) {
-       if(mode == MODE_GROUP_THUMBS) 
+       if(mode == MODE_GROUP_THUMBS)
                initMainChart(groupCharts[i]);
 
        else if(mode == MODE_THUMBS)
@@ -452,7 +452,7 @@ function setMainChartPlay(p) {
                //      'maxZoomOut': 1,
                //};
                //mainchart.last_updated = 0;
-               
+
                //if(!renderChart(mainchart, pauseGraphs))
                pauseGraphs();
        }
@@ -620,7 +620,7 @@ function checkRefreshThread() {
 var timeout = null;
 function renderChartCallback() {
        last_refresh = new Date().getTime();
-       
+
        if(!page_is_visible) {
                timeout = setTimeout(triggerRefresh, CHARTS_CHECK_NO_FOCUS);
                return;
@@ -954,7 +954,7 @@ function switchToGroupGraphs() {
 var groupCharts = null;
 function initGroupGraphs(group) {
        var count = 0;
-       
+
        if(groupCharts) clearGroupGraphs();
        groupCharts = new Array();
 
@@ -1112,7 +1112,7 @@ function initCharts() {
                        return 1;
                }
                categories.sort(categoriessort);
-               
+
                function familiessort(a, b) {
                        if(a.name < b.name) return -1;
                        return 1;
index 31124280d6956847aba320aea1f5c219770ccad1..f1af0a67d2b7f5e27e62920879c05b84ebba309b 100755 (executable)
@@ -54,7 +54,7 @@ function renderChart(chart, doNext) {
        .done(function(jsondata) {
                if(!jsondata || jsondata.length == 0) return;
                chart.jsondata = jsondata;
-               
+
                // Create our data table out of JSON data loaded from server.
                chart.datatable = new google.visualization.DataTable(chart.jsondata);
                //console.log(chart.datatable);
@@ -75,7 +75,7 @@ function renderChart(chart, doNext) {
                        else
                                chart.chart = new google.visualization.AreaChart(document.getElementById(chart.div));
                }
-               
+
                if(chart.chart) {
                        chart.chart.draw(chart.datatable, chart.chartOptions);
                        chart.refreshCount++;
@@ -178,7 +178,7 @@ function calculateChartPointsToShow(c, divisor, maxtime, group, enable_curve) {
                c.points_to_show = Math.round(data_points / group);
                // console.log("rendering with supplied group (group = " + c.group + ", points_to_show = " + c.points_to_show + ')');
        }
-       
+
        // console.log("final configuration (group = " + c.group + ", points_to_show = " + c.points_to_show + ')');
 
        // make sure the line width is not congesting the chart
@@ -200,7 +200,7 @@ function calculateChartPointsToShow(c, divisor, maxtime, group, enable_curve) {
 
        // do not render curves when we don't have at
        // least 2 twice the space per point
-       if(!enable_curve || c.points_to_show > (c.chartOptions.width * c.chartOptions.lineWidth / 2) ) 
+       if(!enable_curve || c.points_to_show > (c.chartOptions.width * c.chartOptions.lineWidth / 2) )
                c.chartOptions.curveType = 'none';
        else
                c.chartOptions.curveType = c.default_curveType;
@@ -313,10 +313,10 @@ function loadCharts(base_url, doNext) {
                                        json.charts[i].chartType = "AreaChart";
                                        json.charts[i].chartOptions.isStacked = false;
                                        json.charts[i].chartOptions.areaOpacity = 0.3;
-                                       
+
                                        json.charts[i].chartOptions.vAxis.viewWindowMode = 'maximized';
                                        json.charts[i].non_zero = 0;
-                                       
+
                                        json.charts[i].group = 3;
                                        break;
 
@@ -342,7 +342,7 @@ function loadCharts(base_url, doNext) {
                                        json.charts[i].non_zero = 0;
 
                                        json.charts[i].default_curveType = 'function';
-                                       
+
                                        json.charts[i].group = 3;
                                        break;
                        }
@@ -465,7 +465,7 @@ function loadCharts(base_url, doNext) {
                                        break;
                        }
                });
-               
+
                if(typeof doNext == "function") doNext(json);
        })
        .fail(function() {
@@ -487,7 +487,7 @@ function loadCharts(base_url, doNext) {
         *               only accounts for vertical position, not horizontal.
         */
        $.fn.visible = function(partial){
-               
+
            var $t                              = $(this),
                $w                              = $(window),
                viewTop                 = $w.scrollTop(),
@@ -496,7 +496,7 @@ function loadCharts(base_url, doNext) {
                _bottom                 = _top + $t.height(),
                compareTop              = partial === true ? _bottom : _top,
                compareBottom   = partial === true ? _top : _bottom;
-               
+
                return ((compareBottom <= viewBottom) && (compareTop >= viewTop));
     };
 })(jQuery);