您的位置:首页 > 移动开发 > IOS开发

基于FreeBSD+nagios下的系统告警系统

2010-04-23 14:40 344 查看
-----------------------------------主要软件应用-------------------------FreeBSD  apache22 php5 php5-extension Ngios  Nagios-plugin  Nrpe  NSCclient++-----------------------------------------系统安装-------------------------1.FreeBSD采用最小化安装2.更新ports# portsnap fetch#portsnap extract---------------------------------------------软件安装------------------------1. Nagios#  cd /usr/ports//net-mgmt/nagios/#  make instal clean//此过程会询问建立用户和组nagios2. Nagios-plugin#  cd /usr//net-mgmt/nagios-plugin/#  make install3. NRpe  下载地址为: http://www.nagios.org/download/addons    //如果所要监控的服务器中有linux,不要直接使用ports 安装,因为ports安装过后,其格式为check_nrpe2, 但是linux 采用源码安装的为check_nrpe. 从而导致两者之间不能通信#  cd /usr/local#  tar zxvf nrpe-2.12.tar.gz#  cd nrpe-2.12#   ./configure#   make #   make install网页服务器的安装请参考前人的文章------------------------------------------------配置文件-------------------------1.查看/var/spool/nagios/下有没如下文件或文件夹,没则建立drwxrwxr-x  2 nagios  nagios    3072 Apr 23 00:00 archivesdrwxrwxr-x  2 nagios  nagios     512 Apr 23 13:53 checkresults-rw-r--r--  1 nagios  nagios    1416 Feb  2 15:15 dead.letter-rw-r--r--  1 nagios  nagios       0 Jan 27 11:30 nagios.debug-rw-r--r--  1 nagios  nagios       4 Apr 21 16:45 nagios.lock-rw-r--r--  1 nagios  nagios   19371 Apr 23 13:45 nagios.log-rw-r--r--  1 nagios  nagios       0 Jan 26 14:31 object.cache-rw-r--r--  1 nagios  nagios       0 Jan 26 14:31 object.precache-rw-r--r--  1 nagios  nagios  125106 Apr 21 16:45 objects.cache-rw-------  1 nagios  nagios  203289 Apr 23 13:45 retention.datdrwxrwxr-x  2 nagios  nagios     512 Apr 21 16:45 rw-rw-rw-r--  1 nagios  nagios  202933 Apr 23 13:53 status.dat-rw-r--r--  1 nagios  nagios       0 Apr 21 16:45 status.sav2. #  ee /usr/local/etc/nagios/nagios.cfg  //添加如下两行   cfg_file=/usr/local/etc/nagios/objects/linux.cfgcfg_file=/usr/local/etc/nagios/objects/windows.cfg3.#  cd /usr/local/etc/nagios/object/#  ee linux.cfg ``````````````````````````````````````````````````````````````````````````````````````````` define hostgroup{        hostgroup_name  linux-servers ; The name of the hostgroup        alias           linux Servers ; Long name of the group        members         vici01,vici02,vici04        }###################### Server CPU Check ######################define service{        use                            generic-service         host_name                      vici01,vici02,vici04        service_description            CPU Load check_command        check_nrpe!check_load       }###################### / Driver Space ######################## define service{        use                             generic-service         ; Name of service template to use        host_name                       vici01,vici02,vici04        service_description             / Drive Space check_command check_nrpe!check_/        }###################### Ping Check #######################define service{        use                             generic-service        host_name                       vici01,vici02,vici04        service_description             PING        check_command                   check_ping!100.0,20%!500.0,60%        }###################### mysql Check #######################define service{        use                             generic-service        host_name                       vici01        service_description             Mysql check_command check_mysql          }#################### Host define config#################                          define host{        use                     linux-server                  host_name               vici01        alias                   vicidial01 Server        address                 192.168.2.xx       }define host{        use                     linux-server        host_name               vici02        alias                   vicidial02 Server        address                 192.168.2.xx        }define host{        use                     linux-server        host_name               vici04        alias                   vicidial04 Server        address                 192.168.1.xx        }`````````````````````````````````````````````````````````````````````````````````````````````````4. #  ee windows.cfg```````````````````````````````````````````````````````````````````````````````````````````````define hostgroup{        hostgroup_name  windows-servers ; The name of the hostgroup        alias           windows Servers ; Long name of the group       members         axisoft-symatec,axiadsvr01        }###################### Server Uptime Check ######################define service{        use                             generic-service         ; Name of service template to use        host_name                       axisoft-symatec,axiadsvr01        service_description             Uptime check_command check_nt!UPTIME        }##################### Server CPU Check #########################define service{        use                             generic-service         ; Name of service template to use        host_name                       axisoft-symatec,axiadsvr01        service_description             CPU Load check_command check_nt!CPULOAD!-l 5,80,90        }##################### Server Memory Check ###################### define service{        use                             generic-service         ; Name of service template to use        host_name                       axisoft-symatec,axiadsvr01        service_description             Memory Usage check_command check_nt!MEMUSE!-w 80 -c 90        }###################### C Driver Space ######################## define service{        use                             generic-service         ; Name of service template to use        host_name                       axisoft-symatec,axiadsvr01        service_description             C:\ Drive Space check_command check_nt!USEDDISKSPACE!-l c -w 98 -c 99        }################## D Driver Check #########################define service{        use                             generic-service         ; Name of service template to use        host_name                       axisoft-symatec,axiadsvr01        service_description             D:\ Drive Space check_command check_nt!USEDDISKSPACE!-l d -w 98 -c 99        }################ E Driver Check ###########################define service{        use                             generic-service         ; Name of service template to use        host_name                       axisoft-symatec,axiadsvr01        service_description             E:\ Drive Space check_command check_nt!USEDDISKSPACE!-l e -w 98 -c 99        }###################### F Driver Check ########################define service{        use                             generic-service         ; Name of service template to use        host_name                       axiadsvr01        service_description             F:\ Drive Space check_command check_nt!USEDDISKSPACE!-l f -w 98 -c 99        }###################### Ping Check #######################define service{        use                             generic-service         ; Name of service template to use        host_name               axisoft-symatec,axiadsvr01        service_description             PING check_command check_ping!100.0,20%!500.0,60%          }######################## Host define config#################define host{        use                     windows-server                  host_name               axisoft-symatec        alias                   endpoint        address                 192.168.2.xx        }define host{        use                     windows-server                  host_name               axiadsvr01        alias                   AD Server        address                 192.168.2.xx        }                   ``````````````````````````````````````````````````````````````````````````````````````````````````4.# ee /usr/local/nagios/nrpe.cfglog_facility=daemonpid_file=/var/spool/nagios/nrpe.pidserver_port=5666nrpe_user=nagiosnrpe_group=nagiosallowed_hosts=127.0.0.1 192.168.xx.xxdont_blame_nrpe=0debug=0command_timeout=60connection_timeout=300command[check_users]=/usr/local/libexec/nagios/check_users -w 5 -c 10command[check_load]=/usr/local/libexec/nagios/check_load -w 15,10,5 -c 30,25,20command[check_/]=/usr/local/libexec/nagios/check_disk -w 10% -c 5% -p /command[check_var]=/usr/local/libexec/nagios/check_disk -w 10% -c 5% -p /varcommand[check_tmp]=/usr/local/libexec/nagios/check_disk -w 10% -c 5% -p /tmpcommand[check_usr]=/usr/local/libexec/nagios/check_disk -w 10% -c 5% -p /usrcommand[check_home]=/usr/local/libexec/nagios/check_disk -w 10% -c 5% -p /homecommand[check_zombie_procs]=/usr/local/libexec/nagios/check_procs -w 5 -c 10 -s Zcommand[check_total_procs]=/usr/local/libexec/nagios/check_procs -w 150 -c 200 `````````````````````````````````````````````````````````````````````````````````````````````````5.#  ee /usr/local/etc/apache22/Include/nagios.cfg````````````````````````````````````````````````````````````````````````````````````````ScriptAlias /nagios/cgi-bin "/usr/local/www/nagios/cgi-bin"<Directory "/usr/local/www/nagios/cgi-bin">AuthType BasicOptions ExecCGIAllowOverride NoneOrder allow,denyAllow from allAuthName "Nagios Access"AuthUserFile /usr/local/etc/nagios/htpasswd.usersRequire valid-user</Directory>Alias /nagios "/usr/local/www/nagios"<Directory "/usr/local/www/nagios">AuthType BasicOptions NoneAllowOverride NoneOrder allow,denyAllow from allAuthName "nagios Access"AuthUserFile /usr/local/etc/nagios/htpasswd.usersRequire valid-user</Directory>至此,服务器端已完成,客户端待续```````````


linux 下的客户端安装,请参照如下附件:
本文出自 “展望过去” 博客,请务必保留此出处http://gnnjw.blog.51cto.com/361372/303429
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: