Observium Monitoring Asterisk: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Install xinetd =
 
= Client =
== Install xinetd ==
<pre>
<pre>
yum -y install xinetd
yum -y install xinetd
Line 5: Line 7:
</pre>
</pre>


= xinetd config =
== xinetd config ==
<pre>
<pre>
vi /etc/xinetd.d/observium_agent
vi /etc/xinetd.d/observium_agent
Line 22: 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
Line 33: Line 35:
</pre>
</pre>


= xinetd script =
== xinetd script ==
<pre>
<pre>
mkdir /usr/bin/observium_agent
mkdir /usr/bin/observium_agent
Line 72: Line 74:
chmod +x /usr/bin/observium_agent/asterisk
chmod +x /usr/bin/observium_agent/asterisk
</pre>
</pre>
== Restart xinetd ==
<pre>
service xinetd restart
</pre>
= Server =
One the Observium server.
# Select the server in question.
# Once the Server is select, click on Settings.
# Choose Application and select Asterisk as Yes, and save changes.
# Select Poller Modules and enable unix-agent


[[Category : Observium]] [[Category : Linux]]
[[Category : Observium]] [[Category : Linux]]

Latest revision as of 05:09, 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 restart

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