summaryrefslogtreecommitdiffstats
path: root/collectors/charts.d.plugin/opensips
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-07 11:45:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-07 11:45:55 +0000
commita8220ab2d293bb7f4b014b79d16b2fb05090fa93 (patch)
tree77f0a30f016c0925cf7ee9292e644bba183c2774 /collectors/charts.d.plugin/opensips
parentAdding upstream version 1.19.0. (diff)
downloadnetdata-a8220ab2d293bb7f4b014b79d16b2fb05090fa93.tar.xz
netdata-a8220ab2d293bb7f4b014b79d16b2fb05090fa93.zip
Adding upstream version 1.29.0.upstream/1.29.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/charts.d.plugin/opensips')
-rw-r--r--collectors/charts.d.plugin/opensips/README.md18
-rw-r--r--collectors/charts.d.plugin/opensips/opensips.chart.sh222
2 files changed, 126 insertions, 114 deletions
diff --git a/collectors/charts.d.plugin/opensips/README.md b/collectors/charts.d.plugin/opensips/README.md
index d41b41120..7575a1dad 100644
--- a/collectors/charts.d.plugin/opensips/README.md
+++ b/collectors/charts.d.plugin/opensips/README.md
@@ -1,7 +1,19 @@
-# OpenSIPS
+<!--
+title: "OpenSIPS monitoring with Netdata"
+custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/charts.d.plugin/opensips/README.md
+sidebar_label: "OpenSIPS"
+-->
-_Under construction_
+# OpenSIPS monitoring with Netdata
-Collects OpenSIPS metrics
+## Configuration
+
+Edit the `charts.d/opensips.conf` configuration file using `edit-config` from the Netdata [config
+directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`.
+
+```bash
+cd /etc/netdata # Replace this path with your Netdata config directory, if different
+sudo ./edit-config charts.d/opensips.conf
+```
[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fopensips%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>)
diff --git a/collectors/charts.d.plugin/opensips/opensips.chart.sh b/collectors/charts.d.plugin/opensips/opensips.chart.sh
index b42462d6d..8ff3e32ef 100644
--- a/collectors/charts.d.plugin/opensips/opensips.chart.sh
+++ b/collectors/charts.d.plugin/opensips/opensips.chart.sh
@@ -14,40 +14,40 @@ 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
+ 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
+ # 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 <<EOF
+ # create the charts
+ cat << EOF
CHART opensips.dialogs_active '' "OpenSIPS Active Dialogs" "dialogs" dialogs '' area $((opensips_priority + 1)) $opensips_update_every
DIMENSION dialog_active_dialogs active absolute 1 1
DIMENSION dialog_early_dialogs early absolute -1 1
@@ -141,91 +141,91 @@ CHART opensips.shmem_fragments '' "OpenSIPS Shared Memory Fragmentation" "fragme
DIMENSION shmem_fragments fragments absolute 1 1
EOF
- return 0
+ return 0
}
opensips_update() {
- # the first argument to this function is the microseconds since last update
- # pass this parameter to the BEGIN statement (see bellow).
-
- # do all the work to collect / calculate the values
- # for each dimension
-
- # 1. get the counters page from opensips
- # 2. sed to remove spaces; replace . with _; remove spaces around =; prepend each line with: local opensips_
- # 3. egrep lines starting with:
- # local opensips_client_http_ then one or more of these a-z 0-9 _ then = and one of more of 0-9
- # local opensips_server_all_ then one or more of these a-z 0-9 _ then = and one of more of 0-9
- # 4. then execute this as a script with the eval
- # be very carefull with eval:
- # prepare the script and always grep at the end the lines that are usefull, so that
- # even if something goes wrong, no other code can be executed
-
- unset \
- opensips_dialog_active_dialogs \
- opensips_dialog_early_dialogs \
- opensips_usrloc_registered_users \
- opensips_usrloc_location_users \
- opensips_usrloc_location_contacts \
- opensips_usrloc_location_expires \
- opensips_registrar_accepted_regs \
- opensips_registrar_rejected_regs \
- opensips_tm_UAS_transactions \
- opensips_tm_UAC_transactions \
- opensips_core_rcv_requests \
- opensips_core_rcv_replies \
- opensips_core_fwd_requests \
- opensips_core_fwd_replies \
- opensips_core_drop_requests \
- opensips_core_drop_replies \
- opensips_core_err_requests \
- opensips_core_err_replies \
- opensips_core_bad_URIs_rcvd \
- opensips_core_unsupported_methods \
- opensips_core_bad_msg_hdr \
- opensips_tm_received_replies \
- opensips_tm_relayed_replies \
- opensips_tm_local_replies \
- opensips_tm_2xx_transactions \
- opensips_tm_3xx_transactions \
- opensips_tm_4xx_transactions \
- opensips_tm_5xx_transactions \
- opensips_tm_6xx_transactions \
- opensips_tm_inuse_transactions \
- opensips_sl_1xx_replies \
- opensips_sl_2xx_replies \
- opensips_sl_3xx_replies \
- opensips_sl_4xx_replies \
- opensips_sl_5xx_replies \
- opensips_sl_6xx_replies \
- opensips_sl_sent_replies \
- opensips_sl_sent_err_replies \
- opensips_sl_received_ACKs \
- opensips_dialog_processed_dialogs \
- opensips_dialog_expired_dialogs \
- opensips_dialog_failed_dialogs \
- opensips_net_waiting_udp \
- opensips_net_waiting_tcp \
- opensips_uri_positive_checks \
- opensips_uri_negative_checks \
- opensips_siptrace_traced_requests \
- opensips_siptrace_traced_replies \
- opensips_shmem_total_size \
- opensips_shmem_used_size \
- opensips_shmem_real_used_size \
- opensips_shmem_max_used_size \
- opensips_shmem_free_size \
- opensips_shmem_fragments
-
- opensips_command_failed=0
- eval "local $(opensips_get_stats)"
- # shellcheck disable=SC2181
- [ $? -ne 0 ] && return 1
-
- [ $opensips_command_failed -eq 1 ] && error "failed to get values, disabling." && return 1
-
- # write the result of the work.
- cat <<VALUESEOF
+ # the first argument to this function is the microseconds since last update
+ # pass this parameter to the BEGIN statement (see bellow).
+
+ # do all the work to collect / calculate the values
+ # for each dimension
+
+ # 1. get the counters page from opensips
+ # 2. sed to remove spaces; replace . with _; remove spaces around =; prepend each line with: local opensips_
+ # 3. egrep lines starting with:
+ # local opensips_client_http_ then one or more of these a-z 0-9 _ then = and one of more of 0-9
+ # local opensips_server_all_ then one or more of these a-z 0-9 _ then = and one of more of 0-9
+ # 4. then execute this as a script with the eval
+ # be very carefull with eval:
+ # prepare the script and always grep at the end the lines that are usefull, so that
+ # even if something goes wrong, no other code can be executed
+
+ unset \
+ opensips_dialog_active_dialogs \
+ opensips_dialog_early_dialogs \
+ opensips_usrloc_registered_users \
+ opensips_usrloc_location_users \
+ opensips_usrloc_location_contacts \
+ opensips_usrloc_location_expires \
+ opensips_registrar_accepted_regs \
+ opensips_registrar_rejected_regs \
+ opensips_tm_UAS_transactions \
+ opensips_tm_UAC_transactions \
+ opensips_core_rcv_requests \
+ opensips_core_rcv_replies \
+ opensips_core_fwd_requests \
+ opensips_core_fwd_replies \
+ opensips_core_drop_requests \
+ opensips_core_drop_replies \
+ opensips_core_err_requests \
+ opensips_core_err_replies \
+ opensips_core_bad_URIs_rcvd \
+ opensips_core_unsupported_methods \
+ opensips_core_bad_msg_hdr \
+ opensips_tm_received_replies \
+ opensips_tm_relayed_replies \
+ opensips_tm_local_replies \
+ opensips_tm_2xx_transactions \
+ opensips_tm_3xx_transactions \
+ opensips_tm_4xx_transactions \
+ opensips_tm_5xx_transactions \
+ opensips_tm_6xx_transactions \
+ opensips_tm_inuse_transactions \
+ opensips_sl_1xx_replies \
+ opensips_sl_2xx_replies \
+ opensips_sl_3xx_replies \
+ opensips_sl_4xx_replies \
+ opensips_sl_5xx_replies \
+ opensips_sl_6xx_replies \
+ opensips_sl_sent_replies \
+ opensips_sl_sent_err_replies \
+ opensips_sl_received_ACKs \
+ opensips_dialog_processed_dialogs \
+ opensips_dialog_expired_dialogs \
+ opensips_dialog_failed_dialogs \
+ opensips_net_waiting_udp \
+ opensips_net_waiting_tcp \
+ opensips_uri_positive_checks \
+ opensips_uri_negative_checks \
+ opensips_siptrace_traced_requests \
+ opensips_siptrace_traced_replies \
+ opensips_shmem_total_size \
+ opensips_shmem_used_size \
+ opensips_shmem_real_used_size \
+ opensips_shmem_max_used_size \
+ opensips_shmem_free_size \
+ opensips_shmem_fragments
+
+ opensips_command_failed=0
+ eval "local $(opensips_get_stats)"
+ # shellcheck disable=SC2181
+ [ $? -ne 0 ] && return 1
+
+ [ $opensips_command_failed -eq 1 ] && error "failed to get values, disabling." && return 1
+
+ # write the result of the work.
+ cat << VALUESEOF
BEGIN opensips.dialogs_active $1
SET dialog_active_dialogs = $opensips_dialog_active_dialogs
SET dialog_early_dialogs = $opensips_dialog_early_dialogs
@@ -320,5 +320,5 @@ SET shmem_fragments = $opensips_shmem_fragments
END
VALUESEOF
- return 0
+ return 0
}