Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/tel/asterisk_http?at=release/7.0
Asterisk by HTTP
Overview
The template for monitoring Asterisk over HTTP that works without any external scripts. It collects metrics by polling the Asterisk Manager API remotely using an HTTP agent and JS preprocessing. All metrics are collected at once, thanks to Zabbix's bulk data collection.
Requirements
Zabbix version: 7.0 and higher.
Tested versions
This template has been tested on:
- Asterisk, version 13 and later
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
You should enable the mini-HTTP Server, add the option webenabled=yes in the general section of the manager.conf file and create Asterisk Manager user with system and command write permissions within your Asterisk instance. Disable the PJSIP driver if you do not use PJSIP or do not have PJSIP endpoints. Please, define AMI address in the {$AMI.URL} macro. Also, set the hostname or IP address of the AMI host in the {$AMI.HOST} macro for Zabbix to check Asterisk service status. Then you can define {$AMI.USERNAME} and {$AMI.SECRET} macros in the template for using on the host level. If there are errors, increase the logging to debug level and see the Zabbix server log.
Macros used
Name | Description | Default |
---|---|---|
{$AMI.URL} | The Asterisk Manager API URL in the format |
http://asterisk:8088/asterisk/rawman |
{$AMI.HOST} | The hostname or IP address of the Asterisk Manager API host. |
<SET AMI HOST> |
{$AMI.PORT} | AMI port number for checking service availability. |
5038 |
{$AMI.USERNAME} | The Asterisk Manager name. |
zabbix |
{$AMI.SECRET} | The Asterisk Manager secret. |
zabbix |
{$AMI.TRUNK_REGEXP} | The regexp for the identification of trunk peers. |
trunk |
{$AMI.RESPONSE_TIME.MAX.WARN} | The Asterisk Manager API page maximum response time in seconds for trigger expression. |
10s |
{$AMI.QUEUE_CALLERS.MAX.WARN} | The maximum number of callers in a queue for trigger expression. |
10 |
{$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN} | The maximum number of busy channels of a trunk for trigger expression. |
28 |
{$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"PJSIP"} | The total maximum number of busy channels of PJSIP trunks for trigger expression. |
28 |
{$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"SIP"} | The total maximum number of busy channels of SIP trunks for trigger expression. |
28 |
{$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"IAX"} | The total maximum number of busy channels of IAX trunks for trigger expression. |
28 |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
Service status | Asterisk Manager API port availability. |
Simple check | net.tcp.service["tcp","{$AMI.HOST}","{$AMI.PORT}"] Preprocessing
|
Service response time | Asterisk Manager API performance. |
Simple check | net.tcp.service.perf["tcp","{$AMI.HOST}","{$AMI.PORT}"] |
Get stats | Asterisk system information in JSON format. |
HTTP agent | asterisk.get_stats Preprocessing
|
Version | Service version |
Dependent item | asterisk.version Preprocessing
|
Uptime | The system uptime expressed in the following format: "N days, hh:mm:ss". |
Dependent item | asterisk.uptime Preprocessing
|
Uptime after reload | System uptime after a config reload in 'N days, hh:mm:ss' format. |
Dependent item | asterisk.uptime_reload Preprocessing
|
Active channels | The number of active channels at the moment. |
Dependent item | asterisk.active_channels Preprocessing
|
Active calls | The number of active calls at the moment. |
Dependent item | asterisk.active_calls Preprocessing
|
Calls processed | The number of calls processed after the last service restart. |
Dependent item | asterisk.calls_processed Preprocessing
|
Calls processed per second | The number of calls processed per second. |
Dependent item | asterisk.calls_processed.rate Preprocessing
|
Total queues | The number of configured queues. |
Dependent item | asterisk.total_queues Preprocessing
|
SIP monitored online | The number of monitored online SIP peers. |
Dependent item | asterisk.sip.monitored_online Preprocessing
|
SIP monitored offline | The number of monitored offline SIP peers. |
Dependent item | asterisk.sip.monitored_offline Preprocessing
|
SIP unmonitored online | The number of unmonitored online SIP peers. |
Dependent item | asterisk.sip.unmonitored_online Preprocessing
|
SIP unmonitored offline | The number of unmonitored offline SIP peers. |
Dependent item | asterisk.sip.unmonitored_offline Preprocessing
|
SIP peers | The total number of SIP peers. |
Dependent item | asterisk.sip.total Preprocessing
|
SIP trunks active channels | The total number of SIP trunks active channels. |
Dependent item | asterisk.sip.active_channels Preprocessing
|
IAX online peers | The number of online IAX peers. |
Dependent item | asterisk.iax.online Preprocessing
|
IAX offline peers | The number of offline IAX peers. |
Dependent item | asterisk.iax.offline Preprocessing
|
IAX unmonitored peers | The number of unmonitored IAX peers. |
Dependent item | asterisk.iax.unmonitored Preprocessing
|
IAX peers | The total number of IAX peers. |
Dependent item | asterisk.iax.total Preprocessing
|
IAX trunks active channels | The total number of IAX trunks active channels. |
Dependent item | asterisk.iax.active_channels Preprocessing
|
PJSIP available endpoints | The number of available PJSIP peers. |
Dependent item | asterisk.pjsip.available Preprocessing
|
PJSIP unavailable endpoints | The number of unavailable PJSIP peers. |
Dependent item | asterisk.pjsip.unavailable Preprocessing
|
PJSIP endpoints | The total number of PJSIP peers. |
Dependent item | asterisk.pjsip.total Preprocessing
|
PJSIP trunks active channels | The total number of PJSIP trunks active channels. |
Dependent item | asterisk.pjsip.active_channels Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
Service is down | last(/Asterisk by HTTP/net.tcp.service["tcp","{$AMI.HOST}","{$AMI.PORT}"])=0 |
Average | Manual close: Yes | |
Service response time is too high | min(/Asterisk by HTTP/net.tcp.service.perf["tcp","{$AMI.HOST}","{$AMI.PORT}"],5m)>{$AMI.RESPONSE_TIME.MAX.WARN} |
Warning | Manual close: Yes Depends on:
|
|
Version has changed | The Asterisk version has changed. Acknowledge to close the problem manually. |
last(/Asterisk by HTTP/asterisk.version,#1)<>last(/Asterisk by HTTP/asterisk.version,#2) and length(last(/Asterisk by HTTP/asterisk.version))>0 |
Info | Manual close: Yes |
Host has been restarted | Uptime is less than 10 minutes. |
last(/Asterisk by HTTP/asterisk.uptime)<10m |
Info | Manual close: Yes |
Failed to fetch AMI page | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/Asterisk by HTTP/asterisk.uptime,30m)=1 |
Warning | Manual close: Yes Depends on:
|
has been reloaded | Uptime is less than 10 minutes. |
last(/Asterisk by HTTP/asterisk.uptime_reload)<10m |
Info | Manual close: Yes |
Total number of active channels of SIP trunks is too high | The SIP trunks may not be able to process new calls. |
min(/Asterisk by HTTP/asterisk.sip.active_channels,10m)>={$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"SIP"} |
Warning | |
Total number of active channels of IAX trunks is too high | The IAX trunks may not be able to process new calls. |
min(/Asterisk by HTTP/asterisk.iax.active_channels,10m)>={$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"IAX"} |
Warning | |
Total number of active channels of PJSIP trunks is too high | The PJSIP trunks may not be able to process new calls. |
min(/Asterisk by HTTP/asterisk.pjsip.active_channels,10m)>={$AMI.TRUNK_ACTIVE_CHANNELS_TOTAL.MAX.WARN:"PJSIP"} |
Warning |
LLD rule SIP peers discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
SIP peers discovery | Dependent item | asterisk.sip_peers.discovery Preprocessing
|
Item prototypes for SIP peers discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
SIP trunk "{#OBJECTNAME}": Get SIP trunk | Raw data for a SIP trunk. |
Dependent item | asterisk.sip.trunk.get[{#OBJECTNAME}] Preprocessing
|
SIP trunk "{#OBJECTNAME}": Status | SIP trunk status. Here are the possible states that a device state may have: Unmonitored UNKNOWN UNREACHABLE OK |
Dependent item | asterisk.sip.trunk.status[{#OBJECTNAME}] Preprocessing
|
SIP trunk "{#OBJECTNAME}": Active channels | The total number of active SIP trunk channels. |
Dependent item | asterisk.sip.trunk.active_channels[{#OBJECTNAME}] Preprocessing
|
Trigger prototypes for SIP peers discovery
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
SIP trunk "{#OBJECTNAME}": SIP trunk {#OBJECTNAME} has a state {ITEM.VALUE} | The SIP trunk is unable to establish a connection with a neighbor due to network issues or incorrect configuration. |
last(/Asterisk by HTTP/asterisk.sip.trunk.status[{#OBJECTNAME}])="UNKNOWN" or last(/Asterisk by HTTP/asterisk.sip.trunk.status[{#OBJECTNAME}])="UNREACHABLE" |
Average | |
SIP trunk "{#OBJECTNAME}": Number of the SIP trunk "{#OBJECTNAME}" active channels is too high | The SIP trunk may not be able to process new calls. |
min(/Asterisk by HTTP/asterisk.sip.trunk.active_channels[{#OBJECTNAME}],10m)>={$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} |
Warning |
LLD rule IAX peers discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
IAX peers discovery | Dependent item | asterisk.iax_peers.discovery Preprocessing
|
Item prototypes for IAX peers discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
IAX trunk "{#OBJECTNAME}": Get IAX trunk | Raw data for an IAX trunk. |
Dependent item | asterisk.iax.trunk.get[{#OBJECTNAME}] Preprocessing
|
IAX trunk "{#OBJECTNAME}": Status | IAX trunk status. Here are the possible states that a device state may have: Unmonitored UNKNOWN UNREACHABLE OK |
Dependent item | asterisk.iax.trunk.status[{#OBJECTNAME}] Preprocessing
|
IAX trunk "{#OBJECTNAME}": Active channels | The total number of active IAX trunk channels. |
Dependent item | asterisk.iax.trunk.active_channels[{#OBJECTNAME}] Preprocessing
|
Trigger prototypes for IAX peers discovery
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
IAX trunk "{#OBJECTNAME}": IAX trunk {#OBJECTNAME} has a state {ITEM.VALUE} | The IAX trunk is unable to establish a connection with a neighbor due to network issues or incorrect configuration. |
last(/Asterisk by HTTP/asterisk.iax.trunk.status[{#OBJECTNAME}])="UNKNOWN" or last(/Asterisk by HTTP/asterisk.iax.trunk.status[{#OBJECTNAME}])="UNREACHABLE" |
Average | |
IAX trunk "{#OBJECTNAME}": Number of the IAX trunk "{#OBJECTNAME}" active channels is too high | The IAX trunk may not be able to process new calls. |
min(/Asterisk by HTTP/asterisk.iax.trunk.active_channels[{#OBJECTNAME}],10m)>={$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} |
Warning |
LLD rule PJSIP endpoints discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
PJSIP endpoints discovery | Dependent item | asterisk.pjsip_endpoints.discovery Preprocessing
|
Item prototypes for PJSIP endpoints discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
PJSIP trunk "{#OBJECTNAME}": Get PJSIP trunk | Raw data for a PJSIP trunk. |
Dependent item | asterisk.pjsip.trunk.get[{#OBJECTNAME}] Preprocessing
|
PJSIP trunk "{#OBJECTNAME}": Device state | PJSIP trunk status. Here are the possible states that a device state may have: Unavailable Not in use In use |
Dependent item | asterisk.pjsip.trunk.devicestate[{#OBJECTNAME}] Preprocessing
|
PJSIP trunk "{#OBJECTNAME}": Active channels | The total number of active PJSIP trunk channels. |
Dependent item | asterisk.pjsip.trunk.active_channels[{#OBJECTNAME}] Preprocessing
|
Trigger prototypes for PJSIP endpoints discovery
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
PJSIP trunk "{#OBJECTNAME}": PJSIP trunk {#OBJECTNAME} has a state Unavailable | The PJSIP trunk is unable to establish a connection with a neighbor due to network issues or incorrect configuration. |
last(/Asterisk by HTTP/asterisk.pjsip.trunk.devicestate[{#OBJECTNAME}])="Unavailable" |
Average | |
PJSIP trunk "{#OBJECTNAME}": Number of the PJSIP trunk "{#OBJECTNAME}" active channels is too high | The PJSIP trunk may not be able to process new calls. |
min(/Asterisk by HTTP/asterisk.pjsip.trunk.active_channels[{#OBJECTNAME}],10m)>={$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} |
Warning |
LLD rule Queues discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
Queues discovery | Dependent item | asterisk.queues.discovery Preprocessing
|
Item prototypes for Queues discovery
Name | Description | Type | Key and additional info |
---|---|---|---|
"{#QUEUE}": Get queue | Raw data for a queue. |
Dependent item | asterisk.queue.get[{#QUEUE}] Preprocessing
|
"{#QUEUE}": Logged in | The number of queue members. |
Dependent item | asterisk.queue.loggedin[{#QUEUE}] Preprocessing
|
"{#QUEUE}": Available | The number of available queue members. |
Dependent item | asterisk.queue.available[{#QUEUE}] Preprocessing
|
"{#QUEUE}": Callers | The number incoming calls in queue. |
Dependent item | asterisk.queue.callers[{#QUEUE}] Preprocessing
|
Trigger prototypes for Queues discovery
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
"{#QUEUE}": Number of callers in the queue "{#QUEUE}" is too high | There is a large number of calls in the queue. |
min(/Asterisk by HTTP/asterisk.queue.callers[{#QUEUE}],10m)>{$AMI.QUEUE_CALLERS.MAX.WARN:"{#QUEUE}"} |
Warning |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums