




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Nagios安装配置手册Nagios, 手册一安装需求Apache GCC compiler GD development libraries 二建立账号1、 Create Account Information /usr/sbin/useradd -m nagiospasswd nagios2、Create a new nagcmd group for allowing external commands to be submitted through the web interface. /usr/sbin/groupadd nagcmd/usr/sbin/usermod -a -G nagcmd nagios/usr/sbin/usermod -a -G nagcmd apache三下载 Nagios and the Plugins 1、Create a directory for storing the downloadsmkdir -p /opt/nagioswget /s . nagios-3.0.6.tar.gzwget /s . ugins-1.4.11.tar.gz四编译和安装nagioscd /opt/nagiostar -zxvf nagios-3.1.0.tar.gz cd nagios-3.1.0./configure -prefix=/usr/local/nagios -with-command-group=nagcmdmake allmake installmake install-initmake install-configmake install-commandmode五定制配置1、配置告警邮件接收者vi /usr/local/nagios/etc/objects/contacts.cfgnagioslocalhost2、配置web接口Install the Nagios web config file in the Apache conf.d directorymake install-webconf (/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf)3、配置web登陆用户名和密码htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin4、启动apache六、编译安装nagios-pluscd /opt/nagios/tar -zxvf nagios-plugins-1.4.13.tar.gzcd nagios-plugins-1.4.13./configure -with-nagios-user=nagios -with-nagios-group=nagiosmake allmake install安装nrpecd /opt/nagiostar -zxvf nrpe-2.12.tar.gzcd nrpe-2.12./configure -enable-ssl-enable-command-args make all make install make install-plugin make install-daemon make install-daemon-configvi /usr/local/nagios/etc/commands.cfgdefine command command_name check_nrpe command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ 七配置启动nagios1、加入启动服务chkconfig -add nagioschkconfig -level 35 nagios on2、检查配置文件/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg出现Total Warnings: 0Total Errors: 0成功3、启动service nagios start4、检查ps -ef | grep nagios/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg八修改selinux和防火墙。安装是将selinux禁止即可九:登陆webhttp:/Ip/nagios监控windows1、nagios配置vi /usr/local/nagios/etc/nagios.cfg#cfg_file=/usr/local/nagios/etc/objects/windows.cfg 去掉#修改windwos监控模板2、Installing the Windows Agent 1、下载agent /projects/nscplus2、Unzip the NSClient+ files into a new C:NSClient+ directory 3、 Open a command prompt and change to the C:NSClient+ directory 4、Register the NSClient+ system service with the following command: nsclient+ /install5、6、Edit the NSC.INI file (located in the C:NSClient+ directory) and make the following changes: 7、 Start the NSClient+ service with the following command: nsclient+ /start 3、linuxuseradd -m nagiospasswd nagios mkdir -p nagios 安装插件 tar -zxvf nagios-plugins-1.4.13.tar.gz cd nagios-plugins-1.4.13 ./configure -prefix=/usr/local/nagios makemake installchown nagios.nagios /usr/local/nagioschown -R nagios.nagios /usr/local/nagios/libexec/安装nrpe tar -zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure make all make install make install-plugin make install-daemon make install-daemon-config 安装check_nrpe这个插件make install-plugin 之前说过监控机需要安装check_nrpe这个插件,被监控机并不需要,我们在这里安装它是为了测试的目的安装deamonmake install-daemon 安装配置文件make install-daemon-config 现在再查看nagios目录就会发现有4个目录了rootdbpi nrpe-2.8.1# ls /usr/local/nagios/bin etc libexec share按照安装文档的说明,是将NRPE deamon作为xinetd下的一个服务运行的.在这样的情况下xinetd就必须要先安装好, 不过一般系统已经默认装了 4.安装xinetd脚本make install-xinetd输出如下/usr/bin/install -c -m 644 sample-config/nrpe.xinetd /etc/xinetd.d/nrpe可以看到创建了这个文件/etc/xinetd.d/nrpe编辑这个脚本vi /etc/xinetd.d/nrpe # default: on# description: NRPE (Nagios Remote Plugin Executor)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 = 在后面增加监控主机的地址0.111,以空格间隔改后 only_from = 11编辑/etc/services文件,增加NRPE服务vi /etc/services 增加如下# Local servicesnrpe 5666/tcp # nrpe启动服务service xinetd restart查看NRPE是否已经启动rootdbpi nrpe-2.8.1# netstat -at|grep nrpetcp 0 0 *:nrpe *:* LISTEN rootdbpi nrpe-2.8.1# netstat -an|grep 5666tcp 0 0 :5666 :* LISTEN 可以看到5666端口已经在监听了5.测试NRPE是否则正常工作之前我们在安装了check_nrpe这个插件用于测试,现在就是用的时候.执行/usr/local/nagios/libexec/check_nrpe -H localhost会返回当前NRPE的版本rootdbpi nrpe-2.8.1# /usr/local/nagios/libexec/check_nrpe -H localhostNRPE v2.12通过ndoutils降nagios数据信息放到数据库配置数据库补充安装包rpm -Uvh mysql-devel-5.0.45-7.el5.i386.rpm (mysql apache 都是采用系统安装时自带的rpm包)service mysqld startmysql -uroot -pmysql -u root -pmysql CREATE DATABASE nagios;mysqlGRANT ALL PRIVILEGES ON nagios.* TO nagioslocalhost IDENTIFIED BY nagios;安装ndoutils /download/tar -zxvf ndoutils-1.4b7.tar.gzcd ndoutils-1.4b7./configure -prefix=/usr/local/nagios-enable-mysqlmake all设置ndo2db和ndomodcp ndo2db-3x /usr/local/nagios/bin/ /ndo2db可执行文件cp ndomod-3x.o /usr/local/nagios/bin/ /ndomod库文件cp config/ndo2db.cfg /usr/local/nagios/etc/ndo2db配置文件cp config/ndomod.cfg /usr/local/nagios/etc/ndomod配置文件注意权限和属组vi /usr/local/nagios/etc/nagios.cfg 找到broker_module添加broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg建立数据库:cd dbvi installdb修改DBI:mysql:database=$database;host=$hostname 的host=改成了,localhost./installdb-unagios -pnagios -d nagios 这里会包错误DBD:mysql:db do failed: Table nagios.nagios_dbversion doesnt exist at ./installdb line 51不用管它 登陆数据库nagiosmysql -unagios -pnagios use nagiosshow tables;看到有表就可以了alter table nagios_configfilevariables drop key instance_id;alter table nagios_configfilevariables add index (instance_id, configfile_id, varname) ;编辑vi /usr/local/nagios/etc/ndo2db.cfg 建立与数据库连接的内容ndo2db_user=nagiosndo2db_group=nagiosdb_servertype=mysqldb_host=localhostdb_port=3306db_name=nagiosdb_user=nagiosdb_pass=nagios修改接口socket_type=unix启动apache+nagios+mysql+ndo2db启动的shell# up apacheservice httpd start#up nagios/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg#up mysqlservice mysqld start#up ndo2db/usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg查看日志tail -f /usr/local/nagios/var/nagios.logtail -f /var/lo
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
评论
0/150
提交评论