Observium Monitoring Asterisk: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
Line 24: Line 24:


         # configure the IPv[4|6] address(es) of your Observium server here:
         # configure the IPv[4|6] address(es) of your Observium server here:
         only_from      = 192.168.19.9
         #only_from      = 192.168.1.1


         # Don't be too verbose. Don't log every check. This might be
         # Don't be too verbose. Don't log every check. This might be

Revision as of 04:31, 12 February 2014

Client

Install xinetd

yum -y install xinetd
service xinetd start

xinetd config

vi /etc/xinetd.d/observium_agent

Add the following to the content

service app-asterisk
{
        type           = UNLISTED
        port           = 36602
        socket_type    = stream
        protocol       = tcp
        wait           = no
        user           = root
        server         = /usr/bin/observium_agent/asterisk

        # configure the IPv[4|6] address(es) of your Observium server here:
        #only_from      = 192.168.1.1

        # Don't be too verbose. Don't log every check. This might be
        # commented out for debugging. If this option is commented out
        # the default options will be used for this service.
        log_on_success =

        disable        = no
}

xinetd script

mkdir /usr/bin/observium_agent
vi /usr/bin/observium_agent/asterisk

Add the following to the file

#!/bin/bash

####### Asterisk Telephony Server
if [ -a /usr/sbin/asterisk ]
then
  echo '<<<app-asterisk>>>'
  ACTIVECHAN=$(asterisk -rx 'core show channels' | grep 'active channels' |  cut -d' ' -f1)
  ACTIVECALL=$(asterisk -rx 'core show channels' | grep 'active call' |  cut -d' ' -f1)
  IAXCHANNELS=$(asterisk -rx 'iax2 show channels' | grep active |  cut -d' ' -f1)
  SIPCHANNELS=$(asterisk -rx 'sip show channels' | grep active |  cut -d' ' -f1)
  SIPTOTALPEERS=$(asterisk -rx 'sip show peers' | grep 'sip peers' | cut -d' ' -f1)
  SIPONLINE=$(asterisk -rx 'sip show peers' |  grep -o '[0-9]* online' | head -1 | cut -d' ' -f1)
  IAXTOTALPEERS=$(asterisk -rx 'iax2 show peers' | grep 'iax2 peers' | cut -d' ' -f1)
  IAXONLINE=$(asterisk -rx 'iax2 show peers' |  grep -o '[0-9]* online' | head -1 | cut -d' ' -f1)

  echo "activechan:$ACTIVECHAN"
  echo "activecall:$ACTIVECALL"
  echo "iaxchannels:$IAXCHANNELS"
  echo "sipchannels:$SIPCHANNELS"
  echo "sippeers:$SIPTOTALPEERS"
  echo "sippeersonline:$SIPONLINE"
  echo "iaxpeers:$IAXTOTALPEERS"
  echo "iaxpeersonline:$IAXONLINE"

fi

Make the asterisk script executable

chmod +x /usr/bin/observium_agent/asterisk

Restart xinetd

service xinetd start

Server

One the Observium server.

  1. Select the server in question.
  2. Once the Server is select, click on Settings.
  3. Choose Application and select Asterisk as Yes, and save changes.
  4. Select Poller Modules and enable unix-agent