From 87649cf32bd0e14d5a903fb85b01e9f41a253540 Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Wed, 23 Nov 2016 15:49:10 +0000 Subject: New upstream version 1.4.0+dfsg --- charts.d/Makefile.am | 1 + charts.d/Makefile.in | 13 +++- charts.d/apcupsd.chart.sh | 152 +++++++++++++++++++++++++++++++++++++++++++++ charts.d/example.chart.sh | 4 +- charts.d/opensips.chart.sh | 10 +-- 5 files changed, 169 insertions(+), 11 deletions(-) create mode 100755 charts.d/apcupsd.chart.sh (limited to 'charts.d') diff --git a/charts.d/Makefile.am b/charts.d/Makefile.am index e131d508f..ec0e101f3 100644 --- a/charts.d/Makefile.am +++ b/charts.d/Makefile.am @@ -5,6 +5,7 @@ MAINTAINERCLEANFILES= $(srcdir)/Makefile.in dist_charts_SCRIPTS = \ ap.chart.sh \ + apcupsd.chart.sh \ apache.chart.sh \ cpu_apps.chart.sh \ cpufreq.chart.sh \ diff --git a/charts.d/Makefile.in b/charts.d/Makefile.in index 5dfb3cc4b..fabbb6dde 100644 --- a/charts.d/Makefile.in +++ b/charts.d/Makefile.in @@ -83,8 +83,13 @@ subdir = charts.d DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(dist_charts_SCRIPTS) $(dist_charts_DATA) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___atomic.m4 \ + $(top_srcdir)/m4/ax_c__generic.m4 \ + $(top_srcdir)/m4/ax_c_mallinfo.m4 \ + $(top_srcdir)/m4/ax_c_mallopt.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/jemalloc.m4 \ + $(top_srcdir)/m4/tcmalloc.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -208,6 +213,7 @@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SSE_CANDIDATE = @SSE_CANDIDATE@ STRIP = @STRIP@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ @@ -240,6 +246,8 @@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +has_jemalloc = @has_jemalloc@ +has_tcmalloc = @has_tcmalloc@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -282,6 +290,7 @@ webdir = @webdir@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in dist_charts_SCRIPTS = \ ap.chart.sh \ + apcupsd.chart.sh \ apache.chart.sh \ cpu_apps.chart.sh \ cpufreq.chart.sh \ diff --git a/charts.d/apcupsd.chart.sh b/charts.d/apcupsd.chart.sh new file mode 100755 index 000000000..df18aaa2e --- /dev/null +++ b/charts.d/apcupsd.chart.sh @@ -0,0 +1,152 @@ +# no need for shebang - this file is loaded from charts.d.plugin + +apcupsd_ip=127.0.0.1 +apcupsd_port=3551 + +# how frequently to collect UPS data +apcupsd_update_every=10 + +apcupsd_timeout=3 + +# the priority of apcupsd related to other charts +apcupsd_priority=90000 + +apcupsd_get() { + timeout $apcupsd_timeout apcaccess status "$1:$2" +} + +apcupsd_check() { + + # this should return: + # - 0 to enable the chart + # - 1 to disable the chart + + require_cmd apcaccess || return 1 + + apcupsd_get $apcupsd_ip $apcupsd_port >/dev/null + if [ $? -ne 0 ] + then + echo >&2 "apcupsd: ERROR: Cannot get information for apcupsd server." + return 1 + elif [ $(apcupsd_get $apcupsd_ip $apcupsd_port | awk '/^STATUS.*/{ print $3 }') != "ONLINE" ] + then + echo >&2 "apcupsd: ERROR: UPS not online." + return 1 + fi + + return 0 +} + +apcupsd_create() { + # create the charts + cat <&2 "apcupsd: failed to get values" && return 1 + + return 0 +} diff --git a/charts.d/example.chart.sh b/charts.d/example.chart.sh index 1f020dee2..93f1cf4fd 100755 --- a/charts.d/example.chart.sh +++ b/charts.d/example.chart.sh @@ -48,8 +48,8 @@ example_get() { else example_count=$((1 + (RANDOM * 5 / 32767) )) - [ $example_last -gt 16383 -a $example_value4 -gt 16383 ] && example_value4=$((value4 - 16383)) - [ $example_last -le 16383 -a $example_value4 -lt 16383 ] && example_value4=$((value4 + 16383)) + [ $example_last -gt 16383 -a $example_value4 -gt 16383 ] && example_value4=$((example_value4 - 16383)) + [ $example_last -le 16383 -a $example_value4 -lt 16383 ] && example_value4=$((example_value4 + 16383)) fi example_last=$example_value4 diff --git a/charts.d/opensips.chart.sh b/charts.d/opensips.chart.sh index ce42ccdd7..779087e35 100755 --- a/charts.d/opensips.chart.sh +++ b/charts.d/opensips.chart.sh @@ -8,14 +8,10 @@ opensips_priority=80000 opensips_get_stats() { timeout $opensips_timeout "$opensips_cmd" $opensips_opts |\ - grep "^\(core\|dialog\|net\|registrar\|shmem\|siptrace\|sl\|tm\|uri\|usrloc\):[a-zA-Z0-9_ -]\+[[:space:]]*=[[:space:]]*[0-9]\+[[:space:]]*$" |\ + grep "^\(core\|dialog\|net\|registrar\|shmem\|siptrace\|sl\|tm\|uri\|usrloc\):[a-zA-Z0-9_-]\+[[:space:]]*[=:]\+[[:space:]]*[0-9]\+[[:space:]]*$" |\ sed \ - -e "s|-|_|g" \ - -e "s|:|_|g" \ - -e "s|[[:space:]]\+=[[:space:]]\+|=|g" \ - -e "s|[[:space:]]\+$||" \ - -e "s|^[[:space:]]\+||" \ - -e "s|[[:space:]]\+|_|" \ + -e "s|[[:space:]]*[=:]\+[[:space:]]*\([0-9]\+\)[[:space:]]*$|=\1|g" \ + -e "s|[[:space:]:-]\+|_|g" \ -e "s|^|opensips_|g" local ret=$? -- cgit v1.2.3