diff options
author | Alon Bar-Lev <alon.barlev@gmail.com> | 2015-11-30 00:34:46 +0200 |
---|---|---|
committer | Alon Bar-Lev <alon.barlev@gmail.com> | 2015-11-30 00:34:46 +0200 |
commit | 9d260bde5a4dc3aebdd5d0ed04af669326456f7f (patch) | |
tree | fbb9004cd8b5350e7df2bb3e288c85580342d62e | |
parent | 9f3c17904982fa7a051baf38526350a60b8bdcc4 (diff) |
cleanup: remove trailing spaces
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
48 files changed, 261 insertions, 261 deletions
@@ -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: diff --git a/charts.d/mysql.chart.sh b/charts.d/mysql.chart.sh index dd7b3620a4..8d0ac228fc 100755 --- a/charts.d/mysql.chart.sh +++ b/charts.d/mysql.chart.sh @@ -13,7 +13,7 @@ declare -A mysql_cmds=() mysql_opts=() mysql_ids=() mysql_exec() { local ret - + "${@}" -s -e "show global status;" ret=$? diff --git a/charts.d/opensips.chart.sh b/charts.d/opensips.chart.sh index e6ae7a8a73..2e4e59b3a9 100755 --- a/charts.d/opensips.chart.sh +++ b/charts.d/opensips.chart.sh @@ -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 } diff --git a/charts.d/postfix.chart.sh b/charts.d/postfix.chart.sh index 3762e822d8..6df54ac527 100755 --- a/charts.d/postfix.chart.sh +++ b/charts.d/postfix.chart.sh @@ -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" |\ diff --git a/charts.d/sensors.chart.sh b/charts.d/sensors.chart.sh index f4ab1b240a..8378321507 100755 --- a/charts.d/sensors.chart.sh +++ b/charts.d/sensors.chart.sh @@ -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 } diff --git a/charts.d/squid.chart.sh b/charts.d/squid.chart.sh index 08a61ed754..9df57613ef 100755 --- a/charts.d/squid.chart.sh +++ b/charts.d/squid.chart.sh @@ -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 } diff --git a/conf.d/apps_groups.conf b/conf.d/apps_groups.conf index e59ce16002..e5e563b1ac 100644 --- a/conf.d/apps_groups.conf +++ b/conf.d/apps_groups.conf @@ -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 diff --git a/plugins.d/README.md b/plugins.d/README.md index ada2b3f5f4..35b9a2d995 100644 --- a/plugins.d/README.md +++ b/plugins.d/README.md @@ -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 diff --git a/plugins.d/charts.d.plugin b/plugins.d/charts.d.plugin index 2ea78717e5..9214b3091f 100755 --- a/plugins.d/charts.d.plugin +++ b/plugins.d/charts.d.plugin @@ -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 diff --git a/plugins.d/loopsleepms.sh.inc b/plugins.d/loopsleepms.sh.inc index c0bbb5fdfa..2e22de3d83 100644 --- a/plugins.d/loopsleepms.sh.inc +++ b/plugins.d/loopsleepms.sh.inc @@ -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 diff --git a/plugins.d/tc-qos-helper.sh b/plugins.d/tc-qos-helper.sh index 16577f4fad..29e31ec502 100755 --- a/plugins.d/tc-qos-helper.sh +++ b/plugins.d/tc-qos-helper.sh @@ -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" diff --git a/src/apps_plugin.c b/src/apps_plugin.c index c4ffa55183..b22de453b9 100755 --- a/src/apps_plugin.c +++ b/src/apps_plugin.c @@ -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); } @@ -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); diff --git a/src/daemon.c b/src/daemon.c index 652cc8618f..d73a3a46c3 100755 --- a/src/daemon.c +++ b/src/daemon.c @@ -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); diff --git a/src/main.c b/src/main.c index 90064cfba3..328d4ac4ea 100755 --- a/src/main.c +++ b/src/main.c @@ -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]; diff --git a/src/old-and-tests/benchmark.c b/src/old-and-tests/benchmark.c index 7044489f6b..bcf1b40fe7 100755 --- a/src/old-and-tests/benchmark.c +++ b/src/old-and-tests/benchmark.c @@ -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 ); diff --git a/src/old-and-tests/benchmark2.c b/src/old-and-tests/benchmark2.c index cdeb81ee96..69287c0f62 100755 --- a/src/old-and-tests/benchmark2.c +++ b/src/old-and-tests/benchmark2.c @@ -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; diff --git a/src/old-and-tests/netdata.c b/src/old-and-tests/netdata.c index 7f45f01ccc..38aeccbe36 100755 --- a/src/old-and-tests/netdata.c +++ b/src/old-and-tests/netdata.c @@ -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 |