diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-06-09 22:49:44 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2016-06-09 22:49:44 +0300 |
commit | bb8cdaf9dd25372bbbd09d916e9afe7f907ec1d6 (patch) | |
tree | c796ac14b633b3fed34cfa43ff0a44ad19558d2a /charts.d | |
parent | 61360d367bf33f2590740a50863f739c819a7d81 (diff) |
properly handle the exit status of plugins to avoid infinite restart attempts; plugins that report failure are now restarted up to 10 times if they have collected values in the past; apache fixed to work with latest apache; example plugin is now disabled by default to prevent starting bash in systems that dont have any other bash plugin used
Diffstat (limited to 'charts.d')
-rwxr-xr-x | charts.d/apache.chart.sh | 23 | ||||
-rwxr-xr-x | charts.d/example.chart.sh | 7 |
2 files changed, 17 insertions, 13 deletions
diff --git a/charts.d/apache.chart.sh b/charts.d/apache.chart.sh index f4f7d0581b..a3e064094c 100755 --- a/charts.d/apache.chart.sh +++ b/charts.d/apache.chart.sh @@ -67,19 +67,14 @@ apache_detect() { # we will not check of the Conns* # keys, since these are apache 2.4 specific - if [ -z "${apache_key_accesses}" \ - -o -z "${apache_key_kbytes}" \ - -o -z "${apache_key_reqpersec}" \ - -o -z "${apache_key_bytespersec}" \ - -o -z "${apache_key_bytesperreq}" \ - -o -z "${apache_key_busyworkers}" \ - -o -z "${apache_key_idleworkers}" \ - -o -z "${apache_key_scoreboard}" \ - ] - then - echo >&2 "apache: Invalid response or missing keys from apache server: ${*}" - return 1 - fi + [ -z "${apache_key_accesses}" ] && echo >&2 "apache: missing 'Total Accesses' from apache server: ${*}" && return 1 + [ -z "${apache_key_kbytes}" ] && echo >&2 "apache: missing 'Total kBytes' from apache server: ${*}" && return 1 + [ -z "${apache_key_reqpersec}" ] && echo >&2 "apache: missing 'ReqPerSec' from apache server: ${*}" && return 1 + [ -z "${apache_key_bytespersec}" ] && echo >&2 "apache: missing 'BytesPerSec' from apache server: ${*}" && return 1 + [ -z "${apache_key_bytesperreq}" ] && echo >&2 "apache: missing 'BytesPerReq' from apache server: ${*}" && return 1 + [ -z "${apache_key_busyworkers}" ] && echo >&2 "apache: missing 'BusyWorkers' from apache server: ${*}" && return 1 + [ -z "${apache_key_idleworkers}" ] && echo >&2 "apache: missing 'IdleWorkers' from apache server: ${*}" && return 1 + [ -z "${apache_key_scoreboard}" ] && echo >&2 "apache: missing 'Scoreboard' from apache server: ${*}" && return 1 if [ ! -z "${apache_key_connstotal}" \ -a ! -z "${apache_key_connsasyncwriting}" \ @@ -88,6 +83,8 @@ apache_detect() { ] then apache_has_conns=1 + else + apache_has_conns=0 fi return 0 diff --git a/charts.d/example.chart.sh b/charts.d/example.chart.sh index ad20504621..b20740e862 100755 --- a/charts.d/example.chart.sh +++ b/charts.d/example.chart.sh @@ -7,14 +7,21 @@ # between the calls of the _update() function example_update_every= +# the priority is used to sort the charts on the dashboard +# 1 = the first chart example_priority=150000 +# to enable this chart, you have to set this to 12345 +# (just a demonstration for something that needs to be checked) +example_magic_number= + # _check is called once, to find out if this chart should be enabled or not example_check() { # this should return: # - 0 to enable the chart # - 1 to disable the chart + [ "${example_magic_number}" != "12345" ] && return 1 return 0 } |