FreePBX Statistics Commands?

Hello. I am trying to include monitoring for FreePBX and would like to use some of the information listed in the “FreePBX Statistics” under reports - system status. I am wondering if someone can help me with the commands that FreePBX runs in order to get the “trunks online” and other statistics information? I have been looking through source code but cannot find the commands.

Thank you

You can get much information with snmp:-

Thanks. I have set that up and looked through Asterisk MIB Definitions, but I cannot find a command to run which lists how many trunks are online. The FreePBX statistics show how many trunks are online but I need to know the command that it uses to find out that information.

Parse the content of


Thanks - I have looked at that table but unfortunately it doesn’t tell me if the 4 trunks we have are online, which the FreePBX Statistics graph does.

That would be in the relevant

astChanEntry(s) as astChanState

Hi dicko, it looks like it won’t tell us if one individual trunk is offline

astChanState OBJECT-TYPE

No it won’t, But it it will tell you that particular one’s status, you have to use simple logic over all four of your instances,


Do you mean to say that each instance of astChanState represents a defined trunk? or a channel on that trunk?

It’s really not what I mean to say, just go to the horses mouth

and figure it out yourself, it is what Digium means to say and it is pretty well documented . . . :wink:


rest assured Nick and I went through the Digium documentation well before posting on this forum. We’re just confused, because we can’t find anything in that MIB about extensions or trunks, only channels, which is not what we are looking for.

Any help would be appreciated

There is little or no difference in Asterisk between an extension and a “trunk”, they are all ultimately channels or perhaps “endpoints”, it is how you interpret these channels when in existance and their current status and all that information is available within the mib.

Perhaps you should take a step back and read

“cover to cover” for how it all works.

If you want a ready built solution, then perhaps an “oldie but goldie” reference

might be an other starting point for you guys .

Seems like is also a good resource


I appreciate the response, we’ve certainly read these resources, if fact we’ve used them to successfully implenet SNMP monitoring on our systems already. We still can’t get the crux of this question, which is

“How can we monitor the number of trunks online”

If no one was making a call at a given time, I would have thought their would be 0 channels active, yet the FreePBX GUI still displays the status of the trunks in the graph.

Another way of asking, would be to say we want to monitor the status of a specific peer, be it an extension, or a trunk or whatever. I can’t find anything in the Digium documentation that speaks to this.

Does that make more sense?

“How can we monitor the number of trunks online” is computable by :-

(Known Number of trunks) - (count of self identified “trunk” instances in astChanTable where astChanState{stateDown} is 0)

Ok, thanks dicko.