• Cacti监控mysql数据库server实现过程


    前言:cactiserver端安装请參考:http://blog.csdn.net/mchdba/article/details/27120605


    1 先在cactiserver端安装mysql模板

    wget https://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz

    tar –xvf better-cacti-templates-1.1.8.tar.gz

    cd better-cacti-templates-1.1.8

    将better-cacti-templates-1.1.8scripts下的 ss_get_mysql_stats.php 这个脚本 这个脚本须要放在cacti的服务端。

    比方cacti部署在/var/www/html文件夹下,那么就cp到/var/www/html/cacti/scripts/下

    cp

    /root/better-cacti-templates-1.1.8/scripts/ss_get_mysql_stats.php/var/www/html/cacti/scripts/

    改动ss_get_mysql_stats.php文件 第30行

    $mysql_user = 'cacti_user'; 
    $mysql_pass = 'cacti'; 
    $cache_dir = "/xok.la/cacti/cache/"; 

    赋予apache账号操作权限

    chown -R apache.apache/var/www/html/cacti/scripts

    chmod -R 755 /var/www/html/cacti/scripts

    使用http訪问cacti主机导入:

    /root/better-cacti-templates-1.1.8/templates/cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml

    2,建立mysql账号

    在被监控的mysqlserver建立数据库的cacti账号,须要PROCESS, SUPER, REPLICATION CLIENT权限,SQL例如以下:

    GRANT PROCESS, SUPER, REPLICATION CLIENT ON*.* TO 'cacti'@'%' IDENTIFIED BY '';

    3,在cacti上面加入主机:

    3.1点击Create devices

    3.2进去之后再点击addbutton,加入主机

    3.3 录入描写叙述符和主机名或者IP地址。点击右下角的Createbutton就可以。

    3.4 界面报错例如以下:

    看到在cacti中加入监控主机时。提示错误“SNMP error”。一般有2种处理办法:

    (1)。确定cacti全部的主机能ping通被监控主机;假设不能ping通,请确认网络配置和被监控主机的ip设置是否正确。

    [root@squid-2 templates]# ping 10.xxx.3.xx

    PING 10.254.3.72 (10.254.3.72) 56(84) bytesof data.

    64 bytes from 10.xx.3.xx: icmp_seq=1 ttl=64time=0.427 ms

    64 bytes from 10.xx.3.xx: icmp_seq=2 ttl=64time=0.389 ms

    64 bytes from 10.xx.3.xx: icmp_seq=3 ttl=64time=0.402 ms

    64 bytes from 10.xx.3.xx: icmp_seq=4 ttl=64time=0.415 ms

    能够ping通,证明不是网络故障。

    (2)。确认被监控主机是否启用snmpd服务:

    [root@xxx ~]# ps -eaf|grep snmpd

    root     4540 27133  0 17:15 pts/0    00:00:00 grep snmpd

    [root@xxx ~]#

    [root@xxx ~]# service snmpd start

    snmpd: 未被识别的服务

    [root@xxx ~]#

    被监控主机须要安装snmpd服务。使用yum -y install snmpd 安装snmpd服务。

    [root@xxx ~]# service snmpdrestart

    snmpd: 未被识别的服务

    [root@xxx ~]#

    [root@db-m2-slave-1 ~]# yum -y install snmp

    Loaded plugins: fastestmirror, security

    Loading mirror speeds from cached hostfile

     *base: mirror.neu.edu.cn

     *extras: mirror.neu.edu.cn

     *updates: mirror.neu.edu.cn

    Setting up Install Process

    No package snmp available.

    Error: Nothing to do

    Yum安装不了,试试yum install -y net-snmp,成功安装:

    [root@xxx ~]# yum install -ynet-snmp

    Loaded plugins: fastestmirror, security

    Loading mirror speeds from cached hostfile

     *base: mirror.neu.edu.cn

     *extras: mirror.neu.edu.cn

     *updates: mirror.neu.edu.cn

    Setting up Install Process

    Resolving Dependencies

    --> Running transaction check

    ---> Package net-snmp.x86_641:5.5-49.el6_5.1 will be installed

    --> Processing Dependency: net-snmp-libs= 1:5.5-49.el6_5.1 for package: 1:net-snmp-5.5-49.el6_5.1.x86_64

    --> Processing Dependency:libsensors.so.4()(64bit) for package: 1:net-snmp-5.5-49.el6_5.1.x86_64

    --> Processing Dependency:libnetsnmptrapd.so.20()(64bit) for package: 1:net-snmp-5.5-49.el6_5.1.x86_64

    --> Processing Dependency:libnetsnmpmibs.so.20()(64bit) for package: 1:net-snmp-5.5-49.el6_5.1.x86_64

    [root@xxx ~]# service snmpdrestart

    停止 snmpd:                                              [失败]

    正在启动 snmpd:                                           [确定]

    [root@xxx ~]#

    也能够用 service snmpd reload命令来又一次载入。

    (3),这个时候去看主机状态,正在恢复中:

    然后也能够到cactiserver上。执行snmpwalk来check下:

    snmpwalk-c public -v 2c 10.xxx.1.xx    # (这个ip10.xxx.1.xx为被监控主机的ip地址)

    假设能够接收到被监控机器的数据信息。则表示被监控主机的snmp配置已经完毕。没有错误。

    4,继续加入被监控主机的绘图,添加graphs:

    在Console界面右側。点击Createdevices连接。例如以下图所看到的:

     

    然后点击host主机名连接,例如以下:


    然后点击右上角的Create Graphs for this Host 连接



    5,加入主机组

    在graphs以下加入tree。点击console,选择左边栏的Graphs Trees,点击右边的Addbutton,

    输入trees名字。选择排序类型为Natural Ordering。点击Createbutton创建。


    之后选择创建好的graphs trees。点击addbutton往trees里面加入database主机。加完例如以下图:


    之后点击最上面的graphs。就会出现

    【待续编辑中】


    參考:http://blog.csdn.net/hw_libo/article/details/6881480

  • 相关阅读:
    ASP.NET 概述
    用vs调试项目页面无样式
    eniac世界第二台计算机
    汇编语言
    操作系统发展史
    网站架构发展
    简单分布式系统构建知识
    Android常用adb命令
    USB 3.0规范中译本 第4章 超高速数据流模型
    ECMAScript 6 &ECMAScript 5(在线手册)
  • 原文地址:https://www.cnblogs.com/mqxnongmin/p/10665852.html
Copyright © 2020-2023  润新知