一个台服务器的状态如何保证?各项信息如何保证? 用Nagios 监控软件可以实现服务器信息的监控。
本人声明; 所有的博文都是本人自己之前学习记录的,没有任何的抄袭情况
Nagios 监控软件
开始安装
安装nagios-3.2.1.tar.gz到/usr/local/src
先解压
tar -zxvf nagios-3.2.1.tar.gz -C /usr/local/src/
tar -zxvf nagios-plugins-1.4.14.tar.gz -C /usr/local/src/
文档所在位置
/usr/local/src/nagios-3.2.1/html/docs
firefox index.html
------------------------------------
useradd nagios 添加这个用户
passwd nagios
/usr/sbin/groupadd nagcmd 创建组
/usr/sbin/usermod -a -G nagcmd nagios 该拥有者 添加到组里
/usr/sbin/usermod -a -G nagcmd apache 该拥有者
建立nagios用户 并设置密码 建立nagcmd组 并且将该组设置为nagios apache用的附加组
到nagios-3.2.1解压目录进行安装
./configure --with-command-group=nagcmd
make all 编译软件`
make install 安装软件
make install-init 生成启动文件
make install-config 生成配置文件
make install-commandmode 设置组的执行权限
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin 用户必须是这个
service httpd restart
-------------------------------------------------------------
插件的安装
nagios-plugins-1.4.14.tar 解压缩 /usr/local/src下
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
chkconfig --add nagios 添加服务启动
chkconfig nagios on 打开服务
service nagios restart
访问http://192.168.1.113/nagios
-----------------------------------------
配置检测对象
vim /usr/local/nagios/etc/objects/ localhost.cfg
cp localhost.cfg 192.168.1.196.cfg
vim 192.168.1.196.cfg 自定自己要图形里要监控的东西
3 define host{
4 use linux-server
5 host_name testserver
6 alias host196
7 address 192.168.1.196
}
让配置文件监控自己定义的文件
vim /usr/local/nagios/etcetc/nagios.cfg
36 复制
37 添加
36 cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
37 cfg_file=/usr/local/nagios/etc/objects/192.168.1.102.cfg
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
检测nagios的配置文件是否正常后 启动nagios
重启服务
service nagios restart
测试
访问http://192.168.1.113/nagios
-----------------------------------
nagios.cfg 主配置文件
localhost.cfg 主机文件
templates.cfg 模板
timeperiods.cfg周期
commands 命令
/usr/local/nagios/ libexec 插件
-------------------
在图形里添加新的功能
192.168.1.102.cfg 主机文件
91 define service{
92 use local-service
93 host_name peng
94 service_description NFS --图形上显示的名字
95 check_command check_nfs --对应 命令名字
96 notifications_enabled 0
97 }
commands 命令
241 define command{
242 command_name check_nfs --这个名字对应下面的模块
243 command_line $USER1$/check_http -H 192.168.1.102 -p 2049
244 }
/usr/local/nagios/ libexec 插件
-----------------------------------
-----------------------------------
远程私有信息
安装openssl包
yum install openssl openssl-devel
server端
安装nrpe
tar -zxvf nrpe-2.12.tar.gz -C /usr/local/src

