From b485aab7e71c1625cfc27e0f92c9509f42378458 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 13:19:16 +0200 Subject: Adding upstream version 1.45.3+dfsg. Signed-off-by: Daniel Baumann --- src/collectors/charts.d.plugin/opensips/README.md | 1 + .../opensips/integrations/opensips.md | 192 ++++++++++++ .../charts.d.plugin/opensips/metadata.yaml | 270 +++++++++++++++++ .../charts.d.plugin/opensips/opensips.chart.sh | 325 +++++++++++++++++++++ .../charts.d.plugin/opensips/opensips.conf | 21 ++ 5 files changed, 809 insertions(+) create mode 120000 src/collectors/charts.d.plugin/opensips/README.md create mode 100644 src/collectors/charts.d.plugin/opensips/integrations/opensips.md create mode 100644 src/collectors/charts.d.plugin/opensips/metadata.yaml create mode 100644 src/collectors/charts.d.plugin/opensips/opensips.chart.sh create mode 100644 src/collectors/charts.d.plugin/opensips/opensips.conf (limited to 'src/collectors/charts.d.plugin/opensips') diff --git a/src/collectors/charts.d.plugin/opensips/README.md b/src/collectors/charts.d.plugin/opensips/README.md new file mode 120000 index 000000000..bb85ba6d0 --- /dev/null +++ b/src/collectors/charts.d.plugin/opensips/README.md @@ -0,0 +1 @@ +integrations/opensips.md \ No newline at end of file diff --git a/src/collectors/charts.d.plugin/opensips/integrations/opensips.md b/src/collectors/charts.d.plugin/opensips/integrations/opensips.md new file mode 100644 index 000000000..6a6a309e8 --- /dev/null +++ b/src/collectors/charts.d.plugin/opensips/integrations/opensips.md @@ -0,0 +1,192 @@ + + +# OpenSIPS + + + + + +Plugin: charts.d.plugin +Module: opensips + + + +## Overview + +Examine OpenSIPS metrics for insights into SIP server operations. Study call rates, error rates, and response times for reliable voice over IP services. + +The collector uses the `opensipsctl` command line utility to gather OpenSIPS metrics. + +This collector is supported on all platforms. + +This collector supports collecting metrics from multiple instances of this integration, including remote instances. + + +### Default Behavior + +#### Auto-Detection + +The collector will attempt to call `opensipsctl` along with a default number of parameters, even without any configuration. + +#### Limits + +The default configuration for this integration does not impose any limits on data collection. + +#### Performance Impact + +The default configuration for this integration is not expected to impose a significant performance impact on the system. + + +## Metrics + +Metrics grouped by *scope*. + +The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. + + + +### Per OpenSIPS instance + +These metrics refer to the entire monitored application. + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | +|:------|:----------|:----| +| opensips.dialogs_active | active, early | dialogs | +| opensips.users | registered, location, contacts, expires | users | +| opensips.registrar | accepted, rejected | registrations/s | +| opensips.transactions | UAS, UAC | transactions/s | +| opensips.core_rcv | requests, replies | queries/s | +| opensips.core_fwd | requests, replies | queries/s | +| opensips.core_drop | requests, replies | queries/s | +| opensips.core_err | requests, replies | queries/s | +| opensips.core_bad | bad_URIs_rcvd, unsupported_methods, bad_msg_hdr | queries/s | +| opensips.tm_replies | received, relayed, local | replies/s | +| opensips.transactions_status | 2xx, 3xx, 4xx, 5xx, 6xx | transactions/s | +| opensips.transactions_inuse | inuse | transactions | +| opensips.sl_replies | 1xx, 2xx, 3xx, 4xx, 5xx, 6xx, sent, error, ACKed | replies/s | +| opensips.dialogs | processed, expire, failed | dialogs/s | +| opensips.net_waiting | UDP, TCP | kilobytes | +| opensips.uri_checks | positive, negative | checks / sec | +| opensips.traces | requests, replies | traces / sec | +| opensips.shmem | total, used, real_used, max_used, free | kilobytes | +| opensips.shmem_fragment | fragments | fragments | + + + +## Alerts + +There are no alerts configured by default for this integration. + + +## Setup + +### Prerequisites + +#### Install charts.d plugin + +If [using our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. + + +#### Required software + +The collector requires the `opensipsctl` to be installed. + + +### Configuration + +#### File + +The configuration file name for this integration is `charts.d/opensips.conf`. + + +You can edit the configuration file using the `edit-config` script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md#the-netdata-config-directory). + +```bash +cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata +sudo ./edit-config charts.d/opensips.conf +``` +#### Options + +The config file is sourced by the charts.d plugin. It's a standard bash file. + +The following collapsed table contains all the options that can be configured for the opensips collector. + + +
Config options + +| Name | Description | Default | Required | +|:----|:-----------|:-------|:--------:| +| opensips_opts | Specify parameters to the `opensipsctl` command. If the default value fails to get global status, set here whatever options are needed to connect to the opensips server. | fifo get_statistics all | no | +| opensips_cmd | If `opensipsctl` is not in $PATH, specify it's full path here. | | no | +| opensips_timeout | How long to wait for `opensipsctl` to respond. | 2 | no | +| opensips_update_every | The data collection frequency. If unset, will inherit the netdata update frequency. | 5 | no | +| opensips_priority | The charts priority on the dashboard. | 80000 | no | +| opensips_retries | The number of retries to do in case of failure before disabling the collector. | 10 | no | + +
+ +#### Examples + +##### Custom `opensipsctl` command + +Set a custom path to the `opensipsctl` command + +```yaml +#opensips_opts="fifo get_statistics all" +opensips_cmd=/opt/opensips/bin/opensipsctl +#opensips_timeout=2 + +# the data collection frequency +# if unset, will inherit the netdata update frequency +#opensips_update_every=5 + +# the charts priority on the dashboard +#opensips_priority=80000 + +# the number of retries to do in case of failure +# before disabling the module +#opensips_retries=10 + +``` + + +## Troubleshooting + +### Debug Mode + +To troubleshoot issues with the `opensips` collector, run the `charts.d.plugin` with the debug option enabled. The output +should give you clues as to why the collector isn't working. + +- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on + your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. + + ```bash + cd /usr/libexec/netdata/plugins.d/ + ``` + +- Switch to the `netdata` user. + + ```bash + sudo -u netdata -s + ``` + +- Run the `charts.d.plugin` to debug the collector: + + ```bash + ./charts.d.plugin debug 1 opensips + ``` + + diff --git a/src/collectors/charts.d.plugin/opensips/metadata.yaml b/src/collectors/charts.d.plugin/opensips/metadata.yaml new file mode 100644 index 000000000..356de5615 --- /dev/null +++ b/src/collectors/charts.d.plugin/opensips/metadata.yaml @@ -0,0 +1,270 @@ +plugin_name: charts.d.plugin +modules: + - meta: + plugin_name: charts.d.plugin + module_name: opensips + monitored_instance: + name: OpenSIPS + link: "https://opensips.org/" + categories: + - data-collection.telephony-servers + icon_filename: "opensips.png" + related_resources: + integrations: + list: [] + info_provided_to_referring_integrations: + description: "" + keywords: + - opensips + - sip + - voice + - video + - stream + most_popular: false + overview: + data_collection: + metrics_description: "Examine OpenSIPS metrics for insights into SIP server operations. Study call rates, error rates, and response times for reliable voice over IP services." + method_description: "The collector uses the `opensipsctl` command line utility to gather OpenSIPS metrics." + supported_platforms: + include: [] + exclude: [] + multi_instance: true + additional_permissions: + description: "" + default_behavior: + auto_detection: + description: "The collector will attempt to call `opensipsctl` along with a default number of parameters, even without any configuration." + limits: + description: "" + performance_impact: + description: "" + setup: + prerequisites: + list: + - title: "Install charts.d plugin" + description: | + If [using our official native DEB/RPM packages](https://github.com/netdata/netdata/blob/master/packaging/installer/UPDATE.md#determine-which-installation-method-you-used), make sure `netdata-plugin-chartsd` is installed. + - title: "Required software" + description: "The collector requires the `opensipsctl` to be installed." + configuration: + file: + name: charts.d/opensips.conf + options: + description: | + The config file is sourced by the charts.d plugin. It's a standard bash file. + + The following collapsed table contains all the options that can be configured for the opensips collector. + folding: + title: "Config options" + enabled: true + list: + - name: opensips_opts + description: Specify parameters to the `opensipsctl` command. If the default value fails to get global status, set here whatever options are needed to connect to the opensips server. + default_value: "fifo get_statistics all" + required: false + - name: opensips_cmd + description: If `opensipsctl` is not in $PATH, specify it's full path here. + default_value: "" + required: false + - name: opensips_timeout + description: How long to wait for `opensipsctl` to respond. + default_value: 2 + required: false + - name: opensips_update_every + description: The data collection frequency. If unset, will inherit the netdata update frequency. + default_value: 5 + required: false + - name: opensips_priority + description: The charts priority on the dashboard. + default_value: 80000 + required: false + - name: opensips_retries + description: The number of retries to do in case of failure before disabling the collector. + default_value: 10 + required: false + examples: + folding: + enabled: false + title: "Config" + list: + - name: Custom `opensipsctl` command + description: Set a custom path to the `opensipsctl` command + config: | + #opensips_opts="fifo get_statistics all" + opensips_cmd=/opt/opensips/bin/opensipsctl + #opensips_timeout=2 + + # the data collection frequency + # if unset, will inherit the netdata update frequency + #opensips_update_every=5 + + # the charts priority on the dashboard + #opensips_priority=80000 + + # the number of retries to do in case of failure + # before disabling the module + #opensips_retries=10 + troubleshooting: + problems: + list: [] + alerts: [] + metrics: + folding: + title: Metrics + enabled: false + description: "" + availability: [] + scopes: + - name: global + description: "These metrics refer to the entire monitored application." + labels: [] + metrics: + - name: opensips.dialogs_active + description: OpenSIPS Active Dialogs + unit: "dialogs" + chart_type: area + dimensions: + - name: active + - name: early + - name: opensips.users + description: OpenSIPS Users + unit: "users" + chart_type: line + dimensions: + - name: registered + - name: location + - name: contacts + - name: expires + - name: opensips.registrar + description: OpenSIPS Registrar + unit: "registrations/s" + chart_type: line + dimensions: + - name: accepted + - name: rejected + - name: opensips.transactions + description: OpenSIPS Transactions + unit: "transactions/s" + chart_type: line + dimensions: + - name: UAS + - name: UAC + - name: opensips.core_rcv + description: OpenSIPS Core Receives + unit: "queries/s" + chart_type: line + dimensions: + - name: requests + - name: replies + - name: opensips.core_fwd + description: OpenSIPS Core Forwards + unit: "queries/s" + chart_type: line + dimensions: + - name: requests + - name: replies + - name: opensips.core_drop + description: OpenSIPS Core Drops + unit: "queries/s" + chart_type: line + dimensions: + - name: requests + - name: replies + - name: opensips.core_err + description: OpenSIPS Core Errors + unit: "queries/s" + chart_type: line + dimensions: + - name: requests + - name: replies + - name: opensips.core_bad + description: OpenSIPS Core Bad + unit: "queries/s" + chart_type: line + dimensions: + - name: bad_URIs_rcvd + - name: unsupported_methods + - name: bad_msg_hdr + - name: opensips.tm_replies + description: OpenSIPS TM Replies + unit: "replies/s" + chart_type: line + dimensions: + - name: received + - name: relayed + - name: local + - name: opensips.transactions_status + description: OpenSIPS Transactions Status + unit: "transactions/s" + chart_type: line + dimensions: + - name: 2xx + - name: 3xx + - name: 4xx + - name: 5xx + - name: 6xx + - name: opensips.transactions_inuse + description: OpenSIPS InUse Transactions + unit: "transactions" + chart_type: line + dimensions: + - name: inuse + - name: opensips.sl_replies + description: OpenSIPS SL Replies + unit: "replies/s" + chart_type: line + dimensions: + - name: 1xx + - name: 2xx + - name: 3xx + - name: 4xx + - name: 5xx + - name: 6xx + - name: sent + - name: error + - name: ACKed + - name: opensips.dialogs + description: OpenSIPS Dialogs + unit: "dialogs/s" + chart_type: line + dimensions: + - name: processed + - name: expire + - name: failed + - name: opensips.net_waiting + description: OpenSIPS Network Waiting + unit: "kilobytes" + chart_type: line + dimensions: + - name: UDP + - name: TCP + - name: opensips.uri_checks + description: OpenSIPS URI Checks + unit: "checks / sec" + chart_type: line + dimensions: + - name: positive + - name: negative + - name: opensips.traces + description: OpenSIPS Traces + unit: "traces / sec" + chart_type: line + dimensions: + - name: requests + - name: replies + - name: opensips.shmem + description: OpenSIPS Shared Memory + unit: "kilobytes" + chart_type: line + dimensions: + - name: total + - name: used + - name: real_used + - name: max_used + - name: free + - name: opensips.shmem_fragment + description: OpenSIPS Shared Memory Fragmentation + unit: "fragments" + chart_type: line + dimensions: + - name: fragments diff --git a/src/collectors/charts.d.plugin/opensips/opensips.chart.sh b/src/collectors/charts.d.plugin/opensips/opensips.chart.sh new file mode 100644 index 000000000..02401fd59 --- /dev/null +++ b/src/collectors/charts.d.plugin/opensips/opensips.chart.sh @@ -0,0 +1,325 @@ +# 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 + opensips_cmd="$OPENSIPSCTL_CMD" + 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 +CHART opensips.dialogs_active '' "OpenSIPS Active Dialogs" "dialogs" dialogs '' area $((opensips_priority + 1)) $opensips_update_every '' '' 'opensips' +DIMENSION dialog_active_dialogs active absolute 1 1 +DIMENSION dialog_early_dialogs early absolute -1 1 + +CHART opensips.users '' "OpenSIPS Users" "users" users '' line $((opensips_priority + 2)) $opensips_update_every '' '' 'opensips' +DIMENSION usrloc_registered_users registered absolute 1 1 +DIMENSION usrloc_location_users location absolute 1 1 +DIMENSION usrloc_location_contacts contacts absolute 1 1 +DIMENSION usrloc_location_expires expires incremental -1 1 + +CHART opensips.registrar '' "OpenSIPS Registrar" "registrations/s" registrar '' line $((opensips_priority + 3)) $opensips_update_every '' '' 'opensips' +DIMENSION registrar_accepted_regs accepted incremental 1 1 +DIMENSION registrar_rejected_regs rejected incremental -1 1 + +CHART opensips.transactions '' "OpenSIPS Transactions" "transactions/s" transactions '' line $((opensips_priority + 4)) $opensips_update_every '' '' 'opensips' +DIMENSION tm_UAS_transactions UAS incremental 1 1 +DIMENSION tm_UAC_transactions UAC incremental -1 1 + +CHART opensips.core_rcv '' "OpenSIPS Core Receives" "queries/s" core '' line $((opensips_priority + 5)) $opensips_update_every '' '' 'opensips' +DIMENSION core_rcv_requests requests incremental 1 1 +DIMENSION core_rcv_replies replies incremental -1 1 + +CHART opensips.core_fwd '' "OpenSIPS Core Forwards" "queries/s" core '' line $((opensips_priority + 6)) $opensips_update_every '' '' 'opensips' +DIMENSION core_fwd_requests requests incremental 1 1 +DIMENSION core_fwd_replies replies incremental -1 1 + +CHART opensips.core_drop '' "OpenSIPS Core Drops" "queries/s" core '' line $((opensips_priority + 7)) $opensips_update_every '' '' 'opensips' +DIMENSION core_drop_requests requests incremental 1 1 +DIMENSION core_drop_replies replies incremental -1 1 + +CHART opensips.core_err '' "OpenSIPS Core Errors" "queries/s" core '' line $((opensips_priority + 8)) $opensips_update_every '' '' 'opensips' +DIMENSION core_err_requests requests incremental 1 1 +DIMENSION core_err_replies replies incremental -1 1 + +CHART opensips.core_bad '' "OpenSIPS Core Bad" "queries/s" core '' line $((opensips_priority + 9)) $opensips_update_every '' '' 'opensips' +DIMENSION core_bad_URIs_rcvd bad_URIs_rcvd incremental 1 1 +DIMENSION core_unsupported_methods unsupported_methods incremental 1 1 +DIMENSION core_bad_msg_hdr bad_msg_hdr incremental 1 1 + +CHART opensips.tm_replies '' "OpenSIPS TM Replies" "replies/s" transactions '' line $((opensips_priority + 10)) $opensips_update_every '' '' 'opensips' +DIMENSION tm_received_replies received incremental 1 1 +DIMENSION tm_relayed_replies relayed incremental 1 1 +DIMENSION tm_local_replies local incremental 1 1 + +CHART opensips.transactions_status '' "OpenSIPS Transactions Status" "transactions/s" transactions '' line $((opensips_priority + 11)) $opensips_update_every '' '' 'opensips' +DIMENSION tm_2xx_transactions 2xx incremental 1 1 +DIMENSION tm_3xx_transactions 3xx incremental 1 1 +DIMENSION tm_4xx_transactions 4xx incremental 1 1 +DIMENSION tm_5xx_transactions 5xx incremental 1 1 +DIMENSION tm_6xx_transactions 6xx incremental 1 1 + +CHART opensips.transactions_inuse '' "OpenSIPS InUse Transactions" "transactions" transactions '' line $((opensips_priority + 12)) $opensips_update_every '' '' 'opensips' +DIMENSION tm_inuse_transactions inuse absolute 1 1 + +CHART opensips.sl_replies '' "OpenSIPS SL Replies" "replies/s" core '' line $((opensips_priority + 13)) $opensips_update_every '' '' 'opensips' +DIMENSION sl_1xx_replies 1xx incremental 1 1 +DIMENSION sl_2xx_replies 2xx incremental 1 1 +DIMENSION sl_3xx_replies 3xx incremental 1 1 +DIMENSION sl_4xx_replies 4xx incremental 1 1 +DIMENSION sl_5xx_replies 5xx incremental 1 1 +DIMENSION sl_6xx_replies 6xx incremental 1 1 +DIMENSION sl_sent_replies sent incremental 1 1 +DIMENSION sl_sent_err_replies error incremental 1 1 +DIMENSION sl_received_ACKs ACKed incremental 1 1 + +CHART opensips.dialogs '' "OpenSIPS Dialogs" "dialogs/s" dialogs '' line $((opensips_priority + 14)) $opensips_update_every '' '' 'opensips' +DIMENSION dialog_processed_dialogs processed incremental 1 1 +DIMENSION dialog_expired_dialogs expired incremental 1 1 +DIMENSION dialog_failed_dialogs failed incremental -1 1 + +CHART opensips.net_waiting '' "OpenSIPS Network Waiting" "kilobytes" net '' line $((opensips_priority + 15)) $opensips_update_every '' '' 'opensips' +DIMENSION net_waiting_udp UDP absolute 1 1024 +DIMENSION net_waiting_tcp TCP absolute 1 1024 + +CHART opensips.uri_checks '' "OpenSIPS URI Checks" "checks / sec" uri '' line $((opensips_priority + 16)) $opensips_update_every '' '' 'opensips' +DIMENSION uri_positive_checks positive incremental 1 1 +DIMENSION uri_negative_checks negative incremental -1 1 + +CHART opensips.traces '' "OpenSIPS Traces" "traces / sec" traces '' line $((opensips_priority + 17)) $opensips_update_every '' '' 'opensips' +DIMENSION siptrace_traced_requests requests incremental 1 1 +DIMENSION siptrace_traced_replies replies incremental -1 1 + +CHART opensips.shmem '' "OpenSIPS Shared Memory" "kilobytes" mem '' line $((opensips_priority + 18)) $opensips_update_every '' '' 'opensips' +DIMENSION shmem_total_size total absolute 1 1024 +DIMENSION shmem_used_size used absolute 1 1024 +DIMENSION shmem_real_used_size real_used absolute 1 1024 +DIMENSION shmem_max_used_size max_used absolute 1 1024 +DIMENSION shmem_free_size free absolute 1 1024 + +CHART opensips.shmem_fragments '' "OpenSIPS Shared Memory Fragmentation" "fragments" mem '' line $((opensips_priority + 19)) $opensips_update_every '' '' 'opensips' +DIMENSION shmem_fragments fragments absolute 1 1 +EOF + + return 0 +} + +opensips_update() { + # the first argument to this function is the microseconds since last update + # pass this parameter to the BEGIN statement (see below). + + # 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 careful with eval: + # prepare the script and always grep at the end the lines that are useful, 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 +END +BEGIN opensips.users $1 +SET usrloc_registered_users = $opensips_usrloc_registered_users +SET usrloc_location_users = $opensips_usrloc_location_users +SET usrloc_location_contacts = $opensips_usrloc_location_contacts +SET usrloc_location_expires = $opensips_usrloc_location_expires +END +BEGIN opensips.registrar $1 +SET registrar_accepted_regs = $opensips_registrar_accepted_regs +SET registrar_rejected_regs = $opensips_registrar_rejected_regs +END +BEGIN opensips.transactions $1 +SET tm_UAS_transactions = $opensips_tm_UAS_transactions +SET tm_UAC_transactions = $opensips_tm_UAC_transactions +END +BEGIN opensips.core_rcv $1 +SET core_rcv_requests = $opensips_core_rcv_requests +SET core_rcv_replies = $opensips_core_rcv_replies +END +BEGIN opensips.core_fwd $1 +SET core_fwd_requests = $opensips_core_fwd_requests +SET core_fwd_replies = $opensips_core_fwd_replies +END +BEGIN opensips.core_drop $1 +SET core_drop_requests = $opensips_core_drop_requests +SET core_drop_replies = $opensips_core_drop_replies +END +BEGIN opensips.core_err $1 +SET core_err_requests = $opensips_core_err_requests +SET core_err_replies = $opensips_core_err_replies +END +BEGIN opensips.core_bad $1 +SET core_bad_URIs_rcvd = $opensips_core_bad_URIs_rcvd +SET core_unsupported_methods = $opensips_core_unsupported_methods +SET core_bad_msg_hdr = $opensips_core_bad_msg_hdr +END +BEGIN opensips.tm_replies $1 +SET tm_received_replies = $opensips_tm_received_replies +SET tm_relayed_replies = $opensips_tm_relayed_replies +SET tm_local_replies = $opensips_tm_local_replies +END +BEGIN opensips.transactions_status $1 +SET tm_2xx_transactions = $opensips_tm_2xx_transactions +SET tm_3xx_transactions = $opensips_tm_3xx_transactions +SET tm_4xx_transactions = $opensips_tm_4xx_transactions +SET tm_5xx_transactions = $opensips_tm_5xx_transactions +SET tm_6xx_transactions = $opensips_tm_6xx_transactions +END +BEGIN opensips.transactions_inuse $1 +SET tm_inuse_transactions = $opensips_tm_inuse_transactions +END +BEGIN opensips.sl_replies $1 +SET sl_1xx_replies = $opensips_sl_1xx_replies +SET sl_2xx_replies = $opensips_sl_2xx_replies +SET sl_3xx_replies = $opensips_sl_3xx_replies +SET sl_4xx_replies = $opensips_sl_4xx_replies +SET sl_5xx_replies = $opensips_sl_5xx_replies +SET sl_6xx_replies = $opensips_sl_6xx_replies +SET sl_sent_replies = $opensips_sl_sent_replies +SET sl_sent_err_replies = $opensips_sl_sent_err_replies +SET sl_received_ACKs = $opensips_sl_received_ACKs +END +BEGIN opensips.dialogs $1 +SET dialog_processed_dialogs = $opensips_dialog_processed_dialogs +SET dialog_expired_dialogs = $opensips_dialog_expired_dialogs +SET dialog_failed_dialogs = $opensips_dialog_failed_dialogs +END +BEGIN opensips.net_waiting $1 +SET net_waiting_udp = $opensips_net_waiting_udp +SET net_waiting_tcp = $opensips_net_waiting_tcp +END +BEGIN opensips.uri_checks $1 +SET uri_positive_checks = $opensips_uri_positive_checks +SET uri_negative_checks = $opensips_uri_negative_checks +END +BEGIN opensips.traces $1 +SET siptrace_traced_requests = $opensips_siptrace_traced_requests +SET siptrace_traced_replies = $opensips_siptrace_traced_replies +END +BEGIN opensips.shmem $1 +SET shmem_total_size = $opensips_shmem_total_size +SET shmem_used_size = $opensips_shmem_used_size +SET shmem_real_used_size = $opensips_shmem_real_used_size +SET shmem_max_used_size = $opensips_shmem_max_used_size +SET shmem_free_size = $opensips_shmem_free_size +END +BEGIN opensips.shmem_fragments $1 +SET shmem_fragments = $opensips_shmem_fragments +END +VALUESEOF + + return 0 +} diff --git a/src/collectors/charts.d.plugin/opensips/opensips.conf b/src/collectors/charts.d.plugin/opensips/opensips.conf new file mode 100644 index 000000000..e25111dce --- /dev/null +++ b/src/collectors/charts.d.plugin/opensips/opensips.conf @@ -0,0 +1,21 @@ +# no need for shebang - this file is loaded from charts.d.plugin + +# netdata +# real-time performance and health monitoring, done right! +# (C) 2018 Costa Tsaousis +# GPL v3+ + +#opensips_opts="fifo get_statistics all" +#opensips_cmd= +#opensips_timeout=2 + +# the data collection frequency +# if unset, will inherit the netdata update frequency +#opensips_update_every=5 + +# the charts priority on the dashboard +#opensips_priority=80000 + +# the number of retries to do in case of failure +# before disabling the module +#opensips_retries=10 -- cgit v1.2.3