summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcharts.d/apache.chart.sh3
-rwxr-xr-xcharts.d/nginx.chart.sh3
-rwxr-xr-xcharts.d/phpfpm.chart.sh10
-rwxr-xr-xcharts.d/tomcat.chart.sh3
4 files changed, 12 insertions, 7 deletions
diff --git a/charts.d/apache.chart.sh b/charts.d/apache.chart.sh
index dbf14a4327..f4f7d0581b 100755
--- a/charts.d/apache.chart.sh
+++ b/charts.d/apache.chart.sh
@@ -2,6 +2,7 @@
# the URL to download apache status info
apache_url="http://127.0.0.1:80/server-status?auto"
+apache_curl_opts=
# _update_every is a special variable - it holds the number of seconds
# between the calls of the _update() function
@@ -94,7 +95,7 @@ apache_detect() {
apache_get() {
local oIFS="${IFS}" ret
- IFS=$':\n' apache_response=($(curl -Ss "${apache_url}"))
+ IFS=$':\n' apache_response=($(curl -Ss ${apache_curl_opts} "${apache_url}"))
ret=$?
IFS="${oIFS}"
diff --git a/charts.d/nginx.chart.sh b/charts.d/nginx.chart.sh
index 450aa94b30..9b75c2c5e6 100755
--- a/charts.d/nginx.chart.sh
+++ b/charts.d/nginx.chart.sh
@@ -4,6 +4,7 @@
# 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 +20,7 @@ nginx_reading=0
nginx_writing=0
nginx_waiting=0
nginx_get() {
- nginx_response=($(curl -Ss "${nginx_url}"))
+ nginx_response=($(curl -Ss ${nginx_curl_opts} "${nginx_url}"))
[ $? -ne 0 -o "${#nginx_response[@]}" -eq 0 ] && return 1
if [ "${nginx_response[0]}" != "Active" \
diff --git a/charts.d/phpfpm.chart.sh b/charts.d/phpfpm.chart.sh
index c0532fab11..55510169b4 100755
--- a/charts.d/phpfpm.chart.sh
+++ b/charts.d/phpfpm.chart.sh
@@ -8,6 +8,7 @@
# you can see, https://easyengine.io/tutorials/php/fpm-status-page/
declare -A phpfpm_urls=()
+declare -A phpfpm_curl_opts=()
# _update_every is a special variable - it holds the number of seconds
# between the calls of the _update() function
@@ -29,8 +30,9 @@ phpfpm_max_active_processes=0
phpfpm_max_children_reached=0
phpfpm_slow_requests=0
phpfpm_get() {
- url=$1
- phpfpm_response=($(curl -Ss "${url}"))
+ local opts="${1}" url="${2}"
+
+ phpfpm_response=($(curl -Ss ${opts} "${url}"))
[ $? -ne 0 -o "${#phpfpm_response[@]}" -eq 0 ] && return 1
if [[ "${phpfpm_response[0]}" != "pool:" \
@@ -94,7 +96,7 @@ phpfpm_check() {
local m
for m in "${!phpfpm_urls[@]}"
do
- phpfpm_get "${phpfpm_urls[$m]}"
+ phpfpm_get "${phpfpm_curl_opts[$m]}" "${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]
@@ -149,7 +151,7 @@ phpfpm_update() {
local m
for m in "${!phpfpm_urls[@]}"
do
- phpfpm_get "${phpfpm_urls[$m]}"
+ phpfpm_get "${phpfpm_curl_opts[$m]}" "${phpfpm_urls[$m]}"
if [ $? -ne 0 ]; then
continue
fi
diff --git a/charts.d/tomcat.chart.sh b/charts.d/tomcat.chart.sh
index f7809ddd31..b0eddc7f0d 100755
--- a/charts.d/tomcat.chart.sh
+++ b/charts.d/tomcat.chart.sh
@@ -6,6 +6,7 @@
# the URL to download tomcat status info
# usually http://localhost:8080/manager/status?XML=true
tomcat_url=""
+tomcat_curl_opts=""
# set tomcat username/password here
tomcatUser=""
@@ -64,7 +65,7 @@ tomcat_check() {
tomcat_get() {
# collect tomcat values
tomcat_port="$(IFS=/ read -ra a <<< "$tomcat_url"; hostport=${a[2]}; echo "${hostport#*:}")"
- mapfile -t lines < <(curl -u "$tomcatUser":"$tomcatPassword" -Ss "$tomcat_url" |\
+ mapfile -t lines < <(curl -u "$tomcatUser":"$tomcatPassword" -Ss ${tomcat_curl_opts} "$tomcat_url" |\
xmlstarlet sel \
-t -m "/status/jvm/memory" -v @free \
-n -m "/status/connector[@name='\"http-bio-$tomcat_port\"']/threadInfo" -v @currentThreadCount \