- 工信部备案号 滇ICP备05000110号-1
- 滇公网安备53011102001527号
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
- CN域名投诉举报处理平台:电话:010-58813000、邮箱:service@cnnic.cn
# vim /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
# vim /usr/local/nagios/etc/objects/localhost.cfg
define host{
use linux-server --模版
host_name localhost --主机名
alias localhost --主机别名
address 127.0.0.1 --被监控机器的IP
}
define hostgroup{
hostgroup_name linux-servers
alias Linux Servers
members localhost --linux Servers组现在只有localhost这一个成员
}
--下面是8个默认定义的服务,以监控磁盘利用率的这一段为例
define service{
use local-service --模版,在templates.cfg 里定义的
host_name localhost --主机名,调用的是同配置文件里define host里定义的host_name
service_description Root Partition --描述,会在web界面显示的一个标题
check_command check_local_disk!20%!10%!/ --检测利用率的命令,free空间小于20%就报警,小于10就critcal警告
}
# vim /usr/local/nagios/etc/objects/templates.cfg
define host{
name linux-server
use generic-host --linux主机模版也使用了一个叫generic-host的模版,也在templates.cfg里
check_period 24x7 --在timeperiods.cfg 里定义的时间段
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive --在commands.cfg 里定义的命令
notification_period workhours --通知时间在timeperiods.cfg里定义的
notification_interval 120 --通知间隔
notification_options d,u,r --通知选项
contact_groups admins --通知组,在contacts.cfg 里定义
register 0 --不注册,表示这只是一个模版,被调用,不会被nagios进程认为就是一台主机
}
# vim /usr/local/nagios/etc/objects/commands.cfg
define command{
command_name check-host-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
}
--命令都在libexec下,用--help去查
# /usr/local/nagios/libexec/check_ping --help售前咨询
售后咨询
备案咨询
二维码

TOP