前一段工作需要配置一台监控服务器,就一路安装了Nagios. 为了避免我丢失 安装时候的记录,就先放在这里。事情太多,只能慢慢整理。我使用的是Centos6.2 mini安装的,在Nagios过程中需要安装的组件
perl wget make mailx sendmail vim xinetd openssl-devel
具体安装nagios的方法,在网上有说明文档http://nagios-cn.sourceforge.net/nagios-cn/
其他网站上也有很多的安装手册,不再列出
安装 pnp4nagios-0.6.6 的时候出现 configure: error: Perl Module Time::HiRes not available
yum install perl-Time-HiRes 即可解决
下面是wget 地址,nagiso-3.3.1和nagios-plugins-1.4.15要安装的。
http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.3.1.tar.gz
./configure --with-command-group=nagcmd
http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz
http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz
给nagios安装nrpe插件报错: checking for SSL headers... configure: error: Cannot find ssl headers
安装nrpe,编译的时候提示以下信息
checking for SSL headers... configure: error: Cannot find ssl headers
原因是缺少openssl-devel包,
yum -y install openssl-devel
问题解决!
http://sourceforge.net/projects/pnp4nagios/ pnp4nagios
http://docs.pnp4nagios.org/pnp-0.6/doc_completel
http://docs.pnp4nagios.org/pnp-0.6/install
重启httpd
我使用的是sendemail实现发送警告邮件的功能
具体方法可参考http://linuxjcq.blog.51cto.com/3042600/717918
安装nrpe的方法文档http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf
至于以下配置,在各个配置手册里都有详细的说明,保留只是为了记录我安装过程中的记录而已。
define host{
host_name Nagios-Server
alias Nagios Server
address 192.168.140.128
check_command check-host-alive
check_interval 5
retry_interval 1
max_check_attempts 5
check_period 24x7
process_perf_data 0
retain_nonstatus_information 0
contact_groups sagroup
notification_interval 30
notification_period 24x7
notification_options d,u,r
}
define host{
host_name Nagios-Client
alias Nagios Client
address 192.168.140.129
check_command check-host-alive
check_interval 5
retry_interval 1
max_check_attempts 5
check_period 24x7
process_perf_data 0
retain_nonstatus_information 0
contact_groups sagroup
notification_interval 30
notification_period 24x7
notification_options d,u,r
}
define hostgroup {
hostgroup_name Nagios-Example
alias Nagios Example
members Nagios-Server,Nagios-Clientesx
}
define service {
host_name Nagios-Server
service_description check-host-alive
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check-host-alive
}
define service {
host_name Nagios-Clientesx
service_description check-host-alive
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check-host-alive
}
define servicegroup{
servicegroup_name Host-Alive
alias Host Alive
members Nagios-Server,check-host-alive,Nagios-Clientesx,check-host-alive
}
#check nrpe
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define host{
host_name Nagios-Server
alias Nagios Server
address 192.168.140.128
check_command check-host-alive
check_interval 5
retry_interval 1
max_check_attempts 5
check_period 24x7
process_perf_data 0
retain_nonstatus_information 0
contact_groups sagroup
notification_interval 30
notification_period 24x7
notification_options d,u,r
}
define host{
host_name Nagios-Client
alias Nagios Client
address 192.168.140.129
check_command check-host-alive
check_interval 5
retry_interval 1
max_check_attempts 5
check_period 24x7
process_perf_data 0
retain_nonstatus_information 0
contact_groups sagroup
notification_interval 30
notification_period 24x7
notification_options d,u,r
}
define hostgroup {
hostgroup_name Nagios-Example
alias Nagios Example
members Nagios-Server,Nagios-Client
}
define service {
host_name Nagios-Server
service_description check-host-alive
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check-host-alive
}
define service {
host_name Nagios-Client
service_description check-host-alive
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check-host-alive
}
define servicegroup{
servicegroup_name Host-Alive
alias Host Alive
members Nagios-Server,check-host-alive,Nagios-Client,check-host-alive
}
iptables -I RH-Firewall-1-INPUT -p tcp -m tcp –dport 5666 -j ACCEPT
define host{
host_name Nagios-Server
alias Nagios Server
address 192.168.140.128
check_command check-host-alive
check_interval 5
retry_interval 1
max_check_attempts 5
check_period 24x7
process_perf_data 0
retain_nonstatus_information 0
contact_groups sagroup
notification_interval 30
notification_period 24x7
notification_options d,u,r