程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> MySQL機能監控軟件Nagios的裝置及設置裝備擺設教程

MySQL機能監控軟件Nagios的裝置及設置裝備擺設教程

編輯:MySQL綜合教程

MySQL機能監控軟件Nagios的裝置及設置裝備擺設教程。本站提示廣大學習愛好者:(MySQL機能監控軟件Nagios的裝置及設置裝備擺設教程)文章只能為提供參考,不一定能成為您想要的結果。以下是MySQL機能監控軟件Nagios的裝置及設置裝備擺設教程正文


 Nagios是一款Linux上成熟的監督體系運轉狀況和收集信息的開原IT基本舉措措施監督體系,Nagios能監督所指定的當地或長途主機及辦事,例如HTTP辦事、FTP辦事等,同時供給異常告訴、事宜處置等功效,當主機或辦事湧現毛病時,Nagios還可以經由過程郵件、手機短信等情勢在第一時光停止告訴。Nagios可運轉在Linux和Unix平台上,同時供給一個可選的基於閱讀器的Web界面,便利體系治理員檢查體系的運轉狀況、收集狀況、各類體系成績及日記異常等。
情況: 192.168.0.201      mysql主機      rhel6.4
             192.186.0.202      nagios主機    rhel6.4
裝置相干軟件包:

  yum install httpd gcc make perl-ExtUtils-Embed.x86_64 -y
  yum localinstall gd-devel-2.0.35-11.el6.x86_64.rpm  -y

裝置nagios:

useradd nagios
usermod -G nagios apache
#編譯所需軟件包
#運轉 nagios 辦事的用戶
#使 apache 用戶對 nagios 目次具有寫權限,否則 web 頁面操作掉敗
tar jxf nagios-cn-3.2.3.tar.bz2
#nagios 軟件裝置
cd nagios-cn-3.2.3
./configure –enable-embedded-perl
make all      //依據提醒完成裝置
make install
make install-init
make install-commandmode
make install-config
make install-webconf   //在apache下經由過程這條敕令可以疾速整合

裝置nagios-plugins:

yum install mysql-devel openssl-devel -y
tar zxf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-extra-opts --enable-libtap --enable-perl-modules
make
make install

設置裝備擺設nagios:

vi /usr/local/nagios/etc/nagios.cfg
   #cfg_file=/usr/local/nagios/etc/objects/localhost.cfg #正文失落localhost.cfg文件
   cfg_file=/usr/local/nagios/etc/objects/services.cfg  #新建 services.cfg 文件,寄存辦事與辦事組界說
   cfg_file=/usr/local/nagios/etc/objects/hosts.cfg   #新建 hosts.cfg 文件,寄存主機與主機組界說

設置裝備擺設hosts.cfg:

vi /usr/local/nagios/etc/objects/hosts.cfg
define host{                     //主機的治理
use linux-server                  //應用默許的主機規矩
host_name vm2.example.com        //主機名
alias Nagios vm2                  //主機別號
address 127.0.0.1                 //主機ip地址
icon_image switch.gif              //圖標
statusmap_image switch.gd2          
2d_coords 100,200                //2D圖象坐標
3d_coords 100,200,100             //3D圖象坐標
}
define hostgroup{                //主機組的治理
hostgroup_name linux-servers        //主機組名字
alias Linux Servers                //別號
members *                      //*代表下面一切主機

設置裝備擺設mysql
----樹立nagdb公用數據庫

mysql> create database nagdb default CHARSET=utf8;
Query OK, 1 row affected (0.01 sec)

mysql> grant select on nagdb.* to 'nagios'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> update mysql.user set 'Password' = PASSWORD('nagios') where 'User'='nagios';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Password' = PASSWORD('nagios') where 'User'='nagios'' at line 1
mysql> update mysql.user set Password = PASSWORD('nagios') where user='nagios';
Query OK, 1 row affected (0.03 sec)
Rows matched: 1 Changed: 1 Warnings: 0

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

----用以下敕令來驗證一下:

[root@node2 etc]# /usr/local/nagios/libexec/check_mysql -H 192.168.1.152 -u nagios -d nagdb -p nagios
Uptime: 3374 Threads: 1 Questions: 11 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.003

備注:假如湧現:/usr/local/nagios/libexec/check_mysql: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
請檢查$MYSQL_HOME/lib   

[root@node2 lib]# ln -s ./libmysqlclient.so.18.0.0 /usr/lib/libmysqlclient.so.18

設置裝備擺設nrpe.cfg

[root@node2 etc]# tail /usr/local/nagios/etc/nrpe.cfg 
command[check_mysql]=/usr/local/nagios/libexec/check_mysql -H 192.168.1.152 -u nagios -d nagdb -p nagios  //參加此行

設置裝備擺設nagios辦事端

[root@node1 etc]# cat services.cfg    //參加上面內容
define service{
    use               local-service
    host_name            node2
    service_description       mysql
    check_command          check_nrpe!check_mysql
    notifications_enabled      1
    }

最初重啟nrpe和辦事真個nagios。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved