Jean - 记录成长历程

  • 关于
  • Language
  • RSS Feed
  • 微博
  • 豆瓣
11
Sep

nagios机器分组批量检测

By admin|Linux系统|Be the first to comment!

我一直不太喜欢用nagios,主要原因是配置太过复杂,有些时候可能自己写几行脚本就能搞定的事情却要修改一堆配置,太麻烦了。插件虽然很多但也会常常需要二次开发,实在没有那个精力。

这里说说今天改配置文件时候发现的一些技巧,在监控大量服务器时会更省力一些

一。在nagios.cfg中加入

?View Code CONFIG
#groupfile
cfg_file=/usr/local/nagios/etc/objects/hostsgroup.cfg
cfg_file=/usr/local/nagios/etc/objects/groupservers.cfg
<pre>
 
二。监控组模板配置,这个模板写好以后,可以在需要时调用,非常的方便。
 
/nagios/etc/objectsgroupservers.cfg
 
<pre lang="CONFIG">
define service{
use local-service ; Name of service template to use
hostgroup_name   Webserver
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
 
# Define a service to check SSH on the local machine.
# Disable notifications for this service by default, as not all users may have SSH enabled.
 
define service{
use                             local-service         ; Name of service template to use
hostgroup_name   Webserver
service_description             SSH
check_command                   check_ssh
notifications_enabled           1
}
 
 
 
# Define a service to check HTTP on the local machine.
# Disable notifications for this service by default, as not all users may have HTTP enabled.
 
define service{
use                             local-service         ; Name of service template to use
hostgroup_name   Webserver
service_description             HTTP
check_command                   check_http
#       notifications_enabled           0
}
#Define a service to check squid on the local machine
define service{
use                             local-service         ; Name of service template to use
hostgroup_name   Webserver
service_description             SQUID
check_command                   check_squid
}
 
#CPU Load
define service{
use                 local-service
hostgroup_name   Webserver
service_description CPU Load
check_command       check_nrpe!check_load
}
#User Login
define service{
use                 local-service
hostgroup_name   Webserver
service_description Current user
check_command       check_nrpe!check_users
}
#Total Processes
define service{
use                 local-service
hostgroup_name   Webserver
service_description Total Processes
check_command       check_nrpe!check_total_procs
}

三。调用。在此处调用的机器,在hosts.cfg中一定要声明过,否则nagios将无法启动

?View Code CONFIG
define hostgroup{
hostgroup_name   Webserver
alias            Webserver     ;在web界面显示的名字
members    web1
}

无觅相关文章插件,快速提升流量

Tagged as: nagios
Add your comment →

0 Comments

Leave your comment below! Cancel Reply

点击取消回复

View More Posts:
  • ←
  • →

分类

  • Linux系统 (61)
  • Linux集群 (4)
  • Web服务器 (26)
  • 创业相关 (6)
  • 工作笔记 (34)
  • 我爱折腾 (16)
  • 日记 (46)
  • 网络 (3)
  • 脚本编程 (49)

最新日志

  • 使用w3 total cache给wordpress提速
  • 从零开始,我的创业感悟
  • 为大众创造更美好的日常生活
  • 我的站立式工作平台
  • 阿里云计算使用简评

最新评论

  • suerrumsEmigH on 如何做Tomcat集群和session复制?
  • admin on 从零开始,我的创业感悟
  • Kovlala on 从零开始,我的创业感悟
  • jean on 从零开始,我的创业感悟
  • Kovlala on 从零开始,我的创业感悟

博客互联

  • HackLog
  • leapsoul
  • Myredhat
  • Ninth element
  • Ti’blog
  • William Hua
  • young001
  • 懒人运维
  • 曙光博客
  • 月夜
  • 月影
  • 杂货店一号铺
  • 王先进’s blog
  • 疯中舞步
  • 菜鸟的技术站
  • 运维进行时

技术

  • DBA BLOG
  • 回忆未来[张宴]
  • 扶凯
  • 王炜's Blog
  • 百变贝贝

Powered by the inLine Minimal WordPress Theme