Asterisk

Asterisk is a software implementation of a telephone private branch exchange (PBX). It allows telephones interfaced with a variety of hardware technologies to make calls to one another, and to connect to telephony services, such as the public switched telephone network (PSTN) and voice over Internet Protocol (VoIP) services.

Available solutions




This template is for Zabbix version: 6.4
Also available for: 6.2 6.0 5.4

Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/tel/asterisk_http?at=release/6.4

Asterisk by HTTP

Overview

For Zabbix version: 6.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:

  • 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 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, the Zabbix host should have an Agent interface with the AMI address 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.

Zabbix configuration

No specific Zabbix configuration is required.

Macros used

Name Description Default
{$AMI.PORT}

AMI port number for checking service availability.

5038
{$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 of a trunk 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
{$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_REGEXP}

The regexp for the identification of trunk peers.

trunk
{$AMI.URL}

The Asterisk Manager API URL in the format <scheme>://<host>:<port>/<prefix>/rawman.

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
IAX peers discovery

-

DEPENDENT asterisk.iax_peers.discovery

Preprocessing:

- JSONPATH: $.iax.trunks

- DISCARD_UNCHANGED_HEARTBEAT: 1h

PJSIP endpoints discovery

-

DEPENDENT asterisk.pjsip_endpoints.discovery

Preprocessing:

- JSONPATH: $.pjsip.trunks

- DISCARD_UNCHANGED_HEARTBEAT: 1h

Queues discovery

-

DEPENDENT asterisk.queues.discovery

Preprocessing:

- JSONPATH: $.queue.queues

- DISCARD_UNCHANGED_HEARTBEAT: 1h

SIP peers discovery

-

DEPENDENT asterisk.sip_peers.discovery

Preprocessing:

- JSONPATH: $.sip.trunks

- DISCARD_UNCHANGED_HEARTBEAT: 1h

Items collected

Group Name Description Type Key and additional info
Asterisk Asterisk: Service status

Asterisk Manager API port availability.

SIMPLE net.tcp.service["tcp","{HOST.CONN}","{$AMI.PORT}"]

Preprocessing:

- DISCARD_UNCHANGED_HEARTBEAT: 10m

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: $.version

Asterisk Asterisk: Uptime

System uptime in 'N days, hh:mm:ss' format.

DEPENDENT asterisk.uptime

Preprocessing:

- JSONPATH: $.uptime

Asterisk Asterisk: Uptime after reload

System uptime after a config reload in 'N days, hh:mm:ss' format.

DEPENDENT asterisk.uptime_reload

Preprocessing:

- JSONPATH: $.uptime_reload

Asterisk Asterisk: Active channels

The number of active channels at the moment.

DEPENDENT asterisk.active_channels

Preprocessing:

- JSONPATH: $.active_channels

Asterisk Asterisk: Active calls

The number of active calls at the moment.

DEPENDENT asterisk.active_calls

Preprocessing:

- JSONPATH: $.active_calls

Asterisk Asterisk: Calls processed

The number of calls processed after the last service restart.

DEPENDENT asterisk.calls_processed

Preprocessing:

- JSONPATH: $.calls_processed

Asterisk Asterisk: Calls processed per second

The number of calls processed per second.

DEPENDENT asterisk.calls_processed.rate

Preprocessing:

- JSONPATH: $.calls_processed

- CHANGE_PER_SECOND

Asterisk Asterisk: Total queues

The number of configured queues.

DEPENDENT asterisk.total_queues

Preprocessing:

- JSONPATH: $.queue.total

Asterisk Asterisk: SIP monitored online

The number of monitored online SIP peers.

DEPENDENT asterisk.sip.monitored_online

Preprocessing:

- JSONPATH: $.sip.monitored_online

Asterisk Asterisk: SIP monitored offline

The number of monitored offline SIP peers.

DEPENDENT asterisk.sip.monitored_offline

Preprocessing:

- JSONPATH: $.sip.monitored_offline

Asterisk Asterisk: SIP unmonitored online

The number of unmonitored online SIP peers.

DEPENDENT asterisk.sip.unmonitored_online

Preprocessing:

- JSONPATH: $.sip.unmonitored_online

Asterisk Asterisk: SIP unmonitored offline

The number of unmonitored offline SIP peers.

DEPENDENT asterisk.sip.unmonitored_offline

Preprocessing:

- JSONPATH: $.sip.unmonitored_offline

Asterisk Asterisk: SIP peers

The total number of SIP peers.

DEPENDENT asterisk.sip.total

Preprocessing:

- JSONPATH: $.sip.total

Asterisk Asterisk: SIP trunks active channels

The total number of SIP trunks active channels.

DEPENDENT asterisk.sip.active_channels

Preprocessing:

- JSONPATH: $.sip.active_channels

Asterisk Asterisk: IAX online peers

The number of online IAX peers.

DEPENDENT asterisk.iax.online

Preprocessing:

- JSONPATH: $.iax.online

Asterisk Asterisk: IAX offline peers

The number of offline IAX peers.

DEPENDENT asterisk.iax.offline

Preprocessing:

- JSONPATH: $.iax.offline

Asterisk Asterisk: IAX unmonitored peers

The number of unmonitored IAX peers.

DEPENDENT asterisk.iax.unmonitored

Preprocessing:

- JSONPATH: $.iax.unmonitored

Asterisk Asterisk: IAX peers

The total number of IAX peers.

DEPENDENT asterisk.iax.total

Preprocessing:

- JSONPATH: $.iax.total

Asterisk Asterisk: IAX trunks active channels

The total number of IAX trunks active channels.

DEPENDENT asterisk.iax.active_channels

Preprocessing:

- JSONPATH: $.iax.active_channels

Asterisk Asterisk: PJSIP available endpoints

The number of available PJSIP peers.

DEPENDENT asterisk.pjsip.available

Preprocessing:

- JSONPATH: $.pjsip.available

Asterisk Asterisk: PJSIP unavailable endpoints

The number of unavailable PJSIP peers.

DEPENDENT asterisk.pjsip.unavailable

Preprocessing:

- JSONPATH: $.pjsip.unavailable

Asterisk Asterisk: PJSIP endpoints

The total number of PJSIP peers.

DEPENDENT asterisk.pjsip.total

Preprocessing:

- JSONPATH: $.pjsip.total

Asterisk Asterisk: PJSIP trunks active channels

The total number of PJSIP trunks active channels.

DEPENDENT asterisk.pjsip.active_channels

Preprocessing:

- JSONPATH: $.pjsip.active_channels

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: $.sip.trunks[?(@.ObjectName=='{#OBJECTNAME}')].Status.first()

- DISCARD_UNCHANGED_HEARTBEAT: 1h

Asterisk SIP trunk "{#OBJECTNAME}": Active channels

The total number of active SIP trunk channels.

DEPENDENT asterisk.sip.trunk.active_channels[{#OBJECTNAME}]

Preprocessing:

- JSONPATH: $.sip.trunks[?(@.ObjectName=='{#OBJECTNAME}')].active_channels.first()

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: $.iax.trunks[?(@.ObjectName=='{#OBJECTNAME}')].Status.first()

- DISCARD_UNCHANGED_HEARTBEAT: 1h

Asterisk IAX trunk "{#OBJECTNAME}": Active channels

The total number of active IAX trunk channels.

DEPENDENT asterisk.iax.trunk.active_channels[{#OBJECTNAME}]

Preprocessing:

- JSONPATH: $.iax.trunks[?(@.ObjectName=='{#OBJECTNAME}')].active_channels.first()

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: $.pjsip.trunks[?(@.ObjectName=='{#OBJECTNAME}')].DeviceState.first()

- DISCARD_UNCHANGED_HEARTBEAT: 1h

Asterisk PJSIP trunk "{#OBJECTNAME}": Active channels

The total number of active PJSIP trunk channels.

DEPENDENT asterisk.pjsip.trunk.active_channels[{#OBJECTNAME}]

Preprocessing:

- JSONPATH: $.pjsip.trunks[?(@.ObjectName=='{#OBJECTNAME}')].active_channels.first()

Asterisk "{#QUEUE}": Logged in

The number of queue members.

DEPENDENT asterisk.queue.loggedin[{#QUEUE}]

Preprocessing:

- JSONPATH: $.queue.queues[?(@.Queue=='{#QUEUE}')].LoggedIn.first()

Asterisk "{#QUEUE}": Available

The number of available queue members.

DEPENDENT asterisk.queue.available[{#QUEUE}]

Preprocessing:

- JSONPATH: $.queue.queues[?(@.Queue=='{#QUEUE}')].Available.first()

Asterisk "{#QUEUE}": Callers

The number incoming calls in queue.

DEPENDENT asterisk.queue.callers[{#QUEUE}]

Preprocessing:

- JSONPATH: $.queue.queues[?(@.Queue=='{#QUEUE}')].Callers.first()

Zabbix raw items Asterisk: Get stats

Asterisk system information in JSON format.

HTTP_AGENT asterisk.get_stats

Preprocessing:

- JAVASCRIPT: The text is too long. Please see the template.

Triggers

Name Description Expression Severity Dependencies and additional info
Asterisk: Service is down

-

last(/Asterisk by HTTP/net.tcp.service["tcp","{HOST.CONN}","{$AMI.PORT}"])=0 AVERAGE

Manual close: YES

Asterisk: Service response time is too high

-

min(/Asterisk by HTTP/net.tcp.service.perf["tcp","{HOST.CONN}","{$AMI.PORT}"],5m)>{$AMI.RESPONSE_TIME.MAX.WARN} WARNING

Manual close: YES

Depends on:

- Asterisk: Service is down

Asterisk: Version has changed

Asterisk version has changed. Ack to close.

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

Asterisk: has been restarted

Uptime is less than 10 minutes.

last(/Asterisk by HTTP/asterisk.uptime)<10m INFO

Manual close: YES

Asterisk: Failed to fetch AMI page

Zabbix has not received data for items for the last 30 minutes.

nodata(/Asterisk by HTTP/asterisk.uptime,30m)=1 WARNING

Manual close: YES

Depends on:

- Asterisk: Service is down

Asterisk: has been reloaded

Uptime is less than 10 minutes.

last(/Asterisk by HTTP/asterisk.uptime_reload)<10m INFO

Manual close: YES

Asterisk: 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
Asterisk: 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
Asterisk: 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
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
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
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
"{#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 with it at ZABBIX forums.

References

https://wiki.asterisk.org/wiki/display/AST/Home

Didn't find what you are looking for?