Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/tel/asterisk_http
Asterisk by HTTP
Overview
For Zabbix version: 5.2 and higher
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.
This template was tested on:
- Zabbix, version 5.0 and later
- Asterisk, version 13 and later
Setup
See Zabbix template operation for basic instructions.
You should enable the mini-HTTP Server, add the option webenabled=yes in the general section of manager.conf file and create Asterisk Manager user in your Asterisk instance. Then you can define {$AMI.USERNAME} and {$AMI.SECRET} macros in the template for using on the host level.
Zabbix configuration
No specific Zabbix configuration is required.
Macros used
Name | Description | Default |
---|---|---|
{$AMI.PORT} | AMI port number for checking service availability. |
8088 |
{$AMI.QUEUE_CALLERS.MAX.WARN} | The maximum number of callers in a queue for trigger expression. |
10 |
{$AMI.RESPONSE_TIME.MAX.WARN} | The Asterisk Manager API page maximum response time in seconds for trigger expression. |
10s |
{$AMI.SECRET} | The Asterisk Manager secret. |
zabbix |
{$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN} | The maximum number of busy channels for trigger expression. |
28 |
{$AMI.TRUNK_REGEXP} | The regexp for the identification of trunk peers. |
trunk |
{$AMI.URL} | The Asterisk Manager API URL in the format |
http://asterisk:8088/asterisk/rawman |
{$AMI.USERNAME} | The Asterisk Manager name. |
zabbix |
Template links
There are no template links in this template.
Discovery rules
Name | Description | Type | Key and additional info |
---|---|---|---|
SIP peers discovery | - |
DEPENDENT | asterisk.sip_peers.discovery Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
IAX peers discovery | - |
DEPENDENT | asterisk.iax_peers.discovery Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
PJSIP endpoints discovery | - |
DEPENDENT | asterisk.pjsip_endpoints.discovery Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
Queues discovery | - |
DEPENDENT | asterisk.queues.discovery Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
Items collected
Group | Name | Description | Type | Key and additional info |
---|---|---|---|---|
Asterisk | Asterisk: Service status | Asterisk Manager API port avalability. |
SIMPLE | net.tcp.service["tcp","{HOST.CONN}","{$AMI.PORT}"] Preprocessing: - DISCARD_UNCHANGED_HEARTBEAT: |
Asterisk | Asterisk: Service response time | Asterisk Manager API performance. |
SIMPLE | net.tcp.service.perf["tcp","{HOST.CONN}","{$AMI.PORT}"] |
Asterisk | Asterisk: Version | Service version |
DEPENDENT | asterisk.version Preprocessing: - JSONPATH: |
Asterisk | Asterisk: Uptime | System uptime in 'N days, hh:mm:ss' format. |
DEPENDENT | asterisk.uptime Preprocessing: - JSONPATH: |
Asterisk | Asterisk: Uptime after reload | System uptime after a config reload in 'N days, hh:mm:ss' format. |
DEPENDENT | asterisk.uptime_reload Preprocessing: - JSONPATH: |
Asterisk | Asterisk: Active channels | The number of active channels at the moment. |
DEPENDENT | asterisk.active_channels Preprocessing: - JSONPATH: |
Asterisk | Asterisk: Active calls | The number of active calls at the moment. |
DEPENDENT | asterisk.active_calls Preprocessing: - JSONPATH: |
Asterisk | Asterisk: Calls processed | The number of calls processed after the last service restart. |
DEPENDENT | asterisk.calls_processed Preprocessing: - JSONPATH: |
Asterisk | Asterisk: Calls processed per second | The number of calls processed per second. |
DEPENDENT | asterisk.calls_processed.rate Preprocessing: - JSONPATH: - CHANGE_PER_SECOND |
Asterisk | Asterisk: Total queues | The number of configured queues. |
DEPENDENT | asterisk.total_queues Preprocessing: - JSONPATH: |
Asterisk | Asterisk: SIP monitored online | The number of monitored online SIP peers. |
DEPENDENT | asterisk.sip.monitored_online Preprocessing: - JSONPATH: |
Asterisk | Asterisk: SIP monitored offline | The number of monitored offline SIP peers. |
DEPENDENT | asterisk.sip.monitored_offline Preprocessing: - JSONPATH: |
Asterisk | Asterisk: SIP unmonitored online | The number of unmonitored online SIP peers. |
DEPENDENT | asterisk.sip.unmonitored_online Preprocessing: - JSONPATH: |
Asterisk | Asterisk: SIP unmonitored offline | The number of unmonitored offline SIP peers. |
DEPENDENT | asterisk.sip.unmonitored_offline Preprocessing: - JSONPATH: |
Asterisk | Asterisk: SIP peers | The total number of SIP peers. |
DEPENDENT | asterisk.sip.total Preprocessing: - JSONPATH: |
Asterisk | Asterisk: IAX offline peers | The number of offline IAX peers. |
DEPENDENT | asterisk.iax.offline Preprocessing: - JSONPATH: |
Asterisk | Asterisk: IAX unmonitored peers | The number of unmonitored IAX peers. |
DEPENDENT | asterisk.iax.unmonitored Preprocessing: - JSONPATH: |
Asterisk | Asterisk: IAX peers | The total number of IAX peers. |
DEPENDENT | asterisk.iax.total Preprocessing: - JSONPATH: |
Asterisk | Asterisk: PJSIP unavailable endpoints | The number of unavailable PJSIP peers. |
DEPENDENT | asterisk.pjsip.unavailable Preprocessing: - JSONPATH: |
Asterisk | Asterisk: PJSIP endpoints | The total number of PJSIP peers. |
DEPENDENT | asterisk.pjsip.total Preprocessing: - JSONPATH: |
Asterisk | SIP trunk "{#OBJECTNAME}": Status | SIP trunk status. Here are the possible states that a device state may have: Unmonitored UNKNOWN UNREACHABLE OK |
DEPENDENT | asterisk.sip.trunk.status[{#OBJECTNAME}] Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
Asterisk | SIP trunk "{#OBJECTNAME}": Active channels | The total number of active SIP trunk channels. |
DEPENDENT | asterisk.sip.trunk.active_channels[{#OBJECTNAME}] Preprocessing: - JSONPATH: |
Asterisk | IAX trunk "{#OBJECTNAME}": Status | IAX trunk status. Here are the possible states that a device state may have: Unmonitored UNKNOWN UNREACHABLE OK |
DEPENDENT | asterisk.iax.trunk.status[{#OBJECTNAME}] Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
Asterisk | IAX trunk "{#OBJECTNAME}": Active channels | The total number of active IAX trunk channels. |
DEPENDENT | asterisk.iax.trunk.active_channels[{#OBJECTNAME}] Preprocessing: - JSONPATH: |
Asterisk | 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 | asterisk.pjsip.trunk.devicestate[{#OBJECTNAME}] Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
Asterisk | PJSIP trunk "{#OBJECTNAME}": Active channels | The total number of active PJSIP trunk channels. |
DEPENDENT | asterisk.pjsip.trunk.active_channels[{#OBJECTNAME}] Preprocessing: - JSONPATH: |
Asterisk | "{#QUEUE}": Logged in | The number of queue members. |
DEPENDENT | asterisk.queue.loggedin[{#QUEUE}] Preprocessing: - JSONPATH: |
Asterisk | "{#QUEUE}": Available | The number of available queue members. |
DEPENDENT | asterisk.queue.available[{#QUEUE}] Preprocessing: - JSONPATH: |
Asterisk | "{#QUEUE}": Callers | The number incomming calls in queue. |
DEPENDENT | asterisk.queue.callers[{#QUEUE}] Preprocessing: - JSONPATH: |
Zabbix_raw_items | Asterisk: Get stats | Asterisk system information in JSON format. |
HTTP_AGENT | asterisk.get_stats Preprocessing: - JAVASCRIPT: |
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
Asterisk: Service is down | - |
{TEMPLATE_NAME:net.tcp.service["tcp","{HOST.CONN}","{$AMI.PORT}"].last()}=0 |
AVERAGE | Manual close: YES |
Asterisk: Service response time is too high (over {$AMI.RESPONSE_TIME.MAX.WARN} for 5m) | - |
{TEMPLATE_NAME:net.tcp.service.perf["tcp","{HOST.CONN}","{$AMI.PORT}"].min(5m)}>{$AMI.RESPONSE_TIME.MAX.WARN} |
WARNING | Manual close: YES Depends on: - Asterisk: Service is down |
Asterisk: Version has changed (new version: {ITEM.VALUE}) | Asterisk version has changed. Ack to close. |
{TEMPLATE_NAME:asterisk.version.diff()}=1 and {TEMPLATE_NAME:asterisk.version.strlen()}>0 |
INFO | Manual close: YES |
Asterisk: has been restarted (uptime < 10m) | Uptime is less than 10 minutes |
{TEMPLATE_NAME:asterisk.uptime.last()}<10m |
INFO | Manual close: YES |
Asterisk: Failed to fetch AMI page (or no data for 30m) | Zabbix has not received data for items for the last 30 minutes. |
{TEMPLATE_NAME:asterisk.uptime.nodata(30m)}=1 |
WARNING | Manual close: YES Depends on: - Asterisk: Service is down |
Asterisk: has been reloaded (uptime < 10m) | Uptime is less than 10 minutes |
{TEMPLATE_NAME:asterisk.uptime_reload.last()}<10m |
INFO | Manual close: YES |
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. |
{TEMPLATE_NAME:asterisk.sip.trunk.status[{#OBJECTNAME}].last()}="UNKNOWN" or {TEMPLATE_NAME:asterisk.sip.trunk.status[{#OBJECTNAME}].last()}="UNREACHABLE" |
AVERAGE | |
SIP trunk "{#OBJECTNAME}": Number of the SIP trunk "{#OBJECTNAME}" active channels is too high (over {$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} for 10m | The SIP trunk may not be able to process new calls. |
{TEMPLATE_NAME:asterisk.sip.trunk.active_channels[{#OBJECTNAME}].min(10m)}>={$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} |
WARNING | |
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. |
{TEMPLATE_NAME:asterisk.iax.trunk.status[{#OBJECTNAME}].last()}="UNKNOWN" or {TEMPLATE_NAME:asterisk.iax.trunk.status[{#OBJECTNAME}].last()}="UNREACHABLE" |
AVERAGE | |
IAX trunk "{#OBJECTNAME}": Number of the IAX trunk "{#OBJECTNAME}" active channels is too high (over {$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} for 10m | The IAX trunk may not be able to process new calls. |
{TEMPLATE_NAME:asterisk.iax.trunk.active_channels[{#OBJECTNAME}].min(10m)}>={$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} |
WARNING | |
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. |
{TEMPLATE_NAME:asterisk.pjsip.trunk.devicestate[{#OBJECTNAME}].last()}="Unavailable" |
AVERAGE | |
PJSIP trunk "{#OBJECTNAME}": Number of the PJSIP trunk "{#OBJECTNAME}" active channels is too high (over {$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} for 10m | The PJSIP trunk may not be able to process new calls. |
{TEMPLATE_NAME:asterisk.pjsip.trunk.active_channels[{#OBJECTNAME}].min(10m)}>={$AMI.TRUNK_ACTIVE_CHANNELS.MAX.WARN:"{#OBJECTNAME}"} |
WARNING | |
"{#QUEUE}": Number of callers in the queue "{#QUEUE}" is too high (over {$AMI.QUEUE_CALLERS.MAX.WARN:"{#QUEUE}"} for 10m | There is a large number of calls in the queue. |
{TEMPLATE_NAME:asterisk.queue.callers[{#QUEUE}].min(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 a feedback, discuss the template or ask for help with it at ZABBIX forums.