open-falcon是由小米運維團隊,從互聯網公司角度爲出發點,開發出來的一套面向互聯網行業的企業級的開源監控系統,截至2019年7月,open-falcon最新穩定版本爲v0.2html
5.1安裝redis前端
#建立redis工做目錄
mkdir /home/redis && cd /home/redis #下載redis程序包: wget http://download.redis.io/releases/redis-4.0.9.tar.gz #編譯安裝 tar -zxvf redis-4.0.9.tar.gz mv redis-4.0.9 redis4.0.9 && cd redis4.0.9 mkdir logs make && make install #修改配置文件 vim redis.conf bind 0.0.0.0 daemonize yes pidfile /var/run/redis_6379.pid logfile "/home/redis/redis4.0.9/logs/redis.log" #啓動redis redis-server /home/redis/redis4.0.9/redis.conf #鏈接測試 redis-cli -h 127.0.0.1 -p 6379
5.2安裝mysqlpython
#安裝yum-utils yum -y install yum-utils #mysql官網上下載mysql的yum源安裝包 wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm #添加yum源 rpm -ivh mysql80-community-release-el7-1.noarch.rpm #開啓5.7安裝,關閉8.0安裝源 yum-config-manager --disable mysql80-community yum-config-manager --enable mysql57-community #yum安裝mysql yum -y install mysql-community-server #修改mysql配置文件,關閉複雜密碼策略 echo "validate-password=OFF" >> /etc/my.cnf #啓動mysql 並加入開機啓動項 systemctl start mysqld.service systemctl status mysqld.service systemctl enable mysqld.service #查看默認root密碼 grep 'temporary password' /var/log/mysqld.log #登錄mysql後修改root密碼 ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; #root用戶受權 GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY '123456'; GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '123456'; flush privileges;
5.3初始化表結構mysql
#clone項目至本地
git clone https://github.com/open-falcon/falcon-plus.git
#導入表結構 cd ./falcon-plus/scripts/mysql/db_schema/ mysql -uroot -p123456 < 1_uic-db-schema.sql mysql -uroot -p123456 < 2_portal-db-schema.sql mysql -uroot -p123456 < 3_dashboard-db-schema.sql mysql -uroot -p123456 < 4_graph-db-schema.sql mysql -uroot -p123456 < 5_alarms-db-schema.sql
#刪除目錄 rm -rf falcon-plus/
5.4安裝golanglinux
#下載go安裝包 https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz #解壓至/home目錄下 tar -zxvf go1.12.7.linux-amd64.tar.gz -C /home #聲明PATH echo "export PATH=$PATH:/home/go/bin" >> /etc/profile source /etc/profile #查看go版本 go version
5.5建立工做目錄git
export FALCON_HOME=/home export WORKSPACE=$FALCON_HOME/open-falcon mkdir -p $WORKSPACE
5.6下載安裝包github
#下載安裝包 wget https://github.com/open-falcon/falcon-plus/releases/download/v0.2.0/open-falcon-v0.2.0.tar.gz #解壓 cd /home/open-falcon tar -zxvf open-falcon-v0.2.0.tar.gz
5.7後端啓動golang
#修改配置文件爲本身設置的mysql用戶和密碼 grep -Ilr 3306 ./ | xargs -n1 -- sed -i 's/root:/real_user:real_password/g' #啓動服務 /home/open-falcon/open-falcon start /home/open-falcon/open-falcon check #顯示以下則所有啓動成功
falcon-graph UP 27685
falcon-hbs UP 27697
falcon-judge UP 27707
falcon-transfer UP 27716
falcon-nodata UP 27724
falcon-aggregator UP 27732
falcon-agent UP 27743
falcon-gateway UP 27753
falcon-api UP 27761
falcon-alarm UP 28201 redis
5.8前端啓動sql
#下載dashboard項目至本地 cd $WORKSPACE git clone https://github.com/open-falcon/dashboard.git #安裝所需依賴包 yum install -y python-virtualenv yum install -y python-devel yum install -y openldap-devel yum install -y mysql-devel yum groupinstall "Development tools" #建立獨立的虛擬環境 cd $WORKSPACE/dashboard/ virtualenv ./env #pip安裝依賴 ./env/bin/pip install -r pip_requirements.txt -i https://pypi.douban.com/simple #修改配置文件 vim rrd/config # TODO: read from api instead of db PORTAL_DB_HOST = os.environ.get("PORTAL_DB_HOST","127.0.0.1") PORTAL_DB_PORT = int(os.environ.get("PORTAL_DB_PORT",3306)) PORTAL_DB_USER = os.environ.get("PORTAL_DB_USER","root") PORTAL_DB_PASS = os.environ.get("PORTAL_DB_PASS","123456") PORTAL_DB_NAME = os.environ.get("PORTAL_DB_NAME","falcon_portal") # alarm database # TODO: read from api instead of db ALARM_DB_HOST = os.environ.get("ALARM_DB_HOST","127.0.0.1") ALARM_DB_PORT = int(os.environ.get("ALARM_DB_PORT",3306)) ALARM_DB_USER = os.environ.get("ALARM_DB_USER","root") ALARM_DB_PASS = os.environ.get("ALARM_DB_PASS","123456") ALARM_DB_NAME = os.environ.get("ALARM_DB_NAME","alarms") #啓動 bash control start bash control status #查看日誌 bash control tail
5.9安裝agent
#將agent目錄及啓動命令拷貝至客戶端上 scp -r agent/ root@192.168.1.66:/home/open-falcon/ scp open-falcon root@192.168.1.66:/home/open-falcon/ #編輯agent配置文件,修改hostname、transfer、heaetbeat配置項 vim agent/config/cfg.json #啓動agent,查看agent狀態 ./open-falcon start agent ./open-falcon check agent tailf agent/logs/agent.log #重載配置文件 curl 127.0.0.1:1988/config/reload
5.10訪問測試
agent訪問地址: http://ip:1988/ dashboard訪問地址: http://ip:8081/
中文手冊:http://book.open-falcon.com/zh_0_2/
項目地址:https://github.com/open-falcon/falcon-plus