Nagios备忘之安装

###############################################Server端###############################################

----------------

Nagios

----------------

源码包地址:http://sourceforge.net/projects/nagios/?source=directory

建立nagios账号:
# useradd nagios && passwd nagios
# groupadd nagcmd                                                   //nagcmd用于从web接口执行外部命令
# usermod -G nagcmd nagios
# usermod -G nagcmd daemon

安装nagios:
# tar xf nagios.xx.xx
# ./configure --with-command-group=nagcmd --with-nagios-user=nagios --with-nagios-group=nagios
# make all
# make install
# make install-init                            --> 生成init启动脚本
# make install-commandmode    --> 设置相应的目录权限
# make install-config                      --> 生成模板配置文件
# make install-webconf                  --> 生成apache配置文件

# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin


# yum install httpd
# cp /etc/httpd/conf/nagios.conf /usr/local/apache2/conf/extra/nagios.conf
# vim /usr/local/apache2/conf/httpd.conf
include conf/extra/nagios.conf

# chkconfig --add nagios
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# /etc/init.d/nagios start

测试:http://IP/nagios/
###############################################Server端###############################################


##########################################Server端和Client端安装#########################################

安装nagios插件
-----------------------
nagios-plugin.xx.xx

-----------------------

源码地址:http://sourceforge.net/projects/nagiosplug/

# tar xf nagios-plugin.xx.xx
# cd nagios-plugin.xx.xx
# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios
# make && make install

# pwd
/usr/local/nagios/libexec
// 插件安装后的文件

-----------------------

nrpe
监控linux本地主机时,我们可以直接更改配置文件进行监控,如果需要监控的主机与nagios不在同一机器上,即监控远程linux主机时,需要借助NRPE插件实现。

-----------------------

源码地址:http://sourceforge.net/projects/nrpe/?source=directory

# ./configure
# make
# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
# vim /usr/local/nagios/etc/nrpe.cfg

allowed_hosts=127.0.0.1,192.168.1.20 #逗号隔开,授权Server获取check_nrpe

# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg ‐d   //启动
# /usr/local/nagios/libexec/check_nrpe  -H 127.0.0.1   //输出表示nrpe配置成功
NRPE v2.12

##########################################Server端和Client端安装#########################################


posted @ 2012-11-21 17:07  枯木-Linux  阅读(143)  评论(0编辑  收藏  举报