Nagios+MySQL+Ndo2安装总结(2)

3.nagios -plugins安装

3.1下载

3.2安装
Nagios是一个框架,真正的所有的监控工作全部是由nagios插件来完成的,而nagios只是做一个汇总,把监控结果整理的明了之后呈现到用户面前。
tar -zxf ./nagios-plugins-1.4.10.tar.gz
cd ./nagios-plugins-1.4.10
./configure –prefix=/usr/local/nagios //注意这里要把安装目录与nagios安装目录相同
make && make install //安装完毕之后回在/usr/local/nagios/下产生一个libexec的目录
ls /usr/local/nagios/libexec //里面有很多插件,安装完成

3.3启动apache+nagios+apache
//启动apache
/usr/local/apache/bin/apachectl start
//检查nagios配置是否有误
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
//启动nagios
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
在任意一台机器上打开网页服务器地址/nagios
输入用户名test 密码111111
登入,就可以看到nagios的界面。

4.MySQL安装

4.1下载

4.2安装
tar zvxf mysql-5.0.20a.tar.gz //解压缩
cd mysql-5.0.20a //进入解压缩后的文件目录
./configure --prefix=/usr/local/mysql \ //设定安装目录
--enable-thread-safe-client \ //编译线程安全版的客户端库
--without-debug \ //关闭debug功能
--localstatedir=/data/mysqldata \ //设定数据库文件目录
make //编译
make install //安装
cd /
mkdir /data
mkdir /data/mysqldata
/usr/local/mysql/bin/mysql_install_db //初始化授权
这一命令如果出错(...gethostname...)
修改/etc/hosts中第一行开头的1:为:
127.0.0.1
chown –R root:root /usr/local/mysql //文件属性改为root用户
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf //复制配置文件
----------------------------------启动MySQL服务----------------------------------
/usr/local/mysql/bin/mysqld_safe --user=root & //启动MySQL
----------------------------------修改MySQL密码----------------------------------
/usr/local/mysql/bin/mysqladmin -uroot password hrsoft//修改密码
----------------------------------关闭MySQL服务----------------------------------
/usr/local/mysql/bin/mysqladmin -uroot –phrsoft shutdown //关闭MySQL
//添加一个nagios用户供ndo2db使用,密码1234
/usr/local/mysql/bin/mysql -uroot -phrsoft  //登录到mysql
use mysql;
GRANT ALL PRIVILEGES ON *.* TO nagios@localhost IDENTIFIED BY '1234';
//修改mysql用户(nagios)权限
grant select,insert,update,delete on *.* to nagios@localhost.localdomain identified by "1234";
退出mysql,使用nagios登录mysql
/usr/local/mysql/bin/mysql -unagios -p1234
show databases;
//添加数据库给ndo2db使用
create database nagios;
//以下几个是常用的命令
修改mysql用户(nagios)密码:
use mysql;update user set password = PASSOWRD("123456") where user='nagios';
修改mysql用户(nagios)权限
grant select,insert,update,delete on *.* to nagios@localhost.localdomain identified by "1234";
添加用户:
INSERT INTO user VALUES( 'localhost.localdomain', 'monty', PASSWORD('something'), 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
添加用户:
GRANT ALL PRIVILEGES ON *.* TO username@localhost IDENTIFIED BY 'password';

4.3启动
/usr/local/mysql/bin/mysqld_safe --user=root &  //启动mysql
/usr/local/mysql/bin/mysqladmin -uroot –phrsoft shutdown //关闭MySQL

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyffdf.html