189 8069 5689

nagios的安装与配置

安装前准备检查环境

创新互联专注于奎文网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供奎文营销型网站建设,奎文网站制作、奎文网页设计、奎文网站官网定制、微信小程序开发服务,打造奎文网络公司原创品牌,更为您提供奎文网站排名全网营销落地服务。

iptables -F

setenforce 0

#gcc环境 lamp环境和其他的一些 nagios 的依赖包

yum -y install gcc* yum -y install httpd MySQL mysql-server mysql-devel php php-server glibc glibc-common *gd*

#添加nagios运行所需要的用户和组

groupadd nagcmd 

useradd -G nagcmd nagios

usermod -G nagcmd apache

#编译安装nagios

mkdir /cdrom

cp -a /cdrom/* .

tar -xf nagios-3.3.1..tar.gz

cd nagios

./configure --with-commadn-group=nagcmd --enable-event-broker

make all && make install && make install-init make install-commandmode make install-config && make install-webconf

2.生成密码文件

htpasswd -c /usr/local/nagios/etc/htpasswd.user nagiosadmin

service httpd restart

在浏览器中查看效果输入用户名和密码

安装插件管理器nagios-plugins

解压编译

tar -xf nagios-plugins-1.4.14.tar.gz

cd /root/nagios-plugins-1.4.14

./configure --with-nagios-user=nagios --wtih-nagios-group=nagios --with-mysql --enable-perl-modules

make && make install

配置并启动nagios

chkconfig --add nagios

chkconfig nagios on

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

#此命令用来检测语法

service nagios start

windows 主机的监控

安装 NSCLIENt ++

nagios的安装与配置

nagios的安装与配置

服务器端设置windows监控

cd /usr/local/nagios

cd etc/

cd objects/

nagios的安装与配置

#进入nagios主目录,启用windows的支持

vim nagios.cf

vim /usr/local/nagios/etc/objects/contacts.cfg

#39  cfg_file=/usr/local/nagios/etc/objects/windows.cfg

vim /usr/local/nagios/etc/objects/contacts.cfg

#35     email    nagios@localhost报警邮箱根据实际改找个软件最好然后用qq邮箱然后跟微信关联qq号然后微信就可以知道报警了

检测,并启动nagios服务

/usr/local/nagios/bin/nagios -v /usr/local/ngios/etc/nagios.cfg

service nagios restart

Linux的监控

安装gcc,openssl openssl-devel

yum -y install openssl openssl-devel

安装插件管理器nagios-plugins

创建个nagios用户,否则会报错

useradd nagios

cd /root

tar -xf nagios-plugins-1.4.14.tar.gz

cd nagios-plugins-1.4.14

./configure --with-nagios-user=nagios --with-nagios-group=nagios

make all && make install

安装nrpe确保openssl,openss-devel已经安装

tar -xf nrpe-2.8.1.tar.gz

cd nrpe-2.8.1

./configure --enable-ssl --with-ssl-lib=/usr/lib

make all  

make install-plugin

make install-daemon

make install-daemon-config

vim /usr/local/nagios/etc/nrpe.cfg

allowed_hosts=192.168.121.1 127.0.0.1

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

服务端装

nagios-plugins

./configure --enable-ssl --with-ssl-lib=/usr/lib

make all

make install-plugin

cd /usr/local/nagios/etc/

cd objects/

ls

vim linux.cfg

nagios的安装与配置

vim cmmands.cfg

nagios的安装与配置

启用自定义的liunx.cfg文件

vim /usr/local/nagios/etc/nagios.cfg

31# cfg_file=/usr/local/nagios/etc/objects/linux.cfg

检测并启用

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

service nagios restart

服务的监控

客户端

yum -y install mysql mysql-server

service mysqld start

mysqladmin -uroot password '123123'

mysql -uroot -p

create database nagios;

grant selcet on nagios.* to nagios@'%' identifed by '123123';

select user,password,host from mysql.user;

服务端检查一下是否能够连接数据库

/usr/local/nagios/libexec/check_mysql -H 192.168.121.1 -u nagios -d nagios -p 123123

vim mysql.cfgnagios的安装与配置

启动配置

vim /usr/local/nagios/etc/nagios.cfg

nagios的安装与配置

vim commaDNS.cfg

nagios的安装与配置

检测启动nagios

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

service nagios restart

在浏览器中查看


名称栏目:nagios的安装与配置
网页URL:http://cdxtjz.cn/article/gepjid.html

其他资讯