热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

HomerSIPcaptureandVoIPMonitoringInstallGuide

Homerisacarrier-gradeSIPcaptureandVoIPmonitoringsystem.ThisprocedurewillshowhowtoinstallHo

Homer is a carrier-grade SIP capture and VoIP monitoring system. This procedure will show how to install Homer on a CentOS v7 server.

CaptAgent is a Homer Encapsulation Protocol (HEP) agent. It is used to collect relevant data on a local Linux VoIP server, encapsulate it for transportation, and send it to Homer. This procedure will show how to install it on CentOS v6, v7, and Debian v8


Software

CentOS v7

Homer v5

Kamailio v5

CaptAgent v6


PRE-INSTALL


Disable Selinux

Check status.

sestatus

If not disabled, do the following and reboot.

sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config

Disable firewall

It is sometimes helpful to disable the firewall during install.

systemctl disable firewalld
systemctl disable iptables
systemctl stop firewalld
systemctl stop iptables

Timezone

yum install ntp
systemctl enable ntpd
systemctl start ntpd

Find timezone

tzselect

Set timezone example

timedatectl set-timezone America/Vancouver

INSTALL


Prerequisites

yum -y install epel-release
yum -y update
yum -y install git nano gcc httpd mariadb mariadb-server mariadb-devel php php-mysql bison pcre-devel libpcap-devel flex GeoIP-devel

Homer

Download

cd /usr/src/
git clone https://github.com/sipcapture/homer-ui.git
git clone https://github.com/sipcapture/homer-api.git
git clone https://github.com/sipcapture/homer-config.git

Optionally change the default database password in the following files

/usr/src/homer-api/api/configuration_example.php
/usr/src/homer-api/sql/rotation_kamailio5.ini
/usr/src/homer-api/sql/mysql/homer_user.sql
/usr/src/homer-config/sipcapture/sipcapture.kamailio5

Copy files

cp -R /usr/src/homer-ui/* /var/www/html
cp -R /usr/src/homer-api/api /var/www/html/api
mkdir /opt/homer
cp /usr/src/homer-api/scripts/mysql/* /opt/homer
mv -f /opt/homer/rotation_kamailio5.ini /opt/homer/rotation.ini
chmod +x /opt/homer/*

Rename preference and configuration files.

cd /var/www/html/api
mv preferences_example.php preferences.php
mv configuration_example.php configuration.php

Edit preferences

nano /var/www/html/api/preferences.php

Set define('RTCP_TABLE_PARTITION', 1);

Change the REMOTE_LOG_URL and EXTERNAL_AUTH_URL to Homer server IP.

Change ALARM_FROMEMAIL, ALARM_TOEMAIL, HOMER_TIMEZONE, as necessary.

Change mysql socket directory and name for compatibility with CentOS v7

sed -i "s/run\/mysqld\/mysqld.sock/lib\/mysql\/mysql.sock/g" /opt/homer/rotation.ini

MariaDB

Create MySQL databases and tables

systemctl enable mariadb
systemctl restart mariadb

cd /usr/src/homer-api/sql/mysql

mysql mysql mysql homer_data mysql homer_configuration mysql homer_statistic

Lock down the database server

mysql_secure_installation

Answer Y to everything.

Rotation script

Create the daily cron

crontab -e

30 3 * * * root /opt/homer/homer_mysql_rotate > /dev/null 2>&1

The daily cron must be run before Homer can begin capturing data.

/opt/homer/homer_mysql_rotate

Kamailio

Compile install is required to use the geoip module. This compile procedure installs into the same directories as the official Kamailio RPMs, therefore it is interchangeable with an RPM install.

cd /usr/src
git clone -b 5.0 --single-branch https://github.com/kamailio/kamailio.git
cd /usr/src/kamailio
make include_modules="db_mysql sipcapture pv textops rtimer xlog sqlops htable sl siputils geoip" cfg \
prefix=/usr/ cfg_prefix=/

make all && make install

Copy and modify kamailio.cfg.

cp /usr/src/homer-config/sipcapture/sipcapture.kamailio5 /etc/kamailio/kamailio.cfg
sed -i "s/GeoIP.dat/GeoIPCity.dat/g" /etc/kamailio/kamailio.cfg
sed -i "s/lib\/x86_64-linux-gnu/lib64/g" /etc/kamailio/kamailio.cfg

Install GeoIP data

mkdir /usr/share/GeoIP
cd /usr/share/GeoIP/
wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
mv GeoLiteCity.dat.gz GeoIPCity.dat.gz
gunzip GeoIPCity.dat.gz

Enable GeoIP

nano /etc/kamailio/kamailio.cfg

## Uncomment the following line near the top. So instead of ##, make it #
#!define WITH_HOMER_GEO

Create startup systemd file

nano /etc/systemd/system/kamailio.service

[Unit]
Description=Kamailio - the Open Source SIP Server
After=network-online.target
After=mariadb.service httpd.service
[Service]
Type=forking
EnvirOnment='CFGFILE=/etc/kamailio/kamailio.cfg'
EnvirOnmentFile=/etc/default/kamailio
ExecStartPre=/usr/bin/mkdir -m=2770 -p /var/run/kamailio
ExecStartPre=/usr/bin/chown kamailio:kamailio /var/run/kamailio
PIDFile=/var/run/kamailio.pid
ExecStart=/usr/sbin/kamailio -P /var/run/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP
ExecStopPost=/usr/bin/rm -f /var/run/kamailio.pid
Restart=on-abort
[Install]
WantedBy=multi-user.target

Create kamailio user

useradd kamailio

Copy Kamailio environment file

cp /usr/src/kamailio/pkg/kamailio/centos/7/kamailio.sysconfig /etc/default/kamailio

Enable and start Kamailio

systemctl enable kamailio
systemctl start kamailio

Apache configuration

chown -R apache. /var/www/html

nano /etc/httpd/conf.d/homer.conf


ServerName homer
# Indexes + Directory Root.
DirectoryIndex index.php index.html index.htm
DocumentRoot /var/www/html

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all


systemctl enable httpd
systemctl restart httpd

Browse to http://yourserverip

username: admin
password: test123

Make sure date/time range in upper right is correct when searching.


Firewall

Replace x.x.x.x with the VoIP server IP being monitored and repeat as necessary.

systemctl enable firewalld
systemctl start firewalld
firewall-cmd --permanent --zOne=public --add-service={http,https}
firewall-cmd --permanent --zOne=public --add-rich-rule='rule family="ipv4" source address="x.x.x.x" accept'
firewall-cmd --reload

CaptAgent

Universal Homer Encapsulation Protocol (HEP) agent.

Install on any VoIP server you want to monitor. Alternatively, Asterisk PJSIP, Freeswitch, Kamailio, OpenSIPS, and rtpengine have the ability to enable native HEP support. Native clients may not support all features. For example, Freeswitch v1.6 does not currently support RTCP for QoS stats.


Prerequisites

Debian 8 (jessie)

apt-get install build-essential git-core libexpat-dev libpcap-dev libjson0-dev libtool automake flex bison libuv-dev

CentOS v6 & v7

yum -y install epel-release
yum -y install git gcc json-c-devel expat-devel libpcap-devel flex-devel automake libtool bison flex libuv-devel

Install

cd /usr/src
git clone https://github.com/sipcapture/captagent.git
cd captagent
./build.sh
./configure
make && make install

Configure

socket_pcap.xml

The only change necessary is to enable=true the rtcp section. If not using eth0 network interface, try change "dev" value="any" for both sections.

nano /usr/local/captagent/etc/captagent/socket_pcap.xml












portrange 5060-5091















portrange 5060-50000 and len >=50





transport_hep.xml

nano /usr/local/captagent/etc/captagent/transport_hep.xml

Change x.x.x.x to the IP address of your Homer monitoring server and change port to 9060. Optionally change capture-id number to uniquely identify this captagent instance.

















sip_capture_plan.cfg

Uncomment the if(sip_has_sdp()) section

nano /usr/local/captagent/etc/captagent/captureplans/sip_capture_plan.cfg

capture[pcap] {
# here we can check source/destination IP/port, message size
if(msg_check("size", "100")) {
#Do parsing
if(parse_sip()) {
#Can be defined many profiles in transport_hep.xml

if(!send_hep("hepsocket")) {
clog("ERROR", "Error sending HEP!!!!");
}

if(sip_has_sdp())
{
#Activate it for RTCP checks
if(!check_rtcp_ipport())
{
clog("ERROR", "ALREADY EXIST");
}
}

#Duplicate all INVITEs to JSON transport
# if(sip_is_method() && sip_check("method","INVITE")) {
# #Can be defined many profiles in transport_json.xml
# if(!send_json("jsonsocket")) {
# clog("ERROR", "Error sending JSON!!!");
# }
# }
}
}
drop;
}

Configure init or systemd and default

Debian8

cp /usr/src/captagent/init/deb/jessie/captagent.service /etc/systemd/system/
cp /usr/src/captagent/init/deb/debian/captagent.default /etc/default/captagent
systemctl daemon-reload
systemctl enable captagent
systemctl start captagent

CentOS 7

cp /usr/src/captagent/init/el/7/captagent.service /etc/systemd/system/
cp /usr/src/captagent/init/el/captagent.sysconfig /etc/sysconfig/captagent
systemctl daemon-reload
systemctl enable captagent
systemctl start captagent

CentOS 6

cp /usr/src/captagent/init/el/6/captagent.init /etc/init.d/captagent
cp /usr/src/captagent/init/el/captagent.sysconfig /etc/sysconfig/captagent
# Modify init.d change directory name from "bin" to "sbin"
nano /etc/init.d/captagent
APP_FILE=/usr/local/captagent/sbin/$prog
chmod 755 /etc/init.d/captagent
chkconfig --add captagent
chkconfig captagent on
service captagent start

Screenshots

Homer Screenshot



Sections: 
Other
 

推荐阅读
  • EPICS Archiver Appliance存储waveform记录的尝试及资源需求分析
    本文介绍了EPICS Archiver Appliance存储waveform记录的尝试过程,并分析了其所需的资源容量。通过解决错误提示和调整内存大小,成功存储了波形数据。然后,讨论了储存环逐束团信号的意义,以及通过记录多圈的束团信号进行参数分析的可能性。波形数据的存储需求巨大,每天需要近250G,一年需要90T。然而,储存环逐束团信号具有重要意义,可以揭示出每个束团的纵向振荡频率和模式。 ... [详细]
  • Centos7.6安装Gitlab教程及注意事项
    本文介绍了在Centos7.6系统下安装Gitlab的详细教程,并提供了一些注意事项。教程包括查看系统版本、安装必要的软件包、配置防火墙等步骤。同时,还强调了使用阿里云服务器时的特殊配置需求,以及建议至少4GB的可用RAM来运行GitLab。 ... [详细]
  • FeatureRequestIsyourfeaturerequestrelatedtoaproblem?Please ... [详细]
  • 本文介绍了如何使用C#制作Java+Mysql+Tomcat环境安装程序,实现一键式安装。通过将JDK、Mysql、Tomcat三者制作成一个安装包,解决了客户在安装软件时的复杂配置和繁琐问题,便于管理软件版本和系统集成。具体步骤包括配置JDK环境变量和安装Mysql服务,其中使用了MySQL Server 5.5社区版和my.ini文件。安装方法为通过命令行将目录转到mysql的bin目录下,执行mysqld --install MySQL5命令。 ... [详细]
  • CentOS7.8下编译muduo库找不到Boost库报错的解决方法
    本文介绍了在CentOS7.8下编译muduo库时出现找不到Boost库报错的问题,并提供了解决方法。文章详细介绍了从Github上下载muduo和muduo-tutorial源代码的步骤,并指导如何编译muduo库。最后,作者提供了陈硕老师的Github链接和muduo库的简介。 ... [详细]
  • 负载均衡_Nginx反向代理动静分离负载均衡及rewrite隐藏路径详解(Nginx Apache MySQL Redis)–第二部分
    nginx反向代理、动静分离、负载均衡及rewrite隐藏路径详解 ... [详细]
  • 原文地址http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/最开始时 ... [详细]
  • NetBPM的安装还是比较简单的,有比较详细的文档。1.当然是先下载运行程序了,netbpm-0.8.3.1.zip,官方网站ÿ ... [详细]
  • python3.7 安装pip3_python3的pip3安装
    ---恢复内容开始---pip3的安装需要对应一整套python的编译工具库,所以安装好的pip3是这个样子:inearAi:~$pip3-Vpi ... [详细]
  • 一、设置时区方法一:使用setup工具setup选择Timezoneconfiguration选择AsiaShanghai空格键勾选上System ... [详细]
  • 前端简史之纵横:Node东出
    引💡Ajax的出现,带来了jQuery时代,而jQuery时代也伴随着Node风暴淡淡退出了历史舞台。如果说Ajax给前端带来了从网页静 ... [详细]
  • 编译安装更轻量,不会像yum安装那么臃肿。(一)安装MYSQL:一、安装简介用户名:mysql安装目录:us ... [详细]
  • systemd-nspawn可以创建最轻量级的容器(ns的意思就是namespace),本文的实验平台是Ubuntu16.04,x86_64机器。本文的目的是:在Ubuntu中用syst ... [详细]
  • 如何将CentOS8转换为CentOSStream
    CentOS Stream是一个持续交付的Linux发行版,它在RHEL之前处于领先地位。它将具有滚动发布,即不断进行更改。CentOS将成为一个上游版本,它将具有测试补丁和更新。 ... [详细]
  • Linux神奇漏洞:长按回车键70秒 即可轻松拿到Root权限
    一般来说获取系统root权限是很困难的,尤其是加密系统中,但西班牙安全研究员hectormarco、ismaelripoll发现,linux系统下只需按住回车键70秒钟,就能轻 ... [详细]
author-avatar
手机用户2602889575
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有