X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=charts.d%2Fnginx.chart.sh;h=0ae7d630775af82d3c4580ba0c6fc6cf401ba15e;hb=4d0af341e3c40993ba427fe4e306f09cc6866577;hp=a6795415b4f9a7870d508160e86a1d8589bd7dc6;hpb=e4506e87f913284acc0a01033b26f53d7145e639;p=netdata.git diff --git a/charts.d/nginx.chart.sh b/charts.d/nginx.chart.sh old mode 100755 new mode 100644 index a6795415..0ae7d630 --- a/charts.d/nginx.chart.sh +++ b/charts.d/nginx.chart.sh @@ -1,9 +1,16 @@ -#!/bin/bash +# no need for shebang - this file is loaded from charts.d.plugin + +# netdata +# real-time performance and health monitoring, done right! +# (C) 2016 Costa Tsaousis +# GPL v3+ +# # if this chart is called X.chart.sh, then all functions and global variables # must start with X_ nginx_url="http://127.0.0.1:80/stub_status" +nginx_curl_opts="" # _update_every is a special variable - it holds the number of seconds # between the calls of the _update() function @@ -19,7 +26,7 @@ nginx_reading=0 nginx_writing=0 nginx_waiting=0 nginx_get() { - nginx_response=($(curl -s "${nginx_url}")) + nginx_response=($(run curl -Ss ${nginx_curl_opts} "${nginx_url}")) [ $? -ne 0 -o "${#nginx_response[@]}" -eq 0 ] && return 1 if [ "${nginx_response[0]}" != "Active" \ @@ -33,7 +40,7 @@ nginx_get() { -o "${nginx_response[14]}" != "Waiting:" \ ] then - echo >&2 "nginx: Invalid response from nginx server: ${nginx_response[*]}" + error "Invalid response from nginx server: ${nginx_response[*]}" return 1 fi @@ -54,7 +61,7 @@ nginx_get() { -o -z "${nginx_waiting}" \ ] then - echo >&2 "nginx: empty values got from nginx server: ${nginx_response[*]}" + error "empty values got from nginx server: ${nginx_response[*]}" return 1 fi @@ -67,7 +74,7 @@ nginx_check() { nginx_get if [ $? -ne 0 ] then - echo >&2 "nginx: cannot find stub_status on URL '${nginx_url}'. Please set nginx_url='http://nginx.server/stub_status' in $confd/nginx.conf" + 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 @@ -81,18 +88,18 @@ nginx_check() { # _create is called once, to create the charts nginx_create() { cat <