nagios的安装与配置

发布时间:2020-07-18 23:52:23 作者:lampit凌宇
来源:网络 阅读:404

安装前准备检查环境

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


在浏览器中查看



推荐阅读:
  1. nagios安装及配置
  2. Nagios+PNP+NRPE的安装与配置

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

nagios的监控配置windows 和 na

上一篇:hadoop 3.0.0 安装配置

下一篇:Retina CS强大漏洞检测工具

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》