]> arthur.barton.de Git - netdata.git/commitdiff
Merge branch 'objects'
authorpaulfantom <paulfantom@gmail.com>
Sat, 18 Jun 2016 18:01:46 +0000 (20:01 +0200)
committerpaulfantom <paulfantom@gmail.com>
Sat, 18 Jun 2016 18:01:46 +0000 (20:01 +0200)
34 files changed:
charts.d/phpfpm.chart.sh
charts.d/tomcat.chart.sh
configure.ac
contrib/README.md
contrib/debian/control.wheezy [new file with mode: 0644]
contrib/debian/netdata.default
python.d/README.md
python.d/mysql.chart.py
src/Makefile.am
src/apps_plugin.c
src/common.c
src/common.h
src/daemon.c
src/log.c
src/log.h
src/main.c
src/main.h
src/proc_net_netstat.c
src/proc_net_rpc_nfsd.c
src/proc_net_snmp.c
src/proc_net_snmp6.c
src/proc_net_stat_conntrack.c
src/proc_stat.c
src/proc_vmstat.c
src/procfile.c
src/rrd.c
src/rrd2json.c
src/storage_number.h
src/sys_fs_cgroup.c
src/unit_test.c
src/web_buffer.c
src/web_client.c
web/dashboard.js
web/index.html

index 55510169b4bb372bcc37bd7bba8415897679b3fb..7cd77269e7a787a0ed8dbb927ec3a226d1f49217 100755 (executable)
@@ -44,7 +44,6 @@ phpfpm_get() {
                || "${phpfpm_response[26]}" != "idle" \
                || "${phpfpm_response[29]}" != "active" \
                || "${phpfpm_response[32]}" != "total" \
-               || "${phpfpm_response[43]}" != "slow" \
        ]]
                then
                echo >&2 "phpfpm: invalid response from phpfpm status server: ${phpfpm_response[*]}"
@@ -63,7 +62,12 @@ phpfpm_get() {
        phpfpm_total_processes="${phpfpm_response[34]}"
        phpfpm_max_active_processes="${phpfpm_response[38]}"
        phpfpm_max_children_reached="${phpfpm_response[42]}"
-       phpfpm_slow_requests="${phpfpm_response[45]}"
+       if [ "${phpfpm_response[43]}" == "slow" ]
+               then
+               phpfpm_slow_requests="${phpfpm_response[45]}"
+       else
+               phpfpm_slow_requests="-1"
+       fi
        
        if [[ -z "${phpfpm_pool}" \
                || -z "${phpfpm_start_time}" \
@@ -77,7 +81,6 @@ phpfpm_get() {
                || -z "${phpfpm_total_processes}" \
                || -z "${phpfpm_max_active_processes}" \
                || -z "${phpfpm_max_children_reached}" \
-               || -z "${phpfpm_slow_requests}" \
        ]]
                then
                echo >&2 "phpfpm: empty values got from phpfpm status server: ${phpfpm_response[*]}"
@@ -132,8 +135,11 @@ DIMENSION requests '' incremental 1 1
 
 CHART phpfpm_$m.performance '' "PHP-FPM Performance" "status" phpfpm phpfpm.performance line $((phpfpm_priority + 3)) $phpfpm_update_every
 DIMENSION reached 'max children reached' absolute 1 1
-DIMENSION slow 'slow requests' absolute 1 1
 EOF
+               if [ $((phpfpm_slow_requests)) -ne -1 ]
+                       then
+                       echo "DIMENSION slow 'slow requests' absolute 1 1"
+               fi
        done
        
        return 0
@@ -168,10 +174,17 @@ SET requests = $((phpfpm_accepted_conn))
 END
 BEGIN phpfpm_$m.performance $1
 SET reached = $((phpfpm_max_children_reached))
-SET slow = $((phpfpm_slow_requests))
-END
 EOF
+               if [ $((phpfpm_slow_requests)) -ne -1 ]
+                       then
+                       echo "SET slow = $((phpfpm_slow_requests))"
+               fi
+               echo "END"
        done
        
        return 0
 }
+
+phpfpm_check
+phpfpm_create
+phpfpm_update
index b0eddc7f0dac66345b79ad55b017a321b53ae5ac..50a17e2b3fa3b15f4277a1599eba42d4abdfd774 100755 (executable)
@@ -9,8 +9,8 @@ tomcat_url=""
 tomcat_curl_opts=""
 
 # set tomcat username/password here
-tomcatUser=""
-tomcatPassword=""
+tomcat_user=""
+tomcat_password=""
 
 # _update_every is a special variable - it holds the number of seconds
 # between the calls of the _update() function
@@ -37,13 +37,23 @@ tomcat_check() {
                echo >&2 "tomcat url is unset or set to the empty string"
                return 1
        fi
-       if [ -z "${tomcatUser}" ]; then
-               echo >&2 "tomcat user is unset or set to the empty string"
-               return 1
+       if [ -z "${tomcat_user}" ]; then
+               # check backwards compatibility
+               if [ -z "${tomcatUser}" ]; then         
+                       echo >&2 "tomcat user is unset or set to the empty string"
+                       return 1
+               else
+                       tomcat_user="${tomcatUser}"
+               fi
        fi
-       if [ -z "${tomcatPassword}" ]; then
-               echo >&2 "tomcat password is unset or set to the empty string"
-               return 1
+       if [ -z "${tomcat_password}" ]; then
+               # check backwards compatibility
+               if [ -z "${tomcatPassword}" ]; then
+                       echo >&2 "tomcat password is unset or set to the empty string"
+                       return 1
+               else
+                       tomcat_password="${tomcatPassword}"
+               fi
        fi
 
        # check if we can get to tomcat's status page
@@ -65,7 +75,7 @@ tomcat_check() {
 tomcat_get() {
        # collect tomcat values
        tomcat_port="$(IFS=/ read -ra a <<< "$tomcat_url"; hostport=${a[2]}; echo "${hostport#*:}")"
-       mapfile -t lines < <(curl -u "$tomcatUser":"$tomcatPassword" -Ss ${tomcat_curl_opts} "$tomcat_url" |\
+       mapfile -t lines < <(curl -u "$tomcat_user":"$tomcat_password" -Ss ${tomcat_curl_opts} "$tomcat_url" |\
                xmlstarlet sel \
                        -t -m "/status/jvm/memory" -v @free \
                        -n -m "/status/connector[@name='\"http-bio-$tomcat_port\"']/threadInfo" -v @currentThreadCount \
index 371286fdc15dfc9c540065fcdbfeac4cb7d70f35..9fba9bc29b3f9f2e90cc105febba0784fb44a540 100644 (file)
@@ -150,6 +150,7 @@ fi
 AC_DEFINE_UNQUOTED([NETDATA_USER], ["${with_user}"], [use this user to drop privileged])
 
 AC_SUBST([varlibdir], ["\$(localstatedir)/lib/netdata"])
+AC_SUBST([registrydir], ["\$(localstatedir)/lib/netdata/registry"])
 AC_SUBST([cachedir], ["\$(localstatedir)/cache/netdata"])
 AC_SUBST([chartsdir], ["\$(libexecdir)/netdata/charts.d"])
 AC_SUBST([nodedir], ["\$(libexecdir)/netdata/node.d"])
index 4578989a4e687da7836201a6dc0c838b7de374b3..d3643d753cbd05afcbbab31f43b89c0233ae7254 100644 (file)
@@ -35,8 +35,16 @@ updates first.
 * edit `contrib/debian/rules` and adjust the `dh` rule near the
   top to remove systemd (see comments in that file).
 
-* edit `contrib/debian/control`: remove `dh-systemd` from the
-  Build-Depends list, and add `pkg-config` to it.
+* rename `contrib/debian/control.wheezy` to `contrib/debian/control`.
+
+* uncomment `EXTRA_OPTS="-P /var/run/netdata.pid"` in
+ `contrib/debian/netdata.default`
+
+* edit `contrib/debian/netdata.init` and change `PIDFILE` to
+  `/var/run/netdata.pid`
+
+* uncomment `postrotate` in `system/netdata.logrotate.in` and change
+  `try-restart` to `restart`
 
 Then proceed as the main instructions above.
 
@@ -46,4 +54,3 @@ The recommended way to upgrade netdata packages built from this
 source is to remove the current package from your system, then
 install the new package. Upgrading on wheezy is known to not
 work cleanly; Jessie may behave as expected.
-
diff --git a/contrib/debian/control.wheezy b/contrib/debian/control.wheezy
new file mode 100644 (file)
index 0000000..4103908
--- /dev/null
@@ -0,0 +1,25 @@
+Source: netdata
+Build-Depends: debhelper (>= 9),
+               dh-autoreconf,
+               pkg-config,
+               dpkg-dev (>= 1.13.19),
+               zlib1g-dev,
+               uuid-dev
+Section: net
+Priority: optional
+Maintainer: Costa Tsaousis <costa@tsaousis.gr>
+Standards-Version: 3.9.6
+Homepage: https://github.com/firehol/netdata/wiki
+
+Package: netdata
+Architecture: any
+Depends: adduser,
+         libcap2-bin (>= 1:2.0),
+         lsb-base (>= 3.1-23.2),
+         ${misc:Depends},
+         ${shlibs:Depends}
+Description: real-time charts for system monitoring
+ Netdata is a daemon that collects data in realtime (per second)
+ and presents a web site to view and analyze them. The presentation
+ is also real-time and full of interactive charts that precisely
+ render all collected values.
index eb1a69037fb9da482498aefb24cc2e75c45d4f95..9e7f8ae6edb34e40f2a995eede4387be89ac2d97 100644 (file)
@@ -1,4 +1,5 @@
 # Extra arguments to pass to netdata
 #
 #EXTRA_OPTS=""
-
+#uncomment following line if you are building a wheezy-package
+#EXTRA_OPTS="-P /var/run/netdata.pid"
index 0a8e032e8f2d7db6ea7820e45476fe5edbea5df4..7e74a28e15d7bfbb17bf536a7f8cc71743287567 100644 (file)
@@ -1,5 +1,7 @@
 # Disclaimer
 
+**Python plugin support is experimental and implementation may change in the future**
+
 Currently every plugin must be written in python3.
 All third party libraries should be installed system-wide or in `python_modules` directory.
 Also plugins support changing their data collection frequency by setting `update_every` variable in their configuration file.
index 01216c83b534098db2d9cd89ca4258ec45e3ca0f..04ccd4c4637be4b0f530d46d78e3d995fad43488 100644 (file)
@@ -25,7 +25,7 @@ from base import BaseService
 config = {
     'local': {
         'user'     : 'root',
-        'password' : 'a',
+        'password' : '',
         'socket'   : '/var/run/mysqld/mysqld.sock',
         'update_every' : 3,
         'retries'  : 4,
@@ -451,10 +451,3 @@ class Service(BaseService):
                 print(header + lines + "END")
         
         return True
-
-#FIXME debug only:
-if __name__ == "__main__":
-    my = Service(config['local'],'loc')
-    my.check()
-    my.create()
-    my.update(1)
index ac7ac44f5d33484ddd51216b727da3051e3d1607..e2d1667c8c959cb0f58d56f8d6a0893bbc58ccfd 100644 (file)
@@ -21,6 +21,8 @@ AM_CFLAGS = \
 
 sbin_PROGRAMS = netdata
 dist_cache_DATA = .keep
+dist_varlib_DATA = .keep
+dist_registry_DATA = .keep
 dist_log_DATA = .keep
 plugins_PROGRAMS = apps.plugin
 
index 92c0a4ae31bd450d44ad0c545578812a100a0332..39d0efc8af2ad2917cf055758178a128f3a0d8d7 100644 (file)
@@ -92,12 +92,12 @@ void *check_allocation(const char *file, int line, const char *function, void *m
 
        // fprintf(stderr, "MEMORY_POINTER: Checking pointer at %p, real %p for %s/%u@%s.\n", marked_ptr, (void *)(marked_ptr - MALLOC_PREFIX), function, line, file);
 
-       if(real_ptr[0] != MALLOC_MARK) fatal("MEMORY: prefix MARK is not valid for %s/%u@%s.", function, line, file);
+       if(real_ptr[0] != MALLOC_MARK) fatal("MEMORY: prefix MARK is not valid for %s/%d@%s.", function, line, file);
 
        size_t size = real_ptr[1];
 
        uint32_t *end_ptr = (uint32_t *)(marked_ptr + size);
-       if(end_ptr[0] != MALLOC_MARK) fatal("MEMORY: suffix MARK of allocation with size %zu is not valid for %s/%u@%s.", size, function, line, file);
+       if(end_ptr[0] != MALLOC_MARK) fatal("MEMORY: suffix MARK of allocation with size %zu is not valid for %s/%d@%s.", size, function, line, file);
 
        if(size_without_overheads_ptr) *size_without_overheads_ptr = size;
 
@@ -106,12 +106,12 @@ void *check_allocation(const char *file, int line, const char *function, void *m
 
 void *malloc_debug(const char *file, int line, const char *function, size_t size) {
        void *ptr = malloc(size + MALLOC_OVERHEAD);
-       if(!ptr) fatal("MEMORY: Cannot allocate %zu bytes for %s/%u@%s.", size, function, line, file);
+       if(!ptr) fatal("MEMORY: Cannot allocate %zu bytes for %s/%d@%s.", size, function, line, file);
 
        allocations.allocated += size;
        allocations.allocations++;
 
-       debug(D_MEMORY, "MEMORY: Allocated %zu bytes for %s/%u@%s."
+       debug(D_MEMORY, "MEMORY: Allocated %zu bytes for %s/%d@%s."
                " Status: allocated %zu in %zu allocs."
                , size
                , function, line, file
@@ -149,7 +149,7 @@ void free_debug(const char *file, int line, const char *function, void *ptr) {
        allocations.allocated -= size;
        allocations.allocations--;
 
-       debug(D_MEMORY, "MEMORY: freed %zu bytes for %s/%u@%s."
+       debug(D_MEMORY, "MEMORY: freed %zu bytes for %s/%d@%s."
                " Status: allocated %zu in %zu allocs."
                , size
                , function, line, file
@@ -166,12 +166,12 @@ void *realloc_debug(const char *file, int line, const char *function, void *ptr,
        void *real_ptr = check_allocation(file, line, function, ptr, &old_size);
 
        void *new_ptr = realloc(real_ptr, size + MALLOC_OVERHEAD);
-       if(!new_ptr) fatal("MEMORY: Cannot allocate %zu bytes for %s/%u@%s.", size, function, line, file);
+       if(!new_ptr) fatal("MEMORY: Cannot allocate %zu bytes for %s/%d@%s.", size, function, line, file);
 
        allocations.allocated += size;
        allocations.allocated -= old_size;
 
-       debug(D_MEMORY, "MEMORY: Re-allocated from %zu to %zu bytes for %s/%u@%s."
+       debug(D_MEMORY, "MEMORY: Re-allocated from %zu to %zu bytes for %s/%d@%s."
                " Status: allocated %zu in %zu allocs."
                , old_size, size
                , function, line, file
@@ -213,6 +213,13 @@ char *strdup_debug(const char *file, int line, const char *function, const char
 
 #endif /* NETDATA_INTERNAL_CHECKS */
 
+// ----------------------------------------------------------------------------
+
+void netdata_cleanup_and_exit(int ret) {
+       exit(ret);
+}
+
+
 // ----------------------------------------------------------------------------
 // system functions
 // to retrieve settings of the system
@@ -377,16 +384,16 @@ struct target *get_users_target(uid_t uid)
                return NULL;
        }
 
-       snprintfz(w->compare, MAX_COMPARE_NAME, "%d", uid);
+       snprintfz(w->compare, MAX_COMPARE_NAME, "%u", uid);
        w->comparehash = simple_hash(w->compare);
        w->comparelen = strlen(w->compare);
 
-       snprintfz(w->id, MAX_NAME, "%d", uid);
+       snprintfz(w->id, MAX_NAME, "%u", uid);
        w->idhash = simple_hash(w->id);
 
        struct passwd *pw = getpwuid(uid);
        if(!pw)
-               snprintfz(w->name, MAX_NAME, "%d", uid);
+               snprintfz(w->name, MAX_NAME, "%u", uid);
        else
                snprintfz(w->name, MAX_NAME, "%s", pw->pw_name);
 
@@ -398,7 +405,7 @@ struct target *get_users_target(uid_t uid)
        users_root_target = w;
 
        if(unlikely(debug))
-               fprintf(stderr, "apps.plugin: added uid %d ('%s') target\n", w->uid, w->name);
+               fprintf(stderr, "apps.plugin: added uid %u ('%s') target\n", w->uid, w->name);
 
        return w;
 }
@@ -415,16 +422,16 @@ struct target *get_groups_target(gid_t gid)
                return NULL;
        }
 
-       snprintfz(w->compare, MAX_COMPARE_NAME, "%d", gid);
+       snprintfz(w->compare, MAX_COMPARE_NAME, "%u", gid);
        w->comparehash = simple_hash(w->compare);
        w->comparelen = strlen(w->compare);
 
-       snprintfz(w->id, MAX_NAME, "%d", gid);
+       snprintfz(w->id, MAX_NAME, "%u", gid);
        w->idhash = simple_hash(w->id);
 
        struct group *gr = getgrgid(gid);
        if(!gr)
-               snprintfz(w->name, MAX_NAME, "%d", gid);
+               snprintfz(w->name, MAX_NAME, "%u", gid);
        else
                snprintfz(w->name, MAX_NAME, "%s", gr->gr_name);
 
@@ -436,7 +443,7 @@ struct target *get_groups_target(gid_t gid)
        groups_root_target = w;
 
        if(unlikely(debug))
-               fprintf(stderr, "apps.plugin: added gid %d ('%s') target\n", w->gid, w->name);
+               fprintf(stderr, "apps.plugin: added gid %u ('%s') target\n", w->gid, w->name);
 
        return w;
 }
@@ -735,13 +742,13 @@ struct pid_stat *get_pid_entry(pid_t pid)
 
        all_pids[pid] = calloc(sizeof(struct pid_stat), 1);
        if(!all_pids[pid]) {
-               error("Cannot allocate %lu bytes of memory", (unsigned long)sizeof(struct pid_stat));
+               error("Cannot allocate %zu bytes of memory", (size_t)sizeof(struct pid_stat));
                return NULL;
        }
 
        all_pids[pid]->fds = calloc(sizeof(int), 100);
        if(!all_pids[pid]->fds)
-               error("Cannot allocate %ld bytes of memory", (unsigned long)(sizeof(int) * 100));
+               error("Cannot allocate %zu bytes of memory", (size_t)(sizeof(int) * 100));
        else all_pids[pid]->fds_size = 100;
 
        if(root_of_pids) root_of_pids->prev = all_pids[pid];
@@ -1995,7 +2002,7 @@ void calculate_netdata_statistics(void)
                        w = p->user_target;
                else {
                        if(unlikely(debug && p->user_target))
-                                       fprintf(stderr, "apps.plugin: \t\tpid %d (%s) switched user from %d (%s) to %d.\n", p->pid, p->comm, p->user_target->uid, p->user_target->name, p->uid);
+                                       fprintf(stderr, "apps.plugin: \t\tpid %d (%s) switched user from %u (%s) to %u.\n", p->pid, p->comm, p->user_target->uid, p->user_target->name, p->uid);
 
                        w = p->user_target = get_users_target(p->uid);
                }
@@ -2013,7 +2020,7 @@ void calculate_netdata_statistics(void)
                        w = p->group_target;
                else {
                        if(unlikely(debug && p->group_target))
-                                       fprintf(stderr, "apps.plugin: \t\tpid %d (%s) switched group from %d (%s) to %d.\n", p->pid, p->comm, p->group_target->gid, p->group_target->name, p->gid);
+                                       fprintf(stderr, "apps.plugin: \t\tpid %d (%s) switched group from %u (%s) to %u.\n", p->pid, p->comm, p->group_target->gid, p->group_target->name, p->gid);
 
                        w = p->group_target = get_groups_target(p->gid);
                }
index 266e5ac12ed7950f6800fb6efaefa8e56a8627a4..699f58c64d025938456eb35553795dcb6711db32 100644 (file)
@@ -685,7 +685,7 @@ void *mymmap(const char *filename, size_t size, int flags, int ksm)
                if(lseek(fd, size, SEEK_SET) == (off_t)size) {
                        if(write(fd, "", 1) == 1) {
                                if(ftruncate(fd, size))
-                                       error("Cannot truncate file '%s' to size %ld. Will use the larger file.", filename, size);
+                                       error("Cannot truncate file '%s' to size %zu. Will use the larger file.", filename, size);
 
 #ifdef MADV_MERGEABLE
                                if(flags & MAP_SHARED || !enable_ksm || !ksm) {
@@ -734,9 +734,9 @@ void *mymmap(const char *filename, size_t size, int flags, int ksm)
                                }
 #endif
                        }
-                       else error("Cannot write to file '%s' at position %ld.", filename, size);
+                       else error("Cannot write to file '%s' at position %zu.", filename, size);
                }
-               else error("Cannot seek file '%s' to size %ld.", filename, size);
+               else error("Cannot seek file '%s' to size %zu.", filename, size);
 
                close(fd);
        }
index af8f45a4c5aa66b84cb4033d298b416356cae885..1502379e77917b191d28561f22c37d8568ebad3e 100644 (file)
@@ -29,7 +29,7 @@ extern char *trim(char *s);
 
 extern char *strncpyz(char *dst, const char *src, size_t n);
 extern int  vsnprintfz(char *dst, size_t n, const char *fmt, va_list args);
-extern int  snprintfz(char *dst, size_t n, const char *fmt, ...);
+extern int  snprintfz(char *dst, size_t n, const char *fmt, ...) __attribute__ (( format (printf, 3, 4)));
 
 extern void *mymmap(const char *filename, size_t size, int flags, int ksm);
 extern int savememory(const char *filename, void *mem, size_t size);
index 05a77c7c67a2975a660f4c49610badbbff650104..33d3d0c1d819dfc2e10523f3825dbdd0b06c97bb 100644 (file)
@@ -93,29 +93,29 @@ int become_user(const char *username, int access_fd, int output_fd, int error_fd
        }
 
        if(setresgid(gid, gid, gid) != 0) {
-               error("Cannot switch to user's %s group (gid: %d).", username, gid);
+               error("Cannot switch to user's %s group (gid: %u).", username, gid);
                return -1;
        }
 
        if(setresuid(uid, uid, uid) != 0) {
-               error("Cannot switch to user %s (uid: %d).", username, uid);
+               error("Cannot switch to user %s (uid: %u).", username, uid);
                return -1;
        }
 
        if(setgid(gid) != 0) {
-               error("Cannot switch to user's %s group (gid: %d).", username, gid);
+               error("Cannot switch to user's %s group (gid: %u).", username, gid);
                return -1;
        }
        if(setegid(gid) != 0) {
-               error("Cannot effectively switch to user's %s group (gid: %d).", username, gid);
+               error("Cannot effectively switch to user's %s group (gid: %u).", username, gid);
                return -1;
        }
        if(setuid(uid) != 0) {
-               error("Cannot switch to user %s (uid: %d).", username, uid);
+               error("Cannot switch to user %s (uid: %u).", username, uid);
                return -1;
        }
        if(seteuid(uid) != 0) {
-               error("Cannot effectively switch to user %s (uid: %d).", username, uid);
+               error("Cannot effectively switch to user %s (uid: %u).", username, uid);
                return -1;
        }
 
index ae10ae917ac8c8f1189d52bfca9d774b8538fa2c..62f07adde5017a29e8c940a9ff74074851fe69d9 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -214,7 +214,7 @@ void fatal_int( const char *file, const char *function, const unsigned long line
                va_end( args );
        }
 
-       exit(1);
+       netdata_cleanup_and_exit(1);
 }
 
 void log_access( const char *fmt, ... )
index f3f504487a7a1f02cb4eeb3f3f04223fa24d290b..2c0f5cd7a1884c96afc520ad2ad4f122294e36a8 100644 (file)
--- a/src/log.h
+++ b/src/log.h
@@ -2,6 +2,8 @@
 #include <stdarg.h>
 #include <time.h>
 
+#include "main.h"
+
 #ifndef NETDATA_LOG_H
 #define NETDATA_LOG_H 1
 
index b8d8391f4a637ac434a846e9c29672b4c3631b43..16c34c72147b355441a4583ca5467d9c411aeb4d 100644 (file)
@@ -437,7 +437,10 @@ int main(int argc, char **argv)
        setenv("NETDATA_HOST_PREFIX", config_get("global", "host access prefix" , "")         , 1);
        setenv("HOME"               , config_get("global", "home directory"     , CACHE_DIR)  , 1);
 
-       // avoid extended to stat(/etc/localtime)
+       // disable buffering for python plugins
+       setenv("PYTHONUNBUFFERED", "1", 1);
+
+       // avoid flood calls to stat(/etc/localtime)
        // http://stackoverflow.com/questions/4554271/how-to-avoid-excessive-stat-etc-localtime-calls-in-strftime-on-linux
        setenv("TZ", ":/etc/localtime", 0);
 
index 701f8ff24a7e11e44e76f60424a4d210ed0d09e9..a41aa0c2bdcb1e01c25f1378ef82fa60a9c2763d 100644 (file)
@@ -30,6 +30,6 @@ extern struct option_def options[];
 
 extern void kill_childs(void);
 extern int killpid(pid_t pid, int signal);
-extern void netdata_cleanup_and_exit(int ret);
+extern void netdata_cleanup_and_exit(int ret) __attribute__ ((noreturn));
 
 #endif /* NETDATA_MAIN_H */
index c8c12c1dbad9c2415c553407e9a9778897f28499..70d8cd68d0e6f018b648a06ce2bbdd00739ef7fd 100644 (file)
@@ -48,7 +48,7 @@ int do_proc_net_netstat(int update_every, unsigned long long dt) {
                        }
                        words = procfile_linewords(ff, l);
                        if(words < 12) {
-                               error("Cannot read /proc/net/netstat IpExt line. Expected 12 params, read %d.", words);
+                               error("Cannot read /proc/net/netstat IpExt line. Expected 12 params, read %u.", words);
                                continue;
                        }
 
index 6c6dd7066fc12b03ec8745fffe2efa40f15fa8c1..b5d766e057adcc04193c5dcad98330f5c104e02f 100644 (file)
@@ -196,7 +196,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
 
                if(do_rc == 1 && strcmp(type, "rc") == 0) {
                        if(words < 4) {
-                               error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 4);
+                               error("%s line of /proc/net/rpc/nfsd has %u words, expected %d", type, words, 4);
                                continue;
                        }
 
@@ -210,7 +210,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                }
                else if(do_fh == 1 && strcmp(type, "fh") == 0) {
                        if(words < 6) {
-                               error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 6);
+                               error("%s line of /proc/net/rpc/nfsd has %u words, expected %d", type, words, 6);
                                continue;
                        }
 
@@ -226,7 +226,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                }
                else if(do_io == 1 && strcmp(type, "io") == 0) {
                        if(words < 3) {
-                               error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 3);
+                               error("%s line of /proc/net/rpc/nfsd has %u words, expected %d", type, words, 3);
                                continue;
                        }
 
@@ -239,7 +239,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                }
                else if(do_th == 1 && strcmp(type, "th") == 0) {
                        if(words < 13) {
-                               error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 13);
+                               error("%s line of /proc/net/rpc/nfsd has %u words, expected %d", type, words, 13);
                                continue;
                        }
 
@@ -270,7 +270,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                }
                else if(do_ra == 1 && strcmp(type, "ra") == 0) {
                        if(words < 13) {
-                               error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 13);
+                               error("%s line of /proc/net/rpc/nfsd has %u words, expected %d", type, words, 13);
                                continue;
                        }
 
@@ -299,7 +299,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                }
                else if(do_net == 1 && strcmp(type, "net") == 0) {
                        if(words < 5) {
-                               error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 5);
+                               error("%s line of /proc/net/rpc/nfsd has %u words, expected %d", type, words, 5);
                                continue;
                        }
 
@@ -314,7 +314,7 @@ int do_proc_net_rpc_nfsd(int update_every, unsigned long long dt) {
                }
                else if(do_rpc == 1 && strcmp(type, "rpc") == 0) {
                        if(words < 6) {
-                               error("%s line of /proc/net/rpc/nfsd has %d words, expected %d", type, words, 6);
+                               error("%s line of /proc/net/rpc/nfsd has %u words, expected %d", type, words, 6);
                                continue;
                        }
 
index e0ac6a263eee9636959e13e622e02e2df8ee2576..69b2938aae159f005267d1f525cfbf6fc1ce2025 100644 (file)
@@ -60,7 +60,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
 
                        words = procfile_linewords(ff, l);
                        if(words < 20) {
-                               error("Cannot read /proc/net/snmp Ip line. Expected 20 params, read %d.", words);
+                               error("Cannot read /proc/net/snmp Ip line. Expected 20 params, read %u.", words);
                                continue;
                        }
 
@@ -193,7 +193,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
 
                        words = procfile_linewords(ff, l);
                        if(words < 15) {
-                               error("Cannot read /proc/net/snmp Tcp line. Expected 15 params, read %d.", words);
+                               error("Cannot read /proc/net/snmp Tcp line. Expected 15 params, read %u.", words);
                                continue;
                        }
 
@@ -306,7 +306,7 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
 
                        words = procfile_linewords(ff, l);
                        if(words < 7) {
-                               error("Cannot read /proc/net/snmp Udp line. Expected 7 params, read %d.", words);
+                               error("Cannot read /proc/net/snmp Udp line. Expected 7 params, read %u.", words);
                                continue;
                        }
 
index 885835a8cc807f26a130ec71af012141c1bdb5f0..4586ee7d0d638dd9216f81833159bb5be55ad755 100644 (file)
@@ -361,7 +361,7 @@ int do_proc_net_snmp6(int update_every, unsigned long long dt) {
        for(l = 0; l < lines ;l++) {
                words = procfile_linewords(ff, l);
                if(words < 2) {
-                       if(words) error("Cannot read /proc/net/snmp6 line %d. Expected 2 params, read %d.", l, words);
+                       if(words) error("Cannot read /proc/net/snmp6 line %u. Expected 2 params, read %u.", l, words);
                        continue;
                }
 
index 7d754a1d92f6f3438b15c43c548da49a606dc67b..1fcf6ffceaf27491401ea539bf5265fcc4c3ee4d 100644 (file)
@@ -48,7 +48,7 @@ int do_proc_net_stat_conntrack(int update_every, unsigned long long dt) {
        for(l = 1; l < lines ;l++) {
                words = procfile_linewords(ff, l);
                if(words < 17) {
-                       if(words) error("Cannot read /proc/net/stat/nf_conntrack line. Expected 17 params, read %d.", words);
+                       if(words) error("Cannot read /proc/net/stat/nf_conntrack line. Expected 17 params, read %u.", words);
                        continue;
                }
 
index 154ba167d12176951f7ceeb3a2da31e0eb4f4fe6..9272dd3c29c4e58bd50aaa7de8ddaa1e9d4df66f 100644 (file)
@@ -48,7 +48,7 @@ int do_proc_stat(int update_every, unsigned long long dt) {
                if(strncmp(procfile_lineword(ff, l, 0), "cpu", 3) == 0) {
                        words = procfile_linewords(ff, l);
                        if(words < 9) {
-                               error("Cannot read /proc/stat cpu line. Expected 9 params, read %d.", words);
+                               error("Cannot read /proc/stat cpu line. Expected 9 params, read %u.", words);
                                continue;
                        }
 
index 7b20ed8cff4d72c55cf0d71579bb9616106be2f1..c69b389b6c875af18105087321046f2bfba41d47 100644 (file)
@@ -321,7 +321,7 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
        for(l = 0; l < lines ;l++) {
                words = procfile_linewords(ff, l);
                if(words < 2) {
-                       if(words) error("Cannot read /proc/vmstat line %d. Expected 2 params, read %d.", l, words);
+                       if(words) error("Cannot read /proc/vmstat line %u. Expected 2 params, read %u.", l, words);
                        continue;
                }
 
index 59f75c1ecea132abfde7a42fab1a3f41b75c2e22..25f9d2e749639077cd7f879c6f819f66600ac6a9 100644 (file)
@@ -325,7 +325,7 @@ procfile *procfile_readall(procfile *ff) {
                        ff->size += PROCFILE_INCREMENT_BUFFER;
                }
 
-               debug(D_PROCFILE, "Reading file '%s', from position %ld with length %ld", ff->filename, s, ff->size - s);
+               debug(D_PROCFILE, "Reading file '%s', from position %ld with length %lu", ff->filename, s, ff->size - s);
                r = read(ff->fd, &ff->data[s], ff->size - s);
                if(unlikely(r == -1)) {
                        if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) error(PF_PREFIX ": Cannot read from file '%s'", ff->filename);
@@ -496,16 +496,16 @@ void procfile_print(procfile *ff) {
        uint32_t words, w;
        char *s;
 
-       debug(D_PROCFILE, "File '%s' with %d lines and %d words", ff->filename, ff->lines->len, ff->words->len);
+       debug(D_PROCFILE, "File '%s' with %u lines and %u words", ff->filename, ff->lines->len, ff->words->len);
 
        for(l = 0; likely(l < lines) ;l++) {
                words = procfile_linewords(ff, l);
 
-               debug(D_PROCFILE, "     line %d starts at word %d and has %d words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
+               debug(D_PROCFILE, "     line %u starts at word %u and has %u words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
 
                for(w = 0; likely(w < words) ;w++) {
                        s = procfile_lineword(ff, l, w);
-                       debug(D_PROCFILE, "             [%d.%d] '%s'", l, w, s);
+                       debug(D_PROCFILE, "             [%u.%u] '%s'", l, w, s);
                }
        }
 }
index 28efff0a15074992287fba30a053c58eb9974da9..c0f4f363353436b8a50bd915ffee39cd8d4eb2a1 100644 (file)
--- a/src/rrd.c
+++ b/src/rrd.c
@@ -876,7 +876,7 @@ unsigned long long rrdset_done(RRDSET *st)
 
        // check if we will re-write the entire data set
        if(unlikely(usecdiff(&st->last_collected_time, &st->last_updated) > st->update_every * st->entries * 1000000ULL)) {
-               info("%s: too old data (last updated at %zu.%zu, last collected at %zu.%zu). Reseting it. Will not store the next entry.", st->name, st->last_updated.tv_sec, st->last_updated.tv_usec, st->last_collected_time.tv_sec, st->last_collected_time.tv_usec);
+               info("%s: too old data (last updated at %ld.%ld, last collected at %ld.%ld). Reseting it. Will not store the next entry.", st->name, st->last_updated.tv_sec, st->last_updated.tv_usec, st->last_collected_time.tv_sec, st->last_collected_time.tv_usec);
                rrdset_reset(st);
 
                st->usec_since_last_update = st->update_every * 1000000ULL;
index 7c160a9a82240c7a443da4e4254e29b86383541a..f0b1f97deff0ce926515b7543faed1f2605f5ecd 100644 (file)
@@ -32,8 +32,8 @@ void rrd_stats_api_v1_chart(RRDSET *st, BUFFER *wb)
                "\t\t\t\"data_url\": \"/api/v1/data?chart=%s\",\n"
                "\t\t\t\"chart_type\": \"%s\",\n"
                "\t\t\t\"duration\": %ld,\n"
-               "\t\t\t\"first_entry\": %lu,\n"
-               "\t\t\t\"last_entry\": %lu,\n"
+               "\t\t\t\"first_entry\": %ld,\n"
+               "\t\t\t\"last_entry\": %ld,\n"
                "\t\t\t\"update_every\": %d,\n"
                "\t\t\t\"dimensions\": {\n"
                , st->id
@@ -132,12 +132,12 @@ unsigned long rrd_stats_one_json(RRDSET *st, char *options, BUFFER *wb)
                "\t\t\t\"units\": \"%s\",\n"
                "\t\t\t\"url\": \"/data/%s/%s\",\n"
                "\t\t\t\"chart_type\": \"%s\",\n"
-               "\t\t\t\"counter\": %ld,\n"
+               "\t\t\t\"counter\": %lu,\n"
                "\t\t\t\"entries\": %ld,\n"
-               "\t\t\t\"first_entry_t\": %lu,\n"
-               "\t\t\t\"last_entry\": %ld,\n"
-               "\t\t\t\"last_entry_t\": %lu,\n"
-               "\t\t\t\"last_entry_secs_ago\": %lu,\n"
+               "\t\t\t\"first_entry_t\": %ld,\n"
+               "\t\t\t\"last_entry\": %lu,\n"
+               "\t\t\t\"last_entry_t\": %ld,\n"
+               "\t\t\t\"last_entry_secs_ago\": %ld,\n"
                "\t\t\t\"update_every\": %d,\n"
                "\t\t\t\"isdetail\": %d,\n"
                "\t\t\t\"usec_since_last_update\": %llu,\n"
@@ -184,7 +184,7 @@ unsigned long rrd_stats_one_json(RRDSET *st, char *options, BUFFER *wb)
                        "\t\t\t\t\t\"algorithm\": \"%s\",\n"
                        "\t\t\t\t\t\"multiplier\": %ld,\n"
                        "\t\t\t\t\t\"divisor\": %ld,\n"
-                       "\t\t\t\t\t\"last_entry_t\": %lu,\n"
+                       "\t\t\t\t\t\"last_entry_t\": %ld,\n"
                        "\t\t\t\t\t\"collected_value\": " COLLECTED_NUMBER_FORMAT ",\n"
                        "\t\t\t\t\t\"calculated_value\": " CALCULATED_NUMBER_FORMAT ",\n"
                        "\t\t\t\t\t\"last_collected_value\": " COLLECTED_NUMBER_FORMAT ",\n"
@@ -1429,7 +1429,7 @@ RRDR *rrd2rrdr(RRDSET *st, long points, long long after, long long before, int g
                if(unlikely(slot < 0)) slot = st->entries - 1;
                if(unlikely(slot == stop_at_slot)) stop_now = counter;
 
-               if(unlikely(debug)) debug(D_RRD_STATS, "ROW %s slot: %ld, entries_counter: %ld, group_count: %ld, added: %ld, now: %lu, %s %s"
+               if(unlikely(debug)) debug(D_RRD_STATS, "ROW %s slot: %ld, entries_counter: %ld, group_count: %ld, added: %ld, now: %ld, %s %s"
                                , st->id
                                , slot
                                , counter
@@ -1822,7 +1822,7 @@ time_t rrd_stats_json(int type, RRDSET *st, BUFFER *wb, long points, long group,
        // checks for debugging
 
        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"
+               debug(D_RRD_STATS, "%s first_entry_t = %ld, last_entry_t = %ld, duration = %ld, after = %ld, before = %ld, duration = %ld, entries_to_show = %ld, group = %ld"
                        , st->id
                        , rrdset_first_entry_t(st)
                        , rrdset_last_entry_t(st)
@@ -1835,10 +1835,10 @@ time_t rrd_stats_json(int type, RRDSET *st, BUFFER *wb, long points, long group,
                        );
 
                if(before < after)
-                       debug(D_RRD_STATS, "WARNING: %s The newest value in the database (%lu) is earlier than the oldest (%lu)", st->name, before, after);
+                       debug(D_RRD_STATS, "WARNING: %s The newest value in the database (%ld) is earlier than the oldest (%ld)", st->name, before, after);
 
                if((before - after) > st->entries * st->update_every)
-                       debug(D_RRD_STATS, "WARNING: %s The time difference between the oldest and the newest entries (%lu) is higher than the capacity of the database (%lu)", st->name, before - after, st->entries * st->update_every);
+                       debug(D_RRD_STATS, "WARNING: %s The time difference between the oldest and the newest entries (%ld) is higher than the capacity of the database (%ld)", st->name, before - after, st->entries * st->update_every);
        }
 
 
@@ -1934,7 +1934,7 @@ time_t rrd_stats_json(int type, RRDSET *st, BUFFER *wb, long points, long group,
 
                        int print_this = 0;
 
-                       if(st->debug) debug(D_RRD_STATS, "%s t = %ld, count = %ld, group_count = %ld, printed = %ld, now = %lu, %s %s"
+                       if(st->debug) debug(D_RRD_STATS, "%s t = %ld, count = %ld, group_count = %ld, printed = %ld, now = %ld, %s %s"
                                        , st->id
                                        , t
                                        , count + 1
@@ -2070,7 +2070,7 @@ time_t rrd_stats_json(int type, RRDSET *st, BUFFER *wb, long points, long group,
 
        } // max_loop
 
-       debug(D_RRD_STATS, "RRD_STATS_JSON: %s total %ld bytes", st->name, wb->len);
+       debug(D_RRD_STATS, "RRD_STATS_JSON: %s total %lu bytes", st->name, wb->len);
 
        pthread_rwlock_unlock(&st->rwlock);
        return last_timestamp;
index 382d9daef9560e2cbb69e345ed13e1d978123284..1b7da79f17026cc6086914f558c3927a22a13d4d 100644 (file)
@@ -16,9 +16,8 @@ typedef long double collected_number;
 #define COLLECTED_NUMBER_FORMAT "%0.7Lf"
 */
 
-typedef int32_t storage_number;
-typedef uint32_t ustorage_number;
-#define STORAGE_NUMBER_FORMAT "%d"
+typedef uint32_t storage_number;
+#define STORAGE_NUMBER_FORMAT "%u"
 
 #define SN_NOT_EXISTS          (0x0 << 24)
 #define SN_EXISTS                      (0x1 << 24)
index 904b8a15133345c72687922e543a0d26c8f41c58..9ce6e33d08a619861e6f2f2a111eaa2900028bfd 100644 (file)
@@ -48,21 +48,30 @@ void read_cgroup_plugin_configuration() {
 
        mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "cpuacct");
        if(!mi) mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "cpuacct");
-       if(!mi) s = "/sys/fs/cgroup/cpuacct";
+       if(!mi) {
+               error("Cannot find cgroup cpuacct mountinfo. Assuming default: /sys/fs/cgroup/cpuacct");
+               s = "/sys/fs/cgroup/cpuacct";
+       }
        else s = mi->mount_point;
        snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, s);
        cgroup_cpuacct_base = config_get("plugin:cgroups", "path to /sys/fs/cgroup/cpuacct", filename);
 
        mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "blkio");
        if(!mi) mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "blkio");
-       if(!mi) s = "/sys/fs/cgroup/blkio";
+       if(!mi) {
+               error("Cannot find cgroup blkio mountinfo. Assuming default: /sys/fs/cgroup/blkio");
+               s = "/sys/fs/cgroup/blkio";
+       }
        else s = mi->mount_point;
        snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, s);
        cgroup_blkio_base = config_get("plugin:cgroups", "path to /sys/fs/cgroup/blkio", filename);
 
        mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "memory");
        if(!mi) mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "memory");
-       if(!mi) s = "/sys/fs/cgroup/memory";
+       if(!mi) {
+               error("Cannot find cgroup memory mountinfo. Assuming default: /sys/fs/cgroup/memory");
+               s = "/sys/fs/cgroup/memory";
+       }
        else s = mi->mount_point;
        snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, s);
        cgroup_memory_base = config_get("plugin:cgroups", "path to /sys/fs/cgroup/memory", filename);
@@ -243,7 +252,7 @@ void cgroup_read_cpuacct_usage(struct cpuacct_usage *ca) {
                if(!ff) return;
 
                if(procfile_lines(ff) < 1) {
-                       error("File '%s' should have 1+ lines but has %d.", ca->filename, procfile_lines(ff));
+                       error("File '%s' should have 1+ lines but has %u.", ca->filename, procfile_lines(ff));
                        return;
                }
 
@@ -1009,14 +1018,14 @@ void update_cgroup_charts(int update_every) {
                                st = rrdset_create(type, "cpu_per_core", NULL, "cpu", "cgroup.cpu_per_core", title, "%", 40100, update_every, RRDSET_TYPE_STACKED);
 
                                for(i = 0; i < cg->cpuacct_usage.cpus ;i++) {
-                                       snprintfz(id, CHART_TITLE_MAX, "cpu%d", i);
+                                       snprintfz(id, CHART_TITLE_MAX, "cpu%u", i);
                                        rrddim_add(st, id, NULL, 100, 1000000, RRDDIM_INCREMENTAL);
                                }
                        }
                        else rrdset_next(st);
 
                        for(i = 0; i < cg->cpuacct_usage.cpus ;i++) {
-                               snprintfz(id, CHART_TITLE_MAX, "cpu%d", i);
+                               snprintfz(id, CHART_TITLE_MAX, "cpu%u", i);
                                rrddim_set(st, id, cg->cpuacct_usage.cpu_percpu[i]);
                        }
                        rrdset_done(st);
index 06b7afacbd6afcc2af202d7ff227e587e0a26e3c..22fb16d6b1db30b4a80d3535b4407e00f6d45274 100644 (file)
@@ -760,7 +760,7 @@ int unit_test(long delay, long shift)
 
        unsigned long oincrement = increment;
        increment = increment * st->update_every * 1000000 / delay;
-       fprintf(stderr, "\n\nORIGINAL INCREMENT: %lu, INCREMENT %lu, DELAY %lu, SHIFT %lu\n", oincrement * 10, increment * 10, delay, shift);
+       fprintf(stderr, "\n\nORIGINAL INCREMENT: %lu, INCREMENT %ld, DELAY %ld, SHIFT %ld\n", oincrement * 10, increment * 10, delay, shift);
 
        int ret = 0;
        storage_number sn;
index ab0381b89b9e9d9d5d491079b8bb65e0fb2608c1..13cf901ef21ff5c3602e8222dd5aab9b13d8b031 100644 (file)
@@ -29,7 +29,7 @@ static inline void buffer_overflow_init(BUFFER *b)
 static inline void _buffer_overflow_check(BUFFER *b, const char *file, const char *function, const unsigned long line)
 {
        if(b->len > b->size) {
-               error("BUFFER: length %ld is above size %ld, at line %lu, at function %s() of file '%s'.", b->len, b->size, line, function, file);
+               error("BUFFER: length %zu is above size %zu, at line %lu, at function %s() of file '%s'.", b->len, b->size, line, function, file);
                b->len = b->size;
        }
 
@@ -93,7 +93,7 @@ void buffer_strcat(BUFFER *wb, const char *txt)
        buffer_overflow_check(wb);
 
        if(*txt) {
-               debug(D_WEB_BUFFER, "strcat(): increasing web_buffer at position %ld, size = %ld\n", wb->len, wb->size);
+               debug(D_WEB_BUFFER, "strcat(): increasing web_buffer at position %zu, size = %zu\n", wb->len, wb->size);
                len = strlen(txt);
                buffer_increase(wb, len);
                buffer_strcat(wb, txt);
@@ -160,7 +160,7 @@ void buffer_sprintf(BUFFER *wb, const char *fmt, ...)
                // if it does.
                buffer_overflow_check(wb);
 
-               debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %ld, size = %ld\n", wb->len, wb->size);
+               debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu\n", wb->len, wb->size);
                buffer_need_bytes(wb, len + WEB_DATA_LENGTH_INCREASE_STEP);
 
                va_start(args, fmt);
index 51f3f5084a88b88ddbbf6c1c10d26c7ba3e27711..4714ef8d979754d036944c53bbf703779aed344b 100644 (file)
@@ -404,14 +404,14 @@ int mysendfile(struct web_client *w, char *filename)
 
        // check if the file is owned by expected user
        if(stat.st_uid != web_files_uid()) {
-               error("%llu: File '%s' is owned by user %d (expected user %d). Access Denied.", w->id, webfilename, stat.st_uid, web_files_uid());
+               error("%llu: File '%s' is owned by user %u (expected user %u). Access Denied.", w->id, webfilename, stat.st_uid, web_files_uid());
                buffer_sprintf(w->response.data, "Access to file '%s' is not permitted.", webfilename);
                return 403;
        }
 
        // check if the file is owned by expected group
        if(stat.st_gid != web_files_gid()) {
-               error("%llu: File '%s' is owned by group %d (expected group %d). Access Denied.", w->id, webfilename, stat.st_gid, web_files_gid());
+               error("%llu: File '%s' is owned by group %u (expected group %u). Access Denied.", w->id, webfilename, stat.st_gid, web_files_gid());
                buffer_sprintf(w->response.data, "Access to file '%s' is not permitted.", webfilename);
                return 403;
        }
@@ -813,7 +813,7 @@ int web_client_api_v1_badge(struct web_client *w, char *url) {
                        units = st->units;
        }
 
-       debug(D_WEB_CLIENT, "%llu: API command 'badge.svg' for chart '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%u', options '0x%08x'"
+       debug(D_WEB_CLIENT, "%llu: API command 'badge.svg' for chart '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%d', options '0x%08x'"
                        , w->id
                        , chart
                        , (dimensions)?buffer_tostring(dimensions):""
@@ -968,7 +968,7 @@ int web_client_api_request_v1_data(struct web_client *w, char *url)
        long long after  = (after_str  && *after_str) ?atol(after_str):0;
        int       points = (points_str && *points_str)?atoi(points_str):0;
 
-       debug(D_WEB_CLIENT, "%llu: API command 'data' for chart '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%u', format '%u', options '0x%08x'"
+       debug(D_WEB_CLIENT, "%llu: API command 'data' for chart '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%d', format '%u', options '0x%08x'"
                        , w->id
                        , chart
                        , (dimensions)?buffer_tostring(dimensions):""
@@ -994,7 +994,7 @@ int web_client_api_request_v1_data(struct web_client *w, char *url)
                        );
 
                buffer_sprintf(w->response.data,
-                       "%s({version:'%s',reqId:'%s',status:'ok',sig:'%lu',table:",
+                       "%s({version:'%s',reqId:'%s',status:'ok',sig:'%ld',table:",
                        responseHandler, google_version, google_reqId, st->last_updated.tv_sec);
        }
        else if(format == DATASOURCE_JSONP) {
@@ -1449,11 +1449,11 @@ int web_client_api_old_data_request(struct web_client *w, char *url, int datasou
 
        if(datasource_type == DATASOURCE_DATATABLE_JSONP) {
                buffer_sprintf(w->response.data,
-                       "%s({version:'%s',reqId:'%s',status:'ok',sig:'%lu',table:",
+                       "%s({version:'%s',reqId:'%s',status:'ok',sig:'%ld',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).",
+       debug(D_WEB_CLIENT_ACCESS, "%llu: Sending RRD data '%s' (id %s, %d lines, %d group, %d group_method, %ld after, %ld before).",
                w->id, st->name, st->id, lines, group_count, group_method, after, before);
 
        time_t timestamp_in_data = rrd_stats_json(datasource_type, st, w->response.data, lines, group_count, group_method, (unsigned long)after, (unsigned long)before, nonzero);
@@ -1758,11 +1758,11 @@ void web_client_process(struct web_client *w) {
                if(w->response.data->len > TOO_BIG_REQUEST) {
                        strcpy(w->last_url, "too big request");
 
-                       debug(D_WEB_CLIENT_ACCESS, "%llu: Received request is too big (%zd bytes).", w->id, w->response.data->len);
+                       debug(D_WEB_CLIENT_ACCESS, "%llu: Received request is too big (%zu bytes).", w->id, w->response.data->len);
 
                        code = 400;
                        buffer_flush(w->response.data);
-                       buffer_sprintf(w->response.data, "Received request is too big  (%zd bytes).\r\n", w->response.data->len);
+                       buffer_sprintf(w->response.data, "Received request is too big  (%zu bytes).\r\n", w->response.data->len);
                }
                else {
                        // wait for more data
@@ -2032,7 +2032,7 @@ void web_client_process(struct web_client *w) {
        // if we know the content length, put it
        if(!w->response.zoutput && (w->response.data->len || w->response.rlen))
                buffer_sprintf(w->response.header_output,
-                       "Content-Length: %ld\r\n"
+                       "Content-Length: %zu\r\n"
                        , w->response.data->len? w->response.data->len: w->response.rlen
                        );
        else if(!w->response.zoutput)
@@ -2190,7 +2190,7 @@ ssize_t web_client_send_deflate(struct web_client *w)
        // when using compression,
        // w->response.sent is the amount of bytes passed through compression
 
-       debug(D_DEFLATE, "%llu: web_client_send_deflate(): w->response.data->len = %zu, w->response.sent = %zu, w->response.zhave = %zu, w->response.zsent = %zu, w->response.zstream.avail_in = %d, w->response.zstream.avail_out = %d, w->response.zstream.total_in = %lu, w->response.zstream.total_out = %lu.",
+       debug(D_DEFLATE, "%llu: web_client_send_deflate(): w->response.data->len = %zu, w->response.sent = %zu, w->response.zhave = %zu, w->response.zsent = %zu, w->response.zstream.avail_in = %u, w->response.zstream.avail_out = %u, w->response.zstream.total_in = %lu, w->response.zstream.total_out = %lu.",
                w->id, w->response.data->len, w->response.sent, w->response.zhave, w->response.zsent, w->response.zstream.avail_in, w->response.zstream.avail_out, w->response.zstream.total_in, w->response.zstream.total_out);
 
        if(w->response.data->len - w->response.sent == 0 && w->response.zstream.avail_in == 0 && w->response.zhave == w->response.zsent && w->response.zstream.avail_out != 0) {
@@ -2212,7 +2212,7 @@ ssize_t web_client_send_deflate(struct web_client *w)
                }
 
                if(unlikely(!w->keepalive)) {
-                       debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %ld bytes sent.", w->id, w->response.sent);
+                       debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
                        WEB_CLIENT_IS_DEAD(w);
                        return t;
                }
@@ -2283,7 +2283,7 @@ ssize_t web_client_send_deflate(struct web_client *w)
                w->stats_sent_bytes += len;
                w->response.zsent += len;
                len += t;
-               debug(D_WEB_CLIENT, "%llu: Sent %zu bytes.", w->id, len);
+               debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, len);
        }
        else if(len == 0) {
                debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client (zhave = %zu, zsent = %zu, need to send = %zu).",
@@ -2324,7 +2324,7 @@ ssize_t web_client_send(struct web_client *w) {
                }
 
                if(unlikely(!w->keepalive)) {
-                       debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %ld bytes sent.", w->id, w->response.sent);
+                       debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
                        WEB_CLIENT_IS_DEAD(w);
                        return 0;
                }
@@ -2338,7 +2338,7 @@ ssize_t web_client_send(struct web_client *w) {
        if(likely(bytes > 0)) {
                w->stats_sent_bytes += bytes;
                w->response.sent += bytes;
-               debug(D_WEB_CLIENT, "%llu: Sent %zu bytes.", w->id, bytes);
+               debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, bytes);
        }
        else if(likely(bytes == 0)) {
                debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client.", w->id);
@@ -2373,7 +2373,7 @@ ssize_t web_client_receive(struct web_client *w)
                w->response.data->len += bytes;
                w->response.data->buffer[w->response.data->len] = '\0';
 
-               debug(D_WEB_CLIENT, "%llu: Received %zu bytes.", w->id, bytes);
+               debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
                debug(D_WEB_DATA, "%llu: Received data: '%s'.", w->id, &w->response.data->buffer[old]);
 
                if(w->mode == WEB_CLIENT_MODE_FILECOPY) {
index 18fd5b0fd6490a427b34da84e48f3e433bbd9ae4..5a51b0222841132683c9394c5bf19801d6947295 100644 (file)
                                                data = null;
                                        }
 
-                                       if(data === null && redirect !== null && max_redirects > 0) {
-                                               NETDATA.registry.server = redirect;
-                                               NETDATA.registry.access(max_redirects - 1, callback);
+                                       if(data === null) {
+                                               if(redirect !== null && max_redirects > 0) {
+                                                       NETDATA.registry.server = redirect;
+                                                       NETDATA.registry.access(max_redirects - 1, callback);
+                                               }
+                                               else {
+                                                       if(typeof callback === 'function')
+                                                               callback(null);
+                                               }
                                        }
                                        else {
                                                if(typeof data.person_guid === 'string')
                                                callback(null);
                                });
                },
-               
+
                switch: function(new_person_guid, callback) {
                        // impersonate
                        $.ajax({
index c84289696ee93cbcea6bf223196e1d215baaa9bb..e7638317fb40c8544d2973a9b4c2dd4d1c90559e 100644 (file)
@@ -1361,10 +1361,15 @@ var menuData = {
                info: undefined
        },
 
+       'phpfpm': {
+               title: 'PHP-FPM',
+               info: undefined,
+       },
+
        'named': {
                title: 'named',
                info: undefined
-       },
+       }
 };
 
 var submenuData = {
@@ -1800,6 +1805,7 @@ function enrichChartData(chart) {
                        break;
 
                case 'mysql':
+               case 'phpfpm':
                case 'named':
                case 'cgroup':
                        chart.menu = chart.type;