added mysql.chart.sh
Costa Tsaousis (ktsaou) committed
Oct 18, 2015 at 01:14 UTC
478472f37f17de35f58c926d92dac67242f9a224
4 files changed
+25
-12
README.md
+5
-2
@@ -90,10 +90,13 @@ Here is a screenshot:
90
- `charts.d.plugin` provides a simple way to script data collection in BASH. It includes example plugins that collect values from:
91
92
- `nut` (UPS load, frequency, voltage, etc)
93
- - `sensors` (read temperature, voltage, current, power, humidity, fans rotation sensors)
94
- - `cpufreq` (read current CPU clock frequency)
93
+ - `sensors` (temperature, voltage, current, power, humidity, fans rotation sensors)
94
+ - `cpufreq` (current CPU clock frequency)
95
- `postfix` (e-mail queue size)
96
- `squid` (web proxy statistics)
97
+ - `mysql` (mysql global statistics)
98
+
99
+ Of course, you can write your own using BASH scripting.
100
101
- netdata is a web server, supporting gzip compression
102
conf.d/apps_groups.conf
+3
-1
@@ -20,7 +20,7 @@
20
# If a group_name starts with a -, the dimension will be hidden (cpu chart only)
21
#
22
23
-compile: cc1 cc1plus as gcc ld make automake autoconf
23
+compile: cc1 cc1plus as gcc ld make automake autoconf git
24
rsync: rsync
25
media: mplayer vlc xine mediatomb omxplayer omxplayer.bin kodi kodi.bin xbmc xbmc.bin mediacenter eventlircd
26
squid: squid squid2 squid3
@@ -33,6 +33,8 @@ fail2ban: fail2ban-server
33
mail: dovecot imapd pop3d
34
postfix: master
35
nginx: nginx
36
+splunk: splunkd
37
+mongo: mongod
38
lighttpd: lighttpd
39
ftpd: proftpd in.tftpd
40
samba: smbd nmbd winbindd
src/web_client.c
+13
-9
@@ -70,9 +70,11 @@ struct web_client *web_client_create(int listener)
70
w->client_port[NI_MAXSERV] = '\0';
71
72
switch(sadr->sa_family) {
73
+
74
case AF_INET:
75
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);
76
break;
77
+
78
case AF_INET6:
79
if(strncmp(w->client_ip, "::ffff:", 7) == 0) {
80
strcpy(w->client_ip, &w->client_ip[7]);
@@ -80,6 +82,7 @@ struct web_client *web_client_create(int listener)
82
}
83
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);
84
break;
85
+
86
default:
87
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);
88
break;
@@ -90,7 +93,8 @@ struct web_client *web_client_create(int listener)
93
}
94
95
w->data = web_buffer_create(INITIAL_WEB_DATA_LENGTH);
93
- if(!w->data) {
96
+ if(unlikely(!w->data)) {
97
+ // no need for error log - web_buffer_create already logged the error
98
close(w->ifd);
99
free(w);
100
return NULL;
@@ -734,31 +738,31 @@ void web_client_process(struct web_client *w) {
738
char *content_type_string = "";
739
switch(w->data->contenttype) {
740
case CT_TEXT_HTML:
737
- content_type_string = "text/html";
741
+ content_type_string = "text/html; charset=utf-8";
742
break;
743
744
case CT_APPLICATION_XML:
741
- content_type_string = "application/xml";
745
+ content_type_string = "application/xml; charset=utf-8";
746
break;
747
748
case CT_APPLICATION_JSON:
745
- content_type_string = "application/json";
749
+ content_type_string = "application/json; charset=utf-8";
750
break;
751
752
case CT_APPLICATION_X_JAVASCRIPT:
749
- content_type_string = "application/x-javascript";
753
+ content_type_string = "application/x-javascript; charset=utf-8";
754
break;
755
756
case CT_TEXT_CSS:
753
- content_type_string = "text/css";
757
+ content_type_string = "text/css; charset=utf-8";
758
break;
759
760
case CT_TEXT_XML:
757
- content_type_string = "text/xml";
761
+ content_type_string = "text/xml; charset=utf-8";
762
break;
763
764
case CT_TEXT_XSL:
761
- content_type_string = "text/xsl";
765
+ content_type_string = "text/xsl; charset=utf-8";
766
break;
767
768
case CT_APPLICATION_OCTET_STREAM:
@@ -787,7 +791,7 @@ void web_client_process(struct web_client *w) {
791
792
default:
793
case CT_TEXT_PLAIN:
790
- content_type_string = "text/plain";
794
+ content_type_string = "text/plain; charset=utf-8";
795
break;
796
}
797
src/web_server.c
+4
@@ -179,6 +179,10 @@ void *socket_listen_main(void *ptr)
179
// check for new incoming connections
180
if(FD_ISSET(listen_fd, &ifds)) {
181
w = web_client_create(listen_fd);
182
+ if(unlikely(!w)) {
183
+ // no need for error log - web_client_create already logged the error
184
+ continue;
185
+ }
186
187
if(pthread_create(&w->thread, NULL, web_client_main, w) != 0) {
188
error("%llu: failed to create new thread for web client.");