VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
mroth at imminc.com Guest
|
Posted: Thu Feb 14, 2008 12:26 pm Post subject: [asterisk-users] Monitor Asterisk |
|
|
Soumya Kat wrote:
Quote: | Thank you to all those who replied to my last query. For them and for
the suggestion, I can monitor asterisk using the asterisk -r -x
"<command>" option. What I would like to know is that using asterisk
-r -x way I can only use the *CLI commands. Is there any other way in
which I can monitor asterisk?
| Soumya,
Yes, "asterisk -rx" will only allow you to execute CLI commands. It
also tends to spew out a bunch of garbage that makes parsing difficult
unless verbosity is always set to 0.
I recommend taking a look at the Asterisk Manager Interface (AMI)
<http://www.voip-info.org/wiki-Asterisk+manager+API>. It's a cleaner
interface that will allow you to read events and issue commands. All of
the CLI commands are available through the AMI, as well as an array of
additional manager actions.
I recently wrote a program that maps the SIP call IDs of the two legs
that make up a call using the
"POE::Component::Client::Asterisk::Manager" Perl module
<http://search.cpan.org/~xantus/POE-Component-Client-Asterisk-Manager/>.
It provides a simple interface for filtering events, so if you're
familiar with Perl I recommend taking a look at it.
Regards,
Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer |
|
Back to top |
|
|
benny+usenet at amorse... Guest
|
Posted: Thu Feb 14, 2008 4:35 pm Post subject: [asterisk-users] Monitor Asterisk |
|
|
"Matthew J. Roth" <mroth at imminc.com> writes:
Quote: | Yes, "asterisk -rx" will only allow you to execute CLI commands. It
also tends to spew out a bunch of garbage that makes parsing difficult
unless verbosity is always set to 0.
|
It would be very handy if it was possible to turn off messages that
aren't the direct result of a command in a particular instance of
asterisk -r. Perhaps asterisk -r -q?
/Benny |
|
Back to top |
|
|
oej at edvina.net Guest
|
Posted: Fri Feb 15, 2008 2:55 am Post subject: [asterisk-users] Monitor Asterisk |
|
|
14 feb 2008 kl. 22.35 skrev Benny Amorsen:
Quote: | "Matthew J. Roth" <mroth at imminc.com> writes:
Quote: | Yes, "asterisk -rx" will only allow you to execute CLI commands. It
also tends to spew out a bunch of garbage that makes parsing
difficult
unless verbosity is always set to 0.
|
It would be very handy if it was possible to turn off messages that
aren't the direct result of a command in a particular instance of
asterisk -r. Perhaps asterisk -r -q?
|
In the long run we're trying to move to using the manager for all
parsing by adding a lot of new manager events and actions.
If there's something missing that you only can do or information you
only can get in the CLI, please tell us.
I would also like to see manager wrappers that produce data that is
easy to handle for scripts, like a wrapper that produces "show channels
consise" in various formats. Do we have a perl programmer on
the list?
Such a generic script could be added to the scripts library
in the Asterisk distribution.
/O |
|
Back to top |
|
|
tzafrir.cohen at xorco... Guest
|
Posted: Fri Feb 15, 2008 12:13 pm Post subject: [asterisk-users] Monitor Asterisk |
|
|
On Fri, Feb 15, 2008 at 08:55:11AM +0100, Johansson Olle E wrote:
Quote: | I would also like to see manager wrappers that produce data that is
easy to handle for scripts, like a wrapper that produces "show channels
consise" in various formats. Do we have a perl programmer on
the list?
Such a generic script could be added to the scripts library
in the Asterisk distribution.
|
The problem is that such a script needs to authenticate to the Asterisk
manager.
I can imagine a failed cron job yelling:
"But I'm root? why the f__ do I need to show an ID card to some stupid
server?!?!"
Well, if you're capable of writing to the Asterisk socket you're also
capable of reading /etc/asterisk/manager.conf , right?
So here's an idea to work around that problem:
At install time generate a random secret, e.g:
# generates string with 128 random bits. Looks like an md5sum
head -c 16 /dev/urandom | hexdump -e '"" "" "%4x" ""'
This will server as a secret of an "administrative" account. It may be
#include-d from another file. And anybody capable of reading that file
is practically authorised to connect to the manager.
This means that the manager connecting script has to assume something
about the config files of Asterisk, which is probably a bad thing. Any
better ideas?
A similar example from a different program: mysql in Debian:
pungenday:~# ls -l /etc/mysql/debian.cnf
-rw------- 1 root root 312 Oct 26 13:22 /etc/mysql/debian.cnf
pungenday:~# cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = XXXXXXXXXXXXXXXXXX
socket = /var/run/mysqld/mysqld.sock
So now administrative scripts can use:
MYSQLADMIN="mysqladmin --defaults-file=/etc/mysql/debian.cnf"
MYSQL="mysql --defaults-file=/etc/mysql/debian.cnf"
# and then something like:
$MYSQL mysql -e 'select host,user from user'
As a normal user:
Could not open required defaults file: /etc/mysql/debian.cnf
Fatal error in defaults handling. Program aborted
As root:
+-----------+------------------+
| host | user |
+-----------+------------------+
| localhost | debian-sys-maint |
| localhost | root |
| pungenday | root |
+-----------+------------------+
Note that in that example the password and the client configuration may
not be in sync. And in fact if you read that file and the postinst
script you'll see the exatra complexity that this has caused.
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen at xorcom.com
+972-50-7952406 mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir |
|
Back to top |
|
|
mroth at imminc.com Guest
|
Posted: Fri Feb 15, 2008 3:16 pm Post subject: [asterisk-users] Monitor Asterisk |
|
|
Johansson Olle E wrote:
Quote: | In the long run we're trying to move to using the manager for all
parsing by adding a lot of new manager events and actions.
If there's something missing that you only can do or information you
only can get in the CLI, please tell us.
| Olle,
How does what you are describing compare to the action command
<http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+Command>?
Regards,
Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|