<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16546" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>I use mrtg,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I call this from MRTG:
`/usr/local/groundwork/nagios/libexec/asterisk-mrtg.pl -1 Zap -2
SIP`</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Here is my asterisk-mrtg.pl: (note, I have tweaked
this, but I do not know where I had gotten my original reference)</FONT></DIV>
<DIV><FONT face=Arial size=2>-------</FONT></DIV>
<DIV><FONT face=Arial size=2>#!/usr/bin/perl -w</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>use strict;<BR>use IO::Socket;<BR>use
Getopt::Long;<BR>$|=1;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>my $host = "172.16.200.5";<BR>my $username =
"changeduser";<BR>my $password = "changespass";</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>my (<BR> $version, $response, $message, $line,
$chan1, $chan2,<BR> $verbose, $help, $command,<BR> $warning,
$critical, <BR> %warnval,
%critval,<BR> %channels,<BR> $sock,<BR> $key,<BR> $s,<BR> $i,<BR>);<BR>my
$stop = 0;<BR>my $port = 5038;<BR>my $exitcode = 0;<BR>my $cause =
"";</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>sub warning {<BR> $s = shift;<BR> $s =~
s/[\r\n]//g;<BR> print "WARNING: $s\n" if
($verbose);<BR> exit(1);<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>sub error {<BR> $s = shift;<BR> $s =~
s/[\r\n]//g;<BR> print "ERROR: $s\n" if
($verbose);<BR> exit(2);<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>sub unknown {<BR> $s = shift;<BR> $s =~
s/[\r\n]//g;<BR> print "UNKNOWN: $s\n" if
($verbose);<BR> exit(3);<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>sub syntax {<BR> $s = shift;<BR> unless
($s =~ m/Help:/) {<BR> $s = "Error: (".$s.")" or $s =
'Unknown';<BR> }<BR> print "$s\n" unless ($help);<BR> print
"Syntax: $0 -h <host> -u <username> -p <password>
[-cwv]\n";<BR> print "* --username -u
Username\n";<BR> print "* --password -p
Password\n";<BR> print "* --host
-h
Host\n";<BR> print " --port -P
n Port (if not using
$port)\n";<BR> print " --chan1 -1 xxx
Display channel xxx as 1.\n";<BR> print " --chan2 -2
xxx Display channel xxx as 2.\n";<BR> print
" --verbose -v
Verbose\n";<BR> print " --help
-H This
help\n";<BR> exit(3);<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>Getopt::Long::Configure('bundling');<BR>GetOptions<BR> ("p=s"
=> \$password, "password=s" => \$password,<BR>
"u=s" => \$username, "username=s"
=> \$username,<BR> "h=s"
=> \$host, "host=s" =>
\$host,<BR> "P=s" =>
\$port, "port=s" =>
\$port,<BR> "H"
=> \$help, "help"
=> \$help,<BR>
"v" => \$verbose,
"verbose" => \$verbose,<BR>
"chan1=s" => \$chan1,
"1=s" => \$chan1,<BR>
"chan2=s" => \$chan2,
"2=s" => \$chan2);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>syntax("Help:") if ($help);<BR>syntax("Missing
username") unless (defined($username));<BR>syntax("Missing password") unless
(defined($password));<BR>syntax("Missing host") unless
(defined($host));<BR>syntax("Missing channels") if (!defined($chan1) or
!defined($chan2));<BR>if (defined($warning)) {<BR> foreach $s (split(/,/,
$warning)) {<BR> syntax("Warning value given, $s, is
invalid")<BR> unless ($s =~
/^(\w+)=(\d+)$/);<BR> $warnval{$1} = $2;<BR> print "Clear
to give WARNING after $2 connections on $1\n" if
($verbose);<BR> }<BR>}<BR>if (defined($critical)) {<BR> foreach $s
(split(/,/, $critical)) {<BR> syntax("Critical value given, $s, is
invalid")<BR> unless ($s =~
/^(\w+)=(\d+)$/);<BR> $critval{$1} = $2;<BR> print "Clear
to give CRITICAL after $2 connections on $1\n" if
($verbose);<BR> }<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>unless ($sock = IO::Socket::INET->new(PeerAddr
=> $host, PeerPort => $port, Proto => 'tcp')) {<BR> print("Could
not connect to asterisk server ".$host.":".$port."\n") if
($verbose);<BR> exit(2);<BR>}<BR>$version = <$sock>;<BR>print
$version if ($verbose);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>print $sock "Action: Login\r\nUsername:
$username\r\nSecret: $password\r\nEvents: off\r\n\r\n";<BR>print "Action:
Login\r\nUsername: $username\r\nSecret: $password\r\n\r\n" if
($verbose);<BR>$response = <$sock>;<BR>$message = <$sock>;<BR>$s =
<$sock>;<BR>print $response.$message if ($verbose);<BR>print $s if
($verbose);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>exit(1) unless ($response =~
m/^Response:\s+(.*)$/i);<BR>exit(1) unless ($1 =~ m/Success/i);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>print $sock "Action: Status\r\n\r\n";<BR>print
"Action: Status\r\n\r\n" if ($verbose);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>$response = <$sock>;<BR>$message =
<$sock>;<BR>print $response.$message if ($verbose);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>&unknown("Unknown answer $response (wanted
Response: something)") unless ($response =~
m/^Response:\s+(.*)$/i);<BR>&unknown("$response didn't say Success") unless
($1 =~ m/Success/i);<BR>&unknown("Unknown answer $response (wanted Message:
something)") unless ($message =~ m/^Message:\s+(.*)$/i);<BR>&unknown("didn't
understand message $message") unless ($1 =~ m/Channel status will
follow/i);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>$stop=0;<BR>while (($stop == 0) && ($line =
<$sock>)) {<BR> print "$line" if ($verbose);<BR> if ($line =~
m/Channel:\s+(\w+)\//) {<BR> $channels{$1}++;<BR> print
"Found $1 channel\n" if ($verbose);<BR> }<BR> if ($line =~
m/Event:\s*StatusComplete/i)
{<BR> $stop++;<BR> }<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2># Log out<BR>print $sock "Action:
Logoff\r\n\r\n";</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>undef($s);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>for ($i=0;$i<2;$i++) {<BR> if
(defined($channels{$chan1})) {<BR> print $channels{$chan1} .
"\n";<BR> } else {<BR> print "0\n";<BR> }<BR> if
(defined($channels{$chan2})) {<BR> print $channels{$chan2} .
"\n";<BR> } else {<BR> print
"0\n";<BR> }<BR>}<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>-----------</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>my $username should be a user in the asterisk
management file.<BR>my $password should be the password for that
account.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>This gives me this output:</FONT></DIV>
<DIV><FONT face=Arial size=2>
<P class=MsoNormal
style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 3"><B><FONT
face="Times New Roman" size=4><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 14.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">`Daily'
Graph (5 Minute Average)</SPAN></FONT></B></P>
<P class=MsoNormal
style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 3"><B><FONT
face="Times New Roman" size=4><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 14.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"><IMG
src="cid:7E3D5F5BB81E48CC92EFA43DE79678EF@tescogroup.com"><?xml:namespace prefix
= o ns = "urn:schemas-microsoft-com:office:office"
/><o:p></o:p></SPAN></FONT></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 3.75pt; LINE-HEIGHT: normal"><FONT
face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'; mso-no-proof: yes"></SPAN></FONT><FONT
face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'"><o:p></o:p></SPAN></FONT></P><STRONG><FONT
face="Times New Roman"></FONT></STRONG><STRONG><FONT
face="Times New Roman"></FONT></STRONG><STRONG><FONT
face="Times New Roman"></FONT></STRONG>
<TABLE class=MsoNormalTable
style="mso-cellspacing: 1.5pt; mso-yfti-tbllook: 1184" cellPadding=0 border=0>
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 0.75pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0.75pt; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent"></TD>
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 0.75pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0.75pt; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: center"
align=center><B><FONT face="Times New Roman" size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 9.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">Max<o:p></o:p></SPAN></FONT></B></P></TD>
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 0.75pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0.75pt; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: center"
align=center><B><FONT face="Times New Roman" size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 9.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">Average<o:p></o:p></SPAN></FONT></B></P></TD>
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 0.75pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0.75pt; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: center"
align=center><B><FONT face="Times New Roman" size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 9.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">Current<o:p></o:p></SPAN></FONT></B></P></TD></TR>
<TR style="mso-yfti-irow: 1">
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 0.75pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0.75pt; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: center"
align=center><B><FONT face="Times New Roman" color=#00cc00 size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 9.5pt; COLOR: #00cc00; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">Zap
channels<o:p></o:p></SPAN></FONT></B></P></TD>
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 7.5pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 7.5pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: right"
align=right><FONT face="Times New Roman" size=2><SPAN
style="FONT-SIZE: 9.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">5
Zap channels in use<o:p></o:p></SPAN></FONT></P></TD>
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 7.5pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 7.5pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: right"
align=right><FONT face="Times New Roman" size=2><SPAN
style="FONT-SIZE: 9.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">1
Zap channels in use <o:p></o:p></SPAN></FONT></P></TD>
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 7.5pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 7.5pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: right"
align=right><FONT face="Times New Roman" size=2><SPAN
style="FONT-SIZE: 9.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">0
Zap channels in use <o:p></o:p></SPAN></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 2; mso-yfti-lastrow: yes">
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 0.75pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0.75pt; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: center"
align=center><B><FONT face="Times New Roman" color=blue size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 9.5pt; COLOR: blue; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">SIP
channels<o:p></o:p></SPAN></FONT></B></P></TD>
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 7.5pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 7.5pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: right"
align=right><FONT face="Times New Roman" size=2><SPAN
style="FONT-SIZE: 9.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">6
SIP channels in use <o:p></o:p></SPAN></FONT></P></TD>
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 7.5pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 7.5pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: right"
align=right><FONT face="Times New Roman" size=2><SPAN
style="FONT-SIZE: 9.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">1
SIP channels in use <o:p></o:p></SPAN></FONT></P></TD>
<TD
style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 7.5pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 7.5pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: transparent">
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: right"
align=right><FONT face="Times New Roman" size=2><SPAN
style="FONT-SIZE: 9.5pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">0
SIP channels in use
<o:p></o:p></SPAN></FONT></P></TD></TR></TBODY></TABLE><BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><BR><FONT face=Arial size=2>-- <BR>-- <BR>Steven</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><A href="http://www.connectech.org/"><FONT face=Arial
size=2>http://www.connectech.org/</FONT></A></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial><BR><FONT size=2></FONT></FONT> </DIV>
<DIV><FONT face=Arial size=2>"Gordon Henderson" <</FONT><A
href="mailto:gordon+asterisk@drogon.net"><FONT face=Arial
size=2>gordon+asterisk@drogon.net</FONT></A><FONT face=Arial size=2>> wrote
in message </FONT><A
href="news:Pine.LNX.4.64.0801231817520.19953@lion.drogon.net"><FONT face=Arial
size=2>news:Pine.LNX.4.64.0801231817520.19953@lion.drogon.net</FONT></A><FONT
face=Arial size=2>...</FONT></DIV><FONT face=Arial size=2>> <BR>> Is there
any way to find-out the peak number of calls that an asterisk <BR>> system
has had? Not the total number of calls, but the maximum number of <BR>>
simultaneous calls.<BR>> <BR>> I know I can porobably go through the CDR
logs and look for calls which <BR>> have overlapped in time, but I'm
wondering if there's some counter <BR>> somewhere I could access...<BR>>
<BR>> (I'm looking for evidence for an ISDN client who wants to know if he's
<BR>> spent too much on the number of ISDN lines he has installed!)<BR>>
<BR>> Cheers,<BR>> <BR>> Gordon<BR>> <BR>>
_______________________________________________<BR>> -- Bandwidth and
Colocation Provided by </FONT><A href="http://www.api-digital.com"><FONT
face=Arial size=2>http://www.api-digital.com</FONT></A><FONT face=Arial size=2>
--<BR>> <BR>> asterisk-users mailing list<BR>> To UNSUBSCRIBE or update
options visit:<BR>> </FONT><A
href="http://lists.digium.com/mailman/listinfo/asterisk-users"><FONT face=Arial
size=2>http://lists.digium.com/mailman/listinfo/asterisk-users</FONT></A><BR><FONT
face=Arial size=2>></FONT></BODY></HTML>