summaryrefslogtreecommitdiffstats
path: root/charts.d
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2016-05-25 10:36:27 +0000
committerLennart Weller <lhw@ring0.de>2016-05-25 10:36:27 +0000
commit39ecaf8d995e3fefea54f260b8b42bbb9cc806d6 (patch)
tree02ecee3bf4d7dad9dfad2e1799616716f5ffbf03 /charts.d
parentbroken logrotate (diff)
parentImported Upstream version 1.2.0 (diff)
downloadnetdata-39ecaf8d995e3fefea54f260b8b42bbb9cc806d6.tar.xz
netdata-39ecaf8d995e3fefea54f260b8b42bbb9cc806d6.zip
Merge tag 'upstream/1.2.0'
Upstream version 1.2.0
Diffstat (limited to 'charts.d')
-rw-r--r--charts.d/Makefile.am2
-rw-r--r--charts.d/Makefile.in7
-rwxr-xr-xcharts.d/ap.chart.sh12
-rwxr-xr-xcharts.d/apache.chart.sh68
-rwxr-xr-xcharts.d/cpufreq.chart.sh2
-rwxr-xr-xcharts.d/example.chart.sh18
-rwxr-xr-xcharts.d/load_average.chart.sh2
-rwxr-xr-xcharts.d/mysql.chart.sh261
-rwxr-xr-xcharts.d/nginx.chart.sh24
-rwxr-xr-xcharts.d/nut.chart.sh16
-rwxr-xr-xcharts.d/opensips.chart.sh38
-rwxr-xr-xcharts.d/phpfpm.chart.sh175
-rwxr-xr-xcharts.d/postfix.chart.sh4
-rwxr-xr-xcharts.d/sensors.chart.sh14
-rwxr-xr-xcharts.d/squid.chart.sh8
-rwxr-xr-xcharts.d/tomcat.chart.sh129
16 files changed, 634 insertions, 146 deletions
diff --git a/charts.d/Makefile.am b/charts.d/Makefile.am
index 29b41efa..ad11e972 100644
--- a/charts.d/Makefile.am
+++ b/charts.d/Makefile.am
@@ -17,9 +17,11 @@ dist_charts_SCRIPTS = \
nginx.chart.sh \
nut.chart.sh \
opensips.chart.sh \
+ phpfpm.chart.sh \
postfix.chart.sh \
sensors.chart.sh \
squid.chart.sh \
+ tomcat.chart.sh \
$(NULL)
dist_charts_DATA = \
diff --git a/charts.d/Makefile.in b/charts.d/Makefile.in
index c14403fa..3aff5a94 100644
--- a/charts.d/Makefile.in
+++ b/charts.d/Makefile.in
@@ -186,6 +186,8 @@ OPTIONAL_MATH_CLFAGS = @OPTIONAL_MATH_CLFAGS@
OPTIONAL_MATH_LIBS = @OPTIONAL_MATH_LIBS@
OPTIONAL_NFACCT_CLFAGS = @OPTIONAL_NFACCT_CLFAGS@
OPTIONAL_NFACCT_LIBS = @OPTIONAL_NFACCT_LIBS@
+OPTIONAL_UUID_CLFAGS = @OPTIONAL_UUID_CLFAGS@
+OPTIONAL_UUID_LIBS = @OPTIONAL_UUID_LIBS@
OPTIONAL_ZLIB_CLFAGS = @OPTIONAL_ZLIB_CLFAGS@
OPTIONAL_ZLIB_LIBS = @OPTIONAL_ZLIB_LIBS@
PACKAGE = @PACKAGE@
@@ -207,6 +209,8 @@ PTHREAD_LIBS = @PTHREAD_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
VERSION = @VERSION@
ZLIB_CFLAGS = @ZLIB_CFLAGS@
ZLIB_LIBS = @ZLIB_LIBS@
@@ -267,6 +271,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+varlibdir = @varlibdir@
webdir = @webdir@
#
@@ -287,9 +292,11 @@ dist_charts_SCRIPTS = \
nginx.chart.sh \
nut.chart.sh \
opensips.chart.sh \
+ phpfpm.chart.sh \
postfix.chart.sh \
sensors.chart.sh \
squid.chart.sh \
+ tomcat.chart.sh \
$(NULL)
dist_charts_DATA = \
diff --git a/charts.d/ap.chart.sh b/charts.d/ap.chart.sh
index 10a65688..aed51c1b 100755
--- a/charts.d/ap.chart.sh
+++ b/charts.d/ap.chart.sh
@@ -54,25 +54,25 @@ ap_create() {
# create the chart with 3 dimensions
cat <<EOF
-CHART ap_clients.${dev} '' "Connected clients to ${ssid} on ${dev}" "clients" ${dev} ap.clients line $[ap_priority + 1] $ap_update_every
+CHART ap_clients.${dev} '' "Connected clients to ${ssid} on ${dev}" "clients" ${dev} ap.clients line $((ap_priority + 1)) $ap_update_every
DIMENSION clients '' absolute 1 1
-CHART ap_bandwidth.${dev} '' "Bandwidth for ${ssid} on ${dev}" "kilobits/s" ${dev} ap.net area $[ap_priority + 2] $ap_update_every
+CHART ap_bandwidth.${dev} '' "Bandwidth for ${ssid} on ${dev}" "kilobits/s" ${dev} ap.net area $((ap_priority + 2)) $ap_update_every
DIMENSION received '' incremental 8 1024
DIMENSION sent '' incremental -8 1024
-CHART ap_packets.${dev} '' "Packets for ${ssid} on ${dev}" "packets/s" ${dev} ap.packets line $[ap_priority + 3] $ap_update_every
+CHART ap_packets.${dev} '' "Packets for ${ssid} on ${dev}" "packets/s" ${dev} ap.packets line $((ap_priority + 3)) $ap_update_every
DIMENSION received '' incremental 1 1
DIMENSION sent '' incremental -1 1
-CHART ap_issues.${dev} '' "Transmit Issues for ${ssid} on ${dev}" "issues/s" ${dev} ap.issues line $[ap_priority + 4] $ap_update_every
+CHART ap_issues.${dev} '' "Transmit Issues for ${ssid} on ${dev}" "issues/s" ${dev} ap.issues line $((ap_priority + 4)) $ap_update_every
DIMENSION retries 'tx retries' incremental 1 1
DIMENSION failures 'tx failures' incremental -1 1
-CHART ap_signal.${dev} '' "Average Signal for ${ssid} on ${dev}" "dBm" ${dev} ap.signal line $[ap_priority + 5] $ap_update_every
+CHART ap_signal.${dev} '' "Average Signal for ${ssid} on ${dev}" "dBm" ${dev} ap.signal line $((ap_priority + 5)) $ap_update_every
DIMENSION signal 'average signal' absolute 1 1
-CHART ap_bitrate.${dev} '' "Bitrate for ${ssid} on ${dev}" "Mbps" ${dev} ap.bitrate line $[ap_priority + 6] $ap_update_every
+CHART ap_bitrate.${dev} '' "Bitrate for ${ssid} on ${dev}" "Mbps" ${dev} ap.bitrate line $((ap_priority + 6)) $ap_update_every
DIMENSION receive '' absolute 1 1000
DIMENSION transmit '' absolute -1 1000
DIMENSION expected 'expected throughput' absolute 1 1000
diff --git a/charts.d/apache.chart.sh b/charts.d/apache.chart.sh
index 9b6d53b5..dbf14a43 100755
--- a/charts.d/apache.chart.sh
+++ b/charts.d/apache.chart.sh
@@ -47,21 +47,21 @@ apache_detect() {
for x in "${@}"
do
case "${x}" in
- 'Total Accesses') apache_key_accesses=$[i + 1] ;;
- 'Total kBytes') apache_key_kbytes=$[i + 1] ;;
- 'ReqPerSec') apache_key_reqpersec=$[i + 1] ;;
- 'BytesPerSec') apache_key_bytespersec=$[i + 1] ;;
- 'BytesPerReq') apache_key_bytesperreq=$[i + 1] ;;
- 'BusyWorkers') apache_key_busyworkers=$[i + 1] ;;
- 'IdleWorkers') apache_key_idleworkers=$[i + 1];;
- 'ConnsTotal') apache_key_connstotal=$[i + 1] ;;
- 'ConnsAsyncWriting') apache_key_connsasyncwriting=$[i + 1] ;;
- 'ConnsAsyncKeepAlive') apache_key_connsasynckeepalive=$[i + 1] ;;
- 'ConnsAsyncClosing') apache_key_connsasyncclosing=$[i + 1] ;;
- 'Scoreboard') apache_key_scoreboard=$[i] ;;
+ 'Total Accesses') apache_key_accesses=$((i + 1)) ;;
+ 'Total kBytes') apache_key_kbytes=$((i + 1)) ;;
+ 'ReqPerSec') apache_key_reqpersec=$((i + 1)) ;;
+ 'BytesPerSec') apache_key_bytespersec=$((i + 1)) ;;
+ 'BytesPerReq') apache_key_bytesperreq=$((i + 1)) ;;
+ 'BusyWorkers') apache_key_busyworkers=$((i + 1)) ;;
+ 'IdleWorkers') apache_key_idleworkers=$((i + 1));;
+ 'ConnsTotal') apache_key_connstotal=$((i + 1)) ;;
+ 'ConnsAsyncWriting') apache_key_connsasyncwriting=$((i + 1)) ;;
+ 'ConnsAsyncKeepAlive') apache_key_connsasynckeepalive=$((i + 1)) ;;
+ 'ConnsAsyncClosing') apache_key_connsasyncclosing=$((i + 1)) ;;
+ 'Scoreboard') apache_key_scoreboard=$((i)) ;;
esac
- i=$[i + 1]
+ i=$((i + 1))
done
# we will not check of the Conns*
@@ -94,7 +94,7 @@ apache_detect() {
apache_get() {
local oIFS="${IFS}" ret
- IFS=$':\n' apache_response=($(curl -s "${apache_url}"))
+ IFS=$':\n' apache_response=($(curl -Ss "${apache_url}"))
ret=$?
IFS="${oIFS}"
@@ -167,27 +167,27 @@ apache_check() {
# _create is called once, to create the charts
apache_create() {
cat <<EOF
-CHART apache.bytesperreq '' "apache Lifetime Avg. Response Size" "bytes/request" statistics apache.bytesperreq area $[apache_priority + 8] $apache_update_every
+CHART apache.bytesperreq '' "apache Lifetime Avg. Response Size" "bytes/request" statistics apache.bytesperreq area $((apache_priority + 8)) $apache_update_every
DIMENSION size '' absolute 1 ${apache_decimal_detail}
-CHART apache.workers '' "apache Workers" "workers" workers apache.workers stacked $[apache_priority + 5] $apache_update_every
+CHART apache.workers '' "apache Workers" "workers" workers apache.workers stacked $((apache_priority + 5)) $apache_update_every
DIMENSION idle '' absolute 1 1
DIMENSION busy '' absolute 1 1
-CHART apache.reqpersec '' "apache Lifetime Avg. Requests/s" "requests/s" statistics apache.reqpersec line $[apache_priority + 6] $apache_update_every
+CHART apache.reqpersec '' "apache Lifetime Avg. Requests/s" "requests/s" statistics apache.reqpersec line $((apache_priority + 6)) $apache_update_every
DIMENSION requests '' absolute 1 ${apache_decimal_detail}
-CHART apache.bytespersec '' "apache Lifetime Avg. Bandwidth/s" "kilobits/s" statistics apache.bytespersec area $[apache_priority + 7] $apache_update_every
-DIMENSION sent '' absolute 8 $[apache_decimal_detail * 1000]
-CHART apache.requests '' "apache Requests" "requests/s" requests apache.requests line $[apache_priority + 1] $apache_update_every
+CHART apache.bytespersec '' "apache Lifetime Avg. Bandwidth/s" "kilobits/s" statistics apache.bytespersec area $((apache_priority + 7)) $apache_update_every
+DIMENSION sent '' absolute 8 $((apache_decimal_detail * 1000))
+CHART apache.requests '' "apache Requests" "requests/s" requests apache.requests line $((apache_priority + 1)) $apache_update_every
DIMENSION requests '' incremental 1 1
-CHART apache.net '' "apache Bandwidth" "kilobits/s" bandwidth apache.net area $[apache_priority + 3] $apache_update_every
+CHART apache.net '' "apache Bandwidth" "kilobits/s" bandwidth apache.net area $((apache_priority + 3)) $apache_update_every
DIMENSION sent '' incremental 8 1
EOF
if [ ${apache_has_conns} -eq 1 ]
then
cat <<EOF2
-CHART apache.connections '' "apache Connections" "connections" connections apache.connections line $[apache_priority + 2] $apache_update_every
+CHART apache.connections '' "apache Connections" "connections" connections apache.connections line $((apache_priority + 2)) $apache_update_every
DIMENSION connections '' absolute 1 1
-CHART apache.conns_async '' "apache Async Connections" "connections" connections apache.conns_async stacked $[apache_priority + 4] $apache_update_every
+CHART apache.conns_async '' "apache Async Connections" "connections" connections apache.conns_async stacked $((apache_priority + 4)) $apache_update_every
DIMENSION keepalive '' absolute 1 1
DIMENSION closing '' absolute 1 1
DIMENSION writing '' absolute 1 1
@@ -212,23 +212,23 @@ apache_update() {
# write the result of the work.
cat <<VALUESEOF
BEGIN apache.requests $1
-SET requests = $[apache_accesses]
+SET requests = $((apache_accesses))
END
BEGIN apache.net $1
-SET sent = $[apache_kbytes]
+SET sent = $((apache_kbytes))
END
BEGIN apache.reqpersec $1
-SET requests = $[apache_reqpersec]
+SET requests = $((apache_reqpersec))
END
BEGIN apache.bytespersec $1
-SET sent = $[apache_bytespersec]
+SET sent = $((apache_bytespersec))
END
BEGIN apache.bytesperreq $1
-SET size = $[apache_bytesperreq]
+SET size = $((apache_bytesperreq))
END
BEGIN apache.workers $1
-SET idle = $[apache_idleworkers]
-SET busy = $[apache_busyworkers]
+SET idle = $((apache_idleworkers))
+SET busy = $((apache_busyworkers))
END
VALUESEOF
@@ -236,12 +236,12 @@ VALUESEOF
then
cat <<VALUESEOF2
BEGIN apache.connections $1
-SET connections = $[apache_connstotal]
+SET connections = $((apache_connstotal))
END
BEGIN apache.conns_async $1
-SET keepalive = $[apache_connsasynckeepalive]
-SET closing = $[apache_connsasyncwriting]
-SET writing = $[apache_connsasyncwriting]
+SET keepalive = $((apache_connsasynckeepalive))
+SET closing = $((apache_connsasyncwriting))
+SET writing = $((apache_connsasyncwriting))
END
VALUESEOF2
fi
diff --git a/charts.d/cpufreq.chart.sh b/charts.d/cpufreq.chart.sh
index 6a968237..008ffe1d 100755
--- a/charts.d/cpufreq.chart.sh
+++ b/charts.d/cpufreq.chart.sh
@@ -36,7 +36,7 @@ cpufreq_create() {
# - the highest speed we can achieve -
[ $cpufreq_source_update -eq 1 ] && echo >$TMP_DIR/cpufreq.sh "cpufreq_update() {"
- echo "CHART cpu.cpufreq '' 'CPU Clock' 'MHz' 'cpufreq' '' line $[cpufreq_priority + 1] $cpufreq_update_every"
+ echo "CHART cpu.cpufreq '' 'CPU Clock' 'MHz' 'cpufreq' '' line $((cpufreq_priority + 1)) $cpufreq_update_every"
echo >>$TMP_DIR/cpufreq.sh "echo \"BEGIN cpu.cpufreq \$1\""
i=0
diff --git a/charts.d/example.chart.sh b/charts.d/example.chart.sh
index 34a3bc1b..ad205046 100755
--- a/charts.d/example.chart.sh
+++ b/charts.d/example.chart.sh
@@ -22,11 +22,11 @@ example_check() {
example_create() {
# create the chart with 3 dimensions
cat <<EOF
-CHART example.random '' "Random Numbers Stacked Chart" "% of random numbers" random random stacked $[example_priority] $example_update_every
+CHART example.random '' "Random Numbers Stacked Chart" "% of random numbers" random random stacked $((example_priority)) $example_update_every
DIMENSION random1 '' percentage-of-absolute-row 1 1
DIMENSION random2 '' percentage-of-absolute-row 1 1
DIMENSION random3 '' percentage-of-absolute-row 1 1
-CHART example.random2 '' "A random number" "random number" random random area $[example_priority + 1] $example_update_every
+CHART example.random2 '' "A random number" "random number" random random area $((example_priority + 1)) $example_update_every
DIMENSION random '' absolute 1 1
EOF
@@ -49,19 +49,19 @@ example_update() {
value1=$RANDOM
value2=$RANDOM
value3=$RANDOM
- value4=$[8192 + (RANDOM * 16383 / 32767) ]
+ value4=$((8192 + (RANDOM * 16383 / 32767) ))
if [ $example_count -gt 0 ]
then
- example_count=$[example_count - 1]
+ example_count=$((example_count - 1))
- [ $example_last -gt 16383 ] && value4=$[example_last + (RANDOM * ( (32767 - example_last) / 2) / 32767)]
- [ $example_last -le 16383 ] && value4=$[example_last - (RANDOM * (example_last / 2) / 32767)]
+ [ $example_last -gt 16383 ] && value4=$((example_last + (RANDOM * ( (32767 - example_last) / 2) / 32767)))
+ [ $example_last -le 16383 ] && value4=$((example_last - (RANDOM * (example_last / 2) / 32767)))
else
- example_count=$[1 + (RANDOM * 5 / 32767) ]
+ example_count=$((1 + (RANDOM * 5 / 32767) ))
- [ $example_last -gt 16383 -a $value4 -gt 16383 ] && value4=$[value4 - 16383]
- [ $example_last -le 16383 -a $value4 -lt 16383 ] && value4=$[value4 + 16383]
+ [ $example_last -gt 16383 -a $value4 -gt 16383 ] && value4=$((value4 - 16383))
+ [ $example_last -le 16383 -a $value4 -lt 16383 ] && value4=$((value4 + 16383))
fi
example_last=$value4
diff --git a/charts.d/load_average.chart.sh b/charts.d/load_average.chart.sh
index 257ea7ca..4d86a8f4 100755
--- a/charts.d/load_average.chart.sh
+++ b/charts.d/load_average.chart.sh
@@ -28,7 +28,7 @@ load_average_check() {
load_average_create() {
# create a chart with 3 dimensions
cat <<EOF
-CHART system.load '' "System Load Average" "load" load system.load line $[load_priority + 1] $load_average_update_every
+CHART system.load '' "System Load Average" "load" load system.load line $((load_priority + 1)) $load_average_update_every
DIMENSION load1 '1 min' absolute 1 100
DIMENSION load5 '5 mins' absolute 1 100
DIMENSION load15 '15 mins' absolute 1 100
diff --git a/charts.d/mysql.chart.sh b/charts.d/mysql.chart.sh
index e037aed5..56dce42d 100755
--- a/charts.d/mysql.chart.sh
+++ b/charts.d/mysql.chart.sh
@@ -91,7 +91,40 @@ mysql_get() {
mysql_Innodb_rows_inserted \
mysql_Innodb_rows_read \
mysql_Innodb_rows_updated \
- mysql_Innodb_rows_deleted
+ mysql_Innodb_rows_deleted \
+ mysql_Innodb_buffer_pool_pages_data \
+ mysql_Innodb_buffer_pool_pages_dirty \
+ mysql_Innodb_buffer_pool_pages_flushed \
+ mysql_Innodb_buffer_pool_pages_free \
+ mysql_Innodb_buffer_pool_pages_misc \
+ mysql_Innodb_buffer_pool_pages_total \
+ mysql_Innodb_buffer_pool_bytes_data \
+ mysql_Innodb_buffer_pool_bytes_dirty \
+ mysql_Innodb_buffer_pool_read_ahead_rnd \
+ mysql_Innodb_buffer_pool_read_ahead \
+ mysql_Innodb_buffer_pool_read_ahead_evicted \
+ mysql_Innodb_buffer_pool_read_requests \
+ mysql_Innodb_buffer_pool_reads \
+ mysql_Innodb_buffer_pool_wait_free \
+ mysql_Innodb_buffer_pool_write_requests \
+ mysql_Qcache_free_blocks \
+ mysql_Qcache_free_memory \
+ mysql_Qcache_hits \
+ mysql_Qcache_inserts \
+ mysql_Qcache_lowmem_prunes \
+ mysql_Qcache_not_cached \
+ mysql_Qcache_queries_in_cache \
+ mysql_Qcache_total_blocks \
+ mysql_Key_blocks_not_flushed \
+ mysql_Key_blocks_unused \
+ mysql_Key_blocks_used \
+ mysql_Key_read_requests \
+ mysql_Key_reads \
+ mysql_Key_write_requests \
+ mysql_Key_writes \
+ mysql_Open_files \
+ mysql_Opened_files
+
mysql_plugin_command_failure=0
@@ -116,14 +149,31 @@ mysql_check() {
# - 0 to enable the chart
# - 1 to disable the chart
- local x m mysql_cmd
+ local x m mysql_cmd tryroot=0 unconfigured=0
+
+ if [ "${1}" = "tryroot" ]
+ then
+ tryroot=1
+ shift
+ fi
[ -z "${mysql_cmd}" ] && mysql_cmd="$(which mysql)"
if [ ${#mysql_opts[@]} -eq 0 ]
then
+ unconfigured=1
+
mysql_cmds[local]="$mysql_cmd"
- mysql_opts[local]=
+
+ if [ $tryroot -eq 1 ]
+ then
+ # the user has not configured us for mysql access
+ # if the root user is passwordless in mysql, we can
+ # attempt to connect to mysql as root
+ mysql_opts[local]="-u root"
+ else
+ mysql_opts[local]=
+ fi
fi
# check once if the url works
@@ -150,30 +200,36 @@ mysql_check() {
if [ ${#mysql_opts[@]} -eq 0 ]
then
- echo >&2 "$PROGRAM_NAME: mysql: no mysql servers found. Please set mysql_opts[name]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf"
- return 1
+ if [ ${unconfigured} -eq 1 && ${tryroot} -eq 0 ]
+ then
+ mysql_check tryroot "${@}"
+ return $?
+ else
+ echo >&2 "$PROGRAM_NAME: mysql: no mysql servers found. Please set mysql_opts[name]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf"
+ return 1
+ fi
fi
return 0
}
mysql_create() {
- local m
+ local x
# create the charts
- for m in "${mysql_ids[@]}"
+ for x in "${mysql_ids[@]}"
do
cat <<EOF
-CHART mysql_$m.net '' "mysql Bandwidth" "kilobits/s" bandwidth mysql.net area $[mysql_priority + 1] $mysql_update_every
+CHART mysql_$x.net '' "mysql Bandwidth" "kilobits/s" bandwidth mysql.net area $((mysql_priority + 1)) $mysql_update_every
DIMENSION Bytes_received in incremental 8 1024
DIMENSION Bytes_sent out incremental -8 1024
-CHART mysql_$m.queries '' "mysql Queries" "queries/s" queries mysql.queries line $[mysql_priority + 2] $mysql_update_every
+CHART mysql_$x.queries '' "mysql Queries" "queries/s" queries mysql.queries line $((mysql_priority + 2)) $mysql_update_every
DIMENSION Queries queries incremental 1 1
DIMENSION Questions questions incremental 1 1
DIMENSION Slow_queries slow_queries incremental -1 1
-CHART mysql_$m.handlers '' "mysql Handlers" "handlers/s" handlers mysql.handlers line $[mysql_priority + 3] $mysql_update_every
+CHART mysql_$x.handlers '' "mysql Handlers" "handlers/s" handlers mysql.handlers line $((mysql_priority + 3)) $mysql_update_every
DIMENSION Handler_commit commit incremental 1 1
DIMENSION Handler_delete delete incremental 1 1
DIMENSION Handler_prepare prepare incremental 1 1
@@ -189,86 +245,145 @@ DIMENSION Handler_savepoint_rollback savepoint_rollback incremental 1 1
DIMENSION Handler_update update incremental 1 1
DIMENSION Handler_write write incremental 1 1
-CHART mysql_$m.table_locks '' "mysql Tables Locks" "locks/s" locks mysql.table_locks line $[mysql_priority + 4] $mysql_update_every
+CHART mysql_$x.table_locks '' "mysql Tables Locks" "locks/s" locks mysql.table_locks line $((mysql_priority + 4)) $mysql_update_every
DIMENSION Table_locks_immediate immediate incremental 1 1
DIMENSION Table_locks_waited waited incremental -1 1
-CHART mysql_$m.join_issues '' "mysql Select Join Issues" "joins/s" issues mysql.join_issues line $[mysql_priority + 5] $mysql_update_every
+CHART mysql_$x.join_issues '' "mysql Select Join Issues" "joins/s" issues mysql.join_issues line $((mysql_priority + 5)) $mysql_update_every
DIMENSION Select_full_join full_join incremental 1 1
DIMENSION Select_full_range_join full_range_join incremental 1 1
DIMENSION Select_range range incremental 1 1
DIMENSION Select_range_check range_check incremental 1 1
DIMENSION Select_scan scan incremental 1 1
-CHART mysql_$m.sort_issues '' "mysql Sort Issues" "issues/s" issues mysql.sort.issues line $[mysql_priority + 6] $mysql_update_every
+CHART mysql_$x.sort_issues '' "mysql Sort Issues" "issues/s" issues mysql.sort.issues line $((mysql_priority + 6)) $mysql_update_every
DIMENSION Sort_merge_passes merge_passes incremental 1 1
DIMENSION Sort_range range incremental 1 1
DIMENSION Sort_scan scan incremental 1 1
-CHART mysql_$m.tmp '' "mysql Tmp Operations" "counter" temporaries mysql.tmp line $[mysql_priority + 7] $mysql_update_every
+CHART mysql_$x.tmp '' "mysql Tmp Operations" "counter" temporaries mysql.tmp line $((mysql_priority + 7)) $mysql_update_every
DIMENSION Created_tmp_disk_tables disk_tables incremental 1 1
DIMENSION Created_tmp_files files incremental 1 1
DIMENSION Created_tmp_tables tables incremental 1 1
-CHART mysql_$m.connections '' "mysql Connections" "connections/s" connections mysql.connections line $[mysql_priority + 8] $mysql_update_every
+CHART mysql_$x.connections '' "mysql Connections" "connections/s" connections mysql.connections line $((mysql_priority + 8)) $mysql_update_every
DIMENSION Connections all incremental 1 1
DIMENSION Aborted_connects aborded incremental 1 1
-CHART mysql_$m.binlog_cache '' "mysql Binlog Cache" "transactions/s" binlog mysql.binlog_cache line $[mysql_priority + 9] $mysql_update_every
+CHART mysql_$x.binlog_cache '' "mysql Binlog Cache" "transactions/s" binlog mysql.binlog_cache line $((mysql_priority + 9)) $mysql_update_every
DIMENSION Binlog_cache_disk_use disk incremental 1 1
DIMENSION Binlog_cache_use all incremental 1 1
-CHART mysql_$m.threads '' "mysql Threads" "threads" threads mysql.threads line $[mysql_priority + 10] $mysql_update_every
+CHART mysql_$x.threads '' "mysql Threads" "threads" threads mysql.threads line $((mysql_priority + 10)) $mysql_update_every
DIMENSION Threads_connected connected absolute 1 1
DIMENSION Threads_created created incremental 1 1
DIMENSION Threads_cached cached absolute -1 1
DIMENSION Threads_running running absolute 1 1
-CHART mysql_$m.thread_cache_misses '' "mysql Threads Cache Misses" "misses" threads mysql.thread_cache_misses area $[mysql_priority + 11] $mysql_update_every
+CHART mysql_$x.thread_cache_misses '' "mysql Threads Cache Misses" "misses" threads mysql.thread_cache_misses area $((mysql_priority + 11)) $mysql_update_every
DIMENSION misses misses absolute 1 100
-CHART mysql_$m.innodb_io '' "mysql InnoDB I/O Bandwidth" "kilobytes/s" innodb mysql.innodb_io area $[mysql_priority + 12] $mysql_update_every
+CHART mysql_$x.innodb_io '' "mysql InnoDB I/O Bandwidth" "kilobytes/s" innodb mysql.innodb_io area $((mysql_priority + 12)) $mysql_update_every
DIMENSION Innodb_data_read read incremental 1 1024
DIMENSION Innodb_data_written write incremental -1 1024
-CHART mysql_$m.innodb_io_ops '' "mysql InnoDB I/O Operations" "operations/s" innodb mysql.innodb_io_ops line $[mysql_priority + 13] $mysql_update_every
+CHART mysql_$x.innodb_io_ops '' "mysql InnoDB I/O Operations" "operations/s" innodb mysql.innodb_io_ops line $((mysql_priority + 13)) $mysql_update_every
DIMENSION Innodb_data_reads reads incremental 1 1
DIMENSION Innodb_data_writes writes incremental -1 1
DIMENSION Innodb_data_fsyncs fsyncs incremental 1 1
-CHART mysql_$m.innodb_io_pending_ops '' "mysql InnoDB Pending I/O Operations" "operations" innodb mysql.innodb_io_pending_ops line $[mysql_priority + 14] $mysql_update_every
+CHART mysql_$x.innodb_io_pending_ops '' "mysql InnoDB Pending I/O Operations" "operations" innodb mysql.innodb_io_pending_ops line $((mysql_priority + 14)) $mysql_update_every
DIMENSION Innodb_data_pending_reads reads absolute 1 1
DIMENSION Innodb_data_pending_writes writes absolute -1 1
DIMENSION Innodb_data_pending_fsyncs fsyncs absolute 1 1
-CHART mysql_$m.innodb_log '' "mysql InnoDB Log Operations" "operations/s" innodb mysql.innodb_log line $[mysql_priority + 15] $mysql_update_every
+CHART mysql_$x.innodb_log '' "mysql InnoDB Log Operations" "operations/s" innodb mysql.innodb_log line $((mysql_priority + 15)) $mysql_update_every
DIMENSION Innodb_log_waits waits incremental 1 1
DIMENSION Innodb_log_write_requests write_requests incremental -1 1
DIMENSION Innodb_log_writes writes incremental -1 1
-CHART mysql_$m.innodb_os_log '' "mysql InnoDB OS Log Operations" "operations" innodb mysql.innodb_os_log line $[mysql_priority + 16] $mysql_update_every
+CHART mysql_$x.innodb_os_log '' "mysql InnoDB OS Log Operations" "operations" innodb mysql.innodb_os_log line $((mysql_priority + 16)) $mysql_update_every
DIMENSION Innodb_os_log_fsyncs fsyncs incremental 1 1
DIMENSION Innodb_os_log_pending_fsyncs pending_fsyncs absolute 1 1
DIMENSION Innodb_os_log_pending_writes pending_writes absolute -1 1
-CHART mysql_$m.innodb_os_log_io '' "mysql InnoDB OS Log Bandwidth" "kilobytes/s" innodb mysql.innodb_os_log_io area $[mysql_priority + 17] $mysql_update_every
+CHART mysql_$x.innodb_os_log_io '' "mysql InnoDB OS Log Bandwidth" "kilobytes/s" innodb mysql.innodb_os_log_io area $((mysql_priority + 17)) $mysql_update_every
DIMENSION Innodb_os_log_written write incremental -1 1024
-CHART mysql_$m.innodb_cur_row_lock '' "mysql InnoDB Current Row Locks" "operations" innodb mysql.innodb_cur_row_lock area $[mysql_priority + 18] $mysql_update_every
+CHART mysql_$x.innodb_cur_row_lock '' "mysql InnoDB Current Row Locks" "operations" innodb mysql.innodb_cur_row_lock area $((mysql_priority + 18)) $mysql_update_every
DIMENSION Innodb_row_lock_current_waits current_waits absolute 1 1
-CHART mysql_$m.innodb_rows '' "mysql InnoDB Row Operations" "operations/s" innodb mysql.innodb_rows area $[mysql_priority + 19] $mysql_update_every
+CHART mysql_$x.innodb_rows '' "mysql InnoDB Row Operations" "operations/s" innodb mysql.innodb_rows area $((mysql_priority + 19)) $mysql_update_every
DIMENSION Innodb_rows_read read incremental 1 1
DIMENSION Innodb_rows_deleted deleted incremental -1 1
DIMENSION Innodb_rows_inserted inserted incremental 1 1
DIMENSION Innodb_rows_updated updated incremental -1 1
+CHART mysql_$x.innodb_buffer_pool_pages '' "mysql InnoDB Buffer Pool Pages" "pages" innodb mysql.innodb_buffer_pool_pages line $((mysql_priority + 20)) $mysql_update_every
+DIMENSION Innodb_buffer_pool_pages_data data absolute 1 1
+DIMENSION Innodb_buffer_pool_pages_dirty dirty absolute -1 1
+DIMENSION Innodb_buffer_pool_pages_free free absolute 1 1
+DIMENSION Innodb_buffer_pool_pages_flushed flushed incremental -1 1
+DIMENSION Innodb_buffer_pool_pages_misc misc absolute -1 1
+DIMENSION Innodb_buffer_pool_pages_total total absolute 1 1
+
+CHART mysql_$x.innodb_buffer_pool_bytes '' "mysql InnoDB Buffer Pool Bytes" "MB" innodb mysql.innodb_buffer_pool_bytes area $((mysql_priority + 21)) $mysql_update_every
+DIMENSION Innodb_buffer_pool_bytes_data data absolute 1 $((1024 * 1024))
+DIMENSION Innodb_buffer_pool_bytes_dirty dirty absolute -1 $((1024 * 1024))
+
+CHART mysql_$x.innodb_buffer_pool_read_ahead '' "mysql InnoDB Buffer Pool Read Ahead" "operations/s" innodb mysql.innodb_buffer_pool_read_ahead area $((mysql_priority + 22)) $mysql_update_every
+DIMENSION Innodb_buffer_pool_read_ahead all incremental 1 1
+DIMENSION Innodb_buffer_pool_read_ahead_evicted evicted incremental -1 1
+DIMENSION Innodb_buffer_pool_read_ahead_rnd random incremental 1 1
+
+CHART mysql_$x.innodb_buffer_pool_reqs '' "mysql InnoDB Buffer Pool Requests" "requests/s" innodb mysql.innodb_buffer_pool_reqs area $((mysql_priority + 23)) $mysql_update_every
+DIMENSION Innodb_buffer_pool_read_requests reads incremental 1 1
+DIMENSION Innodb_buffer_pool_write_requests writes incremental -1 1
+
+CHART mysql_$x.innodb_buffer_pool_ops '' "mysql InnoDB Buffer Pool Operations" "operations/s" innodb mysql.innodb_buffer_pool_ops area $((mysql_priority + 24)) $mysql_update_every
+DIMENSION Innodb_buffer_pool_reads 'disk reads' incremental 1 1
+DIMENSION Innodb_buffer_pool_wait_free 'wait free' incremental -1 1
+
+CHART mysql_$x.qcache_ops '' "mysql QCache Operations" "queries/s" qcache mysql.qcache_ops line $((mysql_priority + 25)) $mysql_update_every
+DIMENSION Qcache_hits hits incremental 1 1
+DIMENSION Qcache_lowmem_prunes 'lowmem prunes' incremental -1 1
+DIMENSION Qcache_inserts inserts incremental 1 1
+DIMENSION Qcache_not_cached 'not cached' incremental -1 1
+
+CHART mysql_$x.qcache '' "mysql QCache Queries in Cache" "queries" qcache mysql.qcache line $((mysql_priority + 26)) $mysql_update_every
+DIMENSION Qcache_queries_in_cache queries absolute 1 1
+
+CHART mysql_$x.qcache_freemem '' "mysql QCache Free Memory" "MB" qcache mysql.qcache_freemem area $((mysql_priority + 27)) $mysql_update_every
+DIMENSION Qcache_free_memory free absolute 1 $((1024 * 1024))
+
+CHART mysql_$x.qcache_memblocks '' "mysql QCache Memory Blocks" "blocks" qcache mysql.qcache_memblocks line $((mysql_priority + 28)) $mysql_update_every
+DIMENSION Qcache_free_blocks free absolute 1 1
+DIMENSION Qcache_total_blocks total absolute 1 1
+
+CHART mysql_$x.key_blocks '' "mysql MyISAM Key Cache Blocks" "blocks" myisam mysql.key_blocks line $((mysql_priority + 29)) $mysql_update_every
+DIMENSION Key_blocks_unused unused absolute 1 1
+DIMENSION Key_blocks_used used absolute -1 1
+DIMENSION Key_blocks_not_flushed 'not flushed' absolute 1 1
+
+CHART mysql_$x.key_requests '' "mysql MyISAM Key Cache Requests" "requests/s" myisam mysql.key_requests area $((mysql_priority + 30)) $mysql_update_every
+DIMENSION Key_read_requests reads incremental 1 1
+DIMENSION Key_write_requests writes incremental -1 1
+
+CHART mysql_$x.key_disk_ops '' "mysql MyISAM Key Cache Disk Operations" "operations/s" myisam mysql.key_disk_ops area $((mysql_priority + 31)) $mysql_update_every
+DIMENSION Key_reads reads incremental 1 1
+DIMENSION Key_writes writes incremental -1 1
+
+CHART mysql_$x.files '' "mysql Open Files" "files" files mysql.files line $((mysql_priority + 32)) $mysql_update_every
+DIMENSION Open_files files absolute 1 1
+
+CHART mysql_$x.files_rate '' "mysql Opened Files Rate" "files/s" files mysql.files_rate line $((mysql_priority + 33)) $mysql_update_every
+DIMENSION Opened_files files incremental 1 1
EOF
if [ ! -z "$mysql_Binlog_stmt_cache_disk_use" ]
then
cat <<EOF
-CHART mysql_$m.binlog_stmt_cache '' "mysql Binlog Statement Cache" "statements/s" binlog mysql.binlog_stmt_cache line $[mysql_priority + 20] $mysql_update_every
+CHART mysql_$x.binlog_stmt_cache '' "mysql Binlog Statement Cache" "statements/s" binlog mysql.binlog_stmt_cache line $((mysql_priority + 50)) $mysql_update_every
DIMENSION Binlog_stmt_cache_disk_use disk incremental 1 1
DIMENSION Binlog_stmt_cache_use all incremental 1 1
EOF
@@ -277,7 +392,7 @@ EOF
if [ ! -z "$mysql_Connection_errors_accept" ]
then
cat <<EOF
-CHART mysql_$m.connection_errors '' "mysql Connection Errors" "connections/s" connections mysql.connection_errors line $[mysql_priority + 21] $mysql_update_every
+CHART mysql_$x.connection_errors '' "mysql Connection Errors" "connections/s" connections mysql.connection_errors line $((mysql_priority + 51)) $mysql_update_every
DIMENSION Connection_errors_accept accept incremental 1 1
DIMENSION Connection_errors_internal internal incremental 1 1
DIMENSION Connection_errors_max_connections max incremental 1 1
@@ -369,70 +484,130 @@ SET Sort_merge_passes = $mysql_Sort_merge_passes
SET Sort_range = $mysql_Sort_range
SET Sort_scan = $mysql_Sort_scan
END
-BEGIN mysql_$m.tmp $1
+BEGIN mysql_$x.tmp $1
SET Created_tmp_disk_tables = $mysql_Created_tmp_disk_tables
SET Created_tmp_files = $mysql_Created_tmp_files
SET Created_tmp_tables = $mysql_Created_tmp_tables
END
-BEGIN mysql_$m.connections $1
+BEGIN mysql_$x.connections $1
SET Connections = $mysql_Connections
SET Aborted_connects = $mysql_Aborted_connects
END
-BEGIN mysql_$m.binlog_cache $1
+BEGIN mysql_$x.binlog_cache $1
SET Binlog_cache_disk_use = $mysql_Binlog_cache_disk_use
SET Binlog_cache_use = $mysql_Binlog_cache_use
END
-BEGIN mysql_$m.threads $1
+BEGIN mysql_$x.threads $1
SET Threads_connected = $mysql_Threads_connected
SET Threads_created = $mysql_Threads_created
SET Threads_cached = $mysql_Threads_cached
SET Threads_running = $mysql_Threads_running
END
-BEGIN mysql_$m.thread_cache_misses $1
+BEGIN mysql_$x.thread_cache_misses $1
SET misses = $mysql_Thread_cache_misses
END
-BEGIN mysql_$m.innodb_io $1
+BEGIN mysql_$x.innodb_io $1
SET Innodb_data_read = $mysql_Innodb_data_read
SET Innodb_data_written = $mysql_Innodb_data_written
END
-BEGIN mysql_$m.innodb_io_ops $1
+BEGIN mysql_$x.innodb_io_ops $1
SET Innodb_data_reads = $mysql_Innodb_data_reads
SET Innodb_data_writes = $mysql_Innodb_data_writes
SET Innodb_data_fsyncs = $mysql_Innodb_data_fsyncs
END
-BEGIN mysql_$m.innodb_io_pending_ops $1
+BEGIN mysql_$x.innodb_io_pending_ops $1
SET Innodb_data_pending_reads = $mysql_Innodb_data_pending_reads
SET Innodb_data_pending_writes = $mysql_Innodb_data_pending_writes
SET Innodb_data_pending_fsyncs = $mysql_Innodb_data_pending_fsyncs
END
-BEGIN mysql_$m.innodb_log $1
+BEGIN mysql_$x.innodb_log $1
SET Innodb_log_waits = $mysql_Innodb_log_waits
SET Innodb_log_write_requests = $mysql_Innodb_log_write_requests
SET Innodb_log_writes = $mysql_Innodb_log_writes
END
-BEGIN mysql_$m.innodb_os_log $1
+BEGIN mysql_$x.innodb_os_log $1
SET Innodb_os_log_fsyncs = $mysql_Innodb_os_log_fsyncs
SET Innodb_os_log_pending_fsyncs = $mysql_Innodb_os_log_pending_fsyncs
SET Innodb_os_log_pending_writes = $mysql_Innodb_os_log_pending_writes
END
-BEGIN mysql_$m.innodb_os_log_io $1
+BEGIN mysql_$x.innodb_os_log_io $1
SET Innodb_os_log_written = $mysql_Innodb_os_log_written
END
-BEGIN mysql_$m.innodb_cur_row_lock $1
+BEGIN mysql_$x.innodb_cur_row_lock $1
SET Innodb_row_lock_current_waits = $mysql_Innodb_row_lock_current_waits
END
-BEGIN mysql_$m.innodb_rows $1
+BEGIN mysql_$x.innodb_rows $1
SET Innodb_rows_inserted = $mysql_Innodb_rows_inserted
SET Innodb_rows_read = $mysql_Innodb_rows_read
SET Innodb_rows_updated = $mysql_Innodb_rows_updated
SET Innodb_rows_deleted = $mysql_Innodb_rows_deleted
END
+BEGIN mysql_$x.innodb_buffer_pool_pages $1
+SET Innodb_buffer_pool_pages_data = $mysql_Innodb_buffer_pool_pages_data
+SET Innodb_buffer_pool_pages_dirty = $mysql_Innodb_buffer_pool_pages_dirty
+SET Innodb_buffer_pool_pages_free = $mysql_Innodb_buffer_pool_pages_free
+SET Innodb_buffer_pool_pages_flushed = $mysql_Innodb_buffer_pool_pages_flushed
+SET Innodb_buffer_pool_pages_misc = $mysql_Innodb_buffer_pool_pages_misc
+SET Innodb_buffer_pool_pages_total = $mysql_Innodb_buffer_pool_pages_total
+END
+BEGIN mysql_$x.innodb_buffer_pool_bytes $1
+SET Innodb_buffer_pool_bytes_data = $mysql_Innodb_buffer_pool_bytes_data
+SET Innodb_buffer_pool_bytes_dirty = $mysql_Innodb_buffer_pool_bytes_dirty
+END
+BEGIN mysql_$x.innodb_buffer_pool_read_ahead $1
+SET Innodb_buffer_pool_read_ahead = $mysql_Innodb_buffer_pool_read_ahead
+SET Innodb_buffer_pool_read_ahead_evicted = $mysql_Innodb_buffer_pool_read_ahead_evicted
+SET Innodb_buffer_pool_read_ahead_rnd = $mysql_Innodb_buffer_pool_read_ahead_rnd
+END
+BEGIN mysql_$x.innodb_buffer_pool_reqs $1
+SET Innodb_buffer_pool_read_requests = $mysql_Innodb_buffer_pool_read_requests
+SET Innodb_buffer_pool_write_requests = $mysql_Innodb_buffer_pool_write_requests
+END
+BEGIN mysql_$x.innodb_buffer_pool_ops $1
+SET Innodb_buffer_pool_reads = $mysql_Innodb_buffer_pool_reads
+SET Innodb_buffer_pool_wait_free = $mysql_Innodb_buffer_pool_wait_free
+END
+BEGIN mysql_$x.qcache_ops $1
+SET Qcache_hits hits = $mysql_Qcache_hits
+SET Qcache_lowmem_prunes = $mysql_Qcache_lowmem_prunes
+SET Qcache_inserts inserts = $mysql_Qcache_inserts inserts
+SET Qcache_not_cached = $mysql_Qcache_not_cached
+END
+BEGIN mysql_$x.qcache $1
+SET Qcache_queries_in_cache = $mysql_Qcache_queries_in_cache
+END
+BEGIN mysql_$x.qcache_freemem $1
+SET Qcache_free_memory = $mysql_Qcache_free_memory
+END
+BEGIN mysql_$x.qcache_memblocks $1
+SET Qcache_free_blocks = $mysql_Qcache_free_blocks
+SET Qcache_total_blocks = $mysql_Qcache_total_blocks
+END
+BEGIN mysql_$x.key_blocks $1
+SET Key_blocks_unused = $mysql_Key_blocks_unused
+SET Key_blocks_used = $mysql_Key_blocks_used
+SET Key_blocks_not_flushed = $mysql_Key_blocks_not_flushed
+END
+BEGIN mysql_$x.key_requests $1
+SET Key_read_requests = $mysql_Key_read_requests
+SET Key_write_requests = $mysql_Key_write_requests
+END
+BEGIN mysql_$x.key_disk_ops $1
+SET Key_reads = $mysql_Key_reads
+SET Key_writes = $mysql_Key_writes
+END
+BEGIN mysql_$x.files $1
+SET Open_files = $mysql_Open_files
+END
+BEGIN mysql_$x.files_rate $1
+SET Opened_files = $mysql_Opened_files
+END
VALUESEOF
if [ ! -z "$mysql_Binlog_stmt_cache_disk_use" ]
then
cat <<VALUESEOF
-BEGIN mysql_$m.binlog_stmt_cache $1
+BEGIN mysql_$x.binlog_stmt_cache $1
SET Binlog_stmt_cache_disk_use = $mysql_Binlog_stmt_cache_disk_use
SET Binlog_stmt_cache_use = $mysql_Binlog_stmt_cache_use
END
@@ -442,7 +617,7 @@ VALUESEOF
if [ ! -z "$mysql_Connection_errors_accept" ]
then
cat <<VALUESEOF
-BEGIN mysql_$m.connection_errors $1
+BEGIN mysql_$x.connection_errors $1
SET Connection_errors_accept = $mysql_Connection_errors_accept
SET Connection_errors_internal = $mysql_Connection_errors_internal
SET Connection_errors_max_connections = $mysql_Connection_errors_max_connections
diff --git a/charts.d/nginx.chart.sh b/charts.d/nginx.chart.sh
index a6795415..450aa94b 100755
--- a/charts.d/nginx.chart.sh
+++ b/charts.d/nginx.chart.sh
@@ -19,7 +19,7 @@ nginx_reading=0
nginx_writing=0
nginx_waiting=0
nginx_get() {
- nginx_response=($(curl -s "${nginx_url}"))
+ nginx_response=($(curl -Ss "${nginx_url}"))
[ $? -ne 0 -o "${#nginx_response[@]}" -eq 0 ] && return 1
if [ "${nginx_response[0]}" != "Active" \
@@ -81,18 +81,18 @@ nginx_check() {
# _create is called once, to create the charts
nginx_create() {
cat <<EOF
-CHART nginx.connections '' "nginx Active Connections" "connections" nginx nginx.connections line $[nginx_priority + 1] $nginx_update_every
+CHART nginx.connections '' "nginx Active Connections" "connections" nginx nginx.connections line $((nginx_priority + 1)) $nginx_update_every
DIMENSION active '' absolute 1 1
-CHART nginx.requests '' "nginx Requests" "requests/s" nginx nginx.requests line $[nginx_priority + 2] $nginx_update_every
+CHART nginx.requests '' "nginx Requests" "requests/s" nginx nginx.requests line $((nginx_priority + 2)) $nginx_update_every
DIMENSION requests '' incremental 1 1
-CHART nginx.connections_status '' "nginx Active Connections by Status" "connections" nginx nginx.connections.status line $[nginx_priority + 3] $nginx_update_every
+CHART nginx.connections_status '' "nginx Active Connections by Status" "connections" nginx nginx.connections.status line $((nginx_priority + 3)) $nginx_update_every
DIMENSION reading '' absolute 1 1
DIMENSION writing '' absolute 1 1
DIMENSION waiting idle absolute 1 1
-CHART nginx.connect_rate '' "nginx Connections Rate" "connections/s" nginx nginx.connections.rate line $[nginx_priority + 4] $nginx_update_every
+CHART nginx.connect_rate '' "nginx Connections Rate" "connections/s" nginx nginx.connections.rate line $((nginx_priority + 4)) $nginx_update_every
DIMENSION accepts accepted incremental 1 1
DIMENSION handled '' incremental 1 1
EOF
@@ -114,19 +114,19 @@ nginx_update() {
# write the result of the work.
cat <<VALUESEOF
BEGIN nginx.connections $1
-SET active = $[nginx_active_connections]
+SET active = $((nginx_active_connections))
END
BEGIN nginx.requests $1
-SET requests = $[nginx_requests]
+SET requests = $((nginx_requests))
END
BEGIN nginx.connections_status $1
-SET reading = $[nginx_reading]
-SET writing = $[nginx_writing]
-SET waiting = $[nginx_waiting]
+SET reading = $((nginx_reading))
+SET writing = $((nginx_writing))
+SET waiting = $((nginx_waiting))
END
BEGIN nginx.connect_rate $1
-SET accepts = $[nginx_accepts]
-SET handled = $[nginx_handled]
+SET accepts = $((nginx_accepts))
+SET handled = $((nginx_handled))
END
VALUESEOF
diff --git a/charts.d/nut.chart.sh b/charts.d/nut.chart.sh
index 343c6d9c..a4720845 100755
--- a/charts.d/nut.chart.sh
+++ b/charts.d/nut.chart.sh
@@ -61,34 +61,34 @@ nut_create() {
for x in "${nut_ids[@]}"
do
cat <<EOF
-CHART nut_$x.charge '' "UPS Charge" "percentage" ups nut.charge area $[nut_priority + 1] $nut_update_every
+CHART nut_$x.charge '' "UPS Charge" "percentage" ups nut.charge area $((nut_priority + 1)) $nut_update_every
DIMENSION battery_charge charge absolute 1 100
-CHART nut_$x.battery_voltage '' "UPS Battery Voltage" "Volts" ups nut.battery.voltage line $[nut_priority + 2] $nut_update_every
+CHART nut_$x.battery_voltage '' "UPS Battery Voltage" "Volts" ups nut.battery.voltage line $((nut_priority + 2)) $nut_update_every
DIMENSION battery_voltage voltage absolute 1 100
DIMENSION battery_voltage_high high absolute 1 100
DIMENSION battery_voltage_low low absolute 1 100
DIMENSION battery_voltage_nominal nominal absolute 1 100
-CHART nut_$x.input_voltage '' "UPS Input Voltage" "Volts" input nut.input.voltage line $[nut_priority + 3] $nut_update_every
+CHART nut_$x.input_voltage '' "UPS Input Voltage" "Volts" input nut.input.voltage line $((nut_priority + 3)) $nut_update_every
DIMENSION input_voltage voltage absolute 1 100
DIMENSION input_voltage_fault fault absolute 1 100
DIMENSION input_voltage_nominal nominal absolute 1 100
-CHART nut_$x.input_current '' "UPS Input Current" "Ampere" input nut.input.current line $[nut_priority + 4] $nut_update_every
+CHART nut_$x.input_current '' "UPS Input Current" "Ampere" input nut.input.current line $((nut_priority + 4)) $nut_update_every
DIMENSION input_current_nominal nominal absolute 1 100
-CHART nut_$x.input_frequency '' "UPS Input Frequency" "Hz" input nut.input.frequency line $[nut_priority + 5] $nut_update_every
+CHART nut_$x.input_frequency '' "UPS Input Frequency" "Hz" input nut.input.frequency line $((nut_priority + 5)) $nut_update_every
DIMENSION input_frequency frequency absolute 1 100
DIMENSION input_frequency_nominal nominal absolute 1 100
-CHART nut_$x.output_voltage '' "UPS Output Voltage" "Volts" output nut.output.voltage line $[nut_priority + 6] $nut_update_every
+CHART nut_$x.output_voltage '' "UPS Output Voltage" "Volts" output nut.output.voltage line $((nut_priority + 6)) $nut_update_every
DIMENSION output_voltage voltage absolute 1 100
-CHART nut_$x.load '' "UPS Load" "percentage" ups nut.load area $[nut_priority] $nut_update_every
+CHART nut_$x.load '' "UPS Load" "percentage" ups nut.load area $((nut_priority)) $nut_update_every
DIMENSION load load absolute 1 100
-CHART nut_$x.temp '' "UPS Temperature" "temperature" ups nut.temperature line $[nut_priority + 7] $nut_update_every
+CHART nut_$x.temp '' "UPS Temperature" "temperature" ups nut.temperature line $((nut_priority + 7)) $nut_update_every
DIMENSION temp temp absolute 1 100
EOF
done
diff --git a/charts.d/opensips.chart.sh b/charts.d/opensips.chart.sh
index 4b60c811..c7066ec0 100755
--- a/charts.d/opensips.chart.sh
+++ b/charts.d/opensips.chart.sh
@@ -45,61 +45,61 @@ opensips_check() {
opensips_create() {
# create the charts
cat <<EOF
-CHART opensips.dialogs_active '' "OpenSIPS Active Dialogs" "dialogs" dialogs '' area $[opensips_priority + 1] $opensips_update_every
+CHART opensips.dialogs_active '' "OpenSIPS Active Dialogs" "dialogs" dialogs '' area $((opensips_priority + 1)) $opensips_update_every
DIMENSION dialog_active_dialogs active absolute 1 1
DIMENSION dialog_early_dialogs early absolute -1 1
-CHART opensips.users '' "OpenSIPS Users" "users" users '' line $[opensips_priority + 2] $opensips_update_every
+CHART opensips.users '' "OpenSIPS Users" "users" users '' line $((opensips_priority + 2)) $opensips_update_every
DIMENSION usrloc_registered_users registered absolute 1 1
DIMENSION usrloc_location_users location absolute 1 1
DIMENSION usrloc_location_contacts contacts absolute 1 1
DIMENSION usrloc_location_expires expires incremental -1 1
-CHART opensips.registrar '' "OpenSIPS Registrar" "registrations/s" registrar '' line $[opensips_priority + 3] $opensips_update_every
+CHART opensips.registrar '' "OpenSIPS Registrar" "registrations/s" registrar '' line $((opensips_priority + 3)) $opensips_update_every
DIMENSION registrar_accepted_regs accepted incremental 1 1
DIMENSION registrar_rejected_regs rejected incremental -1 1
-CHART opensips.transactions '' "OpenSIPS Transactions" "transactions/s" transactions '' line $[opensips_priority + 4] $opensips_update_every
+CHART opensips.transactions '' "OpenSIPS Transactions" "transactions/s" transactions '' line $((opensips_priority + 4)) $opensips_update_every
DIMENSION tm_UAS_transactions UAS incremental 1 1
DIMENSION tm_UAC_transactions UAC incremental -1 1
-CHART opensips.core_rcv '' "OpenSIPS Core Receives" "queries/s" core '' line $[opensips_priority + 5] $opensips_update_every
+CHART opensips.core_rcv '' "OpenSIPS Core Receives" "queries/s" core '' line $((opensips_priority + 5)) $opensips_update_every
DIMENSION core_rcv_requests requests incremental 1 1
DIMENSION core_rcv_replies replies incremental -1 1
-CHART opensips.core_fwd '' "OpenSIPS Core Forwards" "queries/s" core '' line $[opensips_priority + 6] $opensips_update_every
+CHART opensips.core_fwd '' "OpenSIPS Core Forwards" "queries/s" core '' line $((opensips_priority + 6)) $opensips_update_every
DIMENSION core_fwd_requests requests incremental 1 1
DIMENSION core_fwd_replies replies incremental -1 1
-CHART opensips.core_drop '' "OpenSIPS Core Drops" "queries/s" core '' line $[opensips_priority + 7] $opensips_update_every
+CHART opensips.core_drop '' "OpenSIPS Core Drops" "queries/s" core '' line $((opensips_priority + 7)) $opensips_update_every
DIMENSION core_drop_requests requests incremental 1 1
DIMENSION core_drop_replies replies incremental -1 1
-CHART opensips.core_err '' "OpenSIPS Core Errors" "queries/s" core '' line $[opensips_priority + 8] $opensips_update_every
+CHART opensips.core_err '' "OpenSIPS Core Errors" "queries/s" core '' line $((opensips_priority + 8)) $opensips_update_every
DIMENSION core_err_requests requests incremental 1 1
DIMENSION core_err_replies replies incremental -1 1
-CHART opensips.core_bad '' "OpenSIPS Core Bad" "queries/s" core '' line $[opensips_priority + 9] $opensips_update_every
+CHART opensips.core_bad '' "OpenSIPS Core Bad" "queries/s" core '' line $((opensips_priority + 9)) $opensips_update_every
DIMENSION core_bad_URIs_rcvd bad_URIs_rcvd incremental 1 1
DIMENSION core_unsupported_methods unsupported_methods incremental 1 1
DIMENSION core_bad_msg_hdr bad_msg_hdr incremental 1 1
-CHART opensips.tm_replies '' "OpenSIPS TM Replies" "replies/s" transactions '' line $[opensips_priority + 10] $opensips_update_every
+CHART opensips.tm_replies '' "OpenSIPS TM Replies" "replies/s" transactions '' line $((opensips_priority + 10)) $opensips_update_every
DIMENSION tm_received_replies received incremental 1 1
DIMENSION tm_relayed_replies relayed incremental 1 1
DIMENSION tm_local_replies local incremental 1 1
-CHART opensips.transactions_status '' "OpenSIPS Transactions Status" "transactions/s" transactions '' line $[opensips_priority + 11] $opensips_update_every
+CHART opensips.transactions_status '' "OpenSIPS Transactions Status" "transactions/s" transactions '' line $((opensips_priority + 11)) $opensips_update_every
DIMENSION tm_2xx_transactions 2xx incremental 1 1
DIMENSION tm_3xx_transactions 3xx incremental 1 1
DIMENSION tm_4xx_transactions 4xx incremental 1 1
DIMENSION tm_5xx_transactions 5xx incremental 1 1
DIMENSION tm_6xx_transactions 6xx incremental 1 1
-CHART opensips.transactions_inuse '' "OpenSIPS InUse Transactions" "transactions" transactions '' line $[opensips_priority + 12] $opensips_update_every
+CHART opensips.transactions_inuse '' "OpenSIPS InUse Transactions" "transactions" transactions '' line $((opensips_priority + 12)) $opensips_update_every
DIMENSION tm_inuse_transactions inuse absolute 1 1
-CHART opensips.sl_replies '' "OpenSIPS SL Replies" "replies/s" core '' line $[opensips_priority + 13] $opensips_update_every
+CHART opensips.sl_replies '' "OpenSIPS SL Replies" "replies/s" core '' line $((opensips_priority + 13)) $opensips_update_every
DIMENSION sl_1xx_replies 1xx incremental 1 1
DIMENSION sl_2xx_replies 2xx incremental 1 1
DIMENSION sl_3xx_replies 3xx incremental 1 1
@@ -110,31 +110,31 @@ DIMENSION sl_sent_replies sent incremental 1 1
DIMENSION sl_sent_err_replies error incremental 1 1
DIMENSION sl_received_ACKs ACKed incremental 1 1
-CHART opensips.dialogs '' "OpenSIPS Dialogs" "dialogs/s" dialogs '' line $[opensips_priority + 14] $opensips_update_every
+CHART opensips.dialogs '' "OpenSIPS Dialogs" "dialogs/s" dialogs '' line $((opensips_priority + 14)) $opensips_update_every
DIMENSION dialog_processed_dialogs processed incremental 1 1
DIMENSION dialog_expired_dialogs expired incremental 1 1
DIMENSION dialog_failed_dialogs failed incremental -1 1
-CHART opensips.net_waiting '' "OpenSIPS Network Waiting" "kilobytes" net '' line $[opensips_priority + 15] $opensips_update_every
+CHART opensips.net_waiting '' "OpenSIPS Network Waiting" "kilobytes" net '' line $((opensips_priority + 15)) $opensips_update_every
DIMENSION net_waiting_udp UDP absolute 1 1024
DIMENSION net_waiting_tcp TCP absolute 1 1024
-CHART opensips.uri_checks '' "OpenSIPS URI Checks" "checks / sec" uri '' line $[opensips_priority + 16] $opensips_update_every
+CHART opensips.uri_checks '' "OpenSIPS URI Checks" "checks / sec" uri '' line $((opensips_priority + 16)) $opensips_update_every
DIMENSION uri_positive_checks positive incremental 1 1
DIMENSION uri_negative_checks negative incremental -1 1
-CHART opensips.traces '' "OpenSIPS Traces" "traces / sec" traces '' line $[opensips_priority + 17] $opensips_update_every
+CHART opensips.traces '' "OpenSIPS Traces" "traces / sec" traces '' line $((opensips_priority + 17)) $opensips_update_every
DIMENSION siptrace_traced_requests requests incremental 1 1
DIMENSION siptrace_traced_replies replies incremental -1 1
-CHART opensips.shmem '' "OpenSIPS Shared Memory" "kilobytes" mem '' line $[opensips_priority + 18] $opensips_update_every
+CHART opensips.shmem '' "OpenSIPS Shared Memory" "kilobytes" mem '' line $((opensips_priority + 18)) $opensips_update_every
DIMENSION shmem_total_size total absolute 1 1024
DIMENSION shmem_used_size used absolute 1 1024
DIMENSION shmem_real_used_size real_used absolute 1 1024
DIMENSION shmem_max_used_size max_used absolute 1 1024
DIMENSION shmem_free_size free absolute 1 1024
-CHART opensips.shmem_fragments '' "OpenSIPS Shared Memory Fragmentation" "fragments" mem '' line $[opensips_priority + 19] $opensips_update_every
+CHART opensips.shmem_fragments '' "OpenSIPS Shared Memory Fragmentation" "fragments" mem '' line $((opensips_priority + 19)) $opensips_update_every
DIMENSION shmem_fragments fragments absolute 1 1
EOF
diff --git a/charts.d/phpfpm.chart.sh b/charts.d/phpfpm.chart.sh
new file mode 100755
index 00000000..c0532fab
--- /dev/null
+++ b/charts.d/phpfpm.chart.sh
@@ -0,0 +1,175 @@
+#!/bin/bash
+
+# if this chart is called X.chart.sh, then all functions and global variables
+# must start with X_
+
+# first, you need open php-fpm status in php-fpm.conf
+# second, you need add status location in nginx.conf
+# you can see, https://easyengine.io/tutorials/php/fpm-status-page/
+
+declare -A phpfpm_urls=()
+
+# _update_every is a special variable - it holds the number of seconds
+# between the calls of the _update() function
+phpfpm_update_every=
+phpfpm_priority=60000
+
+declare -a phpfpm_response=()
+phpfpm_pool=""
+phpfpm_start_time=""
+phpfpm_start_since=0
+phpfpm_accepted_conn=0
+phpfpm_listen_queue=0
+phpfpm_max_listen_queue=0
+phpfpm_listen_queue_len=0
+phpfpm_idle_processes=0
+phpfpm_active_processes=0
+phpfpm_total_processes=0
+phpfpm_max_active_processes=0
+phpfpm_max_children_reached=0
+phpfpm_slow_requests=0
+phpfpm_get() {
+ url=$1
+ phpfpm_response=($(curl -Ss "${url}"))
+ [ $? -ne 0 -o "${#phpfpm_response[@]}" -eq 0 ] && return 1
+
+ if [[ "${phpfpm_response[0]}" != "pool:" \
+ || "${phpfpm_response[2]}" != "process" \
+ || "${phpfpm_response[5]}" != "start" \
+ || "${phpfpm_response[12]}" != "accepted" \
+ || "${phpfpm_response[15]}" != "listen" \
+ || "${phpfpm_response[16]}" != "queue:" \
+ || "${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[*]}"
+ return 1
+ fi
+
+ phpfpm_pool="${phpfpm_response[1]}"
+ phpfpm_start_time="${phpfpm_response[7]} ${phpfpm_response[8]}"
+ phpfpm_start_since="${phpfpm_response[11]}"
+ phpfpm_accepted_conn="${phpfpm_response[14]}"
+ phpfpm_listen_queue="${phpfpm_response[17]}"
+ phpfpm_max_listen_queue="${phpfpm_response[21]}"
+ phpfpm_listen_queue_len="${phpfpm_response[25]}"
+ phpfpm_idle_processes="${phpfpm_response[28]}"
+ phpfpm_active_processes="${phpfpm_response[31]}"
+ 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 [[ -z "${phpfpm_pool}" \
+ || -z "${phpfpm_start_time}" \
+ || -z "${phpfpm_start_since}" \
+ || -z "${phpfpm_accepted_conn}" \
+ || -z "${phpfpm_listen_queue}" \
+ || -z "${phpfpm_max_listen_queue}" \
+ || -z "${phpfpm_listen_queue_len}" \
+ || -z "${phpfpm_idle_processes}" \
+ || -z "${phpfpm_active_processes}" \
+ || -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[*]}"
+ return 1
+ fi
+
+ return 0
+}
+
+# _check is called once, to find out if this chart should be enabled or not
+phpfpm_check() {
+ if [ ${#phpfpm_urls[@]} -eq 0 ]; then
+ phpfpm_urls[local]="http://localhost/status"
+ fi
+
+ local m
+ for m in "${!phpfpm_urls[@]}"
+ do
+ phpfpm_get "${phpfpm_urls[$m]}"
+ if [ $? -ne 0 ]; then
+ echo >&2 "phpfpm: cannot find status on URL '${phpfpm_url[$m]}'. Please set phpfpm_urls[$m]='http://localhost/status' in $confd/phpfpm.conf"
+ unset phpfpm_urls[$m]
+ continue
+ fi
+ done
+
+ if [ ${#phpfpm_urls[@]} -eq 0 ]; then
+ echo >&2 "phpfpm: no phpfpm servers found. Please set phpfpm_urls[name]='url' to whatever needed to get status to the phpfpm server, in $confd/phpfpm.conf"
+ return 1
+ fi
+
+ # this should return:
+ # - 0 to enable the chart
+ # - 1 to disable the chart
+
+ return 0
+}
+
+# _create is called once, to create the charts
+phpfpm_create() {
+ local m
+ for m in "${!phpfpm_urls[@]}"
+ do
+ cat <<EOF
+CHART phpfpm_$m.connections '' "PHP-FPM Active Connections" "connections" phpfpm phpfpm.connections line $((phpfpm_priority + 1)) $phpfpm_update_every
+DIMENSION active '' absolute 1 1
+DIMENSION maxActive 'max active' absolute 1 1
+DIMENSION idle '' absolute 1 1
+
+CHART phpfpm_$m.requests '' "PHP-FPM Requests" "requests/s" phpfpm phpfpm.requests line $((phpfpm_priority + 2)) $phpfpm_update_every
+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
+ done
+
+ return 0
+}
+
+# _update is called continiously, to collect the values
+phpfpm_update() {
+ # the first argument to this function is the microseconds since last update
+ # pass this parameter to the BEGIN statement (see bellow).
+
+ # do all the work to collect / calculate the values
+ # for each dimension
+ # remember: KEEP IT SIMPLE AND SHORT
+
+ local m
+ for m in "${!phpfpm_urls[@]}"
+ do
+ phpfpm_get "${phpfpm_urls[$m]}"
+ if [ $? -ne 0 ]; then
+ continue
+ fi
+
+ # write the result of the work.
+ cat <<EOF
+BEGIN phpfpm_$m.connections $1
+SET active = $((phpfpm_active_processes))
+SET maxActive = $((phpfpm_max_active_processes))
+SET idle = $((phpfpm_idle_processes))
+END
+BEGIN phpfpm_$m.requests $1
+SET requests = $((phpfpm_accepted_conn))
+END
+BEGIN phpfpm_$m.performance $1
+SET reached = $((phpfpm_max_children_reached))
+SET slow = $((phpfpm_slow_requests))
+END
+EOF
+ done
+
+ return 0
+}
diff --git a/charts.d/postfix.chart.sh b/charts.d/postfix.chart.sh
index d286f99f..f4f71027 100755
--- a/charts.d/postfix.chart.sh
+++ b/charts.d/postfix.chart.sh
@@ -43,9 +43,9 @@ postfix_check() {
postfix_create() {
cat <<EOF
-CHART postfix.qemails '' "Postfix Queue Emails" "emails" queue postfix.queued.emails line $[postfix_priority + 1] $postfix_update_every
+CHART postfix.qemails '' "Postfix Queue Emails" "emails" queue postfix.queued.emails line $((postfix_priority + 1)) $postfix_update_every
DIMENSION emails '' absolute 1 1
-CHART postfix.qsize '' "Postfix Queue Emails Size" "emails size in KB" queue postfix.queued.size area $[postfix_priority + 2] $postfix_update_every
+CHART postfix.qsize '' "Postfix Queue Emails Size" "emails size in KB" queue postfix.queued.size area $((postfix_priority + 2)) $postfix_update_every
DIMENSION size '' absolute 1 1
EOF
diff --git a/charts.d/sensors.chart.sh b/charts.d/sensors.chart.sh
index 946de540..19e93858 100755
--- a/charts.d/sensors.chart.sh
+++ b/charts.d/sensors.chart.sh
@@ -129,7 +129,7 @@ sensors_create() {
files="$( sensors_check_files $files )"
files="$( sensors_check_temp_type $files )"
[ -z "$files" ] && continue
- echo "CHART sensors.temp_$id '' '$name Temperature' 'Celsius' 'temperature' 'sensors.temp' line $[sensors_priority + 1] $sensors_update_every"
+ echo "CHART sensors.temp_$id '' '$name Temperature' 'Celsius' 'temperature' 'sensors.temp' line $((sensors_priority + 1)) $sensors_update_every"
echo >>$TMP_DIR/sensors.sh "echo \"BEGIN sensors.temp_$id \$1\""
divisor=1000
;;
@@ -138,7 +138,7 @@ sensors_create() {
files="$( ls $path/in*_input 2>/dev/null )"
files="$( sensors_check_files $files )"
[ -z "$files" ] && continue
- echo "CHART sensors.volt_$id '' '$name Voltage' 'Volts' 'voltage' 'sensors.volt' line $[sensors_priority + 2] $sensors_update_every"
+ echo "CHART sensors.volt_$id '' '$name Voltage' 'Volts' 'voltage' 'sensors.volt' line $((sensors_priority + 2)) $sensors_update_every"
echo >>$TMP_DIR/sensors.sh "echo \"BEGIN sensors.volt_$id \$1\""
divisor=1000
;;
@@ -147,7 +147,7 @@ sensors_create() {
files="$( ls $path/curr*_input 2>/dev/null )"
files="$( sensors_check_files $files )"
[ -z "$files" ] && continue
- echo "CHART sensors.curr_$id '' '$name Current' 'Ampere' 'current' 'sensors.curr' line $[sensors_priority + 3] $sensors_update_every"
+ echo "CHART sensors.curr_$id '' '$name Current' 'Ampere' 'current' 'sensors.curr' line $((sensors_priority + 3)) $sensors_update_every"
echo >>$TMP_DIR/sensors.sh "echo \"BEGIN sensors.curr_$id \$1\""
divisor=1000
;;
@@ -156,7 +156,7 @@ sensors_create() {
files="$( ls $path/power*_input 2>/dev/null )"
files="$( sensors_check_files $files )"
[ -z "$files" ] && continue
- echo "CHART sensors.power_$id '' '$name Power' 'Watt' 'power' 'sensors.power' line $[sensors_priority + 4] $sensors_update_every"
+ echo "CHART sensors.power_$id '' '$name Power' 'Watt' 'power' 'sensors.power' line $((sensors_priority + 4)) $sensors_update_every"
echo >>$TMP_DIR/sensors.sh "echo \"BEGIN sensors.power_$id \$1\""
divisor=1000000
;;
@@ -165,7 +165,7 @@ sensors_create() {
files="$( ls $path/fan*_input 2>/dev/null )"
files="$( sensors_check_files $files )"
[ -z "$files" ] && continue
- echo "CHART sensors.fan_$id '' '$name Fans Speed' 'Rotations / Minute' 'fans' 'sensors.fans' line $[sensors_priority + 5] $sensors_update_every"
+ echo "CHART sensors.fan_$id '' '$name Fans Speed' 'Rotations / Minute' 'fans' 'sensors.fans' line $((sensors_priority + 5)) $sensors_update_every"
echo >>$TMP_DIR/sensors.sh "echo \"BEGIN sensors.fan_$id \$1\""
;;
@@ -173,7 +173,7 @@ sensors_create() {
files="$( ls $path/energy*_input 2>/dev/null )"
files="$( sensors_check_files $files )"
[ -z "$files" ] && continue
- echo "CHART sensors.energy_$id '' '$name Energy' 'Joule' 'energy' 'sensors.energy' areastack $[sensors_priority + 6] $sensors_update_every"
+ echo "CHART sensors.energy_$id '' '$name Energy' 'Joule' 'energy' 'sensors.energy' areastack $((sensors_priority + 6)) $sensors_update_every"
echo >>$TMP_DIR/sensors.sh "echo \"BEGIN sensors.energy_$id \$1\""
algorithm="incremental"
divisor=1000000
@@ -183,7 +183,7 @@ sensors_create() {
files="$( ls $path/humidity*_input 2>/dev/null )"
files="$( sensors_check_files $files )"
[ -z "$files" ] && continue
- echo "CHART sensors.humidity_$id '' '$name Humidity' 'Percent' 'humidity' 'sensors.humidity' line $[sensors_priority + 7] $sensors_update_every"
+ echo "CHART sensors.humidity_$id '' '$name Humidity' 'Percent' 'humidity' 'sensors.humidity' line $((sensors_priority + 7)) $sensors_update_every"
echo >>$TMP_DIR/sensors.sh "echo \"BEGIN sensors.humidity_$id \$1\""
divisor=1000
;;
diff --git a/charts.d/squid.chart.sh b/charts.d/squid.chart.sh
index 5e1ebb06..f6154b25 100755
--- a/charts.d/squid.chart.sh
+++ b/charts.d/squid.chart.sh
@@ -63,21 +63,21 @@ squid_check() {
squid_create() {
# create the charts
cat <<EOF
-CHART squid.clients_net '' "Squid Client Bandwidth" "kilobits / sec" clients squid.clients.net area $[squid_priority + 1] $squid_update_every
+CHART squid.clients_net '' "Squid Client Bandwidth" "kilobits / sec" clients squid.clients.net area $((squid_priority + 1)) $squid_update_every
DIMENSION client_http_kbytes_in in incremental 8 1
DIMENSION client_http_kbytes_out out incremental -8 1
DIMENSION client_http_hit_kbytes_out hits incremental -8 1
-CHART squid.clients_requests '' "Squid Client Requests" "requests / sec" clients squid.clients.requests line $[squid_priority + 3] $squid_update_every
+CHART squid.clients_requests '' "Squid Client Requests" "requests / sec" clients squid.clients.requests line $((squid_priority + 3)) $squid_update_every
DIMENSION client_http_requests requests incremental 1 1
DIMENSION client_http_hits hits incremental 1 1
DIMENSION client_http_errors errors incremental -1 1
-CHART squid.servers_net '' "Squid Server Bandwidth" "kilobits / sec" servers squid.servers.net area $[squid_priority + 2] $squid_update_every
+CHART squid.servers_net '' "Squid Server Bandwidth" "kilobits / sec" servers squid.servers.net area $((squid_priority + 2)) $squid_update_every
DIMENSION server_all_kbytes_in in incremental 8 1
DIMENSION server_all_kbytes_out out incremental -8 1
-CHART squid.servers_requests '' "Squid Server Requests" "requests / sec" servers squid.servers.requests line $[squid_priority + 4] $squid_update_every
+CHART squid.servers_requests '' "Squid Server Requests" "requests / sec" servers squid.servers.requests line $((squid_priority + 4)) $squid_update_every
DIMENSION server_all_requests requests incremental 1 1
DIMENSION server_all_errors errors incremental -1 1
EOF
diff --git a/charts.d/tomcat.chart.sh b/charts.d/tomcat.chart.sh
new file mode 100755
index 00000000..4e10a918
--- /dev/null
+++ b/charts.d/tomcat.chart.sh
@@ -0,0 +1,129 @@
+#!/bin/bash
+
+# Description: Tomcat netdata charts.d plugin
+# Author: Jorge Romero
+
+# the URL to download tomcat status info
+# usually http://localhost:8080/manager/status?XML=true
+tomcat_url=""
+
+# set tomcat username/password here
+tomcatUser=""
+tomcatPassword=""
+
+# _update_every is a special variable - it holds the number of seconds
+# between the calls of the _update() function
+tomcat_update_every=
+
+tomcat_priority=60000
+
+# convert tomcat floating point values
+# to integer using this multiplier
+# this only affects precision - the values
+# will be in the proper units
+tomcat_decimal_detail=1000000
+
+# used by volume chart to convert bytes to KB
+tomcat_decimal_KB_detail=1000
+
+tomcat_check() {
+
+ require_cmd xmlstarlet || return 1
+
+
+ # check if url, username, passwords are set
+ if [ -z "${tomcat_url}" ]; then
+ 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
+ fi
+ if [ -z "${tomcatPassword}" ]; then
+ echo >&2 "tomcat password is unset or set to the empty string"
+ return 1
+ fi
+
+ # check if we can get to tomcat's status page
+ tomcat_get
+ if [ $? -ne 0 ]
+ then
+ echo >&2 "tomcat: couldn't get to status page on URL '${tomcat_url}'."\
+ "Please make sure tomcat url, username and password are correct."
+ return 1
+ fi
+
+ # this should return:
+ # - 0 to enable the chart
+ # - 1 to disable the chart
+
+ return 0
+}
+
+tomcat_get() {
+ # Collect tomcat values
+ mapfile -t lines < <(curl -u "$tomcatUser":"$tomcatPassword" -Ss "$tomcat_url" |\
+ xmlstarlet sel \
+ -t -m "/status/jvm/memory" -v @free \
+ -n -m "/status/connector[@name='\"http-bio-8080\"']/threadInfo" -v @currentThreadCount \
+ -n -v @currentThreadsBusy \
+ -n -m "/status/connector[@name='\"http-bio-8080\"']/requestInfo" -v @requestCount \
+ -n -v @bytesSent -n -)
+
+ tomcat_jvm_freememory="${lines[0]}"
+ tomcat_threads="${lines[1]}"
+ tomcat_threads_busy="${lines[2]}"
+ tomcat_accesses="${lines[3]}"
+ tomcat_volume="${lines[4]}"
+
+ return 0
+}
+
+# _create is called once, to create the charts
+tomcat_create() {
+ cat <<EOF
+CHART tomcat.accesses '' "tomcat requests" "requests/s" statistics tomcat.accesses area $((tomcat_priority + 8)) $tomcat_update_every
+DIMENSION accesses '' incremental
+CHART tomcat.volume '' "tomcat volume" "KB/s" volume tomcat.volume area $((tomcat_priority + 5)) $tomcat_update_every
+DIMENSION volume '' incremental divisor ${tomcat_decimal_KB_detail}
+CHART tomcat.threads '' "tomcat threads" "current threads" statistics tomcat.threads line $((tomcat_priority + 6)) $tomcat_update_every
+DIMENSION current '' absolute 1
+DIMENSION busy '' absolute 1
+CHART tomcat.jvm '' "JVM Free Memory" "MB" statistics tomcat.jvm area $((tomcat_priority + 8)) $tomcat_update_every
+DIMENSION jvm '' absolute 1 ${tomcat_decimal_detail}
+EOF
+ return 0
+}
+
+# _update is called continiously, to collect the values
+tomcat_update() {
+ local reqs net
+ # the first argument to this function is the microseconds since last update
+ # pass this parameter to the BEGIN statement (see bellow).
+
+ # do all the work to collect / calculate the values
+ # for each dimension
+ # remember: KEEP IT SIMPLE AND SHORT
+
+ tomcat_get || return 1
+
+ # write the result of the work.
+ cat <<VALUESEOF
+BEGIN tomcat.accesses $1
+SET accesses = $((tomcat_accesses))
+END
+BEGIN tomcat.volume $1
+SET volume = $((tomcat_volume))
+END
+BEGIN tomcat.threads $1
+SET current = $((tomcat_threads))
+SET busy = $((tomcat_threads_busy))
+END
+BEGIN tomcat.jvm $1
+SET jvm = $((tomcat_jvm_freememory))
+END
+VALUESEOF
+
+ return 0
+}