Monitoring servers, such as mysql and redis

Source: Internet
Author: User
Tags mcrypt

Monitoring servers, such as mysql and redis
1: software application source-Official Website
Designed for All database managers and Internet enterprise database monitoring without the need to deploy agents, the system can easily monitor over 1000 database instances, improve flexible alarm configurations, and provide detailed performance analysis indicators.


Deployment environment:

Linux environment: CentOS7.2

Terms and paths:

Deploy the Lepus server-monitoring end

Mysql and Redis server where the business is located-monitored

Installation package location --/data

Software decompress compilation and installation location --/usr/local/
2:

If it is a local virtual machine, it is recommended to install lrzsz to facilitate transmission of some downloaded installation packages.

Preface

For unknown installations, official documentation is the best tool (although the official documentation of Lepus cannot bear to look directly at it ). Install the software according to the installation requirements in the official documents (Figure 1-1). (The installation of Linux is not listed here. The installation in this article is based on the installed Linux ).

The sequence of Lepus installation and debugging is as follows:

LAMP environment setup-> monitoring us collector & console setup-> monitoring us logon-> monitoring us function configuration


To avoid detours. 1. Disable SELinux. 2. Disable the firewall.

What is a LAMP environment?

LAMP = Linux + Apache + MySQL + PHP Environment


Here is the lamp + python environment directly installed by yum (mysql5.6, Apache/2.4.6, PHP 5.4.16 (cli), python2.7 (built-in ))
[Root @ localhost ~] # Yum-y install httpd-manual mod_ssl mod_perl mod_auth_mysql
[Root @ localhost ~] # Yum install php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
[Root @ localhost ~] # Yum install-y python-devel zlib-devel bzip2-devel Open SSL-devel ncurses-devel sqlite-devel tcl-devel tk-devel
[Root @ localhost ~] # Yum install-y httpd-devel python-devel
[Root @ localhost ~] # Yum install php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
[Root @ localhost ~] # Yum-y install httpd-manual mod_ssl mod_perl mod_auth_mysql
[Root @ localhost ~] # Yum-y install gd php-gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap
Start service and set auto-start
[Root @ localhost ~] # Systemctl enable httpd
[Root @ localhost ~] # Systemctl enable mysqld
[Root @ localhost ~] # Systemctl start httpd
[Root @ localhost ~] # Systemctl start mysqld
Disable firewall and selinux
[Root @ localhost html] # systemctl stop iptables
[Root @ localhost html] # setenforce 0 # temporarily disable
[Root @ localhost html] # cat/etc/sysconfig/selinux # permanently disable
SELINUX = disabled # enforcing changed to disabled to restart the server
Access Test



Build a Python module package in the Lepus Environment

The Python module package is actually included in the LAMP environment. Here it is a module package designed to support Lepus. This part of the package is set up in the Lepus environment.

Installation Process

It is not difficult to install the module package after Python2.X is installed. You can directly follow the instructions in [4 ].

# MySQLdb for python (installation required)
[Root @ localhost html] # cd/data

[Root @ localhost html] # wgetHttp://cdn.lepus.cc/cdncache/software/MySQLdb-python.zip

#-P specifies the download path

[Root @ localhost html] # unzip src/MySQLdb-python.zip

[Root @ localhost html] # MySQLdb1-master/cd/
[Root @ localhost data] # which mysql_config # find the path of mysql_config
/Usr/bin/mysql_config

Shell> vim site. cfg # modify the configuration and add the mysql_config path to the file.

# Setup that requires it.
Mysql_config =/usr/bin/mysql_config # open a comment and write the position of mysql_config found by which

Shell> python setup. py build # If compilation is interrupted, read the FAQ and solve the problem and re-Execute

Shell> python setup. py install

# Pymongo for python (not required)
[Root @ localhost MySQLdb1-master] # cd/data

[Root @ localhost data] # wget http://cdn.lepus.cc/cdncache/software/pymongo-2.7.tar.gz

[Root @ localhost data] # tar xvf pymongo-2.7.tar.gz

[Root @ localhost data] # pymongo-2.7/cd/

[Root @ localhost data] # python setup. py install

Redis-py for python (not required)

[Root @ localhost data] # wgetHttp://cdn.lepus.cc/cdncache/software/redis-py-2.10.3.tar.gz

[Root @ localhost data] # tar xvf redis-py-2.10.3.tar.gz

[Root @ localhost data] # redis-2.10.3/cd/

[Root @ localhost data] # python setup. py install

Module test

Download and decompress the Lepus package. After downloading it in Windows, use rz to upload it to the virtual machine.
: Http://www.lepus.cc/soft/17
Bytes
Upload data to the/data Directory through lrzsz

[Root @ localhost data] # cd/data

[Root @ localhost data] # unzip Lepus.zip

[Root @ localhost data] # cd lepus_v3.7/python/

[Root @ localhost data] # python test_driver_mysql.py # If any error is reported, see the FAQ.

[Root @ localhost data] # python test_driver_mongodb.py

[Root @ localhost data] # python test_driver_redis.py


Lepus collector installation and Installation Process

# Lepus initial data import

[Root @ localhost SQL] # mysql-uroot-phanye131 # Do not clear the password in the actual environment

[Root @ localhost SQL] # create database lepus default character set utf8;

Mysql> create user 'identified us _ user' @ '%' identified by '20140901 ';

Mysql> grant select, insert, update, delete, create on orders us. * to 'Orders us _ user' @ '% ';

Mysql> flush privileges;

[Root @ localhost SQL] # cd/data/lepus_v3.7/SQL/

[Root @ localhost SQL] #

[Root @ localhost SQL] # mysql-uroot-phanye131 lepus <lepus_table. SQL
[Root @ localhost SQL] # mysql-uroot-phanye131 lepus <lepus_data. SQL

# Lepus Program Installation

[Root @ localhost python] # cd/data/lepus_v3.7/python

[Root @ localhost python] # chmod + x install. sh

[Root @ localhost python] #./install. sh

[Root @ localhost python] # vim/data/lepus/etc/config. ini

[Monitor_server]

Host = "127.0.0.1"

Port = 3306

User = "rootr" # username and password created when Lepus initializes data

Passwd = "hanye131"

Dbname = "lepus"

[Root @ localhost python] # lepus start # start Lepus

[Root @ localhost python] # tail-f/usr/local/us US/logs/lepus. log # log storage

FAQ

Q: mysql: [Warning] Using a password on the command line interface can be insecure.

ERROR 1067 (42000) at line 698: Invalid default value for 'ts _ min'

A:

Shell> vim/usr/local/lepus_v3.7/SQL/lepus_table. SQL

Vim> change '2017-00-00 'to '2017-01-01'

'Ts _ min' datetime not null default '2017-01-01 00:00:00 ',
'Ts _ max 'datetime not null default '2017-01-01 00:00:00 ',
'Ts _ cnt 'float default null,

Web Console installation and Installation Process

Shell> cp-rf/data/lepus_v3.7/php/*/var/www/html/

# Copy the files in the PHP folder to the Web virtual directory corresponding to Apache

Shell> vim/var/www/html/application/config/database. php

# Modify the database information of the PHP connection monitoring server according to your own configuration.

[Root @ localhost SQL] # vim/var/www/html/application/config/database. php

$ Active_group = 'default ';
$ Active_record = TRUE;

$ Db ['default'] ['hostname'] = 'localhost ';
$ Db ['default'] ['Port'] = '000000 ';
$ Db ['default'] ['username'] = 'root ';
$ Db ['default'] ['Password'] = 'root12300 .';
$ Db ['default'] ['database'] = 'lepus ';
$ Db ['default'] ['dbdriver '] = 'mysql ';
$ Db ['default'] ['dbprefix'] = '';
$ Db ['default'] ['pconnect '] = TRUE;
$ Db ['default'] ['db _ debug'] = TRUE;
$ Db ['default'] ['cache _ on'] = FALSE;
$ Db ['default'] ['cachedir'] = '';
$ Db ['default'] ['Char _ set'] = 'utf8 ';
$ Db ['default'] ['dbcollat'] = 'utf8 _ general_ci ';
$ Db ['default'] ['SWAp _ pre'] = '';
$ Db ['default'] ['autoinit '] = TRUE;
$ Db ['default'] ['stricton '] = FALSE;

Lepus starts [root @ localhost python] # lepus stop
[Root @ localhost python] # lepus start

The IP address used by the browser to access the machine. For example, in this document, the IP address is:Http: // 192.168.1.200The initial account password is admin/Lepusadmin.



Lepus monitoring configuration operating system monitoring configuration

Lepus collects operating system data through the SNMP protocol, so you need to enable the SNMP service in the monitor.

The SNMP Protocol, also known as SNMP (Simple Network Management Protocol), forms part of the Internet Protocol cluster defined by the internet Engineering team (IETF, Internet Engineering Task Force. This protocol supports network management systems to monitor whether devices connected to the network have any management concerns. It consists of a set of network management standards, including an application layer protocol, database schema, and a set of data objects.

Monitored and monitored

Shell> yum install net-snmp *

Shell> vim/etc/snmp/snmpd. conf

In line 42, change the original default of source to the IP address of the monitoring terminal; change the public of community to lepus (Note: lepus is a common entity configured in the configuration file of the rabbit, if the object to be configured is another name, modify it here)
Row 62: Modify the read permission from systemview to all.

85 rows. Open the original comment.

Service snmpd start
After the server is set up, the server will be supplemented in the future. Do not spray it for your reference only.





















Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.