name generic-service ; The 'name' of this service template
通过name来指定服务类名,这里的generice-service是一个类名。
active_checks_enabled 1 ; Active service checks are enabled
设定启用活动监测服务。
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
设定启用被动监测服务。
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
设定启用并发活动监测服务。
obsess_over_service 1 ; We should obsess over this service (if necessary)
设定启用服务防停滞。
check_freshness 0 ; Default is to NOT check service 'freshness'
设定关闭更新监测。
notifications_enabled 1 ; Service notifications are enabled
设定启用事件通知。
event_handler_enabled 1 ; Service event handler is enabled
设定启用事件处理程序。
flap_detection_enabled 1 ; Flap detection is enabled
设定启用状态抖动监测。
failure_prediction_enabled 1 ; Failure prediction is enabled
设定启用故障预测。
process_perf_data 1 ; Process performance data
设定启用进程性能数据记录。
retain_status_information 1 ; Retain status information across program restarts
设定启用状态信息保存功能。当Nagios重新启动的时候不会是空数据,而是先显示上次离线时最后保留的状态数据。
retain_nonstatus_information 1 ; Retain non-status information across program restarts
设定启用非状态信息保存功能。当Nagios重新启动的时候不会是空数据,而是先显示上次离线时最后保留的非状态数据。
is_volatile 0 ; The service is not volatile
设定服务非易失。
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
设定非注册。此项register为0值的时候Nagios会理解到该定义段是主机类而为实体主机的定义段。因此,在自定义主机类段的时候,记得也要加入这一个属性,用来向Nagios表明该段为主机类段。
}
# Local service definition template - This is NOT a real service, just a template!
这里Nagios还默认定义了一个针对“本地系统监测服务”的类。
define service{
name local-service ; The name of this service template
use generic-service ; Inherit default values from the generic-service definition
通过use来继承generic-service这个类。类也是能够继承类的。
check_period all_days ; The service can be checked at any time of the day
max_check_attempts 2 ; Re-check the service up to 4 times in order to determine its final (hard) state
设定监测失败后最尝试次数。
normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
设定正常监测服务的间隔,单位秒。
retry_check_interval 1 ; Re-check the service every minute until a hard state can be determined
设定监测失败后尝试的间隔,单位秒。
contact_groups admins ; Notifications get sent out to everyone in the 'admins' group
设定联系组。
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
设定监测指定服务产生的事件通知的条件选项。这里后面跟上一些级别类型参数:
w代表warning告警;
u代表unknown未知;
c代表critical严重;
r代表recover恢复;
d代表down奔溃。
notification_interval 15 ; Re-notify about service problems every hour
设定服务通知的间隔。
notification_period all_days ; Notifications can be sent out at any time
设定服务通知运行时间。
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
设定register表明本段定义的是一个服务类,而不是具体的服务。
}
分享到:
相关推荐
define service { use generic-service host_name example.com service_description HTTP check_command check_http!http://example.com } ``` 五、维护与更新 1. **定期更新**:为了保持最新的监控功能和修复...
define service { use generic-service host_name your_memcached_host service_description Memcached Memory Usage check_command check_memcached!localhost!-w 80% -c 90% } ``` 这里`check_command`...
define service{ use generic-service host_name mysqlserver service_description MySQL Service check_command check_mysql!localhost!3306!root!password } ``` 8. **安装Nagios Web界面** 配置Apache以...
define service{ use generic-service host_name Web1.tianway.net service_description Disk Usage check_command check_disk!/dev/sda1 } ``` 通过上述步骤,我们完成了NAGIOS的基本安装配置以及NAGIOS-...
define service{ use generic-service host_name linux-client service_description CPU Load check_command check_nrpe!check_cpu normal_check_interval 5 retry_check_interval 1 max_check_attempts 3 ...
define service{ use generic-service host_name localhost service_description MySQL Connection check_command check_mysql!localhost!root!password } ``` 这里,`check_mysql`是Nagios-plugins中的一...
service_notification_commands notify-service-by-email } ``` 并且在`/usr/local/nagios/etc/objects/commands.cfg`中定义邮件发送命令: ```ini define command{ command_name notify-host-by-email ...
sudo service nagios start (SysVinit) ``` 7. **设置开机启动**: ``` sudo systemctl enable nagios (Systemd) sudo chkconfig nagios on (SysVinit) ``` **二、Nagios使用** 1. **配置监控**:Nagios的...
- `service nrpe` - `socket_type=stream` - `port=5666` - `user=nagios` - `group=nagios` - `server=/usr/local/nagios/bin/nrpe` - `server_args=-c /usr/local/nagios/etc/nrpe.cfg --inetd` - `only_from`选项...
define service{ use generic-service host_name server1.example.com service_description SSH check_command check_ssh } ``` - 修改其他配置文件,如`commands.cfg`、`timeperiods.cfg`等,以适应你的监控...
define service{ host_name localhost service_description BLA-0000 check_command check_webuntis!USER!PASSWORD!SCHOOLNAME!CLASS!https://poly.webuntis.com/WebUntis/jsonrpc.do max_check_attempts 1 ...
command_name notify-service-by-email command_line /usr/bin/printf "%b" "*****Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS...
define service { use generic-service host_name localhost service_description Log Monitoring check_command check_logfiles!path/to/logfile!regex_pattern!critical_level!warning_level } ``` 这里,`...
- **Netware服务器**:同样需要安装额外的插件如NSCA(Nagios Service Check Acceptor)来进行监控。 - **网络打印机**:使用专门针对打印机的插件如check_printer来监控打印队列的状态。 - **路由器/交换机**:利用...
在`/etc/nagios/nagios.cfg`或相应路径的`command.cfg`文件中,找到关于邮件通知的命令定义,如`notify-host-by-email`和`notify-service-by-email`,并将它们的`command_line`部分更新为使用SendEmail的命令。...
define service { host_name TestSSH service_description check_ssh ... check_command check_ssh } ``` 在此定义中,`host_name`指定了服务所在的主机名,`service_description`提供了对该服务的描述,而`...
define service{ host_name linux测试 service_description check_update check_command check_nrpe!check_update max_check_attempts 5 normal_check_interval 3 retry_check_interval 2 check_period 24x7 ...
在Nagios的配置文件`commands.cfg`中,定义两个命令`notify-host-by-fetion`和`notify-service-by-fetion`,分别用于发送主机和服务级别的告警信息。 **配置示例:** ```ini define command { command_name notify...
2. **重启Nagios服务**:执行`service nagios restart`命令重启Nagios服务。 3. **验证结果**:刷新Nagios监控页面,等待几分钟后即可看到端口流量信息。 通过以上步骤,不仅可以在Nagios中实时监控交换机端口...