Nagios的PassiveChecks是什么

Nagios的PassiveChecks是什么

Nagios的PassiveChecks是什么
(图片来源网络,侵删)

Nagios是一款开源的网络监控工具,用于监控网络设备、服务器和应用程序的性能和可用性,在Nagios中,Passive Checks是一种被动检查方法,它不需要从被监控对象获取实时数据,而是通过查询外部资源来获取所需的信息,这种方法可以降低对被监控对象的负载,提高监控效率。

Passive Checks的原理

Passive Checks的原理是通过查询外部资源(如DNS、SNMP等)来获取被监控对象的状态信息,当Nagios执行一个Passive Check时,它会向指定的外部资源发送请求,然后根据返回的数据来判断被监控对象的状态,这种方法不需要在被监控对象上运行任何插件或代理,因此对被监控对象的负载影响较小。

Passive Checks的类型

Nagios支持多种类型的Passive Checks,包括:

1、DNS Check:通过查询DNS服务器来获取主机名对应的IP地址,从而判断主机是否可达。

2、TCP Check:通过尝试与目标主机建立TCP连接,判断主机是否可达。

3、POP3 Check:通过查询邮件服务器的POP3服务,判断邮件服务器是否正常运行。

4、ICMP Check:通过发送ICMP回显请求包,判断目标主机是否可达。

5、JDBC Check:通过查询数据库服务器的JDBC服务,判断数据库服务器是否正常运行。

6、Ping Check:通过发送ICMP回显请求包,判断目标主机是否可达。

7、SSH Check:通过SSH协议连接到目标主机,判断主机是否可达。

8、SMTP Check:通过查询邮件服务器的SMTP服务,判断邮件服务器是否正常运行。

9、SSL Check:通过SSL协议连接到目标主机,判断主机是否可达。

10、TELNET Check:通过TELNET协议连接到目标主机,判断主机是否可达。

Passive Checks的配置

在Nagios中配置Passive Checks非常简单,首先需要在Nagios的主配置文件(nagios.cfg)中启用相应的插件,要启用DNS插件,可以在nagios.cfg文件中添加以下内容:

cfg_dir=/usr/local/nagios/etc/objects
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
include_dir=/usr/local/nagios/etc/servers
command_file=/usr/local/nagios/etc/objects/commands.cfg
...
启用DNS插件
object_cache_entries=10000
enable_passive_checks=1
...

接下来,需要在Nagios的命令配置文件(commands.cfg)中定义Passive Check的命令,要定义一个DNS Check,可以在commands.cfg文件中添加以下内容:

define command{
        command_name    check_dns
        command_line    $USER1$/check_dns H $HOSTADDRESS$ w 5,8,10 c 1 p 5,8,10 $ARG1$
}

在Nagios的服务配置文件(service.cfg)中为服务定义Passive Check,要为一个Web服务定义一个DNS Check,可以在service.cfg文件中添加以下内容:

define service{
        use                             genericservice         ; Inherit default values from a templated service.id file.
        host_name                       webserver                ; Define the host name we are monitoring. This could be a fully qualified domain name or a IP address.
        alias                           Web Server               ; This is just an arbitrary name for us to identify this service by within Nagios. It is not used by Nagios itself.
        service_description             Apache Web Server        ; A brief description of what this service does. This can be left blank if not needed.
        check_command                   check_dns                ; The actual check we will be performing on the host. This should be defined in the commands.cfg file above.
        normal_check_interval           60                        ; How often to check the host in normal operation (in seconds). If this value is set to zero, then the host will only be checked in response to a problem being reported for it.
        retry_check_interval            120                       ; How often to retry a check if one fails (in seconds). If this value is set to zero, then retries are disabled and a failed check will not be retried until manually restarted by the administrator.        max_check_attempts              3                        ; The maximum number of times to retry a check before declaring it has failed permanently (unless 'check_freshness' is set to 'true'). If this value is set to zero, then retries are disabled and a failed check will not be retried until manually restarted by the administrator.         check_period                    24x7                      ; When to check the host (in days, hours, minutes, and seconds). For example, '24x7' means check the host every day of the week at all times of day and night. If this value is set to zero, then the host will only be checked in response to a problem being reported for it.        check_freshness                 true                     ; Whether to consider the state of any dependent services when checking the host (see below). If this value is set to false, then the host will be considered up if all its dependent services are up regardless of their actual state.        active_checks_enabled           false                    ; Whether to allow active checks to be performed on this host (see below). If this value is set to false, then passive checks will be used instead of active checks for this host.        passive_checks_enabled          true                     ; Whether to allow passive checks to be performed on this host (see below). If this value is set to false, then active checks will be used instead of passive checks for this host.        event_handler                   root                     ; The user that Nagios should use as the owner of events generated by this service definition (e.g., host notifications). This user must have write permission on the log files specified in the log_location parameter below and must also have access to any external command or program specified in the check_command parameter above.        log_location                     /var/log/nagios3/rw/nagios.log ; Where Nagios should store its log files for this service definition (see above). This directory must exist and must be writable by the user specified in the event_handler parameter above and by all users that may need to read these log files (e.g., system administrators).        }

Passive Checks的优势和局限性

优势:

1、对被监控对象的负载影响较小:Passive Checks不需要在被监控对象上运行任何插件或代理,因此对被监控对象的负载影响较小。

2、提高监控效率:由于Passive Checks不需要实时获取数据,因此可以提高监控效率,特别是在网络环境较差的情况下,Active Checks可能会因为超时而失败,而Passive Checks则不会受到影响。

原创文章,作者:未希,如若转载,请注明出处:https://www.kdun.com/ask/574845.html

(0)
未希的头像未希新媒体运营
上一篇 2024-05-06 18:36
下一篇 2024-05-06 18:38

相关推荐

  • nagios安装报错怎么解决

    Nagios是一款开源的电脑系统和网络监视工具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设置,打印机等。 ,,如果您在安装Nagios时遇到报错,可以尝试以下方法解决: ,- 确保您的系统是Linux或者其他Nagios支持的系统。,- 安装Apache(http服务),因为它提供了一个直观的界面来查看监控信息。,- 在源码安装nagios时下面的错误:Error: Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update! Then it means that the permissions on the folder are messed up. Don’t bother setting up the permissions on the file itself, nagios.cmd, since that file gets recreated very often,so。,- 如果以上方法都不行,可以尝试使用yum命令安装pnp4nagios。

    2024-01-07
    0117
  • 触发器监控ddl_ddl

    触发器是一种在数据库中定义的自动执行的操作,它基于特定的事件(如DDL操作)被触发。监控DDL操作可以帮助追踪和审计对数据库结构所做的更改,确保数据完整性并防止未授权的修改。

    2024-06-26
    065
  • 如何实现数据中心的监控和管理?

    使用DCIM软件,集成硬件监控工具,部署智能传感器和摄像头。实施集中式日志管理与实时告警系统,确保高效运维。

    2024-07-11
    031
  • agentstate_监视座席通知事件

    “agentstate_监视座席通知事件”是一个用于监控座席状态并发送相关通知的功能。它可以帮助管理者实时了解座席的工作状态,提高工作效率和服务质量。

    2024-06-16
    063

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

免费注册
电话联系

400-880-8834

产品咨询
产品咨询
分享本页
返回顶部
云产品限时秒杀。精选云产品高防服务器,20M大带宽限量抢购  >>点击进入