Skip to content

How to monitor Asterisk trunks with PRTG

Last updated on May 14, 2020

A trunk is a single physical connection that can carry multiple VLANs. Each frame that crosses the trunk has a VLAN identifier attached to it, so it can be identified and kept within the correct VLAN.

Trunks can be used between two switches, between a switch and a router or between a switch and a computer that supports trunking. When connecting to a router or computer, each VLAN appears as a separate virtual interface.

When using trunks, it is important to consider that all the VLANs carried over the trunk share the same bandwidth. If the trunk is running over a 100Mbps interface, for example, the combined bandwidth of all the VLANs crossing that trunk is limited to 100Mbps.

Create shell script

touch /var/prtg/scripts/

Add the content to the script

status=$(/usr/sbin/asterisk -rx "sip show peers" |grep trunk_name |awk '{print $6}')
if [ "$status" == OK ]
echo "0:200:$status"
if [ $serviceIsRunning == false ]
echo "2:404:$status"

Save the script and make it executable

chmod +x

Try to run it


Go to the PRTG, and add the SSH Script sensor to the device

In the ‘Script’ field choose and SAVE

Normal response will be “200 OK”
If it is down, you will get “404 Unreachable” error

! Make sure your PRTG Server has access to Asterisk Server, if not, add root username and password to the credentials in the BASIC DEVICE SETTINGS

And here’s the result:

Published inAsteriskLinuxScriptShell