Friday, June 20, 2014

Monast – An uber cool FREE web based monitoring for Asterisk (an install guide for Debian users)

I had the chance to install and use Monast (http://monast.sourceforge.net/) by Diego Aguirre and found it extremely useful, simple, fast and FREE to monitor Asterisk 1.4 or higher (this guide uses Asterisk 11.x). Thought i’d share this how to for basic asterisk monitoring needs. Even though the project has not been updated for years, i still find it super useful and works on Asterisk 11 for me just fine.

Important notes:

  • This guide is for users of Debian 32/64, other platforms can adapt, esp the “apt” parts :-)
  • You should already have a running FreePBX (or at least Apache and related libraries) if you do not have FreePBX
  • This guide would likely work for Ubuntu as well

Follow this guide to get it up and running in minutes

  1. Update your apt and get some packages
  2. #apt-get update
  3. #apt-get install python-twisted python-zope.interface php-pear
  4. #pear install HTTP_Client
  5. Get starpy package and install it
  6. #cd /usr/src
  7. #wget -O starpy-1.0.0a13.tar.gz http://downloads.sourceforge.net/project/starpy/starpy/1.0.0a13/starpy-1.0.0a13.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fstarpy%2Ffiles%2Fstarpy%2F1.0.0a13%2F&ts=1402506121&use_mirror=jaist
  8. #tar –zxvf starpy-1.0.0a13.tar.gz
  9. #cd starpy-1.0.0a13/
  10. #./setup.py install
  11. #cd ..
  12. Now download monast
  13. #wget –O monast-3.0b4.tar.gz http://downloads.sourceforge.net/project/monast/Monast%20for%20Asterisk%201.4%2C%201.6%20and%201.8/3.0b4/monast-3.0b4.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmonast%2Ffiles%2FMonast%2520for%2520Asterisk%25201.4%252C%25201.6%2520and%25201.8%2F3.0b4%2F&ts=1403193094&use_mirror=jaist
  14. #tar -zxvf monast-3.0b4.tar.gz
  15. #cd monast-3.0b4/
  16. At this point below, simply use the defaults, change if you know what you’re doing….
  17. #./install.sh
  18. Now, lets create an AMI user using FreePBX’s
  19. Note, use the module Asterisk Manager Users and its a recommended way to add AMI users
  20. Create a new manager user called monastfpbx with a secret like this “mysecret123”, select ALL for read, and ALL for write

    Example below
    image
  21. Submit and apply
  22. If you do not have/use this module, create you own user like this in [freepbx users] /etc/asterisk/manager_custom.conf or rest of the world /etc/asterisk/manager.conf

    [monastfpbx]
    secret = mysecret123
    deny=0.0.0.0/0.0.0.0
    permit=127.0.0.1/255.255.255.0
    read = system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate
    write = system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate
  23. Then reload the manager module #asterisk –rx “manager reload”
  24. Now, edit the monast config file
  25. #nano /etc/monast.conf
  26. Look for the following and change per suggested here (basic setup, change others if you know what you’re doing)

    auth_required = true

    [server: Server_1] # Server name can not contains space
    hostname = 127.0.0.1
    hostport = 5038
    username = monastfpbx
    password = mysecret123

    default_context = from-internal
    transfer_context = from-internal-xfer

    [user: admin]
    secret  = secret12345
    roles   = originate,queue,command,spy
    servers = ALL
  27. Save and exit
  28. Now, lets test start monast
    #/opt/monast/monast.py
    You should see this at minimum (ignore server_2 errors)
    [Fri Jun 20 19:17:05 2014] NOTICE   :: Initializing Monast AMI Interface...
    [Fri Jun 20 19:17:05 2014] NOTICE   :: Parsing config file /etc/monast.conf
    [Fri Jun 20 19:17:05 2014] NOTICE   :: Server Server_1 :: AMI Connected...
  29. Now, ctrl-c to stop that and run this monast as a daemon instead (runs in background)
    #/opt/monast/monast.py --daemon
    You should see something like this:
    Monast daemonized with pid 6738
  30. That’s about it, now log on to the webUI
  31. http(s)://<yourIP>/html/monast with username admin and password secret12345
  32. Remember, you can right click and do stuff to the tabs you see there such as originate calls…
    image 
    image 
    image
    image
  33. The init.d should be automatically added and should auto start in daemon mode, but do verify yourself
  34. Shout out to Diego Aguirre! awesome software mate :-)
  35. Thanks and as usual do give us feedback

 

Happy weekend folks!