X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=charts.d%2Fopensips.chart.sh;h=2a0249daed4d048082188e325c3894b81111f7d0;hb=b060bae83cc36fdc4f14120228e4c9b0d1ec42e8;hp=60ca728749d991cd18efc9a32ff510b3c3dded9b;hpb=f86722e7a092f5d1c6c7815499bd61866c75045c;p=netdata.git diff --git a/charts.d/opensips.chart.sh b/charts.d/opensips.chart.sh old mode 100755 new mode 100644 index 60ca7287..2a0249da --- a/charts.d/opensips.chart.sh +++ b/charts.d/opensips.chart.sh @@ -1,20 +1,23 @@ -#!/bin/sh +# 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+ +# opensips_opts="fifo get_statistics all" opensips_cmd= opensips_update_every=5 opensips_timeout=2 +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:]]*$" |\ + run -t $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:]]*$" |\ 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=$? @@ -34,7 +37,7 @@ opensips_check() { local x="$(opensips_get_stats | grep "^opensips_core_")" if [ ! $? -eq 0 -o -z "$x" ] then - echo >&2 "$PROGRAM_NAME: opensips: cannot get global status. Please set opensips_opts='options' whatever needed to get connected to opensips server, in $confd/opensips.conf" + error "cannot get global status. Please set opensips_opts='options' whatever needed to get connected to opensips server, in $confd/opensips.conf" return 1 fi @@ -44,103 +47,102 @@ opensips_check() { opensips_create() { # create the charts cat <&2 "$PROGRAM_NAME: opensips: failed to get values, disabling." && return 1 + [ $opensips_command_failed -eq 1 ] && error "failed to get values, disabling." && return 1 # write the result of the work. cat <