[2、 Install Python basic modules](https://www.ssgeek.com/#2-%E5%AE%89%E8%A3%85python%E5%9F%BA%E7%A1%80%E6%A8%A1% E5%9D%97)
[2.2、 Install cx_oracle for python (if you need to monitor Oracle, you must install it)](https://www.ssgeek.com/#22-%E5%AE%89%E8%A3%85cx_oracle-for-python%E5%A6%82 %E6%9E%9C%E9%9C%80%E8%A6%81%E7%9B%91%E6%8E%A7oracle%E5%88%99%E5%BF%85%E9%A1%BB%E5 %AE%89%E8%A3%85)
[2.3、 Install Pymongo for python (If you need to monitor Mongodb, you must install it)](https://www.ssgeek.com/#23-%E5%AE%89%E8%A3%85pymongo-for-python%E5%A6%82 %E6%9E%9C%E9%9C%80%E8%A6%81%E7%9B%91%E6%8E%A7mongodb%E5%88%99%E5%BF%85%E9%A1%BB%E5 %AE%89%E8%A3%85)
[2.4、 Install Redis driver (If you need to monitor Redis, you must install it)](https://www.ssgeek.com/#24-%E5%AE%89%E8%A3%85redis-%E9%A9%B1%E5%8A %A8%E5%A6%82%E6%9E%9C%E9%9C%80%E8%A6%81%E7%9B%91%E6%8E%A7redis%E5%88%99%E5%BF%85 %E9%A1%BB%E5%AE%89%E8%A3%85)
[2.5、 Test whether each driver is operating normally (not required)](https://www.ssgeek.com/#25-%E6%B5%8B%E8%AF%95%E5%90%84%E4%B8%AA% E9%A9%B1%E5%8A%A8%E6%98%AF%E5%90%A6%E6%AD%A3%E5%B8%B8%E8%BF%90%E8%A1%8C%E9% 9D%9E%E5%BF%85%E9%A1%BB)
[5、 Add monitoring database instance](https://www.ssgeek.com/#5-%E6%B7%BB%E5%8A%A0%E7%9B%91%E6%8E%A7%E6%95%B0% E6%8D%AE%E5%BA%93%E5%AE%9E%E4%BE%8B)
[6、 Add operating system snmp monitoring instance](https://www.ssgeek.com/#6-%E6%B7%BB%E5%8A%A0%E6%93%8D%E4%BD%9C%E7%B3% BB%E7%BB%9Fsnmp%E7%9B%91%E6%8E%A7%E5%AE%9E%E4%BE%8B)
Lepus is an open source database monitoring platform. It currently supports basic monitoring and alarms of databases such as MySQL, Oracle, SQLServer, MongoDB, Redis (MySQL already supports replication monitoring, slow query analysis and Advanced functions such as directional push). Lepus does not need to deploy scripts or agents on each database server. It only needs to create an authorized account in the database to perform remote monitoring. It is suitable for monitoring companies with more database servers and monitoring databases in the cloud. This will greatly reduce monitoring deployment for enterprises. At the same time, the Lepus system has built-in rich performance monitoring indicators, so that companies can find potential performance problems and deal with them before the database goes down, reducing the company's direct losses due to database problems.
Environmental description
System version CentOS 7.2 x86_64
Software version lepus 3.7
[ root@lepus ~]# yum install -y httpd php php-mysql mariadb-server
[ root@lepus ~]# mkdir -p /service/tools
[ root@lepus ~]# cd /service/tools
[ root@lepus tools]# unzip MySQLdb-python.zip
[ root@lepus MySQLdb1-master]# cd MySQLdb1-master/[root@lepus MySQLdb1-master]# yum install -y mariadb-devel
[ root@lepus MySQLdb1-master]# which mysql_config
/usr/bin/mysql_config
[ root@lepus MySQLdb1-master]# vim site.cfg
mysql_config =/usr/bin/mysql_config
[ root@lepus MySQLdb1-master]# python setup.py build #The following error occurred
[ root@lepus MySQLdb1-master]# yum install -y python2-pip #Solve the error
[ root@lepus MySQLdb1-master]# python setup.py build #The following error occurred
[ root@lepus MySQLdb1-master]# yum install -y python-devel #Solve the error
[ root@lepus MySQLdb1-master]# python setup.py build
[ root@lepus MySQLdb1-master]# python setup.py install
[ Download and install oracle instant client]
( http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html)
[ root@lepus tools]# rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
[ root@lepus tools]# rpm -ivh oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm
[ root@lepus tools]# rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
[ root@lepus tools]# vim /root/.bash_profile
ORACLE_HOME="/usr/lib/oracle/11.2/client64"
PATH=$PATH:$ORACLE_HOME/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
[ root@lepus tools]# source ~/.bash_profile #Reload bash after modification_profile file
[ root@lepus tools]# vim /etc/ld.so.conf
/usr/lib/oracle/11.2/client64/lib
[ root@lepus tools]# ldconfig #Execute ldconfig to take effect
Install cx_oracle
[ root@lepus tools]# tar xf cx_Oracle-5.2.1.tar.gz
[ root@lepus tools]# cd cx_Oracle-5.2.1/[root@lepus cx_Oracle-5.2.1]# python setup.py build
[ root@lepus cx_Oracle-5.2.1]# python setup.py install
[ root@lepus tools]# tar xf pymongo-2.7.tar.gz
[ root@lepus tools]# cd pymongo-2.7/[root@lepus pymongo-2.7]# python setup.py install
[ root@lepus tools]# tar xf redis-py-2.10.3.tar.gz
[ root@lepus tools]# cd redis-2.10.3/[root@lepus redis-2.10.3]# python setup.py install
In the python directory of the lepus installation file package, find the following test file to test whether the above driver is installed correctly
[ root@lepus tools]#Unzip Lepus database enterprise monitoring systemThree.7 version official download.zip
[ root@lepus tools]# cd lepus_v3.7/python/[root@lepus python]# python test_driver_mysql.py
MySQL python drivier is ok![root@lepus python]# python test_driver_oracle.py
Oracle python drivier is ok![root@lepus python]# python test_driver_mongodb.py
MongoDB python drivier is ok![root@lepus python]# python test_driver_redis.py
Redis python drivier is ok!
[ root@lepus sql]# systemctl start mariadb.service #Start service
[ root@lepus sql]# systemctl enable mariadb.service
[ root@lepus sql]# mysqladmin -uroot password '123456' #Set database password
[ root@lepus sql]# mysql -uroot -p123456
MariaDB [(none)]> create database lepus default character set utf8; #Create database
MariaDB [(none)]> grant all on lepus.* to lepus@localhost identified by '123456'; #Authorization
MariaDB [(none)]> exit
[ root@lepus sql]# mysql -ulepus -p123456 lepus <lepus_table.sql #Import database file
[ root@lepus sql]# mysql -ulepus -p123456 lepus <lepus_data.sql
[ root@lepus sql]# cd ../python/[root@lepus python]# chmod +x install.sh #Add execute permission for installation script
[ root@lepus python]# ./install.sh #installation
[ root@lepus python]# cd /usr/local/lepus/[root@lepus lepus]# vim etc/config.ini #Modify the configuration file
[ monitor_server]
host="127.0.0.1"
port=3306
user="lepus"
passwd="123456"
dbname="lepus"[root@lepus lepus]# lepus start #start up
[ root@lepus lepus]# cd /service/tools/lepus_v3.7/php/[root@lepus php]# cp -a ./var/www/html/ #Copy the web interface code
[ root@lepus php]# systemctl start httpd.service #Start service
[ root@lepus php]# systemctl enable httpd.service
[ root@lepus html]# vim application/config/database.php #Modify the configuration file
$db['default']['hostname']='127.0.0.1';
$db['default']['port']='3306';
$db['default']['username']='lepus';
$db['default']['password']='123456';
$db['default']['database']='lepus';
$db['default']['dbdriver']='mysql';
Enter the IP address or domain name through the browser to open the monitoring interface, you can log in to the system. .The default administrator account password admin/Lepusadmin after logging in, please modify the administrator password and add a common account.
Configuration Center——>mysql——>New
[ root@lepus html]# tail -f /usr/local/lepus/logs/lepus.log #Check the log and successfully add monitoring
[ root@lepus html]# yum install -y net-snmp #Install net-snmp
[ root@lepus html]# vim /etc/snmp/snmpd.conf #Modify the configuration file, add a line
view systemview included .1[root@lepus html]# systemctl start snmpd.service #Start service
[ root@lepus html]# systemctl enable snmpd.service
[ root@lepus html]# netstat -lntup|grep 161
udp 000.0.0.0:1610.0.0.0:*11888/snmpd
Configuration Center -> Operating System -> New
[ root@lepus html]# lepus stop #Restart service
[ root@lepus html]# lepus start
Successfully added snmp host operating system monitoring
At this point, the lepus installation and basic configuration are complete!
Reference from Official Document
Recommended Posts