Asterisk Monitoring
NetXMS can monitor Asterisk PBX systems through the Asterisk Manager Interface (AMI). This enables monitoring of call volumes, channel usage, peer status, and PBX health.
Overview
Asterisk monitoring provides:
-
Active channel and call monitoring
-
SIP/IAX peer status and registration
-
Queue statistics
-
PBX system resource usage
Configuration
Loading the Subagent
The Asterisk monitoring subagent connects to the Asterisk Manager Interface:
SubAgent = asterisk.nsm
AMI Connection Configuration
For a single local system, configure directly in the [Asterisk] section:
[Asterisk]
Login = netxms
Password = monitoring_secret
Hostname = localhost
Port = 5038
For monitoring multiple Asterisk systems, use named subsections:
[Asterisk/Systems/pbx1]
Login = netxms
Password = your_password
Hostname = pbx1.example.com
Port = 5038
[Asterisk/Systems/pbx2]
Login = netxms
Password = your_password
Hostname = pbx2.example.com
Port = 5038
Configuration parameters:
| Parameter | Default | Description |
|---|---|---|
|
root |
AMI user login |
|
AMI user password |
|
|
127.0.0.1 |
Asterisk server address |
|
5038 |
AMI port |
AMI User Configuration
Create a monitoring user in Asterisk’s manager.conf:
[netxms]
secret = monitoring_secret
deny = 0.0.0.0/0.0.0.0
permit = 127.0.0.1/255.255.255.255
read = system,call,agent
write =
Grant read-only permissions for the metrics you need. The monitoring user does not need write access.
Metrics
Metrics take the target system name as the first argument.
For the local system configured in the [Asterisk] section (named LOCAL), the system argument can be omitted — by dropping the argument entirely, not by passing an empty value:
-
Metrics whose only argument is the system name (
Asterisk.AMI.,Asterisk.Channels.,Asterisk.CurrentCalls,Asterisk.Events.*,Asterisk.Version) are then used without arguments at all, e.g.Asterisk.CurrentCalls. -
Asterisk.SIP.Peers.*metrics exist only in the parameterized form — for the local system use empty parentheses, e.g.Asterisk.SIP.Peers.Total(). -
Metrics with additional arguments (peer, task processor, and registration test metrics) are used with the system argument dropped, e.g.
Asterisk.SIP.Peer.Status(peer1). -
Asterisk.SIP.Peer.Detailsis the exception: it always requires all three arguments (system, peer, tag).
System Metrics
| Parameter | Description |
|---|---|
|
AMI connection status (integer) |
|
AMI protocol version |
|
Asterisk version string |
|
Number of current active calls |
Channel Metrics
| Parameter | Description |
|---|---|
|
Number of active channels |
|
Number of channels in use (in call) |
|
Number of channels in dialing state |
|
Number of off-hook channels |
|
Number of reserved channels |
|
Number of ringing channels |
|
Number of channels in up (connected) state |
SIP Peer Metrics
| Parameter | Description |
|---|---|
|
Total number of SIP peers |
|
Number of connected SIP peers |
|
Number of peers in unknown state |
|
Number of unmonitored SIP peers |
|
Number of unreachable SIP peers |
|
Status of a specific SIP peer |
|
IP address of a specific SIP peer |
|
Type of a specific SIP peer |
|
User agent of a specific SIP peer |
|
Voice mailbox of a specific SIP peer |
|
Raw AMI tag value for a SIP peer (3rd arg is AMI tag name, e.g. |
Event Counters
| Parameter | Description |
|---|---|
|
Call barred event count (counter) |
|
Call rejected event count (counter) |
|
Channel unavailable event count (counter) |
|
Congestion event count (counter) |
|
No route event count (counter) |
|
Subscriber absent event count (counter) |
RTCP Statistics (Per Peer)
| Parameter | Description |
|---|---|
|
Average jitter |
|
Average packet loss |
|
Average round-trip time |
|
Last measured jitter |
|
Last measured packet loss |
|
Last measured round-trip time |
|
Maximum jitter |
|
Maximum packet loss |
|
Maximum round-trip time |
|
Minimum jitter |
|
Minimum packet loss |
|
Minimum round-trip time |
Task Processor Metrics
| Parameter | Description |
|---|---|
|
Task processor high watermark |
|
Task processor low watermark |
|
Maximum queue depth |
|
Total tasks processed (counter) |
|
Currently queued tasks |
SIP Registration Tests
SIP registration tests perform real SIP REGISTER operations against the PBX to verify SIP connectivity.
Test Configuration
Configure tests in the agent config file under the Asterisk system section:
[Asterisk/SIPRegistrationTests/104]
Login = 104
Password = 12345
Domain = demo.netxms
Interval = 300
Timeout = 30
[Asterisk/Systems/Remote1/SIPRegistrationTests/120]
Login = 120
Password = 12345
Domain = remote.netxms
Test configuration parameters:
| Parameter | Default | Description |
|---|---|---|
|
|
SIP login name |
|
|
SIP password |
|
Domain name used for registration |
|
|
|
SIP proxy address (with or without |
|
300 |
Check interval in seconds |
|
30 |
Registration request timeout in seconds |
Test Metrics
| Parameter | Description |
|---|---|
|
Ad-hoc SIP registration test; returns elapsed time in ms or -1 on failure. Uses the Asterisk system’s own IP address as SIP proxy and a fixed 5 second timeout |
|
SIP status code of last run (e.g. 200, 401, 408) |
|
Human-readable SIP status text (e.g. OK, Unauthorized) |
|
Last test elapsed time in ms; -1 if failed |
|
Unix timestamp of last test run |
Per-Peer Event Counters
In addition to the global event counters, per-peer counters are available.
They use the same counter names with a Peer. prefix and take two arguments: system and peer name.
| Parameter | Description |
|---|---|
|
Per-peer call barred events |
|
Per-peer call rejected events |
|
Per-peer channel unavailable events |
|
Per-peer congestion events |
|
Per-peer no route events |
|
Per-peer subscriber absent events |
Tables
| Table | Description |
|---|---|
|
Active channels with state, caller/connected ID, context, extension, bridge, codec, and duration (23 columns) |
|
SIP peers with type, IP, port, status, and related properties. 15 columns when Asterisk uses chan_sip, 10 columns for PJSIP (the SIP stack is detected automatically) |
|
Configured SIP registration tests with status, elapsed time, and timestamp (9 columns) |
|
Task processors with queue stats (6 columns) |
Lists
| List | Description |
|---|---|
|
Active channel names |
|
Output lines from an Asterisk CLI command |
|
SIP peer names |
|
Configured SIP registration test names |
|
Names of all configured Asterisk systems (no arguments) |
|
Task processor names |
Multi-System Configuration Example
SubAgent = asterisk.nsm
[Asterisk]
Login = root
Password = password1
[Asterisk/SIPRegistrationTests/104]
Login = 104
Password = 12345
Domain = demo.netxms
[Asterisk/Systems/Remote1]
Hostname = 10.0.0.1
Login = root
Password = password1
[Asterisk/Systems/Remote1/SIPRegistrationTests/120]
Login = 120
Password = 12345
Domain = remote.netxms
Interval = 60
The default local system uses the name LOCAL.
For it, the system argument can be omitted from metrics as described at the beginning of the Metrics section above.
Monitoring Examples
PBX Health Dashboard
Key metrics for an Asterisk health dashboard:
-
Asterisk.Channels.ActiveandAsterisk.CurrentCalls— shows current PBX load -
Asterisk.SIP.Peers.Connected()/Asterisk.SIP.Peers.Total()— shows connectivity status -
Asterisk.Events.Congestion— shows capacity problems -
Asterisk.Peer.RTCP.AverageJitter(peer)— shows call quality for a specific peer