打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Nagios 常用配置大全

Nagios 常用配置大全

以IP:192.168.2.215为例:下面依次罗列了check_ping(网络是否通畅),check_http(WEB服务),check_tcp(TCP端口是否开启),check_snmp(SNMP监控某个参数(根据OID))

define host{
       use                   linux-server
       host_name             1921682215
       alias                 1921682215
       address               192.168.2.215
       }
define service{
        use                             generic-service
        host_name                       1921682215
        process_perf_data               1
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        }
define service{
        use                             generic-service         ; Name of service template to use
        host_name                       1921682215
        service_description             HTTP
    check_command           check_http
    notifications_enabled       1
        }
define service{
        use                             generic-service         ; Name of service template to use
        host_name                       1921682215
        service_description             TCP
    check_command           check_tcp!80!
    notifications_enabled       1
        }
define service{
        use                             generic-service         ; Name of service template to use
        host_name                       1921682215
        service_description             SNMP
    check_command           check_snmp!-P 1 -C public -w 1:400 -o .1.3.6.1.2.1.31.1.1.1.18.12
    notifications_enabled       1
        }

 

关于SNMP这个OID对于每种设备还不一样.所以这种方法不怎么好.

Nagios官方网站给我提供了一个解决方案:

 

首先安装

perl -MCPAN -e "install Net::SNMP"

一路默认设置,唯一就是选择时区的时候要自己选一下

安装成功之后

nagios-snmp-plugins.1.1.1.tgz解压出来的文件夹里执行install.sh.

经过几个设置就安装好了

安装完之后就可以进行配置了.

根据 http://nagios.manubulon.com/index_snmp.html

可以配置"硬盘使用情况","内存使用情况","SNMP服务","服务器环境(网络设备风扇,温度等)"等信息.

"硬盘使用情况"为例吧.

首先我们需要在commands.cfg添加一条命令

# 'check_snmp_storage" command definition
define command{
        command_name    check_snmp_storage
        command_line    $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG1$ -m ^[C] -w $ARG2$ -c $ARG3$
        }

 这是监控Windows平台下的C盘的使用状况,其中^[C]表示C盘.
如果是Linux下监控/home可以把^[C]改成/home.
然后在配置文件里面添加一个监控命令:

define service{
        use                             generic-service
        host_name                       1921682215
        service_description             SNMP_Storage
        check_command            check_snmp_storage!public!60!90
        notifications_enabled        1
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
nagios监控DNS和网站页面
nagios发送邮件配置
Ganglia and Nagios, Part 2: Monitor enterpris...
Linux下Nagios的安装与配置
nagios 使用模板生成配置文件
CentOS 6.2+Nginx+Nagios,手机短信和qq邮箱提醒
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服