CentOS源码安装nagios与nagios-plugin
2014-09-17 21:27
274 查看
CentOSx64 源码安装nagios与nagios-plugin
官方网址:http://www.nagios.org
一、安装指导:
http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html
二、nagios的配置
1)修改/usr/local/nagios/etc/nagios.cnf 文件修改如下:
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg
2)在/usr/local/nagios/etc/objects/目录下建立主机文件hosts.cfg和服务文件services.cfg两个文件
#touch hosts.cfg
#touch services.cfg
#chown -R nagios:nagcmd hosts.cfg
#chown -R nagios:nagcmd services.cfg
#chmod -R 755 hosts.cfg
#chmod -R 755 services.cfg
3)在hosts.cfg和services.cfg ,添加如下内容:
#vi hosts.cfg
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
}
define host {
host_name 118.X.35.226
alias SingTel_Main_Broadcast
address 118.X.35.226
check_command check-host-alive
check_period 24x7
notification_period 24x7
use windows-server
}
define host {
host_name 118.X.35.242
alias SingTel_Backup_Broadcast
address 118.X.35.242
check_command check-host-alive
check_period 24x7
notification_period 24x7
use windows-server
}
#define host {
# host_name 118.X.35.241
# alias Cisco router
# address 118.X.35.241
# check_command check-host-alive
# check_period 24x7
# notification_period 24x7
#}
#define host {
# host_name 118.X.35.225
# alias Juniper Firewall
# address 118.X.35.225
# check_command check-host-alive
# check_period 24x7
# notification_period 24x7
#
#}
~
#vi services.cfg
define service {
service_description PING
check_interval 5
retry_interval 1
check_command check_ping!3000.0,80%!5000.0,100%
host_name 118.X.35.226,118.X.35.242
hostgroup_name windows-servers
check_period 24x7
notification_period 24x7
max_check_attempts 5
# notification_interval 5
use local-service
contact_groups +admins
}
define service {
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 92 -c 95
host_name 118.X.35.226,118.X.35.242
hostgroup_name windows-servers
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description D:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l d -w 92 -c 95
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
hostgroup_name windows-servers
contact_groups +admins
}
define service {
service_description Z:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l z -w 96 -c 98
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
hostgroup_name windows-servers
contact_groups +admins
}
define service {
service_description Recv_XD
check_command check_nt!PROCSTATE!-d SHOWALL -l Recv_XD.exe
host_name 118.X.35.226
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description GoodSync_client
check_command check_nt!PROCSTATE!-d SHOWALL -l GoodSync.exe
host_name 118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description TSPlay_Program
check_command check_nt!PROCSTATE!-d SHOWALL -l TSServer.exe
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description IIS Service
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description MSSQLSERVER
check_command check_nt!SERVICESTATE!-d SHOWALL -l MSSQLSERVER
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description Apache Tomcat
check_command check_nt!SERVICESTATE!-d SHOWALL -l Tomcat6
host_name 118.X.35.226
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description http-8080
check_command check_tcp!8080 -t 5!
host_name 118.X.35.226
check_period 24x7
notification_period 24x7
max_check_attempts 1 最多检查一次(默认3次)
check_interval 1 检查间隔1分钟,有问题发邮件
use generic-service
contact_groups +admins
}
#/etc/init.d/nagios start
日志文件: tail -f /var/log/messages
4)访问网址:http://ip/nagios
官方网址:http://www.nagios.org
一、安装指导:
http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html
二、nagios的配置
1)修改/usr/local/nagios/etc/nagios.cnf 文件修改如下:
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg
2)在/usr/local/nagios/etc/objects/目录下建立主机文件hosts.cfg和服务文件services.cfg两个文件
#touch hosts.cfg
#touch services.cfg
#chown -R nagios:nagcmd hosts.cfg
#chown -R nagios:nagcmd services.cfg
#chmod -R 755 hosts.cfg
#chmod -R 755 services.cfg
3)在hosts.cfg和services.cfg ,添加如下内容:
#vi hosts.cfg
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
}
define host {
host_name 118.X.35.226
alias SingTel_Main_Broadcast
address 118.X.35.226
check_command check-host-alive
check_period 24x7
notification_period 24x7
use windows-server
}
define host {
host_name 118.X.35.242
alias SingTel_Backup_Broadcast
address 118.X.35.242
check_command check-host-alive
check_period 24x7
notification_period 24x7
use windows-server
}
#define host {
# host_name 118.X.35.241
# alias Cisco router
# address 118.X.35.241
# check_command check-host-alive
# check_period 24x7
# notification_period 24x7
#}
#define host {
# host_name 118.X.35.225
# alias Juniper Firewall
# address 118.X.35.225
# check_command check-host-alive
# check_period 24x7
# notification_period 24x7
#
#}
~
#vi services.cfg
define service {
service_description PING
check_interval 5
retry_interval 1
check_command check_ping!3000.0,80%!5000.0,100%
host_name 118.X.35.226,118.X.35.242
hostgroup_name windows-servers
check_period 24x7
notification_period 24x7
max_check_attempts 5
# notification_interval 5
use local-service
contact_groups +admins
}
define service {
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 92 -c 95
host_name 118.X.35.226,118.X.35.242
hostgroup_name windows-servers
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description D:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l d -w 92 -c 95
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
hostgroup_name windows-servers
contact_groups +admins
}
define service {
service_description Z:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l z -w 96 -c 98
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
hostgroup_name windows-servers
contact_groups +admins
}
define service {
service_description Recv_XD
check_command check_nt!PROCSTATE!-d SHOWALL -l Recv_XD.exe
host_name 118.X.35.226
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description GoodSync_client
check_command check_nt!PROCSTATE!-d SHOWALL -l GoodSync.exe
host_name 118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description TSPlay_Program
check_command check_nt!PROCSTATE!-d SHOWALL -l TSServer.exe
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description IIS Service
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description MSSQLSERVER
check_command check_nt!SERVICESTATE!-d SHOWALL -l MSSQLSERVER
host_name 118.X.35.226,118.X.35.242
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description Apache Tomcat
check_command check_nt!SERVICESTATE!-d SHOWALL -l Tomcat6
host_name 118.X.35.226
check_period 24x7
notification_period 24x7
max_check_attempts 1
check_interval 1
use generic-service
contact_groups +admins
}
define service {
service_description http-8080
check_command check_tcp!8080 -t 5!
host_name 118.X.35.226
check_period 24x7
notification_period 24x7
max_check_attempts 1 最多检查一次(默认3次)
check_interval 1 检查间隔1分钟,有问题发邮件
use generic-service
contact_groups +admins
}
#/etc/init.d/nagios start
日志文件: tail -f /var/log/messages
4)访问网址:http://ip/nagios
相关文章推荐
- 源码安装nagios-4.2 (centos 6.8)
- 源码安装nagios监控系统(centos7)
- nagios(centos7.3环境) 的源码安装
- 在CentOS 5.2上安装Nagios 3.06+Centreon 2.0.1 (四)
- CentOS环境Nagios的安装与配置
- CentOS 5.3 下源码编译安装Ipmsg 笔记
- nagios+plugin+NRPE+PNP快速安装指南
- Centos 5.2安装Cacti并集成Nagios安装文档
- Centos 5.5 安装Nagios 3.2.3记录
- CentOS 5.2安装nagios笔记1——邮件短信飞
- Centos 5.2安装Cacti并集成Nagios安装文档
- Linux系统监控二:Nagios源码安装
- 在CentOS下源码安装SugarCRM Pro / CE 5.0.0 (待续)
- Centos 5.5 Lamp源码包安装编译
- centos 5.5安装nagios3.2.0(一)
- Nagios3.0.5在CentOS5.2中安装
- CentOS 5.3 下源码编译安装Ipmsg 笔记
- 基于CentOS下Nagios的安装
- 基于CentOS下Nagios的安装
- 在CentOS上安装Nagios ( 官方文档 )