diff options
-rwxr-xr-x | README.md | 7 | ||||
-rw-r--r-- | conf.d/apps_groups.conf | 4 | ||||
-rwxr-xr-x | src/web_client.c | 22 | ||||
-rwxr-xr-x | src/web_server.c | 4 |
4 files changed, 25 insertions, 12 deletions
@@ -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 diff --git a/conf.d/apps_groups.conf b/conf.d/apps_groups.conf index ba0a50923b..e59ce16002 100644 --- a/conf.d/apps_groups.conf +++ b/conf.d/apps_groups.conf @@ -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 diff --git a/src/web_client.c b/src/web_client.c index 7f6a2c3486..02439c3c0b 100755 --- a/src/web_client.c +++ b/src/web_client.c @@ -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; } diff --git a/src/web_server.c b/src/web_server.c index b772be6019..c8e1dd7e54 100755 --- a/src/web_server.c +++ b/src/web_server.c @@ -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."); |