1.解决依赖包 yum -y install httpd gcc glibc glibc-common gd gd-devel php php-mysql
安装nagios+监控Linux客户端服务端+监控windows客户端
原创
©著作权归作者所有:来自51CTO博客作者Wangjian_的原创作品,谢绝转载,否则将追究法律责任
mysql mysql-devel mysql-server
2添加nagios运行所需的用户和组
groupadd nagcmd
useradd -G nagcmd nagios
passwd nagios
把apache加入到nagcmd组
usermod -a -G nagcmd apache
3编译nagios
tar zxvf nagios-3.4.1.tar.gz
cd nagios-3.4.1
./configure --sysconfdir=/etc/nagios --with-command-group=nagcmd --enable-event-broker
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
创建一个登录nagios web程序的用户
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
service httpd start (如果遇到Starting httpd: httpd: Could not reliably determine the server's fully quali)
vi /etc/httpd/conf/httpd.conf 把ServerName www.example.com:80的注释去掉
4安装nagios-plugins
tar zxvf nagios-plugins
cd nagios-plugins
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
service nagios start
setenforce 0
----------------------------------------------------------------------------------------------------------
nagios监控Linux服务端的配置
tar zvxf nrpe-2.13
cd nrpe-2.13
./configure --with-nrpe-user=nagios \
--with-nrpe-group=nagios \
--with-nagios-user=nagios \
--with-nagios-group=nagios \
--enable-command-args \
--enable-ssl
make all
make install-plugin
----------------------------------------------------------------------------------------------------------
nagios监控Linux客户端的配置
基于nrpe监控Linux
1.nrpe 依赖与nagios-plugins (5666端口)
在被监控端安装nagios-plugins
先检查看有没有安装开发包组 yum grouplist
yum -y groupinstall "Development Tools" "Development Libraries"
添加用户
useradd -s /sbin/nologin nagios
tar xf nagios-plugins
cd nagios-plugins
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make all
make install
2.安装nrpe
tar zvxf nrpe-2.13
cd nrpe-2.13
./configure --with-nrpe-user=nagios \
--with-nrpe-group=nagios \
--with-nagios-user=nagios \
--with-nagios-group=nagios \
--enable-command-args \
--enable-ssl
make all
make install-plugin
make install-daemon
make install-daemon-config
3配置nrpe
vim /usr/local/nagios/etc/nrpe.cfg
修改 allowed_hosts=192.168.142.11
4启动nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
或者通过脚本
vim /etc/init.d/nrpe
#!/bin/bash
# chkconfig: 2345 88 12
# description: NRPE DAEMON
NRPE=/usr/local/nagios/bin/nrpe
NRPECONF=/usr/local/nagios/etc/nrpe.cfg
case "$1" in
start)
echo -n "Starting NRPE daemon..."
$NRPE -c $NRPECONF -d
echo "done."
;;
stop)
echo -n "Stopping NRPE daemon..."
pkill -u nagios nrpe
echo " done."
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: $0 start|stop|restart"
;;
esac
exit 0
-------------------------------------------------------------------------------------------------
nagios监控windows客户端的配置
1.windows客户端安装一个nscclient++ (需要定义主机,服务,联系人)
在windows 客户端 用netstat -an 查看是否有12489的端口
2.回到监控端 cd /usr/local/nagios/libexec (全是命令)
./check_nt -h 查看用法
如 ./check_nt -H 192.168.142.50 -p 12489(端口) -v UPTIME (命令)
./check_nt -H 192.168.142.50 -p 12489 -v CPULOAD -w 80 -c 90 -l 5,80,90
./check_nt -H 192.168.142.50 -p 12489 -v USEDDISKSPACE -w 80 -c 80 -l 5,80,90
3.cd /etc/nagios/object
vim commands.cfg
定义一个命令
define command {
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v $ARG1$ $ARG2$
}
4 vim windows.cfg
把主机名字改为winhost
把地址改为要监控的地址如192.168.142.50
改所有 :.,$s@winserver@winhost@g
保存退出
5启用文件 windows.cfg
cd /etc/nagios
vim nagios.cfg
把cfg_file处加个 cfg_file=/etc/nagios/objects/windows.cfg
保存退出
6查错 /usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg
然后重启 service nagios restart
-------------------------------------------------------------------------------------------------------------------
上一篇:安装nginx
下一篇:Mysql实现主从复制

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
nagios window客户端监控
nagios对window客户端的监控方法
职场 windows 监控 nagios 休闲 -
Nagios监控--Linux客户端(Use NRPE)
nagios 对linux服务器监控配置
Linux nagios 休闲 nrpe 监控主机