Track Trunk Usage

Is there a way to track trunk usage? I would like to be able to look at some kind of historical record of how many trunks are used at a given time.

My motivation is so I know if I have too many or too few trunks. If I see that the most trunks ever used simultaniously in the past 30 days is 5 and I have 8, I may have too many, but I dont know how to monitor this.


I see.

Thanks for the explanation. So I guess a bulk of the shortcomings in FreePBX are lack of functionality in Asterisk (such as Shared Line Appearances)


Perhaps the perspective is different. Having an extensible system, to me, is much more useful than having a single presentation of the data. The peak stats you’re looking for aren’t kept in asterisk/DAHDI for easy presentation. This means you’re left to ask asterisk/DAHDI how and however often you’d like to collect the current usage.

The CDR evaluation (the latter link posted) can be run whenever you like and can contain as much legacy call information as you retrain in the CDR. My munin plugin is run as often as the munin server polls (5mins?) so there may be spikes of usage within the polling runs – a risk I’m willing to accept.

Perhaps the DAHDI programmers would be open to collect and report peak usage statistics, but that would be well outside the specific interests of FreePBX. Of couse, should such metrics be available it would quickly become available in an existing module or as a new module for FreePBX.


As someone who has a total of a few days experience with this system, I have to say that if you have to write custom code to view such a seemingly simple system metric as this, this is clearly an item that might be considered as an upgrade for the next rev. That seems like data that pretty much anyone would want at their fingertips.


I’ve been running this as a munin plugin. I’m not overly happy with certain aspects of it, it gets me some data.

[code]if [ “$1” = “autoconf” ]; then
echo yes
exit 0

if [ “$1” = “config” ]; then
echo 'graph_title Asterisk Call Utilization’
echo 'graph_args --base 1000 -l 0’
echo “graph_scale no”;
echo 'graph_vlabel Channels’
echo 'graph_category asterisk’
echo 'channels.draw AREA’
echo 'channels.label Channels’
echo 'channels.type GAUGE’
echo 'calls.draw AREA’
echo 'calls.label Calls’
echo 'calls.type GAUGE’
echo 'confu.draw AREA’
echo 'confu.label Conference Callers’
echo 'confu.type GAUGE’
echo 'confs.draw LINE’
echo 'confs.label Active Conferences’
echo 'confs.type GAUGE’
exit 0

echo -n "calls.value "
/usr/sbin/asterisk -rnx ‘core show channels’ 2>/dev/null |
/bin/grep -c ‘^DAHDI’

echo -n "channels.value "
/usr/sbin/asterisk -rnx ‘core show channels’ 2>/dev/null |
/bin/grep ‘active channel’ | /bin/awk ‘{ print $1 }’

echo -n "confu.value "
CONFU=/usr/sbin/asterisk -rnx 'meetme list' 2>/dev/null | \ /bin/grep MeetMe|/bin/awk '{print $7}'
if [ -z “${CONFU}” ]; then echo 0; else echo ${CONFU}; fi

echo -n "confs.value "
/usr/sbin/asterisk -rnx ‘meetme list’ |/bin/egrep -cv ‘MeetMe|Conf’

exit 0


Obviously if you’re not interested in the conference calls you can edit out the confX statements.