97.5. 配置监控设备

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
云数据库 RDS MySQL Serverless,价值2615元额度,1个月
简介:

97.5.1. routers

vim /etc/nagios3/routers/firewall.cfg

define host{

        use             generic-host; Inherit default values from a template

        host_name       firewall         ; The name we're giving to this switch

        alias           Cisco PIX 515E Firewall ; A longer name associated with the switch

        address         172.16.1.254            ; IP address of the switch

        hostgroups      all,networks            ; Host groups this switch is associated with

        }

define service{

        use                     generic-service ; Inherit values from a template

        host_name                       firewall ; The name of the host the service is associated with

        service_description     PING            ; The service description

        check_command           check_ping!200.0,20%!600.0,60%  ; The command used to monitor the service

        normal_check_interval   5       ; Check the service every 5 minutes under normal conditions

        retry_check_interval    1       ; Re-check the service every minute until its final/hard state is determined

        }

define service{

        use                     generic-service ; Inherit values from a template

        host_name                       firewall

        service_description     Uptime

        check_command           check_snmp!-C public -o sysUpTime.0

        }

			

97.5.2. host

define service{
    use                             local-service
    host_name                       www.example.com
    service_description             Host Alive
    check_command                   check-host-alive
    }
			

97.5.3. service

97.5.3.1. http

hosts

$ cat /etc/nagios3/hosts/www.example.com.cfg
define host{

        use             generic-host            ; Inherit default values from a template

        host_name       www.example.com             ; The name we're giving to this host

        alias           Some Remote Host        ; A longer name associated with the host

        address         120.132.14.6           ; IP address of the host

        hostgroups      all,http-servers        ; Host groups this host is associated with

        }

define service{

        use             generic-service         ; Inherit default values from a template

        host_name               www.example.com

        service_description     HTTP

        check_command   check_http

        }

				

HTTP状态

neo@monitor:~$ /usr/lib/nagios/plugins/check_http -H www.example.com -I 172.16.0.8 -s "HTTs"
HTTP CRITICAL: HTTP/1.1 404 Not Found - string not found - 336 bytes in 0.001 second response time |time=0.000733s;;;0.000000 size=336B;;;0

neo@monitor:~$ /usr/lib/nagios/plugins/check_http -H www.example.com -I 172.16.0.8 -e '404'
HTTP OK: Status line output matched "404" - 336 bytes in 0.001 second response time |time=0.000715s;;;0.000000 size=336B;;;0

				
97.5.3.2. mysql hosts
$ sudo vim /etc/nagios3/hosts/mysql.cfg


define host{

        use             generic-host            ; Inherit default values from a template

        host_name       mysql-master.example.com            ; The name we're giving to this host

        alias           Some Remote Host        ; A longer name associated with the host

        address         172.16.1.6             ; IP address of the host

        hostgroups      all,mysql-servers       ; Host groups this host is associated with

        }

define service{

        use             generic-service         ; Inherit default values from a template

        host_name               mysql-master.example.com

        service_description     MySQL

        check_command   check_mysql_database!user!passwd!database

        }

				
97.5.3.3. check_tcp
define service{
    use                        generic-service     
    host_name                  db.example.com
    service_description        MySQL Master1 Port
    check_command              check_tcp!3306
    }
				




原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
12天前
|
运维 网络协议 安全
【专栏】30个必备的思科设备巡检命令,涵盖设备基本信息、性能、网络连接、安全及其它重要方面
【4月更文挑战第28天】本文列举了30个必备的思科设备巡检命令,涵盖设备基本信息、性能、网络连接、安全及其它重要方面。这些命令包括`show version`、`show running-config`、`show ip route`、`show access-lists`等,对监控设备状态、排查故障及优化性能至关重要。熟悉并运用这些命令能提升网络工程师的工作效率,确保网络稳定运行。不断学习新命令以适应网络技术发展是网络工程师的必修课。
|
8月前
|
JSON 物联网 开发工具
设备接入组件功能介绍
设备接入组件功能介绍
330 0
|
11月前
|
监控
监控网卡实时流量脚本
监控网卡实时流量脚本
80 0
|
12月前
|
监控 网络协议 安全
科来网络全流量安全分析设备的使用
科来网络全流量安全分析设备的使用
|
存储 监控 安全
网络视频监控如何入门?如何安装和配置、设备选择和实时监控?
网络视频监控如何入门?如何安装和配置、设备选择和实时监控?
672 0
|
Android开发 网络架构 Docker
「WGCLOUD」可以监测哪些网络设备
「WGCLOUD」可以监测哪些网络设备
「WGCLOUD」可以监测哪些网络设备
|
Android开发
网关设备是一台安卓来管理子设备
网关设备(安卓)跟子设备通信是通过Modbus RTU通信的,现在有个问题就是点位配置,与每个子设备通信的命令和获取每个属性的命令都是不一样的,现在需要做成跟设备绑定配置在一块的,这个有没有好一点的方案
|
物联网 对象存储
远程采集IoT设备运行日志的最佳实践
借助IoT技术的力量,在办公室动动手指,轻松获取远端IoT设备运行日志
4650 0
|
监控 关系型数据库 MySQL
|
Web App开发 监控 索引