聊聊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.cwhello.com/452130.html

如有侵犯您的合法权益请发邮件951076433@qq.com联系删除

(0)
夏雨夏雨订阅用户
上一篇 2024年6月27日 23:25
下一篇 2024年6月27日 23:25

相关推荐

  • 小编教你如何在Zabbix中进行性能调优。

    了解Zabbix性能瓶颈 (图片来源网络,侵删) 在开始进行性能调优之前,首先需要对Zabbix监控的性能指标有所了解,通常,性能问题可能来源于多个方面,比如数据库、网络延迟、服务器资源(CPU、内存)限制或者Zabbix…

    2024年7月21日
    01
  • 说说Nagios如何触发告警。

    Nagios是一款强大的网络监控工具,它可以帮助我们实时监控系统、网络设备、应用程序等的状态,当系统或设备出现异常时,Nagios可以触发告警,通知相关人员进行处理,下面将详细介绍如何在Nagios中触发告警。 (图片…

    2024年6月26日
    00
  • 关于怎么用Icinga的RESTful API实现自动化配置和管理。

    要使用Icinga的RESTful API实现自动化配置和管理,您需要遵循以下步骤: (图片来源网络,侵删) 1、了解Icinga API:您需要对Icinga的API有一个基本的了解,包括它如何工作以及它可以执行哪些操作,Icinga API允许…

    2024年6月27日
    01
  • 我来说说Icinga怎么与ELK管理系统集成。

    Icinga与ELK集成概述 (图片来源网络,侵删) Icinga 是一个开源的网络监控工具,基于 Nagios 核心开发而来,它提供了丰富的功能,用于监测网络服务、主机资源和应用程序等,而 ELK(Elasticsearch, Logstash, Kiba…

    2024年6月27日
    00
  • PHP实现数据库容器化监控的方法。

    随着容器化技术在云计算领域的广泛应用,大量的应用程序也开始在容器中运行,其中数据库也不例外。但是容器的动态性和快速的扩展能力,也给数据库的监控和管理带来一些困难。为了解决这个问题,本文将介绍一种基于P…

    2023年5月21日
    00
  • 教你智能运维相关问题。

    智能运维概述 智能运维(AIOps)是指通过人工智能技术,对IT运维过程中的数据进行实时分析,自动识别和解决问题,提高运维效率和质量的一种方法,智能运维可以帮助企业实现自动化、智能化的运维管理,降低人力成本…

    2024年6月28日
    00
  • 小编教你怎么使用Icinga进行数据分析和报告生成。

    使用Icinga进行数据分析和报告生成涉及多个步骤,包括安装配置、监控项配置、性能数据收集配置以及数据分析与报告生成等,以下是具体的操作流程: (图片来源网络,侵删) 1、安装和配置Icinga:需要在你的服务器上…

    2024年6月27日
    01
  • 分享Nagios的核心组件有哪些。

    Nagios是一个强大的网络监控工具,其核心组件主要包括以下几个部分: (图片来源网络,侵删) 1、Nagios主程序:Nagios主程序是整个系统的核心,负责调度和处理所有的监控任务,它通过读取配置文件,获取需要监控的…

    2024年6月26日
    00

联系我们

QQ:951076433

在线咨询:点击这里给我发消息邮件:951076433@qq.com工作时间:周一至周五,9:30-18:30,节假日休息