diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:22:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:22:44 +0000 |
commit | 1e6c93250172946eeb38e94a92a1fd12c9d3011e (patch) | |
tree | 8ca5e16dfc7ad6b3bf2738ca0a48408a950f8f7e /collectors/charts.d.plugin/nginx | |
parent | Update watch file (diff) | |
download | netdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.tar.xz netdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.zip |
Merging upstream version 1.11.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/charts.d.plugin/nginx/Makefile.inc | 13 | ||||
-rw-r--r-- | collectors/charts.d.plugin/nginx/README.md | 2 | ||||
-rw-r--r-- | collectors/charts.d.plugin/nginx/nginx.chart.sh (renamed from charts.d/nginx.chart.sh) | 51 | ||||
-rw-r--r-- | collectors/charts.d.plugin/nginx/nginx.conf (renamed from conf.d/charts.d/nginx.conf) | 0 |
4 files changed, 42 insertions, 24 deletions
diff --git a/collectors/charts.d.plugin/nginx/Makefile.inc b/collectors/charts.d.plugin/nginx/Makefile.inc new file mode 100644 index 000000000..c9d31aada --- /dev/null +++ b/collectors/charts.d.plugin/nginx/Makefile.inc @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +# THIS IS NOT A COMPLETE Makefile +# IT IS INCLUDED BY ITS PARENT'S Makefile.am +# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT + +# install these files +dist_charts_DATA += nginx/nginx.chart.sh +dist_chartsconfig_DATA += nginx/nginx.conf + +# do not install these files, but include them in the distribution +dist_noinst_DATA += nginx/README.md nginx/Makefile.inc + diff --git a/collectors/charts.d.plugin/nginx/README.md b/collectors/charts.d.plugin/nginx/README.md new file mode 100644 index 000000000..d82951aac --- /dev/null +++ b/collectors/charts.d.plugin/nginx/README.md @@ -0,0 +1,2 @@ +> THIS MODULE IS OBSOLETE. +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT diff --git a/charts.d/nginx.chart.sh b/collectors/charts.d.plugin/nginx/nginx.chart.sh index d0df460ac..14dda0832 100644 --- a/charts.d/nginx.chart.sh +++ b/collectors/charts.d.plugin/nginx/nginx.chart.sh @@ -1,9 +1,10 @@ +# shellcheck shell=bash # no need for shebang - this file is loaded from charts.d.plugin +# SPDX-License-Identifier: GPL-3.0-or-later # netdata # real-time performance and health monitoring, done right! # (C) 2016 Costa Tsaousis <costa@tsaousis.gr> -# GPL v3+ # # if this chart is called X.chart.sh, then all functions and global variables @@ -26,20 +27,21 @@ nginx_reading=0 nginx_writing=0 nginx_waiting=0 nginx_get() { + # shellcheck disable=SC2207 nginx_response=($(run curl -Ss ${nginx_curl_opts} "${nginx_url}")) - [ $? -ne 0 -o "${#nginx_response[@]}" -eq 0 ] && return 1 - - if [ "${nginx_response[0]}" != "Active" \ - -o "${nginx_response[1]}" != "connections:" \ - -o "${nginx_response[3]}" != "server" \ - -o "${nginx_response[4]}" != "accepts" \ - -o "${nginx_response[5]}" != "handled" \ - -o "${nginx_response[6]}" != "requests" \ - -o "${nginx_response[10]}" != "Reading:" \ - -o "${nginx_response[12]}" != "Writing:" \ - -o "${nginx_response[14]}" != "Waiting:" \ - ] - then + # shellcheck disable=SC2181 + if [ $? -ne 0 ] || [ "${#nginx_response[@]}" -eq 0 ]; then return 1; fi + + if [ "${nginx_response[0]}" != "Active" ] ||\ + [ "${nginx_response[1]}" != "connections:" ] ||\ + [ "${nginx_response[3]}" != "server" ] ||\ + [ "${nginx_response[4]}" != "accepts" ] ||\ + [ "${nginx_response[5]}" != "handled" ] ||\ + [ "${nginx_response[6]}" != "requests" ] ||\ + [ "${nginx_response[10]}" != "Reading:" ] ||\ + [ "${nginx_response[12]}" != "Writing:" ] ||\ + [ "${nginx_response[14]}" != "Waiting:" ] + then error "Invalid response from nginx server: ${nginx_response[*]}" return 1 fi @@ -52,15 +54,14 @@ nginx_get() { nginx_writing="${nginx_response[13]}" nginx_waiting="${nginx_response[15]}" - if [ -z "${nginx_active_connections}" \ - -o -z "${nginx_accepts}" \ - -o -z "${nginx_handled}" \ - -o -z "${nginx_requests}" \ - -o -z "${nginx_reading}" \ - -o -z "${nginx_writing}" \ - -o -z "${nginx_waiting}" \ - ] - then + if [ -z "${nginx_active_connections}" ] ||\ + [ -z "${nginx_accepts}" ] ||\ + [ -z "${nginx_handled}" ] ||\ + [ -z "${nginx_requests}" ] ||\ + [ -z "${nginx_reading}" ] ||\ + [ -z "${nginx_writing}" ] ||\ + [ -z "${nginx_waiting}" ] + then error "empty values got from nginx server: ${nginx_response[*]}" return 1 fi @@ -72,8 +73,10 @@ nginx_get() { nginx_check() { nginx_get + # shellcheck disable=2181 if [ $? -ne 0 ] - then + then + # shellcheck disable=SC2154 error "cannot find stub_status on URL '${nginx_url}'. Please set nginx_url='http://nginx.server/stub_status' in $confd/nginx.conf" return 1 fi diff --git a/conf.d/charts.d/nginx.conf b/collectors/charts.d.plugin/nginx/nginx.conf index c46100a58..c46100a58 100644 --- a/conf.d/charts.d/nginx.conf +++ b/collectors/charts.d.plugin/nginx/nginx.conf |