Browse Source

feat(statsd.plugin): add Asterisk configuration file with synthetic charts (#12381)

Ilya Mashchenko 3 years ago
parent
commit
300575a168

+ 1 - 0
collectors/statsd.plugin/Makefile.am

@@ -11,6 +11,7 @@ statsdconfigdir=$(libconfigdir)/statsd.d
 dist_statsdconfig_DATA = \
     example.conf \
     k6.conf \
+    asterisk.conf \
     $(NULL)
 
 userstatsdconfigdir=$(configdir)/statsd.d

+ 4 - 0
collectors/statsd.plugin/README.md

@@ -27,6 +27,10 @@ On these charts, we can have alarms as with any metric and chart.
   - **Description:** k6 is a developer-centric, free and open-source load testing tool built for making performance testing a productive and enjoyable experience.
   - [Documentation](/collectors/statsd.plugin/k6.md)
   - [Configuration](https://github.com/netdata/netdata/blob/master/collectors/statsd.plugin/k6.conf)
+- [Asterisk](https://www.asterisk.org/)
+  - **Description:** Asterisk is an Open Source PBX and telephony toolkit.
+  - [Documentation](/collectors/statsd.plugin/asterisk.md)
+  - [Configuration](https://github.com/netdata/netdata/blob/master/collectors/statsd.plugin/asterisk.conf)
 
 ## Metrics supported by Netdata
 

+ 208 - 0
collectors/statsd.plugin/asterisk.conf

@@ -0,0 +1,208 @@
+[app]
+	name = asterisk
+	metrics = asterisk.*
+	private charts = yes
+	gaps when not collected = no
+
+[dictionary]
+	# https://www.voip-info.org/asterisk-variable-hangupcause/
+	q931.1 = unallocated 1
+	q931.2 = no route transit net 2
+	q931.3 = no route destination 3
+	q931.6 = channel unacceptable 6
+	q931.7 = call awarded delivered 7
+	q931.16 = normal 16
+	q931.17 = busy 17
+	q931.18 = no response 18
+	q931.19 = no answer 19
+	q931.21 = rejected call 21
+	q931.22 = number changed 22
+	q931.27 = dst out of order 27
+	q931.28 = invalid number 28
+	q931.29 = rejected facility 29
+	q931.30 = response to status 30
+	q931.31 = normal unspecified 31
+	q931.34 = congestion circuit 34
+	q931.38 = net out of order 38
+	q931.41 = normal tmp fail 41
+	q931.42 = congestion switch 42
+	q931.43 = access info discarded 43
+	q931.44 = requested chan unavail 44
+	q931.45 = pre empted 45
+	q931.47 = resource unavailable, unspecified 47
+	q931.50 = facility not subscribed 50
+	q931.52 = outgoing call barred 52
+	q931.54 = incoming call barred 54
+	q931.57 = bearer capability not auth 57
+	q931.58 = bearer capability not avail 58
+	q931.65 = bearer capability not implemented 65
+	q931.66 = chan not implemented 66
+	q931.69 = facility not implemented 67
+	q931.81 = invalid call reference 81
+	q931.88 = incompatible destination 88
+	q931.95 = invalid msg specified 95
+	q931.96 = mandatory ie missing 96
+	q931.97 = message type non exist 97
+	q931.98 = wrong message 98
+	q931.99 = ie non exist 99
+	q931.100 = invalid ie contents 100
+	q931.101 = wrong call state 101
+	q931.102 = recovery on timer expire 102
+	q931.103 = mandatory ie length error 103
+	q931.111 = protocol error 111
+	q931.127 = interworking 127
+
+
+[channels]
+	name = channels
+	title = Active Channels
+	family = channels
+	context = asterisk.channels
+	units = channels
+	priority = 91000
+	type = stacked
+	dimension = pattern asterisk.channels.count 'channels' last 1 1
+	# FIXME: netdata needs to prevent this from going negative
+
+[endpoints]
+	name = endpoints
+	title = Active Endpoints
+	family = endpoints
+	context = asterisk.endpoints
+	units = endpoints
+	priority = 91005
+	type = stacked
+	dimension = pattern asterisk.endpoints.count 'endpoints' last 1 1
+
+[endpoints_by_status]
+	name = endpoints_by_status
+	title = Active Endpoints by Status
+	family = endpoints
+	context = asterisk.endpoints_by_status
+	units = endpoints
+	priority = 91006
+	type = stacked
+	dimension = pattern asterisk.endpoints.state.* '' last 1 1
+
+[sip_channels_by_endpoint]
+	name = sip_channels_by_endpoint
+	title = Active SIP channels by endpoint
+	family = channels
+	context = asterisk.sip_channels_by_endpoint
+	units = channels
+	priority = 91110
+	type = stacked
+	dimension = pattern asterisk.endpoints.SIP.*.channels '' last 1 1
+
+[pjsip_channels_by_endpoint]
+	name = pjsip_channels_by_endpoint
+	title = Active PJSIP channels by endpoint
+	family = channels
+	context = asterisk.pjsip_channels_by_endpoint
+	units = channels
+	priority = 91111
+	type = stacked
+	dimension = pattern asterisk.endpoints.PJSIP.*.channels '' last 1 1
+
+[dialstatuses]
+	name = dialstatuses
+	title = Distribution of Dial Statuses
+	family = dial_statuses
+	context = asterisk.dialstatus
+	units = calls
+	priority = 91150
+	type = stacked
+	dimension = pattern 'asterisk.dialstatus.*' '' last 1 1
+
+[calltime]
+	name = calltime
+	title = Asterisk Channels Call Duration
+	family = calltime
+	context = asterisk.calltime
+	units = milliseconds
+	priority = 91160
+	type = stacked
+	dimension = asterisk.channels.calltime 'calltime' average 1 1
+	dimension = asterisk.channels.calltime 'sum'      sum     1 1 hidden
+	dimension = asterisk.channels.calltime 'count'    events  1 1 hidden
+
+[hangupcause]
+	name = hangupcause
+	title = Distribution of Hangup Causes
+	family = hangup_causes
+	context = asterisk.hangupcause
+	units = calls
+	priority = 91200
+	type = stacked
+	dimension = pattern 'asterisk.hangupcause.*' 'q931.' last 1 1
+
+[hangupcause_answer]
+	name = hangupcause_answer
+	title = Distribution of Hangup Causes for ANSWERed calls
+	family = hangup_causes
+	context = asterisk.hangupcause_answer
+	units = calls
+	priority = 91210
+	type = stacked
+	dimension = pattern 'asterisk.dialhangupcause.ANSWER.*' 'q931.' last 1 1
+
+[hangupcause_busy]
+	name = hangupcause_busy
+	title = Distribution of Hangup Causes for BUSY calls
+	family = hangup_causes
+	context = asterisk.hangupcause_busy
+	units = calls
+	priority = 91215
+	type = stacked
+	dimension = pattern 'asterisk.dialhangupcause.BUSY.*' 'q931.' last 1 1
+
+[hangupcause_cancel]
+	name = hangupcause_cancel
+	title = Distribution of Hangup Causes for CANCELled calls
+	family = hangup_causes
+	context = asterisk.hangupcause_cancel
+	units = calls
+	priority = 91220
+	type = stacked
+	dimension = pattern 'asterisk.dialhangupcause.CANCEL.*' 'q931.' last 1 1
+
+[hangupcause_chanunavail]
+	name = hangupcause_chanunavail
+	title = Distribution of Hangup Causes for CHANUNVAILed calls
+	family = hangup_causes
+	context = asterisk.hangupcause_chanunavail
+	units = calls
+	priority = 91230
+	type = stacked
+	dimension = pattern 'asterisk.dialhangupcause.CHANUNAVAIL.*' 'q931.' last 1 1
+
+[hangupcause_congestion]
+	name = hangupcause_congestion
+	title = Distribution of Hangup Causes for CONGESTIONed calls
+	family = hangup_causes
+	context = asterisk.hangupcause_congestion
+	units = calls
+	priority = 91240
+	type = stacked
+	dimension = pattern 'asterisk.dialhangupcause.CONGESTION.*' 'q931.' last 1 1
+
+[events]
+	name = events
+	title = Asterisk Dialplan Events
+	family = events
+	context = asterisk.events
+	units = events/s
+	priority = 91400
+	type = stacked
+	dimension = pattern 'asterisk.stasis.message.ast_channel_*_type' '' last 1 1
+
+[qualify]
+	name = qualify
+	title = Asterisk PJSIP Peers Qualify
+	family = qualify
+	context = asterisk.qualify
+	units = milliseconds
+	priority = 91500
+	type = stacked
+	dimension = pattern 'asterisk.PJSIP.contacts.*.rtt' '' max 1 1
+	# FIXME: netdata needs to set update every = 15 on this

+ 61 - 0
collectors/statsd.plugin/asterisk.md

@@ -0,0 +1,61 @@
+<!--
+title: "Asterisk monitoring with Netdata"
+custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/statsd.plugin/asterisk.md
+
+sidebar_label: "Asterisk"
+-->
+
+# Asterisk monitoring with Netdata
+
+Monitors [Asterisk](https://www.asterisk.org/) dialplan application's statistics.
+
+## Requirements
+
+- Asterisk [integrated with StatsD](https://www.asterisk.org/integrating-asterisk-with-statsd/).
+
+## Configuration
+
+Netdata ships
+with [asterisk.conf](https://github.com/netdata/netdata/blob/master/collectors/statsd.plugin/asterisk.conf) with
+preconfigured charts.
+
+To receive Asterisk metrics in Netdata, uncomment the following lines in the `/etc/asterisk/statsd.conf` file:
+
+```ini
+[general]
+enabled = yes                   ; When set to yes, statsd support is enabled
+server = 127.0.0.1              ; server[:port] of statsd server to use.
+                                ; If not specified, the port is 8125
+prefix = asterisk               ; Prefix to prepend to all metrics
+```
+
+> See [statsd.conf.sample](https://github.com/asterisk/asterisk/blob/master/configs/samples/statsd.conf.sample) for all available options.
+
+## Charts and metrics
+
+<details><summary>Click to see screenshots of the charts.</summary>
+
+![image](https://user-images.githubusercontent.com/2662304/158055351-fcc7a7fb-9b95-4656-bdc6-2e5f5a909215.png)
+![image](https://user-images.githubusercontent.com/2662304/158055367-cfd25cd5-d71a-4bab-8cd1-bfcc47bc7312.png)
+
+</details>
+
+Mapping Asterisk StatsD metrics and Netdata charts.
+
+| Chart                                                | Metrics                                    |
+|------------------------------------------------------|--------------------------------------------|
+| Active Channels                                      | asterisk.channels.count                    |
+| Active Endpoints                                     | asterisk.endpoints.count                   |
+| Active Endpoints by Status                           | asterisk.endpoints.state.*                 |
+| Active SIP channels by endpoint                      | asterisk.endpoints.SIP.*.channels          |
+| Active PJSIP channels by endpoint                    | asterisk.endpoints.PJSIP.*.channels        |
+| Distribution of Dial Statuses                        | asterisk.dialstatus.*                      |
+| Asterisk Channels Call Duration                      | asterisk.channels.calltime                 |
+| Distribution of Hangup Causes                        | asterisk.hangupcause.*                     |
+| Distribution of Hangup Causes for ANSWERed calls     | asterisk.dialhangupcause.ANSWER.*          |
+| Distribution of Hangup Causes for BUSY calls         | asterisk.dialhangupcause.BUSY.*            |
+| Distribution of Hangup Causes for CANCELled calls    | asterisk.dialhangupcause.CANCEL.*          |
+| Distribution of Hangup Causes for CHANUNVAILed calls | asterisk.dialhangupcause.CHANUNAVAIL.*     |
+| Distribution of Hangup Causes for CONGESTIONed calls | asterisk.dialhangupcause.CONGESTION.*      |
+| Asterisk Dialplan Events                             | asterisk.stasis.message.ast_channel_*_type |
+| Asterisk PJSIP Peers Qualify                         | asterisk.PJSIP.contacts.*.rtt              |