当前位置:首页 >知识 >Nagios监控服务器的配置 只是监控命令不同罢了

Nagios监控服务器的配置 只是监控命令不同罢了

2024-06-28 15:24:27 [百科] 来源:避面尹邢网

Nagios监控服务器的监控配置

作者:舜东 运维 系统运维 Nagios监控服务器的配置很简单,跟我学习下!服务

 

Nagios 

Nagios监控服务器的配置 只是监控命令不同罢了

图-Nagios

Nagios监控服务器的配置 只是监控命令不同罢了

  Nagios监控服务器的配置配置如下:

Nagios监控服务器的配置 只是监控命令不同罢了

  1.安装nrpe

  [root@UnixHot src]# tar zxvf nrpe-2.12.tar.gz

  [root@UnixHot nrpe-2.12]# ./configure && make all

  [root@UnixHot nrpe-2.12]# make install-plugin

  [root@UnixHot nrpe-2.12]# make install-daemon

  [root@UnixHot nrpe-2.12]# make install-daemon-config

  [root@UnixHot nrpe-2.12]# make install-xinetd

  2.配置nrep

  [root@UnixHot nrpe-2.12]# vi /etc/xinetd.d/nrpe

  service nrpe

  {

  flags = REUSE

  socket_type = stream

  port = 5666

  wait = no

  user = nagios

  group = nagios

  server = /usr/local/nagios/bin/nrpe

  server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd

  log_on_failure += USERID

  disable = no

  only_from = 127.0.0.1 192.168.0.206 192.168.0.155 192.168.0.157

  在only_from 添加要监控的主机的IP地址,中间以空格隔开。监控

#p#

  3.添加端口

  [root@UnixHot nrpe-2.12]# vi /etc/services 在***添加

  nrpe 5666/tcp #nrpe

  4.重新启动Xinetd服务

  [root@UnixHot nrpe-2.12]# /etc/init.d/xinetd restart

  [root@UnixHot nrpe-2.12]# netstat -na | grep 5666

  tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN

  以上的服务1-4的步骤要在客户端上做。

  5.修改配置文件commands.cfg加入对nrpe的配置支持

  [root@UnixHot ~]# vi /usr/local/nagios/etc/objects/commands.cfg

  #nrpe set

  define command{

  command_name check_nrpe

  command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

  }

#p#

  6.有哪些nrpe检测命令可以用,它们在哪里呢?监控

  [root@UnixHot ~]# vi /usr/local/nagios/etc/nrpe.cfg

  (默认有下面四个命令)

  command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10

  command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20

  command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1

  command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z

  command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200

  7.怎么使用这些命令监控客户端呢?

  其实很简单,就是服务在services.cfg里面添加服务即可,格式就和上篇文档讲的配置一样,只是监控命令不同罢了。

  [root@UnixHot ~]# vi /usr/local/nagios/etc/objects/services.cfg

  加入:

  define service {

  host_name Nagios-Server

  service_description check-users

  check_period 24x7

  max_check_attempts 4

  normal_check_interval 3

  retry_check_interval 2

  contact_groups sagroup

  notification_interval 10

  notification_period 24x7

  notification_options w,服务u,c,r

  check_command check_nrpe!check_users

  }

  define service {

  host_name Nagios-Server

  service_description check-load

  check_period 24x7

  max_check_attempts 4

  normal_check_interval 3

  retry_check_interval 2

  contact_groups sagroup

  notification_interval 10

  notification_period 24x7

  notification_options w,u,c,r

  check_command check_nrpe!check_load

  }

  define service {

  host_name Nagios-Server

  service_description check-total-procs

  check_period 24x7

  max_check_attempts 4

  normal_check_interval 3

  retry_check_interval 2

  contact_groups sagroup

  notification_interval 10

  notification_period 24x7

  notification_options w,u,c,r

  check_command check_total_procs

  }

  在这里仅列出了一个客户端的配置,其它的配置客户端,只需修改host_name 即可。监控

通过这篇文章的服务介绍,我们清楚的配置知道Nagios监控服务器的配置情况!

【编辑推荐】

  • Nagios监控Windows客户端
  • Ubuntu下安装运行Nagios
  • 运维监控Nagios:启动服务
  • Nagios远程监控软件的装置与设置装备
  • nagios报警通过飞信
  • nagios客户端程序的安装
责任编辑:赵鹏 来源: 网络转载 Nagios监控

(责任编辑:焦点)

    推荐文章
    热点阅读