]> arthur.barton.de Git - netdata.git/commitdiff
Merge pull request #806 from ktsaou/master
authorCosta Tsaousis <costa@tsaousis.gr>
Sun, 21 Aug 2016 11:08:09 +0000 (14:08 +0300)
committerGitHub <noreply@github.com>
Sun, 21 Aug 2016 11:08:09 +0000 (14:08 +0300)
fixed context for python.d charts and other improvements

15 files changed:
conf.d/health.d/net.conf
configs.signatures
python.d/dovecot.chart.py
python.d/exim.chart.py
python.d/hddtemp.chart.py
python.d/memcached.chart.py
python.d/mysql.chart.py
python.d/nginx.chart.py
python.d/postfix.chart.py
python.d/redis.chart.py
python.d/sensors.chart.py
python.d/squid.chart.py
src/plugin_nfacct.c
src/plugins_d.c
src/sys_fs_cgroup.c

index 19703608527c4366509efd59a3d7434f0af8fa24..84a63587d79e015dfe86d4f74c473fe3626528c4 100644 (file)
@@ -6,6 +6,18 @@
 template: 30min_packet_drops
       on: net.drops
   lookup: sum -30m unaligned absolute
-   every: 10s
+   every: 1m
+    crit: $this > 0
+
+
+# check if an interface is having FIFO
+# buffer errors
+# the alarm is checked every 10 seconds
+# and examines the last 30 minutes of data
+
+template: 30min_fifo_errors
+      on: net.fifo
+  lookup: sum -30m unaligned absolute
+   every: 1m
     crit: $this > 0
 
index c82d81a18d4e8e6decd68c52490853799c8ed49e..5b583ffb9fada30007c202a3016bd66ede763595 100644 (file)
@@ -43,6 +43,7 @@ declare -A configs_signatures=(
   ['a8feb36776005bf419c90278787a1be8']='health.d/entropy.conf'
   ['d8dc489e32f7114c6298fce94e86a8ef']='health.d/entropy.conf'
   ['373c1276dc9e65884ff2b26e1f08afe7']='health.d/named.conf'
+  ['2827de41cf34a91b7a8e4d8724f59668']='health.d/net.conf'
   ['43ebb7f224c3b232d8ad044d7e9508b6']='health.d/net.conf'
   ['d11711b3647bc2bdd0292dd7deebbeb1']='health.d/net.conf'
   ['de02f899a61f21b86adb646940f0bcae']='health.d/net.conf'
@@ -50,11 +51,6 @@ declare -A configs_signatures=(
   ['80f109ff293ac94222bf3959432751bd']='health.d/qos.conf'
   ['325617412a628e3bc776e3fbb777a2a6']='health.d/redis.conf'
   ['23ae815aefa221b1929f96752a1f7556']='health.d/squid.conf'
-  ['6b917300747e7e8314844237e2462261']='python.d/apache_cache.conf'
-  ['e0e96cc47ed61d6492416be5236cd4d3']='python.d/apache_cache.conf'
-  ['5278ebbae19c60db600f0a119cb3664e']='python.d/apache.conf'
-  ['5829812db29598db5857c9f433e96fef']='python.d/apache.conf'
-  ['6bf0de6e3b251b765b10a71d8c5c319d']='python.d/apache.conf'
   ['13141998a5d71308d9c119834c27bfd3']='python.d.conf'
   ['38d1bf04fe9901481dd6febcc0404a86']='python.d.conf'
   ['4b775fb31342f1478b3773d041a72911']='python.d.conf'
@@ -70,6 +66,11 @@ declare -A configs_signatures=(
   ['bba2f3886587f137ea08a6e63dd3d376']='python.d.conf'
   ['d55be5bb5e108da1e7645da007c53cd4']='python.d.conf'
   ['f82924563e41d99cdae5431f0af69155']='python.d.conf'
+  ['5278ebbae19c60db600f0a119cb3664e']='python.d/apache.conf'
+  ['5829812db29598db5857c9f433e96fef']='python.d/apache.conf'
+  ['6bf0de6e3b251b765b10a71d8c5c319d']='python.d/apache.conf'
+  ['6b917300747e7e8314844237e2462261']='python.d/apache_cache.conf'
+  ['e0e96cc47ed61d6492416be5236cd4d3']='python.d/apache_cache.conf'
   ['7830066c46a7e5f9682b8d3f4566b4e5']='python.d/cpufreq.conf'
   ['b5b5a8d6d991fb1cef8d80afa23ba114']='python.d/cpufreq.conf'
   ['dc0d2b96378f290eec3fcf98b89ad824']='python.d/cpufreq.conf'
index 4ec1acd93a4d7e057be55ba138bf02313bbfce9c..586478cdabac0acf0c2e78730e5d5caeed5bde9b 100644 (file)
@@ -19,13 +19,13 @@ ORDER = ['sessions', 'commands',
 
 CHARTS = {
     'sessions': {
-        'options': [None, "logins and sessions", 'number', 'IMAP', 'dovecot.imap', 'line'],
+        'options': [None, "logins and sessions", 'number', 'IMAP', 'dovecot.sessions', 'line'],
         'lines': [
             ['num_logins', 'logins', 'absolute'],
             ['num_connected_sessions', 'active sessions', 'absolute']
         ]},
     'commands': {
-        'options': [None, "commands", "commands", 'IMAP', 'dovecot.imap', 'line'],
+        'options': [None, "commands", "commands", 'IMAP', 'dovecot.commands', 'line'],
         'lines': [
             ['num_cmds', 'commands', 'absolute']
         ]},
@@ -42,31 +42,31 @@ CHARTS = {
             ['invol_cs', 'involountary', 'absolute']
         ]},
     'disk': {
-        'options': [None, "disk", 'bytes/s', 'Reads and Writes', 'dovecot.read_write', 'line'],
+        'options': [None, "disk", 'bytes/s', 'Reads and Writes', 'dovecot.disk', 'line'],
         'lines': [
             ['disk_input', 'read', 'incremental'],
             ['disk_output', 'write', 'incremental']
         ]},
     'bytes': {
-        'options': [None, "bytes", 'bytes/s', 'Reads and Writes', 'dovecot.read_write', 'line'],
+        'options': [None, "bytes", 'bytes/s', 'Reads and Writes', 'dovecot.bytes', 'line'],
         'lines': [
             ['read_bytes', 'read', 'incremental'],
             ['write_bytes', 'write', 'incremental']
         ]},
     'syscalls': {
-        'options': [None, "number of syscalls", 'syscalls/s', 'Reads and Writes', 'dovecot.read_write', 'line'],
+        'options': [None, "number of syscalls", 'syscalls/s', 'Reads and Writes', 'dovecot.syscalls', 'line'],
         'lines': [
             ['read_count', 'read', 'incremental'],
             ['write_count', 'write', 'incremental']
         ]},
     'lookup': {
-        'options': [None, "lookups", 'number/s', 'Mail', 'dovecot.mail', 'line'],
+        'options': [None, "lookups", 'number/s', 'Mail', 'dovecot.lookup', 'line'],
         'lines': [
             ['mail_lookup_path', 'path', 'incremental'],
             ['mail_lookup_attr', 'attr', 'incremental']
         ]},
     'cache': {
-        'options': [None, "hits", 'hits/s', 'Mail', 'dovecot.mail', 'line'],
+        'options': [None, "hits", 'hits/s', 'Mail', 'dovecot.cache', 'line'],
         'lines': [
             ['mail_cache_hits', 'hits', 'incremental']
         ]},
@@ -77,7 +77,7 @@ CHARTS = {
             ['auth_failures', 'failure', 'absolute']
         ]},
     'auth_cache': {
-        'options': [None, "cache", 'number', 'Authentication', 'dovecot.auth', 'stacked'],
+        'options': [None, "cache", 'number', 'Authentication', 'dovecot.auth_cache', 'stacked'],
         'lines': [
             ['auth_cache_hits', 'hit', 'absolute'],
             ['auth_cache_misses', 'miss', 'absolute']
index a0dfa6f9a306fe83303fb36f49a6acf3bb3c3d2f..1858cbc7000ea5af3e189b96446f737e08ab921d 100644 (file)
@@ -14,7 +14,7 @@ ORDER = ['qemails']
 
 CHARTS = {
     'qemails': {
-        'options': [None, "Exim Queue Emails", "emails", 'queue', 'exim.queued.emails', 'line'],
+        'options': [None, "Exim Queue Emails", "emails", 'queue', 'exim.qemails', 'line'],
         'lines': [
             ['emails', None, 'absolute']
         ]}
index 8fe592beb696ceda5e83fcdefbc0492675ddee63..4271001b70daad705e1c00adbeb474adf3764e61 100644 (file)
@@ -23,7 +23,7 @@ ORDER = ['temperatures']
 
 CHARTS = {
     'temperatures': {
-        'options': ['disks_temp', 'temperature', 'Celsius', 'Disks temperature', 'hddtemp.temp', 'line'],
+        'options': ['disks_temp', 'temperature', 'Celsius', 'Disks temperature', 'hddtemp.temperatures', 'line'],
         'lines': [
             # lines are created dynamically in `check()` method
         ]}
index e99186f3fd1aeac1863469842ac86862664461f5..d344530cec93de7699f2d53c5eb20c0a57fa92cb 100644 (file)
@@ -29,14 +29,14 @@ CHARTS = {
             ['bytes_written', 'written', 'incremental', 1, 1024]
         ]},
     'connections': {
-        'options': [None, 'Connections', 'connections/s', 'Cluster', 'memcached.cluster', 'line'],
+        'options': [None, 'Connections', 'connections/s', 'Cluster', 'memcached.connections', 'line'],
         'lines': [
             ['curr_connections', 'current', 'incremental'],
             ['rejected_connections', 'rejected', 'incremental'],
             ['total_connections', 'total', 'incremental']
         ]},
     'items': {
-        'options': [None, 'Items', 'items', 'Cluster', 'memcached.cluster', 'line'],
+        'options': [None, 'Items', 'items', 'Cluster', 'memcached.items', 'line'],
         'lines': [
             ['curr_items', 'current', 'absolute'],
             ['total_items', 'total', 'absolute']
@@ -54,12 +54,12 @@ CHARTS = {
             ['get_misses', 'misses', 'percent-of-absolute-row']
         ]},
     'get_rate': {
-        'options': [None, 'Rate', 'requests/s', 'GET', 'memcached.get', 'line'],
+        'options': [None, 'Rate', 'requests/s', 'GET', 'memcached.get_rate', 'line'],
         'lines': [
             ['cmd_get', 'rate', 'incremental']
         ]},
     'set_rate': {
-        'options': [None, 'Rate', 'requests/s', 'SET', 'memcached.set', 'line'],
+        'options': [None, 'Rate', 'requests/s', 'SET', 'memcached.set_rate', 'line'],
         'lines': [
             ['cmd_set', 'rate', 'incremental']
         ]},
@@ -77,13 +77,13 @@ CHARTS = {
             ['cas_badval', 'bad value', 'percent-of-absolute-row']
         ]},
     'increment': {
-        'options': [None, 'Requests', 'requests', 'Increment', 'memcached.incr', 'stacked'],
+        'options': [None, 'Requests', 'requests', 'Increment', 'memcached.increment', 'stacked'],
         'lines': [
             ['incr_hits', 'hits', 'percent-of-absolute-row'],
             ['incr_misses', 'misses', 'percent-of-absolute-row']
         ]},
     'decrement': {
-        'options': [None, 'Requests', 'requests', 'Decrement', 'memcached.decr', 'stacked'],
+        'options': [None, 'Requests', 'requests', 'Decrement', 'memcached.decrement', 'stacked'],
         'lines': [
             ['decr_hits', 'hits', 'percent-of-absolute-row'],
             ['decr_misses', 'misses', 'percent-of-absolute-row']
@@ -95,7 +95,7 @@ CHARTS = {
             ['touch_misses', 'misses', 'percent-of-absolute-row']
         ]},
     'touch_rate': {
-        'options': [None, 'Rate', 'requests/s', 'Touch', 'memcached.touch', 'line'],
+        'options': [None, 'Rate', 'requests/s', 'Touch', 'memcached.touch_rate', 'line'],
         'lines': [
             ['cmd_touch', 'rate', 'incremental']
         ]}
index d84f322429b5234e923b96c1a3a0e47558e9f8a0..7c3931acf75d1721fcba11fbf406a3dbb1e631ed 100644 (file)
@@ -105,7 +105,7 @@ CHARTS = {
             ["Select_scan", "scan", "incremental"]
         ]},
     'sort_issues': {
-        'options': [None, 'mysql Sort Issues', 'issues/s', 'issues', 'mysql.sort.issues', 'line'],
+        'options': [None, 'mysql Sort Issues', 'issues/s', 'issues', 'mysql.sort_issues', 'line'],
         'lines': [
             ["Sort_merge_passes", "merge_passes", "incremental"],
             ["Sort_range", "range", "incremental"],
index 07196173871821c511d6dd51e587a59a94a99608..ff8bfede84328c280395883d7d4b72d67425afa7 100644 (file)
@@ -32,14 +32,14 @@ CHARTS = {
             ["requests", None, 'incremental']
         ]},
     'connection_status': {
-        'options': [None, 'nginx Active Connections by Status', 'connections', 'nginx', 'nginx.connection.status', 'line'],
+        'options': [None, 'nginx Active Connections by Status', 'connections', 'nginx', 'nginx.connection_status', 'line'],
         'lines': [
             ["reading"],
             ["writing"],
             ["waiting", "idle"]
         ]},
     'connect_rate': {
-        'options': [None, 'nginx Connections Rate', 'connections/s', 'nginx', 'nginx.performance', 'line'],
+        'options': [None, 'nginx Connections Rate', 'connections/s', 'nginx', 'nginx.connect_rate', 'line'],
         'lines': [
             ["accepts", "accepted", "incremental"],
             ["handled", None, "incremental"]
index c8eb3ee853c036abc446b4868291ee297edae55a..ee4142aaf68752b71fb782e36937fedc5b348407 100644 (file)
@@ -14,12 +14,12 @@ ORDER = ['qemails', 'qsize']
 
 CHARTS = {
     'qemails': {
-        'options': [None, "Postfix Queue Emails", "emails", 'queue', 'postfix.queued.emails', 'line'],
+        'options': [None, "Postfix Queue Emails", "emails", 'queue', 'postfix.qemails', 'line'],
         'lines': [
             ['emails', None, 'absolute']
         ]},
     'qsize': {
-        'options': [None, "Postfix Queue Emails Size", "emails size in KB", 'queue', 'postfix.queued.size', 'area'],
+        'options': [None, "Postfix Queue Emails Size", "emails size in KB", 'queue', 'postfix.qsize', 'area'],
         'lines': [
             ["size", None, 'absolute']
         ]}
index 4c2c1697268fbb2b738b65f5c46c4ad5ffbb28ef..218401e1276d081a052dff0322cb607984723579 100644 (file)
@@ -23,12 +23,12 @@ ORDER = ['operations', 'hit_rate', 'memory', 'keys', 'clients', 'slaves']
 
 CHARTS = {
     'operations': {
-        'options': [None, 'Operations', 'operations/s', 'Statistics', 'redis.statistics', 'line'],
+        'options': [None, 'Operations', 'operations/s', 'Statistics', 'redis.operations', 'line'],
         'lines': [
             ['instantaneous_ops_per_sec', 'operations', 'absolute']
         ]},
     'hit_rate': {
-        'options': [None, 'Hit rate', 'percent', 'Statistics', 'redis.statistics', 'line'],
+        'options': [None, 'Hit rate', 'percent', 'Statistics', 'redis.hit_rate', 'line'],
         'lines': [
             ['hit_rate', 'rate', 'absolute']
         ]},
@@ -50,7 +50,7 @@ CHARTS = {
             ['blocked_clients', 'blocked', 'absolute']
         ]},
     'slaves': {
-        'options': [None, 'Slaves', 'slaves', 'Replication', 'redis.replication', 'line'],
+        'options': [None, 'Slaves', 'slaves', 'Replication', 'redis.slaves', 'line'],
         'lines': [
             ['connected_slaves', 'connected', 'absolute']
         ]}
index 8f7b903c3775ea5e041c3c00ba0e3067cdc852db..7abe7f0809d45a5f20f47147501bf8126072544f 100644 (file)
@@ -13,17 +13,17 @@ ORDER = ['temperature', 'fan', 'voltage', 'current', 'power', 'energy', 'humidit
 # This is a prototype of chart definition which is used to dynamically create self.definitions
 CHARTS = {
     'temperature': {
-        'options': [None, ' temperature', 'Celsius', 'temperature', 'sensors.temp', 'line'],
+        'options': [None, ' temperature', 'Celsius', 'temperature', 'sensors.temperature', 'line'],
         'lines': [
             [None, None, 'absolute', 1, 1000]
         ]},
     'voltage': {
-        'options': [None, ' voltage', 'Volts', 'voltage', 'sensors.volt', 'line'],
+        'options': [None, ' voltage', 'Volts', 'voltage', 'sensors.voltage', 'line'],
         'lines': [
             [None, None, 'absolute', 1, 1000]
         ]},
     'current': {
-        'options': [None, ' current', 'Ampere', 'current', 'sensors.curr', 'line'],
+        'options': [None, ' current', 'Ampere', 'current', 'sensors.current', 'line'],
         'lines': [
             [None, None, 'absolute', 1, 1000]
         ]},
@@ -33,7 +33,7 @@ CHARTS = {
             [None, None, 'absolute', 1, 1000000]
         ]},
     'fan': {
-        'options': [None, ' fans speed', 'Rotations/min', 'fans', 'sensors.fans', 'line'],
+        'options': [None, ' fans speed', 'Rotations/min', 'fans', 'sensors.fan', 'line'],
         'lines': [
             [None, None, 'absolute', 1, 1000]
         ]},
index a4e936b456bbc43e25c807c1cf74616e26d6df3b..8300d9bad515ec04cf422789e876ca6a47139fe5 100644 (file)
@@ -15,27 +15,27 @@ ORDER = ['clients_net', 'clients_requests', 'servers_net', 'servers_requests']
 
 CHARTS = {
     'clients_net': {
-        'options': [None, "Squid Client Bandwidth", "kilobits/s", "clients", "squid.clients.net", "area"],
+        'options': [None, "Squid Client Bandwidth", "kilobits/s", "clients", "squid.clients_net", "area"],
         'lines': [
             ["client_http_kbytes_in", "in", "incremental", 8, 1],
             ["client_http_kbytes_out", "out", "incremental", -8, 1],
             ["client_http_hit_kbytes_out", "hits", "incremental", -8, 1]
         ]},
     'clients_requests': {
-        'options': [None, "Squid Client Requests", "requests/s", "clients", "squid.clients.requests", 'line'],
+        'options': [None, "Squid Client Requests", "requests/s", "clients", "squid.clients_requests", 'line'],
         'lines': [
             ["client_http_requests", "requests", "incremental"],
             ["client_http_hits", "hits", "incremental"],
             ["client_http_errors", "errors", "incremental", -1, 1]
         ]},
     'servers_net': {
-        'options': [None, "Squid Server Bandwidth", "kilobits/s", "servers", "squid.servers.net", "area"],
+        'options': [None, "Squid Server Bandwidth", "kilobits/s", "servers", "squid.servers_net", "area"],
         'lines': [
             ["server_all_kbytes_in", "in", "incremental", 8, 1],
             ["server_all_kbytes_out", "out", "incremental", -8, 1]
         ]},
     'servers_requests': {
-        'options': [None, "Squid Server Requests", "requests/s", "servers", "squid.servers.requests", 'line'],
+        'options': [None, "Squid Server Requests", "requests/s", "servers", "squid.servers_requests", 'line'],
         'lines': [
             ["server_all_requests", "requests", "incremental"],
             ["server_all_errors", "errors", "incremental", -1, 1]
index 58d667c364fcee44843e73d1033f27aa34dbc738..b2396fac19cd354b3033d78ad15896f025d4c9e0 100644 (file)
@@ -1,9 +1,9 @@
+#include "common.h"
+
 #ifdef INTERNAL_PLUGIN_NFACCT
 #include <libmnl/libmnl.h>
 #include <libnetfilter_acct/libnetfilter_acct.h>
 
-#include "common.h"
-
 struct mynfacct {
     const char *name;
     uint64_t pkts;
@@ -136,7 +136,7 @@ void *nfacct_main(void *ptr) {
         // --------------------------------------------------------------------
 
         gettimeofday(&now, NULL);
-        usec = usecdiff(&now, &last) - susec;
+        usec = usec_dt(&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;
index 0f3b8bc6450cd7fbfb296a4a7f991bd85e7c5852..627cc90e5f443543c6f42382d26d7ab3b692db88 100644 (file)
@@ -349,7 +349,7 @@ void *pluginsd_worker_thread(void *arg)
                 }
                 else {
                     // second+ run
-                    usec = usecdiff(&now, &last) - susec;
+                    usec = usec_dt(&now, &last) - susec;
                     error("PLUGINSD: %s last loop took %llu usec (worked for %llu, sleeped for %llu).\n", cd->fullfilename, usec + susec, usec, susec);
                     if(unlikely(usec < (rrd_update_every * 1000000ULL / 2ULL))) susec = (rrd_update_every * 1000000ULL) - usec;
                     else susec = rrd_update_every * 1000000ULL / 2ULL;
index 616b806f678ef3136a573ea39cc7db15c3be7821..f3b20056c1478e771c1a47afe3d87362b42e77ae 100644 (file)
@@ -168,6 +168,8 @@ struct cgroup {
     uint32_t hash;
 
     char *chart_id;
+    uint32_t hash_chart;
+
     char *chart_title;
 
     struct cpuacct_stat cpuacct_stat;
@@ -614,8 +616,8 @@ void cgroup_get_chart_id(struct cgroup *cg) {
 
         freez(cg->chart_id);
         cg->chart_id = strdupz(s);
-
         netdata_fix_chart_id(cg->chart_id);
+        cg->hash_chart = simple_hash(cg->chart_id);
 
         debug(D_CGROUP, "cgroup '%s' renamed to '%s' (title: '%s')", cg->id, cg->chart_id, cg->chart_title);
     }
@@ -676,12 +678,13 @@ struct cgroup *cgroup_add(const char *id) {
 
     struct cgroup *cg = callocz(1, sizeof(struct cgroup));
 
-    debug(D_CGROUP, "adding cgroup '%s'", id);
-
     cg->id = strdupz(id);
     cg->hash = simple_hash(cg->id);
 
     cg->chart_id = strdupz(chart_id);
+    netdata_fix_chart_id(cg->chart_id);
+    cg->hash_chart = simple_hash(cg->chart_id);
+
     cg->chart_title = strdupz(chart_id);
 
     if(!cgroup_root)
@@ -698,10 +701,31 @@ struct cgroup *cgroup_add(const char *id) {
     // fix the name by calling the external script
     cgroup_get_chart_id(cg);
 
+    debug(D_CGROUP, "adding cgroup '%s' with chart id '%s'", id, chart_id);
+
     char option[FILENAME_MAX + 1];
     snprintfz(option, FILENAME_MAX, "enable cgroup %s", cg->chart_title);
     cg->enabled = config_get_boolean("plugin:cgroups", option, def);
 
+    if(cg->enabled) {
+        struct cgroup *t;
+        for (t = cgroup_root; t; t = t->next) {
+            if (t != cg && t->enabled && t->hash_chart == cg->hash_chart && !strcmp(t->chart_id, cg->chart_id)) {
+                if (!strncmp(t->chart_id, "/system.slice/", 14) && !strncmp(cg->chart_id, "/init.scope/system.slice/", 25)) {
+                    error("Control group with chart id '%s' already exists with id '%s' and is enabled. Swapping them by enabling cgroup with id '%s' and disabling cgroup with id '%s'.",
+                          cg->chart_id, t->id, cg->id, t->id);
+                    t->enabled = 0;
+                } else {
+                    error("Control group with chart id '%s' already exists with id '%s' and is enabled. Disabling cgroup with id '%s'.",
+                          cg->chart_id, t->id, cg->id);
+                    cg->enabled = 0;
+                }
+
+                break;
+            }
+        }
+    }
+
     debug(D_CGROUP, "Added cgroup '%s' with chart id '%s' and title '%s' as %s (default was %s)", cg->id, cg->chart_id, cg->chart_title, (cg->enabled)?"enabled":"disabled", (def)?"enabled":"disabled");
 
     return cg;