Summary:ASTERISK-09754: [patch] Add additional call counter information to res_snmp
Reporter:Curt Moore (jcmoore)Labels:
Date Opened:2007-06-25 13:00:32Date Closed:2007-12-07 10:08:16.000-0600
Versions:Frequency of
Environment:Attachments:( 0) call_counters_2.diff.txt
( 1) call_counters_3.diff.txt
( 2) call_counters_4.diff.txt
( 3) call_counters_5.diff.txt
( 4) call_counters_6.diff.txt
( 5) call_counters.diff.txt
Description:This patch adds 2 more datapoints to the Asterisk MIB, number of calls currently on the PBX, (what you would see with 'core show channels') and an entirely new counter, the total number of calls passed through the PBX since time of last restart.  The total number of calls statistic required a new variable and functions in pbx.c/pbx.h.


I put these new datapoints in the ast_var_Config() section of the MIB for now but we may want to separate out a new section for some of these statistics if we intend to add more of these types of things in the future.

The total call counter statistic could useful when saying things like, "My Asterisk box crashes after handling x calls" or for other less technical statements such as "My Asterisk box has been up for x days and has handled y calls".

Comments and feedback are welcome.
Comments:By: Russell Bryant (russell) 2007-06-25 14:26:15

I see the use of ast_current_calls(), but I don't see it defined anywhere.  Did you mean to use ast_active_calls() ?

By: Curt Moore (jcmoore) 2007-06-25 15:42:42

Yes, silly me for not compiling. :-(  I also found an error in my MIB.  Everything should be corrected in the latest patch.

By: Jason Parker (jparker) 2007-06-26 16:06:50

printsec isn't being set anywhere in handle_showcalls

By: Curt Moore (jcmoore) 2007-06-26 19:39:08

In my latest patch, printsec should now be set in all cases in handle_showcalls.

By: Curt Moore (jcmoore) 2007-06-27 16:33:36

Added tab completion for the command options to "core show calls" in call_counters_4.diff.txt

Also changed the names of the OIDs in the MIB. Still wrestling with "CallsActive" and "CallsProcessed".  Any thoughts of other ways to reference/name the number of calls currently up and going through the PBX and the total number of calls which have been run through the PBX since restart?

By: Jason Parker (jparker) 2007-06-29 14:33:23

There is an XXX comment, to address handling "seconds".  Is that something you're still working on, or did you just forget to remove the comment?

By: John Todd (jtodd) 2007-08-20 14:24:03

This is a pretty interesting patch.  I can't say I'll have the time to test it, but this would be useful for our "quick and dirty" statistics collection systems that we have monitoring ASterisk.  Currently, we use a really ugly SQL query to feed into our monitoring graphs, and this would allow to make those queries with one less indirection.

By: Brandon Kruse (bkruse) 2007-08-20 14:41:22

I am currently working on adding some more information to snmp also.

It needs a little bit of attention, and could become a great monitoring resource, with more statistics that are readily available through...say manager or the CLI.


By: Justin Killen (justinkillen) 2007-08-20 15:55:33

This looks like a suitable solution for my recent post to the dev list here: http://lists.digium.com/pipermail/asterisk-dev/2007-August/029102.html  I'm looking forward to seeing this included in so that everybody can benefit from it.

By: Jeff Gehlbach (jeffg) 2007-08-20 16:24:19

This enhancement seems worthwhile and well-executed.  I think you're right, Curt, about the placement of these new objects.  I'd argue for creating a new MIB branch to contain these scalars, as they definitely are not configuration-related.  How about  { asteriskCalls ::= asterisk 6 } or

By: Jeff Gehlbach (jeffg) 2007-08-20 16:32:21

Forgot to say in my previous note -- the syntaxes for these new objects should be updated to provide hints about how they are updated.  Specifically, ast~CallsActive should be a Gauge and ast~CallsProcessed should be a Counter.

By: Curt Moore (jcmoore) 2007-08-21 09:56:29

I've attached an updated patch against r80131.  I removed the XXX comment I'd forgotten noted by qwell and also changed the data type for astConfigCallsActive from an Integer32 to a Gauge32 as suggested by jeffg.

As far as a new branch for these sorts of values, what does everyone think?

By: Curt Moore (jcmoore) 2007-10-18 16:04:59

call_counters_6.diff.txt is against latest trunk, r86371.

Let me know if there is anything else still lacking to get this in trunk.

By: John Todd (jtodd) 2007-10-18 16:53:57

I'd be in favor of the new MIB branch for this data.  It seems like that makes sense instead of trying to shoehorn it into config data.

By: Digium Subversion (svnbot) 2007-12-07 10:08:15.000-0600

Repository: asterisk
Revision: 91779

U   trunk/doc/asterisk-mib.txt
U   trunk/include/asterisk/pbx.h
U   trunk/main/cli.c
U   trunk/main/pbx.c
U   trunk/res/snmp/agent.c

r91779 | qwell | 2007-12-07 10:08:14 -0600 (Fri, 07 Dec 2007) | 5 lines

Add count of total number of calls processed by asterisk during it's lifetime.
Add number of total calls and current calls to SNMP.

Closes issue ASTERISK-9754, patch by jcmoore.