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 скрипт для получения данных с Asterisk:
nano /usr/bin/observium_agent/asterisk
#!/bin/bash
####### Asterisk 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)