环境:
192.168.1.128 mini2
需要的所有软件包:
https://pan.baidu.com/s/1uAZqYnST0VwoCLL3Ir3FCg
Lepus安装需要Lamp环境
安装LAMP:
关闭selinux
[root@mini2 ~]# vim /etc/selinux/config
SELINUX=disabled
[root@mini2 ~]# setenforce 0
[root@mini2 ~]# yum install -y httpd php mariadb mariadb-server php-mysql
[root@mini2 ~]#yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
启动服务
[root@mini2 ~]# systemctl start httpd
[root@mini2 ~]# systemctl start mariadb.service
[root@mini2 ~]# systemctl enable mariadb.service
[root@mini2 ~]# systemctl enable httpd
mariadb安装完是没有密码的,需要设置密码
[root@mini2 ~]# mysqladmin -uroot -p password '123'
Enter password:
测试一下:php是否能连接数据库
[root@mini2 ~]# vim /var/www/html/index.php
$link=mysql_connect("localhost","root","123");
if(!$link) echo "FAILD!连接错误,用户名密码不对";
else echo "OK!可以连接";
?>
[root@mini2 ~]# firewall-cmd --permanent --add-port=80/tcp
success
[root@mini2 ~]# firewall-cmd --reload
success
安装 MySQLdb for python (如果需要监控MySQL则必须安装)
安装MySQLdb for python依赖包
[root@mini2 ~]# yum -y install gcc libffi-devel python-devel openssl-devel mysql-devel zlib-devel
[root@mini2 src]# ls
distribute-0.6.28.tar.gz Lepus.zip MySQLdb-python.zip.zip
[root@mini2 src]# unzip MySQLdb-python.zip.zip
[root@mini2 src]# which mysql_config
/usr/bin/mysql_config
[root@mini2 src]# cd MySQLdb1-master/
[root@mini2 MySQLdb1-master]# vim site.cfg
mysql_config = /usr/bin/mysql_config #修改后
[root@mini2 MySQLdb1-master]# python setup.py build
报错意思urllib2.HTTP错误403:需要SSL
解决办法:
[root@mini2 MySQLdb1-master]# cd ..
[root@mini2 src]# tar zxf distribute-0.6.28.tar.gz
[root@mini2 src]# cd distribute-0.6.28/
[root@mini2 distribute-0.6.28]# python setup.py build
[root@mini2 distribute-0.6.28]# python setup.py install
[root@mini2 distribute-0.6.28]# cd ../MySQLdb1-master/
[root@mini2 MySQLdb1-master]# python setup.py build
[root@mini2 MySQLdb1-master]# python setup.py install #安装成功
安装lepus
[root@mini2 MySQLdb1-master]# cd ..
[root@mini2 src]# unzip Lepus.zip
[root@mini2 src]# cd Lepus_v3.8_beta/
在监控机创建监控数据库,并授权。
[root@mini2 Lepus_v3.8_beta]# mysql -uroot -p123
MariaDB [(none)]> create database lepus default character set utf8;
MariaDB [(none)]> grant select,insert,update,delete,create on lepus.* to 'lepus_user'@'%' identified by '123';
导入表和数据
[root@mini2 Lepus_v3.8_beta]# mysql -uroot -p123 lepus < sql/lepus_table.sql
[root@mini2 Lepus_v3.8_beta]# mysql -uroot -p123 lepus < sql/lepus_data.sql
登录数据库更改表的信息
MariaDB [(none)]> use lepus
MariaDB [lepus]> alter table mysql_status modify column max_connect_errors bigint(18);
MariaDB [lepus]> alter table mysql_status_history modify column max_connect_errors bigint(18);
被监控数据库,本次监控的是本机
MariaDB [lepus]> grant select,super,process,reload,show databases,replication client on *.* to 'lepus_monitor'@'%' identified by '123';
进入到Lepus软件包的python文件夹
[root@mini2 Lepus_v3.8_beta]# cd python/
授予install.sh可执行权限
[root@mini2 python]# chmod +x install.sh
执行安装
[root@mini2 python]# ./install.sh
修改配置文件
[root@mini2 python]# vim /usr/local/lepus/etc/config.ini
###监控机MySQL数据库连接地址###
[monitor_server]
host="192.168.1.129"
port=3306
user="lepus_user"
passwd="123"
dbname="lepus
[root@mini2 python]# ln -s /usr/local/lepus/lepus /etc/init.d/
[root@mini2 python]# service lepus start
lepus server start success! #服务启动成功
安装WEB管理台
[root@mini2 Lepus_v3.8_beta]# cp -rf php/* /var/www/html/
cp: overwrite ‘/var/www/html/index.php’? y
[root@mini2 Lepus_v3.8_beta]# vim /var/www/html/application/config/database.php
通过浏览器打开监控界面,即可登录系统。.默认管理员账号密码admin/Lepusadmin登录后请修改管理员密码,增加普通账号。
监控成功
监控mini1mysql数据库
[root@mini1 ~]# mysql -uroot -p123456
mysql> grant select,super,process,reload,show databases,replication client on *.* to 'lepus_monitor'@'%' identified by '123';
也需要关闭selinux
[root@mini1 ~]# setenforce 0
[root@mini2 Lepus_v3.8_beta]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.128 mini1.centos7.com
192.168.1.129 mini2.centos7.com
[root@mini1 ~]# firewall-cmd --permanent --add-port=3306/tcp
[root@mini1 ~]# firewall-cmd --reload
[root@mini2 Lepus_v3.8_beta]# service lepus stop
[root@mini2 Lepus_v3.8_beta]# service lepus start
[root@mini2 Lepus_v3.8_beta]#