# shellcheck shell=bash disable=SC1117,SC2154,SC2086 # no need for shebang - this file is loaded from charts.d.plugin # SPDX-License-Identifier: GPL-3.0-or-later # netdata # real-time performance and health monitoring, done right! # (C) 2016 Costa Tsaousis # opensips_opts="fifo get_statistics all" opensips_cmd= opensips_update_every=5 opensips_timeout=2 opensips_priority=80000 opensips_get_stats() { 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|[[:space:]]*[=:]\+[[:space:]]*\([0-9]\+\)[[:space:]]*$|=\1|g" \ -e "s|[[:space:]:-]\+|_|g" \ -e "s|^|opensips_|g" local ret=$? [ $ret -ne 0 ] && echo "opensips_command_failed=1" return $ret } opensips_check() { # if the user did not provide an opensips_cmd # try to find it in the system if [ -z "$opensips_cmd" ]; then require_cmd opensipsctl || return 1 fi # check once if the command works local x x="$(opensips_get_stats | grep "^opensips_core_")" # shellcheck disable=SC2181 if [ ! $? -eq 0 ] || [ -z "$x" ]; then 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 return 0 } opensips_create() { # create the charts cat <