diff options
Diffstat (limited to 'charts.d')
-rw-r--r-- | charts.d/Makefile.am | 8 | ||||
-rw-r--r-- | charts.d/Makefile.in | 146 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/ap.chart.sh | 142 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/apache.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/apcupsd.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/cpu_apps.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/cpufreq.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/example.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/hddtemp.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/load_average.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/mem_apps.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/mysql.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/nginx.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/nut.chart.sh | 31 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/opensips.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/phpfpm.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/postfix.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/sensors.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/squid.chart.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | charts.d/tomcat.chart.sh | 0 |
20 files changed, 148 insertions, 179 deletions
diff --git a/charts.d/Makefile.am b/charts.d/Makefile.am index ec0e101f..85bcef3c 100644 --- a/charts.d/Makefile.am +++ b/charts.d/Makefile.am @@ -4,6 +4,10 @@ MAINTAINERCLEANFILES= $(srcdir)/Makefile.in dist_charts_SCRIPTS = \ + $(NULL) + +dist_charts_DATA = \ + README.md \ ap.chart.sh \ apcupsd.chart.sh \ apache.chart.sh \ @@ -24,7 +28,3 @@ dist_charts_SCRIPTS = \ squid.chart.sh \ tomcat.chart.sh \ $(NULL) - -dist_charts_DATA = \ - README.md \ - $(NULL) diff --git a/charts.d/Makefile.in b/charts.d/Makefile.in index ef63f78f..a613e1b3 100644 --- a/charts.d/Makefile.in +++ b/charts.d/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,61 +17,6 @@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -90,9 +36,11 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = charts.d +DIST_COMMON = $(dist_charts_DATA) $(dist_charts_SCRIPTS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___atomic.m4 \ - $(top_srcdir)/m4/ax_c__generic.m4 \ + $(top_srcdir)/m4/ax_c__generic.m4 $(top_srcdir)/m4/ax_c_lto.m4 \ $(top_srcdir)/m4/ax_c_mallinfo.m4 \ $(top_srcdir)/m4/ax_c_mallopt.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ @@ -101,8 +49,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___atomic.m4 \ $(top_srcdir)/m4/tcmalloc.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(dist_charts_SCRIPTS) \ - $(dist_charts_DATA) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -136,32 +82,12 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(chartsdir)" "$(DESTDIR)$(chartsdir)" SCRIPTS = $(dist_charts_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac DATA = $(dist_charts_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -185,7 +111,11 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPMIMONITORING_CFLAGS = @IPMIMONITORING_CFLAGS@ +IPMIMONITORING_LIBS = @IPMIMONITORING_LIBS@ LDFLAGS = @LDFLAGS@ +LIBCAP_CFLAGS = @LIBCAP_CFLAGS@ +LIBCAP_LIBS = @LIBCAP_LIBS@ LIBMNL_CFLAGS = @LIBMNL_CFLAGS@ LIBMNL_LIBS = @LIBMNL_LIBS@ LIBOBJS = @LIBOBJS@ @@ -199,6 +129,10 @@ MKDIR_P = @MKDIR_P@ NFACCT_CFLAGS = @NFACCT_CFLAGS@ NFACCT_LIBS = @NFACCT_LIBS@ OBJEXT = @OBJEXT@ +OPTIONAL_IPMIMONITORING_CFLAGS = @OPTIONAL_IPMIMONITORING_CFLAGS@ +OPTIONAL_IPMIMONITORING_LIBS = @OPTIONAL_IPMIMONITORING_LIBS@ +OPTIONAL_LIBCAP_CFLAGS = @OPTIONAL_LIBCAP_CFLAGS@ +OPTIONAL_LIBCAP_LIBS = @OPTIONAL_LIBCAP_LIBS@ OPTIONAL_MATH_CLFAGS = @OPTIONAL_MATH_CLFAGS@ OPTIONAL_MATH_LIBS = @OPTIONAL_MATH_LIBS@ OPTIONAL_NFACCT_CLFAGS = @OPTIONAL_NFACCT_CLFAGS@ @@ -301,6 +235,10 @@ webdir = @webdir@ # MAINTAINERCLEANFILES = $(srcdir)/Makefile.in dist_charts_SCRIPTS = \ + $(NULL) + +dist_charts_DATA = \ + README.md \ ap.chart.sh \ apcupsd.chart.sh \ apache.chart.sh \ @@ -322,10 +260,6 @@ dist_charts_SCRIPTS = \ tomcat.chart.sh \ $(NULL) -dist_charts_DATA = \ - README.md \ - $(NULL) - all: all-am .SUFFIXES: @@ -341,6 +275,7 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu charts.d/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu charts.d/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -360,11 +295,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): install-dist_chartsSCRIPTS: $(dist_charts_SCRIPTS) @$(NORMAL_INSTALL) + test -z "$(chartsdir)" || $(MKDIR_P) "$(DESTDIR)$(chartsdir)" @list='$(dist_charts_SCRIPTS)'; test -n "$(chartsdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(chartsdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(chartsdir)" || exit 1; \ - fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ @@ -395,11 +327,8 @@ uninstall-dist_chartsSCRIPTS: dir='$(DESTDIR)$(chartsdir)'; $(am__uninstall_files_from_dir) install-dist_chartsDATA: $(dist_charts_DATA) @$(NORMAL_INSTALL) + test -z "$(chartsdir)" || $(MKDIR_P) "$(DESTDIR)$(chartsdir)" @list='$(dist_charts_DATA)'; test -n "$(chartsdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(chartsdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(chartsdir)" || exit 1; \ - fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -414,11 +343,11 @@ uninstall-dist_chartsDATA: @list='$(dist_charts_DATA)'; test -n "$(chartsdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(chartsdir)'; $(am__uninstall_files_from_dir) -tags TAGS: +tags: TAGS +TAGS: -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: distdir: $(DISTFILES) @@ -557,21 +486,18 @@ uninstall-am: uninstall-dist_chartsDATA uninstall-dist_chartsSCRIPTS .MAKE: install-am install-strip -.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ - ctags-am distclean distclean-generic distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dist_chartsDATA \ - install-dist_chartsSCRIPTS install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags-am uninstall uninstall-am \ +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-dist_chartsDATA install-dist_chartsSCRIPTS install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-dist_chartsDATA uninstall-dist_chartsSCRIPTS -.PRECIOUS: Makefile - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/charts.d/ap.chart.sh b/charts.d/ap.chart.sh index 0e85c486..ce2eefc9 100755..100644 --- a/charts.d/ap.chart.sh +++ b/charts.d/ap.chart.sh @@ -16,7 +16,7 @@ declare -A ap_devs=() # _check is called once, to find out if this chart should be enabled or not ap_check() { require_cmd iw || return 1 - + local ev=$(run iw dev | awk ' BEGIN { i = ""; @@ -77,20 +77,19 @@ 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 -DIMENSION signal 'average signal' absolute 1 1 +DIMENSION signal 'average signal' absolute 1 1000 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 EOF - done return 0 } -# _update is called continiously, to collect the values +# _update is called continuously, to collect the values ap_update() { # the first argument to this function is the microseconds since last update # pass this parameter to the BEGIN statement (see bellow). @@ -101,66 +100,81 @@ ap_update() { for dev in "${!ap_devs[@]}" do - iw ${dev} station dump |\ - awk " - BEGIN { - c = 0; - rb = 0; - tb = 0; - rp = 0; - tp = 0; - tr = 0; - tf = 0; - tt = 0; - rt = 0; - s = 0; - g = 0; - e = 0; - } - /^Station/ { c++; } - /^[ \\t]+rx bytes:/ { rb += \$3 } - /^[ \\t]+tx bytes:/ { tb += \$3 } - /^[ \\t]+rx packets:/ { rp += \$3 } - /^[ \\t]+tx packets:/ { tp += \$3 } - /^[ \\t]+tx retries:/ { tr += \$3 } - /^[ \\t]+tx failed:/ { tf += \$3 } - /^[ \\t]+signal:/ { s += \$2; } - /^[ \\t]+rx bitrate:/ { x = \$3; rt += x * 1000; } - /^[ \\t]+tx bitrate:/ { x = \$3; tt += x * 1000; } - /^[ \\t]+expected throughput:(.*)Mbps/ { - x=\$3; - sub(/Mbps/, \"\", x); - e += x * 1000; - } - END { - print \"BEGIN ap_clients.${dev}\" - print \"SET clients = \" c; - print \"END\" - print \"BEGIN ap_bandwidth.${dev}\" - print \"SET received = \" rb; - print \"SET sent = \" tb; - print \"END\" - print \"BEGIN ap_packets.${dev}\" - print \"SET received = \" rp; - print \"SET sent = \" tp; - print \"END\" - print \"BEGIN ap_issues.${dev}\" - print \"SET retries = \" tr; - print \"SET failures = \" tf; - print \"END\" - print \"BEGIN ap_signal.${dev}\" - print \"SET signal = \" s / c; - print \"END\" - - if( c == 0 ) c = 1; - print \"BEGIN ap_bitrate.${dev}\" - print \"SET receive = \" rt / c; - print \"SET transmit = \" tt / c; - print \"SET expected = \" e / c; - print \"END\" - } - " - done + echo + echo "DEVICE ${dev}" + iw ${dev} station dump + done | awk " + function zero_data() { + dev = \"\"; + c = 0; + rb = 0; + tb = 0; + rp = 0; + tp = 0; + tr = 0; + tf = 0; + tt = 0; + rt = 0; + s = 0; + g = 0; + e = 0; + } + function print_device() { + if(dev != \"\" && length(dev) > 0) { + print \"BEGIN ap_clients.\" dev; + print \"SET clients = \" c; + print \"END\"; + print \"BEGIN ap_bandwidth.\" dev; + print \"SET received = \" rb; + print \"SET sent = \" tb; + print \"END\"; + print \"BEGIN ap_packets.\" dev; + print \"SET received = \" rp; + print \"SET sent = \" tp; + print \"END\"; + print \"BEGIN ap_issues.\" dev; + print \"SET retries = \" tr; + print \"SET failures = \" tf; + print \"END\"; + + if( c == 0 ) c = 1; + print \"BEGIN ap_signal.\" dev; + print \"SET signal = \" int(s / c); + print \"END\"; + print \"BEGIN ap_bitrate.\" dev; + print \"SET receive = \" int(rt / c); + print \"SET transmit = \" int(tt / c); + print \"SET expected = \" int(e / c); + print \"END\"; + } + zero_data(); + } + BEGIN { + zero_data(); + } + /^DEVICE / { + print_device(); + dev = \$2; + } + /^Station/ { c++; } + /^[ \\t]+rx bytes:/ { rb += \$3; } + /^[ \\t]+tx bytes:/ { tb += \$3; } + /^[ \\t]+rx packets:/ { rp += \$3; } + /^[ \\t]+tx packets:/ { tp += \$3; } + /^[ \\t]+tx retries:/ { tr += \$3; } + /^[ \\t]+tx failed:/ { tf += \$3; } + /^[ \\t]+signal:/ { x = \$2; s += x * 1000; } + /^[ \\t]+rx bitrate:/ { x = \$3; rt += x * 1000; } + /^[ \\t]+tx bitrate:/ { x = \$3; tt += x * 1000; } + /^[ \\t]+expected throughput:(.*)Mbps/ { + x=\$3; + sub(/Mbps/, \"\", x); + e += x * 1000; + } + END { + print_device(); + } + " return 0 } diff --git a/charts.d/apache.chart.sh b/charts.d/apache.chart.sh index b503e74e..b503e74e 100755..100644 --- a/charts.d/apache.chart.sh +++ b/charts.d/apache.chart.sh diff --git a/charts.d/apcupsd.chart.sh b/charts.d/apcupsd.chart.sh index 46a86101..46a86101 100755..100644 --- a/charts.d/apcupsd.chart.sh +++ b/charts.d/apcupsd.chart.sh diff --git a/charts.d/cpu_apps.chart.sh b/charts.d/cpu_apps.chart.sh index 8e075831..8e075831 100755..100644 --- a/charts.d/cpu_apps.chart.sh +++ b/charts.d/cpu_apps.chart.sh diff --git a/charts.d/cpufreq.chart.sh b/charts.d/cpufreq.chart.sh index b21504a0..b21504a0 100755..100644 --- a/charts.d/cpufreq.chart.sh +++ b/charts.d/cpufreq.chart.sh diff --git a/charts.d/example.chart.sh b/charts.d/example.chart.sh index 86fde490..86fde490 100755..100644 --- a/charts.d/example.chart.sh +++ b/charts.d/example.chart.sh diff --git a/charts.d/hddtemp.chart.sh b/charts.d/hddtemp.chart.sh index 15895c5e..15895c5e 100755..100644 --- a/charts.d/hddtemp.chart.sh +++ b/charts.d/hddtemp.chart.sh diff --git a/charts.d/load_average.chart.sh b/charts.d/load_average.chart.sh index 70d3aec7..70d3aec7 100755..100644 --- a/charts.d/load_average.chart.sh +++ b/charts.d/load_average.chart.sh diff --git a/charts.d/mem_apps.chart.sh b/charts.d/mem_apps.chart.sh index 3bc65fe2..3bc65fe2 100755..100644 --- a/charts.d/mem_apps.chart.sh +++ b/charts.d/mem_apps.chart.sh diff --git a/charts.d/mysql.chart.sh b/charts.d/mysql.chart.sh index 1363d01f..1363d01f 100755..100644 --- a/charts.d/mysql.chart.sh +++ b/charts.d/mysql.chart.sh diff --git a/charts.d/nginx.chart.sh b/charts.d/nginx.chart.sh index 0ae7d630..0ae7d630 100755..100644 --- a/charts.d/nginx.chart.sh +++ b/charts.d/nginx.chart.sh diff --git a/charts.d/nut.chart.sh b/charts.d/nut.chart.sh index e0b1b4cf..6137639f 100755..100644 --- a/charts.d/nut.chart.sh +++ b/charts.d/nut.chart.sh @@ -2,7 +2,7 @@ # netdata # real-time performance and health monitoring, done right! -# (C) 2016 Costa Tsaousis <costa@tsaousis.gr> +# (C) 2016-2017 Costa Tsaousis <costa@tsaousis.gr> # GPL v3+ # @@ -13,8 +13,13 @@ nut_ups= # how frequently to collect UPS data nut_update_every=2 +# how much time in seconds, to wait for nut to respond nut_timeout=2 +# set this to 1, to enable another chart showing the number +# of UPS clients connected to upsd +nut_clients_chart=0 + # the priority of nut related to other charts nut_priority=90000 @@ -26,6 +31,12 @@ nut_get_all() { nut_get() { run -t $nut_timeout upsc "$1" + + if [ "${nut_clients_chart}" -eq "1" ] + then + printf "ups.connected_clients: " + run -t $nut_timeout upsc -c "$1" | wc -l + fi } nut_check() { @@ -97,6 +108,15 @@ DIMENSION load load absolute 1 100 CHART nut_$x.temp '' "UPS Temperature" "temperature" ups nut.temperature line $((nut_priority + 7)) $nut_update_every DIMENSION temp temp absolute 1 100 EOF + + if [ "${nut_clients_chart}" = "1" ] + then + cat <<EOF2 +CHART nut_$x.clients '' "UPS Connected Clients" "clients" ups nut.clients area $((nut_priority + 8)) $nut_update_every +DIMENSION clients '' absolute 1 1 +EOF2 + fi + done return 0 @@ -131,6 +151,8 @@ BEGIN { output_voltage = 0; load = 0; temp = 0; + client = 0; + do_clients = ${nut_clients_chart}; } /^battery.charge: .*/ { battery_charge = \$2 * 100 }; /^battery.voltage: .*/ { battery_voltage = \$2 * 100 }; @@ -146,6 +168,7 @@ BEGIN { /^output.voltage: .*/ { output_voltage = \$2 * 100 }; /^ups.load: .*/ { load = \$2 * 100 }; /^ups.temperature: .*/ { temp = \$2 * 100 }; +/^ups.connected_clients: .*/ { clients = \$2 }; END { print \"BEGIN nut_$x.charge $1\"; print \"SET battery_charge = \" battery_charge; @@ -184,6 +207,12 @@ END { print \"BEGIN nut_$x.temp $1\"; print \"SET temp = \" temp; print \"END\" + + if(do_clients) { + print \"BEGIN nut_$x.clients $1\"; + print \"SET clients = \" clients; + print \"END\" + } }" [ $? -ne 0 ] && unset nut_ids[$i] && error "failed to get values for '$i', disabling it." done diff --git a/charts.d/opensips.chart.sh b/charts.d/opensips.chart.sh index 2a0249da..2a0249da 100755..100644 --- a/charts.d/opensips.chart.sh +++ b/charts.d/opensips.chart.sh diff --git a/charts.d/phpfpm.chart.sh b/charts.d/phpfpm.chart.sh index a5ee0ad5..a5ee0ad5 100755..100644 --- a/charts.d/phpfpm.chart.sh +++ b/charts.d/phpfpm.chart.sh diff --git a/charts.d/postfix.chart.sh b/charts.d/postfix.chart.sh index 85604fcb..85604fcb 100755..100644 --- a/charts.d/postfix.chart.sh +++ b/charts.d/postfix.chart.sh diff --git a/charts.d/sensors.chart.sh b/charts.d/sensors.chart.sh index 125c925d..125c925d 100755..100644 --- a/charts.d/sensors.chart.sh +++ b/charts.d/sensors.chart.sh diff --git a/charts.d/squid.chart.sh b/charts.d/squid.chart.sh index 2c19c35d..2c19c35d 100755..100644 --- a/charts.d/squid.chart.sh +++ b/charts.d/squid.chart.sh diff --git a/charts.d/tomcat.chart.sh b/charts.d/tomcat.chart.sh index 44a92c86..44a92c86 100755..100644 --- a/charts.d/tomcat.chart.sh +++ b/charts.d/tomcat.chart.sh |