]> arthur.barton.de Git - netdata.git/commitdiff
added mysql.chart.sh
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 17 Oct 2015 22:14:16 +0000 (01:14 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 17 Oct 2015 22:14:16 +0000 (01:14 +0300)
README.md
conf.d/apps_groups.conf
src/web_client.c
src/web_server.c

index 58cfdd0e44444e994377b9dca8bdfc9e8ee72ef4..a08951cfcb19c1c0fd85d2d3f0faa17c4551ba2d 100755 (executable)
--- a/README.md
+++ b/README.md
@@ -90,10 +90,13 @@ Here is a screenshot:
  - `charts.d.plugin` provides a simple way to script data collection in BASH. It includes example plugins that collect values from:
 
     - `nut` (UPS load, frequency, voltage, etc)
-    - `sensors` (read temperature, voltage, current, power, humidity, fans rotation sensors)
-    - `cpufreq` (read current CPU clock frequency)
+    - `sensors` (temperature, voltage, current, power, humidity, fans rotation sensors)
+    - `cpufreq` (current CPU clock frequency)
     - `postfix` (e-mail queue size)
     - `squid` (web proxy statistics)
+    - `mysql` (mysql global statistics)
+
+    Of course, you can write your own using BASH scripting.
 
 - netdata is a web server, supporting gzip compression
 
index ba0a50923b4a4b771b7481129d5aeaa59086a387..e59ce16002aa19fe0ae463bf77af9e7dcfb67f57 100644 (file)
@@ -20,7 +20,7 @@
 # If a group_name starts with a -, the dimension will be hidden (cpu chart only)
 #
 
-compile: cc1 cc1plus as gcc ld make automake autoconf
+compile: cc1 cc1plus as gcc ld make automake autoconf git
 rsync: rsync
 media: mplayer vlc xine mediatomb omxplayer omxplayer.bin kodi kodi.bin xbmc xbmc.bin mediacenter eventlircd
 squid: squid squid2 squid3
@@ -33,6 +33,8 @@ fail2ban: fail2ban-server
 mail: dovecot imapd pop3d
 postfix: master
 nginx: nginx
+splunk: splunkd
+mongo: mongod
 lighttpd: lighttpd
 ftpd: proftpd in.tftpd
 samba: smbd nmbd winbindd
index 7f6a2c3486aaee7dced112992caac86981d2170c..02439c3c0b70a1e4b63e979ff70ae26977bfbbfd 100755 (executable)
@@ -70,9 +70,11 @@ struct web_client *web_client_create(int listener)
                w->client_port[NI_MAXSERV] = '\0';
 
                switch(sadr->sa_family) {
+
                case AF_INET:
                        debug(D_WEB_CLIENT_ACCESS, "%llu: New IPv4 web client from %s port %s on socket %d.", w->id, w->client_ip, w->client_port, w->ifd);
                        break;
+
                case AF_INET6:
                        if(strncmp(w->client_ip, "::ffff:", 7) == 0) {
                                strcpy(w->client_ip, &w->client_ip[7]);
@@ -80,6 +82,7 @@ struct web_client *web_client_create(int listener)
                        }
                        debug(D_WEB_CLIENT_ACCESS, "%llu: New IPv6 web client from %s port %s on socket %d.", w->id, w->client_ip, w->client_port, w->ifd);
                        break;
+
                default:
                        debug(D_WEB_CLIENT_ACCESS, "%llu: New UNKNOWN web client from %s port %s on socket %d.", w->id, w->client_ip, w->client_port, w->ifd);
                        break;
@@ -90,7 +93,8 @@ struct web_client *web_client_create(int listener)
        }
 
        w->data = web_buffer_create(INITIAL_WEB_DATA_LENGTH);
-       if(!w->data) {
+       if(unlikely(!w->data)) {
+               // no need for error log - web_buffer_create already logged the error
                close(w->ifd);
                free(w);
                return NULL;
@@ -734,31 +738,31 @@ void web_client_process(struct web_client *w) {
        char *content_type_string = "";
        switch(w->data->contenttype) {
                case CT_TEXT_HTML:
-                       content_type_string = "text/html";
+                       content_type_string = "text/html; charset=utf-8";
                        break;
 
                case CT_APPLICATION_XML:
-                       content_type_string = "application/xml";
+                       content_type_string = "application/xml; charset=utf-8";
                        break;
 
                case CT_APPLICATION_JSON:
-                       content_type_string = "application/json";
+                       content_type_string = "application/json; charset=utf-8";
                        break;
 
                case CT_APPLICATION_X_JAVASCRIPT:
-                       content_type_string = "application/x-javascript";
+                       content_type_string = "application/x-javascript; charset=utf-8";
                        break;
 
                case CT_TEXT_CSS:
-                       content_type_string = "text/css";
+                       content_type_string = "text/css; charset=utf-8";
                        break;
 
                case CT_TEXT_XML:
-                       content_type_string = "text/xml";
+                       content_type_string = "text/xml; charset=utf-8";
                        break;
 
                case CT_TEXT_XSL:
-                       content_type_string = "text/xsl";
+                       content_type_string = "text/xsl; charset=utf-8";
                        break;
 
                case CT_APPLICATION_OCTET_STREAM:
@@ -787,7 +791,7 @@ void web_client_process(struct web_client *w) {
 
                default:
                case CT_TEXT_PLAIN:
-                       content_type_string = "text/plain";
+                       content_type_string = "text/plain; charset=utf-8";
                        break;
        }
 
index b772be601991c4e6cee91e8195649b8925758973..c8e1dd7e549aa8b9a85ecb738e7ff56c6f372399 100755 (executable)
@@ -179,6 +179,10 @@ void *socket_listen_main(void *ptr)
                        // check for new incoming connections
                        if(FD_ISSET(listen_fd, &ifds)) {
                                w = web_client_create(listen_fd);
+                               if(unlikely(!w)) {
+                                       // no need for error log - web_client_create already logged the error
+                                       continue;
+                               }
 
                                if(pthread_create(&w->thread, NULL, web_client_main, w) != 0) {
                                        error("%llu: failed to create new thread for web client.");