RHEL5.5下安装mycheckpoint

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,高可用系列 2核4GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介:
RHEL5.5下安装mycheckpoint
以下是在RHEL5.5下安装mycheckpoint,需要安装python,并且版本大于2.4。需要安装Mysql-Python模块,版本必须大于或等于1.2.3,否则会出现bug。这个已经过查证。
官网及下载:
mysql-python 1.2.3下载:
wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download

rpm -qa|grep -i mysql-python 
查看mysql-python版本,rhel5.5的的是1.2.2,需要将其卸载。
rpm -e --nodeps xxxxxx

欢迎转载,请注明作者、出处。
作者:张正
blog:http://space.itpub.net/26355921 
QQ:176036317
如有疑问,欢迎联系。

(提前已经装好了mysql)
[root@host3 ~]# python
Python 2.4.3 (#1, Jun 11 2009, 14:09:58) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
[root@host3 ~]# ls
anaconda-ks.cfg  install.log.syslog         package2.sh  vmware-tools-distrib
Desktop          mycheckpoint-231.tar.gz    package.sh
install.log      MySQL-python-1.2.3.tar.gz  rlwrap
[root@host3 ~]# tar -zxf mycheckpoint-231.tar.gz 
[root@host3 ~]# rm mycheckpoint-231.tar.gz 
rm: remove regular file `mycheckpoint-231.tar.gz'? y
[root@host3 ~]# cd mycheckpoint-231/
[root@host3 mycheckpoint-231]# sudo python setup.py install
/usr/lib/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'requires'
  warnings.warn(msg)
running install
running build
running build_scripts
creating build
creating build/scripts-2.4
copying and adjusting scripts/mycheckpoint -> build/scripts-2.4
changing mode of build/scripts-2.4/mycheckpoint from 644 to 755
running install_scripts
copying build/scripts-2.4/mycheckpoint -> /usr/bin
changing mode of /usr/bin/mycheckpoint to 755
[root@host3 mycheckpoint-231]# cd ..
[root@host3 ~]# tar -zxf MySQL-python-1.2.3.tar.gz 
[root@host3 ~]# rm MySQL-python-1.2.3.tar.gz 
rm: remove regular file `MySQL-python-1.2.3.tar.gz'? y
[root@host3 ~]# ls
anaconda-ks.cfg  install.log.syslog  package2.sh  vmware-tools-distrib
Desktop          mycheckpoint-231    package.sh
install.log      MySQL-python-1.2.3  rlwrap
[root@host3 ~]# cd MySQL-python-1.2.3/
[root@host3 MySQL-python-1.2.3]# ls
doc           _mysql.c               pymemcompat.h    setup.py
ez_setup.py   MySQLdb                README           setup_windows.py
HISTORY       _mysql_exceptions.py   setup.cfg        site.cfg
MANIFEST.in   MySQL_python.egg-info  setup_common.py  tests
metadata.cfg  PKG-INFO               setup_posix.py
[root@host3 MySQL-python-1.2.3]# locate mysql_config
/usr/local/bin/mysql_config
[root@host3 MySQL-python-1.2.3]# vi site.cfg
[options]
# embedded: link against the embedded server library
# threadsafe: use the threadsafe client
# static: link against a static library (probably required for embedded)

embedded = False
threadsafe = True
static = False

# The path to mysql_config.
# Only use this if mysql_config is not on your PATH, or you have some weird
# setup that requires it.
mysql_config = /usr/local/bin/mysql_config

# The Windows registry key for MySQL.
# This has to be set for Windows builds to work.
# Only change this if you have a different version.
registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0

[root@host3 MySQL-python-1.2.3]# python setup.py install
Traceback (most recent call last):
  File "setup.py", line 5, in ?
    from setuptools import setup, Extension
ImportError: No module named setuptools
[root@host3 MySQL-python-1.2.3]# yum -y install python-setuptools
[root@host3 MySQL-python-1.2.3]# python setup.py install
running install
.............
Installed /usr/lib/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg
Processing dependencies for MySQL-python==1.2.3
[root@host3 MySQL-python-1.2.3]# yum -y install mysql-devel
[root@host3 MySQL-python-1.2.3]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.2-m2-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database mycheckpoint;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on mycheckpoint.* to 'moni_user'@'%' identified by 'moni_passwd';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exitr
    -> Bye
[root@host3 MySQL-python-1.2.3]# vi /etc/mycheckpoint.cnf
[mycheckpoint]
#smtp_host = mail.my-server-company.com
#smtp_from = monitor@my-server-company.com
#smtp_to = dba@my-server-company.com
monitored_port = 3306
purge_days = 60
#... Any command line option can go here; replace dash ("-") with underscored ("_")

[client]
user=moni_user
password=moni_passwd
socket=/tmp/mysql.sock
port=3306

[root@host3 MySQL-python-1.2.3]# mycheckpoint deploy
Traceback (most recent call last):
  File "/usr/bin/mycheckpoint", line 23, in ?
    import MySQLdb
  File "build/bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in ?
  File "build/bdist.linux-i686/egg/_mysql.py", line 7, in ?
  File "build/bdist.linux-i686/egg/_mysql.py", line 6, in __bootstrap__
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
[root@host3 MySQL-python-1.2.3]# updatedb
[root@host3 MySQL-python-1.2.3]# locate libmysqlclient_r.so.16 
/opt/mysql/lib/libmysqlclient_r.so.16
/opt/mysql/lib/libmysqlclient_r.so.16.0.0
[root@host3 MySQL-python-1.2.3]# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/opt/mysql/lib/
[root@host3 MySQL-python-1.2.3]# ldconfig -v
..............................
[root@host3 MySQL-python-1.2.3]# python setup.py install
running install
............
Installed /usr/lib/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg
Processing dependencies for MySQL-python==1.2.3
[root@host3 MySQL-python-1.2.3]# python
Python 2.4.3 (#1, Jun 11 2009, 14:09:58) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/usr/lib/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/lib/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg/_mysql.pyc, but /root/MySQL-python-1.2.3 is being added to sys.path
>>> exit
[root@host3 MySQL-python-1.2.3]# mycheckpoint deploy
-- ERROR: Cannot connect to database
-- ERROR: Failed sending email
(1045, "Access denied for user 'moni_user'@'host3' (using password: YES)")
--
-- Make sure `mycheckpoint` schema exists, e.g.
--   CREATE DATABASE `mycheckpoint`
-- Make sure the user has ALL PRIVILEGES on the `mycheckpoint` schema. e.g.
--   GRANT ALL ON `mycheckpoint`.* TO 'my_user'@'my_host' IDENTIFIED BY 'my_password'
-- The user will have to have the SUPER privilege in order to disable binary logging
-- - Otherwise, use --skip-disable-bin-log (but then be aware that slaves replicate this server's status)
-- In order to read master and slave status, the user must also be granted with REPLICATION CLIENT or SUPER privileges
-- - Otherwise, use --skip-check-replication
--
[root@host3 MySQL-python-1.2.3]# mysql -u moni_user -pmoni_passwd
ERROR 1045 (28000): Access denied for user 'moni_user'@'localhost' (using password: YES)
[root@host3 MySQL-python-1.2.3]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.2-m2-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select user,host,password from mysql.user;
+-----------+-----------+-------------------------------------------+
| user      | host      | password                                  |
+-----------+-----------+-------------------------------------------+
| root      | localhost |                                           | 
| root      | host3     |                                           | 
| root      | 127.0.0.1 |                                           | 
|           | localhost |                                           | 
|           | host3     |                                           | 
| moni_user | %         | *B0F4A3678A0500187C67F54F1013BB4AE6069FFB | 
+-----------+-----------+-------------------------------------------+
6 rows in set (0.09 sec)
mysql> delete from mysql.user where user='';
Query OK, 2 rows affected (0.06 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@host3 MySQL-python-1.2.3]# mycheckpoint deploy
-- ERROR: Cannot show master & slave status. Skipping

如果使用mycheckpoint发邮件,报错:
[root@mysql-monitor ~]#mycheckpoint email_alert_pending_report -v --debug
-- ERROR: Failed sending email
Traceback (most recent call last):
  File "/usr/bin/mycheckpoint", line 4337, in send_email_message
    s = smtplib.SMTP(smtp_host)
  File "/usr/lib64/python2.6/smtplib.py", line 239, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib64/python2.6/smtplib.py", line 295, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib64/python2.6/smtplib.py", line 273, in _get_socket
    return socket.create_connection((port, host), timeout)
  File "/usr/lib64/python2.6/socket.py", line 567, in create_connection
    raise error, msg
error: [Errno 111] Connection refused
查看端口:
[root@mysql-monitor ~]# netstat -antl|grep 25
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      
tcp        1      0 127.0.0.1:25                127.0.0.1:35088             CLOSE_WAIT  
tcp        1      0 127.0.0.1:25                127.0.0.1:35089             CLOSE_WAIT  
tcp        1      0 127.0.0.1:25                127.0.0.1:35374             CLOSE_WAIT  
tcp        1      0 127.0.0.1:25                127.0.0.1:35242             CLOSE_WAIT  
tcp        0      0 127.0.0.1:25                127.0.0.1:35509             ESTABLISHED 
tcp        7      0 127.0.0.1:25                127.0.0.1:35239             CLOSE_WAIT  
tcp        0      0 ::1:25                      :::*                        LISTEN      
tcp        0      0 ::ffff:127.0.0.1:35509      ::ffff:127.0.0.1:25         ESTABLISHED
是因为:127.0.0.1:25  ,只允许使用端口号为25的IP为127.0.0.1,因此会出现Connection refused
服务器重启后,重新配置/etc/mail/sendmail.mc ,然后m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
再查看端口:
[mysql@mysql-monitor ~]$ netstat -antl|grep 25
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN
这样既可。
[mysql@mysql-monitor ~]$ mycheckpoint email_alert_pending_report -v --debug
-- Using /etc/mycheckpoint.cnf as defaults file
-- mycheckpoint rev 231, build 201305231510. Copyright (c) 2009-2013 by Shlomi Noach
-- database is mycheckpoint
-- Will not monitor the database
-- Sending HTML alert pending report message from mysql@mysql-monitor.com to: zhangzheng2040@126.com via: mysql-monitor.com
-- + Sent
发送成功

[root@host3 MySQL-python-1.2.3]# crontab -e
*/5 * * * * mycheckpoint --skip-check-replication
[root@host3 MySQL-python-1.2.3]#service crond restart
Stopping crond: [  OK  ]
Starting crond: [  OK  ]
[root@host3 MySQL-python-1.2.3]# mycheckpoint http
read databases
started httpserver on port 12306...
本地ip:192.168.83.130
用网页访问:
http://192.168.83.130:12306/mycheckpoint

1.jpg

本文转自ITPUB博客84223932的博客,原文链接: RHEL5.5下安装mycheckpoint,如需转载请自行联系原博主。
相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。   相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情: https://www.aliyun.com/product/rds/mysql 
相关文章
|
JSON API 数据格式
LangChain Agent:赋予 LLM 行动力的神秘力量
LangChain Agent 是什么?有什么用?基本原理是什么?那么多 Agent 类型在实际开发中又该如何选择?
1021 8
LangChain Agent:赋予 LLM 行动力的神秘力量
|
存储 缓存 Java
【Spring原理高级进阶】有Redis为啥不用?深入剖析 Spring Cache:缓存的工作原理、缓存注解的使用方法与最佳实践
【Spring原理高级进阶】有Redis为啥不用?深入剖析 Spring Cache:缓存的工作原理、缓存注解的使用方法与最佳实践
|
存储 关系型数据库 MySQL
分析MySQL主从复制中AUTO_INCREMENT值不一致的问题
通过对 `AUTO_INCREMENT`不一致问题的深入分析和合理应对措施的实施,可以有效地维护MySQL主从复制环境中数据的一致性和完整性,确保数据库系统的稳定性和可靠性。
237 6
|
存储 机器学习/深度学习 分布式计算
Hadoop学习笔记(HDP)-Part.12 安装HDFS
本系列为HDP大数据平台部署实战指南,涵盖HDFS、YARN、Hive等核心组件安装配置,详解Ambari集群搭建、Kerberos安全认证及高可用实现,助力快速构建企业级大数据环境。
601 0
|
SQL canal 运维
MySQL高可用架构探秘:主从复制剖析、切换策略、延迟优化与架构选型
MySQL高可用架构探秘:主从复制剖析、切换策略、延迟优化与架构选型
|
关系型数据库 MySQL 数据库
RDS for MySQL 字符序(collation)引发的性能问题
经常会遇到的 RDS 实例性能问题(比如 RDS 实例 CPU 使用率高),而其中有一类是由于字符集的字符排序规则不一致导致的。这类问题如何定位,如何解决?田杰带你来解决这类问题哦。
|
JSON 安全 Java
使用goby检测log4j漏洞
使用goby检测log4j漏洞
|
SQL NoSQL 关系型数据库
MySQL慢日志slow_log为何会出现Prepare与Binlog Dump
尝试分析MySQL慢日志slow_log为何会出现Prepare与Binlog Dump
2542 0
MySQL慢日志slow_log为何会出现Prepare与Binlog Dump
|
弹性计算 关系型数据库 MySQL
通过云服务器跳板连接云数据库RDS?
购买同一VPC下的云服务器ECS和云数据库RDS后,在RDS不绑定EIP,如何通过本地Navicat、DBever等工具连接?这里,我们采用Nginx做代理,轻松实现本地访问云数据库,节省RDS绑定EIP的费用。
650 0
通过云服务器跳板连接云数据库RDS?
|
存储 SQL 缓存
【巡检问题分析与最佳实践】RDS MySQL 实例IO高问题
RDS MySQL的IO性能受到硬件层存储介质类型、软件层的DB内核架构、具体SQL语句扫描或修改数据量的影响。
【巡检问题分析与最佳实践】RDS MySQL 实例IO高问题