Nagios安装配置手册

合集下载

nagios监控端安装配置手册

nagios监控端安装配置手册

一、系统环境与软件版本情况本文档使用被监控机的操作系统为rhel6.3 _64位。

监控主机操作系统为rhel6.0 _64位及windows 2003,nagios主服务版本Nagios® Core™ 3.2.3,linu被监控机与主监控通信插件NRPE版本为nrpe-2.8.1。

window被监控机与主监控服务软件为NSClient++-0.2.7所使用的软件如下nrpe-2.8.1.tar.gzNSClient++-0.2.7.zip二、安装配置过程。

因为系统安装大家都非常熟悉了此次略过操作系统安装过程,首先是linux环境下被监控机的安装配置过程。

在安装之前先写个nagios监控非本地信息的原理图主监控机被监控机NRPE总共由两部分组成:–check_nrpe 插件,位于在监控主机上–NRPE daemon,运行在远程的linux主机上(通常就是被监控机)按照上图,整个的监控过程如下:当nagios需要监控某个远程linux主机的服务或者资源情况时1.nagios会运行check_nrpe这个插件,告诉它要检查什么.2.check_nrpe插件会连接到远程的NRPE daemon,所用的方式是SSL3.NRPE daemon会运行相应的nagios插件来执行检查4.NRPE daemon将检查的结果返回给check_nrpe插件,插件将其递交给nagios做处理.注意:NRPE daemon需要nagios插件安装在远程的linux主机上,否则,daemon不能做任何的监控.因为使用rehl线上的yum源安装需要授权,所以先使用iso搭个本地的yum源。

mount /dev/cdrom /mnt/cdrom/ 挂载光驱mkdir /home/rehliso 创建yum源目录。

cp -Rf /mnt/cdrom/* /home/rehliso/ 拷贝安装文件到源目录cd /etc/yum.repos.d/ 切换至yum配置文件目录cp rhel-source.repo rhel-source.repo.bak 备份配置文件vi rhel-source.repo 编辑配置文件,删除之前内容加入[rhel_6_iso]name=local isobaseurl=file:///home/rehlisogpgcheck=1gpgkey=file:///home/rehliso/RPM-GPG-KEY-redhat-release保存退出Yum clean all清除YUM缓存因为是用二进制安装包进行安装所以要先安装gcc编译器yum -y install gcc 安装gcc编译器安装完成后用sftp上传安装文件nrpe-2.8.1.tar.gz, nagios-plugins-1.4.13.tar.gz至/usr/local/src/目录下创建nagios用户Userad nagiosPasswd nagiosCd /usr/local/src 切换至/usr/local/src/目录解压安装包tar zxvf nagios-plugins-1.4.13.tar.gzcd nagios-plugins-1.4.13编译安装./configuremakemake install这一步完成后会在/usr/local/nagios/下生成两个目录libexec和share修改目录权限把权限所属chown nagios.nagios /usr/local/nagios/chown -R nagios.nagios /usr/local/nagios/libexec/至此被监控机nagios插件已经安装完成,接下来就是安装nrpe服务了切换至软件包目录Cd /usr/local/src解压安装文件tar zxvf nrpe-2.8.1.tar.gzcd nrpe-2.8.1编译安装./configurechecking for SSL... configure: error: Cannot find ssl libraries 出现了该错误主要是因为监控主机插件check_nrpe与被监控nrpe服务的通信是通过ssl方式连接的所以必须安装sslyum -y install openssl-devel 所以这个可以在gcc安装时顺便也安装了ssl安装完成后重新./configure*** Configuration summary for nrpe 2.8.1 05-10-2007 ***:General Options:-------------------------NRPE port: 5666NRPE user: nagiosNRPE group: nagiosNagios user: nagiosNagios group: nagiosReview the options above for accuracy. If they look okay,type 'make all' to compile the NRPE daemon and client.成功后会出现以上安装的基本信息接下来编译安装make allmake install-daemonmake install-daemon-configmake install-plugin 安装check_nrpe这个插件之前说过监控机需要安装check_nrpe这个插件,被监控机并不需要,我们在这里安装它是为了测试的目的安装xinetd脚本make install-xinetd这里还要补充一下因为官网的安装文档是将NRPE deamon作为xinetd下的一个服务运行的.在这样的情况下xinetd就必须要先安装好,所以还得确定系统是否已经安装了xinetd的服务[root@localhost nrpe-2.8.1]# service xinetd restartxinetd: unrecognized service服务并未安装yum -y install xinetd 安装xinetd服务安装完成后修改配置文件vi /etc/xinetd.d/nrpeservice nrpe{flags = REUSEsocket_type = streamport = 5666 端口wait = nouser = nagios 用户group = nagios 用户组server = /usr/local/nagios/bin/nrpeserver_args = -c /usr/local/nagios/etc/nrpe.cfg --inetdlog_on_failure += USERIDdisable = noonly_from = 127.0.0.1,192.168.1.243}only_from = 127.0.0.1,192.168.1.243在后面增加监控主机的地址192.168.1.243以空格间隔编辑/etc/services文件,增加NRPE服务端口添加如下信息nrpe 5666/tcp #nrpe查看防火墙是否启动chkconfig iptables –list如果启动需要添加5666端口的开放规则vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT添加该条目service iptables restart 重启iptables服务重启xinetd服务service xinetd restart检查服务端口状态[root@localhost ~]# netstat -natp |grep 5666tcp 0 0 :::5666 :::* LISTEN 1959/xinetd 服务端口已经启动测试NRPE是否则正常工作之前我们在安装了check_nrpe这个插件用于测试,现在就是用的时候.执行[root@localhost ~]# /usr/local/nagios/libexec/check_nrpe -H localhostNRPE v2.8.1返回了版本信息说明nrpe已经正常的工作了。

nagios全攻略(二)----基本安装和配置

nagios全攻略(二)----基本安装和配置

二. 基本安装和配置本部分主要参考官方文档和田逸的文章<<看我出招之:我用Nagios(技术细节)来修改完成.>>最后达到如下的功能监控机自身的信息,包括主机信息以及对外提供的服务被监控机对外提供的服务如下所有的操作都在监控机192.168.0.111上进行1.安装nagios主程序解压缩tar -zxvf nagios-2.9.tar.gzcd nagios-2.9编译,指定安装目录为/usr/local/nagios./configure --prefix=/usr/local/nagios输出如下信息*** Configuration summary for nagios 2.9 04-10-2007 ***:General Options:-------------------------Nagios executable: nagiosNagios user/group: nagios,nagiosCommand user/group: nagios,nagiosEmbedded Perl: noEvent Broker: yesInstall ${prefix}: /usr/local/nagiosLock file: ${prefix}/var/nagios.lockInit directory: /etc/rc.d/init.dHost OS: linux-gnuWeb Interface Options:------------------------HTML URL: [url]http://localhost/nagios/[/url]CGI URL: [url]http://localhost/nagios/cgi-bin/[/url] Traceroute (used by WAP): /usr/sbin/tracerouteReview the options above for accuracy. If they look okay,type 'make all' to compile the main program and CGIs.make all输出如下信息*** Compile finished ***If the main program and CGIs compiled without any errors, youcan continue with installing Nagios as follows (type 'make'without any arguments for a list of all possible options):make install- This installs the main program, CGIs, and HTML files使用make install来安装主程序,CGI和HTML文件make install-init- This installs the init script in /etc/rc.d/init.d使用make install-init在/etc/rc.d/init.d安装启动脚本make install-commandmode- This installs and configures permissions on thedirectory for holding the external command file使用make install-commandmode来配置目录权限make install-config- This installs *SAMPLE* config files in /usr/local/nagios/etcYou'll have to modify these sample files before you canuse Nagios. Read the HTML documentation for more infoon doing this. Pay particular attention to the docs onobject configuration files, as they determine what/howthings get monitored!使用make install-commandmode来安装示例配置文件,安装的路径是/usr/local/nagios/etc. *** Support Notes *******************************************If you have questions about configuring or running Nagios,please make sure that you:- Look at the sample config files- Read the HTML documentation- Read the FAQs online at [url]/faqs[/url]before you post a question to one of the mailing lists.Also make sure to include pertinent information that couldhelp others help you. This might include:- What version of Nagios you are using- What version of the plugins you are using- Relevant snippets from your config files- Relevant error messages from the Nagios log fileFor more information on obtaining support for Nagios, visit:[url]/support/[/url]*************************************************************Enjoy.很多人都不注意安装过程中的输出信息,直到make install出错了才到处找人求救,而实际上输出的内容包含很多有价值的信息,例如安装路径,版本,每一步做什么,接下来的步骤等.尤其是输出的最后一屏信息,我个人建议好好的读一下.例如上面就列出了很多有价值的信息,我们只需要按照他说的做就行了.安装make install输出如下错误cd ./base && make installmake[1]: Entering directory `/home/yahoon/nagios/nagios-2.9/base'make install-basicmake[2]: Entering directory `/home/yahoon/nagios/nagios-2.9/base'/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin/usr/bin/install: invalid user `nagios' 非法用户nagiosmake[2]: *** [install-basic] Error 1make[2]: Leaving directory `/home/yahoon/nagios/nagios-2.9/base'make[1]: *** [install] Error 2make[1]: Leaving directory `/home/yahoon/nagios/nagios-2.9/base'make: *** [install] Error 2按照文档说明增加用户,修改权限[root@localhost nagios-2.9]# useradd nagios[root@localhost nagios-2.9]# mkdir /usr/local/nagios[root@localhost nagios-2.9]# chown nagios.nagios /usr/local/nagios 查看目录权限[root@localhost nagios-2.9]# ll /usr/localdrwxr-sr-x 2 nagios nagios 4096 Jul 10 11:14 nagios看到nagios目录的权限已经被正确修改了重新执行make install输出信息如下*** Main program, CGIs and HTML files installed ***You can continue with installing Nagios as follows (type 'make'without any arguments for a list of all possible options):make install-init- This installs the init script in /etc/rc.d/init.dmake install-commandmode- This installs and configures permissions on thedirectory for holding the external command filemake install-config- This installs *SAMPLE* config files in /usr/local/nagios/etcYou'll have to modify these sample files before you canuse Nagios. Read the HTML documentation for more infoon doing this. Pay particular attention to the docs onobject configuration files, as they determine what/howthings get monitored!make[1]: Leaving directory `/home/yahoon/nagios/nagios-2.9'执行如下命令来安装脚本make install-init执行make install-commandmode输出信息如下/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var/rw chmod g+s /usr/local/nagios/var/rw*** External command directory configured ***You can continue with installing Nagios as follows (type 'make'without any arguments for a list of all possible options):make install-config- This installs *SAMPLE* config files in /usr/local/nagios/etcYou'll have to modify these sample files before you canuse Nagios. Read the HTML documentation for more infoon doing this. Pay particular attention to the docs onobject configuration files, as they determine what/howthings get monitored!执行make install-config输出信息如下/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/usr/bin/install -c -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg-sample/usr/bin/install -c -m 664 -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg-sample/usr/bin/install -c -m 660 -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg-sample/usr/bin/install -c -m 664 -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/localhost.cfg-sample/usr/bin/install -c -m 664 -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/commands.cfg-sample*** Sample config file installed ***Remember, these are *SAMPLE* config files. You'll need to readthe documentation for more information on how to actually defineservices, hosts, etc. to fit your particular needs.If you have questions about configuring Nagios properly, please:- Look at the sample config files- Read the HTML documentation- Read the FAQs online at [url]/faqs[/url]*BEFORE* you post a question to one of the mailing lists.验证程序是否被正确安装。

Nagios安装与配置详解

Nagios安装与配置详解

Nagios学习笔记之(一)最初搭建2012-07-17 13:05:08标签:linux监控nagios cacti声明:原创作品,如需,请与作者联系。

否则将追究法律责任。

Nagios学习笔记之一最初搭建一、简介:Nagios是一款开源的免费网络监视工具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设置,打印机等。

在系统或服务状态异常时发出或短信报警第一时间通知运维人员,在状态恢复后发出正常的或短信通知。

二、搭建过程:OS:CentOS 5.5 x86_64(最小化即可)Nagios主程序:nagios-cn-3.4.1Nagios插件:nagios-plugins-1.4.15.tar.gz2.1安装前:2.1.1安装依赖包,下载源程序包1.#cd/etc/yum.repos.d/2.#rm-fr./*3.#wget wget mirrors.163./.help/CentOS-Base-163.repo4.#yum makecache#删除系统自带的yum源,下载网易的网络源并更新缓存1.#yum-y install gcc glibc glibc-common gd gd-devel httpd#安装必须的依赖包1.#wget /sourceforge/nagios/nagios-3.4.1.tar.gz2.#wget /sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz#下载nagios主程序以及插件程序2.1.2正式安装:1.#groupadd nagcmd2.#useradd-G nagcmd nagios3.#usermod-G nagcmd apache#创建一个用户组名为nagcmd用于从Web接口执行外部命令。

将nagios用户和apache用户都加到这个组中。

1.#tar zxf nagios-3.4.1.tar.gz2.#cd nagios3.#./configure--prefix=/usr/local/nagios --with-command-group=nagcmd4.#解压程序包,并进行预编译前的配置(默认用户就是nagios,所以只需指定组)5.#make all#编译Nagios程序包源码6.#make install#安装二进制运行程序7.#make install-init#初始化脚本8.#make install-config#配置文件样本9.#make install-commandmode#设置运行目录权限10.#make install-webconf#安装Nagios的WEB配置文件到Apache的conf.d目录下#htpasswd -c /usr/local/nagios/etc/ers nagiosadmin#创建一个nagiosadmin的用户用于登录Nagios的web界面。

ubuntu nagios安装与配置文档

ubuntu nagios安装与配置文档

本系列文章旨在记录作者搭建nagios监控的安装及配置步骤,都经过测试,欢迎指正。

nagios简介:Nagios是一款开源的免费网络监视工具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设置,打印机等。

在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员,在状态恢复后发出正常的邮件或短信通知。

本篇文章将详细说明如何在ubuntu12.04 server 上安装nagios,并监控本机基本信息。

一、准备1.更新ubuntu系统配置好合适的源后/etc/apt/sources.listsudo apt-get updatesudo apt-get upgrade2.依赖软件包:sudo apt-get install build-essentialsudo apt-get install libssl0.9.8 libssl-devopensslsudo apt-get install libgd2-noxpm libgd2-noxpm-devsudo apt-get install apache2(安装完nagios plugin后可以检查一下http,检查:/usr/local/nagios/libexec/check_http -H 127.0.0.1错误结果:Connection refusedHTTP CRITICAL - Unable to open TCP socket启动apache: service apache2 start后再检查,正确结果:HTTP OK: HTTP/1.1 200 OK - 452 bytes in 0.001 second response time|time=0.001221s;;;0.000000 size=452B;;;0 )安装到目录:/usr/bin/htpasswd/usr/sbin/apache2 link/etc/apache2 配置文件httpd.conf在此/usr/lib/apache2 modules 在此/usr/share/apache2/usr/share/man/man8/apache2.8.gzapt-get install php5安装到目录/usr/bin/php5 /etc/php5 /usr/lib/php5 /usr/share/php5/usr/share/man/man1/php5.1.gz二、下面进行nagios的安装以下操作要在root权限用户下进行修改root密码:sudopasswd root设置root密码su切到root用户1.下载nagios软件包下载所需安装包,在/usr/local/src目录下载wget /sourceforge/nagios/nagios-3.2.3.tar.gzwget /sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz wget /sourceforge/nagios/nrpe-2.12.tar.gz2.创建所需用户和组信息groupaddnagcmdgroupaddnagiosuseradd -gnagiosnagios3.安装nagiostar zxvf nagios-3.2.3.tar.gzcd nagios-3.2.3./configure --prefix=/usr/local/nagios --with-command-group=nagcmd终端打印出configure信息:注意关于apache2和mail的配置,以后可能会修改,记住位置:Apache conf.d directory: /etc/apache2/conf.dMail program: /usr/bin/mail编译:make all根据上述提示安装:make installmake install-initmake install-configmake install-commandmodemake install-webconf其中要注意每一步的安装信息,主要是安装目录,方便以后修改。

Nagios安装配置教程(一)基本了解

Nagios安装配置教程(一)基本了解

Nagios安装配置教程(⼀)基本了解⼀、Nagios简介 Nagios是⼀款开源的电脑系统和⽹络监视⼯具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等⽹络设置,打印机等。

在系统或服务状态异常时发出邮件或短信报警第⼀时间通知⽹站运维⼈员,在状态恢复后发出正常的邮件或短信通知。

Nagios能监视所指定的本地或远程主机以及服务,同时提供异常通知功能等。

Nagios可运⾏在Linux/Unix平台之上,同时提供⼀个可选的基于浏览器的WEB界⾯以⽅便系统管理⼈员查看⽹络状态,各种系统问题,以及⽇志等等。

Nagios 可以监控的功能有: 1、监控⽹络服务(SMTP、POP3、HTTP、NNTP、PING等); 2、监控主机资源(处理器负荷、磁盘利⽤率等); 3、简单地插件设计使得⽤户可以⽅便地扩展⾃⼰服务的检测⽅法; 4、并⾏服务检查机制; 5、具备定义⽹络分层结构的能⼒,⽤"parent"主机定义来表达⽹络主机间的关系,这种关系可被⽤来发现和明晰主机宕机或不可达状态; 6、当服务或主机问题产⽣与解决时将告警发送给联系⼈(通过EMail、短信、⽤户定义⽅式); 7、可以定义⼀些处理程序,使之能够在服务或者主机发⽣故障时起到预防作⽤; 8、⾃动的⽇志滚动功能; 9、可以⽀持并实现对主机的冗余监控; 10、可选的WEB界⾯⽤于查看当前的⽹络状态、通知和故障历史、⽇志⽂件等;⼆、Nagios⼯作原理 Nagios的功能是监控服务和主机,但是他⾃⾝并不包括这部分功能,所有的监控、检测功能都是通过各种插件来完成的。

启动Nagios后,它会周期性的⾃动调⽤插件去检测服务器状态,同时Nagios会维持⼀个队列,所有插件返回来的状态信息都进⼊队列,Nagios每次都从队⾸开始读取信息,并进⾏处理后,把状态结果通过web显⽰出来。

Nagios提供了许多插件,利⽤这些插件可以⽅便的监控很多服务状态。

nagios完全安装使用手册

nagios完全安装使用手册

nagios完全安装手册一、虚拟机安装1、推荐版本号VMware-workstation-full-9.0.22、选择“完全安装”,全部选择默认选项,一路“下一步”,注:安装路径推荐安装在C:\下。

3、安装完成后,使用注册码:JV695-DR0D3-LZUC0-H8852-CAWJ4或4F297-84H0M-MZN18-X207P-ACQLQ4、安装VMware9汉化包。

5、打开VMware-workstation,进入VMware-workstation界面6、点击“创建新的虚拟机”7、在新建虚拟机向导中选择“自定义(高级)”选项》"继续"。

8、选择“我以后安装操作系统”》“继续”9、选择“客户机操作系统”为“linux”,版本号选择“Red Hat Enterprise Linux 5 64-bit”》"继续"。

选择的版本位数与主机的操作系统位数一致,32位或64位。

10、创建虚拟机名称,在“位置”选项中将虚拟系统放置除C:\以外的任意磁盘,注:虚拟系统安置的磁盘尽可能保证没有重要文件的空磁盘。

》“继续”11、处理器配置选择默认》“继续”12、虚拟机内存可选择1G或1G倍数。

》“继续”13、网络类型,选择“使用桥接网络”》“继续”14、选择i/O控制器类型,LSI逻辑》“继续”15、选择“创建一个新的虚拟磁盘”》“继续”16、选择磁盘类型为“SCSI”》“继续”17、指定磁盘容量,在最大磁盘空间输入你刚选择的虚拟系统安装盘实际可用空间大小,例如可用空间为499G,填入499G。

勾选“虚拟磁盘拆分成多个文件”18、准备创建虚拟机就绪,选择“定制硬件”》“新建CD/DVD”》“使用ISO映像文件”》“浏览”》选中本地磁盘中的虚拟系统ISO系统文件》“关闭”》“完成”19、选择“打开虚拟机电源”20、如果弹出下对话框,则需要到BIOS中,在高级\处理器设置\Intel虚拟技术选为“开启”》保存重启电脑21、进入该页面,等待安装22、选择“Skip”》“Next”23、选择“简体中文”》“next”24、选择“美国英语式”》“下一步”25、安装号码处填写序列号》“确认”26、在“警告”中选择“是”27、选择“建立自定义的分区结构”》“下一步”28、点击“新建”》挂载点选择“/”》“文件系统类型”选择“ext3”》“大小”,填写磁盘大小,此处数值物理磁盘数值的90%》勾选指定空间大小》“确定”29、再点击“新建”》挂载点选择“/boot”》“文件系统类型”选择“ext3”》“大小”选择,剩余空间的7%》勾选指定空间大小》“确认”30、再点击“新建”》挂载点不选》“指定文件系统类型”选择"SWAP"》勾选“使用全部可用空间”》“确定”31、点击“下一步”32、选择“下一步”“手工配置”输入虚拟系统主机名》输入网关和DNS》“下一步”34、选择时区35、填写“根密码”》“下一步”36、其他保持默认,选择“现在定制”》“下一步”37、“桌面环境”、“应用程序”、“开发”、“服务器”、“基本系统”右侧的所有分选项全部勾选,“虚拟化”、“语言支持”保持默认》“下一步”38、“下一步”39、系统开始安装,耐心等待40、“重新引导”,等待重新启动41、进入欢迎界面》“前进”42、勾选“是,我同意”》“前进”43、“SELinux设置”选择“禁用”》“前进”》“是”】45、修改时间》“前进”46、勾选“不,我将在以后注册”》“前进”47、选择“不,我将在以后注册”》“前进”48、自己创建用户名、全名、口令、确认口令》“前进”49、“前进”50、“完成‘51、”确定“,到此,linux系统安装、配置完成。

Nagios安装配置[1] - Linux配置 - 坐沙发上等戈多

Nagios安装配置[1] - Linux配置 - 坐沙发上等戈多

Nagios安装配置[1] - Linux配置- 坐沙发上等戈多安装问题(我找到的中文版之中最好的一个,我照着手册装了一下,不成功,转而按照此文,最终成,限于篇幅原因就不在贴上来了,我自己的安装步骤基本上和这篇相同)/index.php?play=search&amp;ma ke=view&amp;id=282&amp;key=nagios-----------------------------------------------------------------------------------我的安装步骤(操作系统centos linxu 4.3)1、所需软件nagios-2.5.tar.gznagios-pluginsimagepak-basenrpeapache2、nagios安装首先安装apache 具体过程参考手册不在赘述w[]#adduser nagios[]#groupadd nagios[]#mkdir /usr/local/nagios[]#chown nagios.nagios /usr/local/nagios[]#tar zxvf nagios-2.5.tar.gz[]#cd nagios-2.5[]#./configure --prefix=/usr/local/nagios--with-gd-lib=/usr/local/lib --with-gd-inc=/usr/local/include ------------------------------------------------------------------上面命令用到的libgd库,在centos下的安装可以用以下命令[]#yum install gd(gdb php-gd glib-devel gd-devellibpng-devel libpng10-devel libjpeg-devel mod_perl-devel glibc mod_perl)具体的可参考我上文给出的联接------------------------------------------------------------------[]#make all[]#make install[]#make install-init ##This installs the init script in/usr/local/etc/rc.d[]#make install-commandmode[]#make install-config ##将初始的配置文件安装到/usr/local/nagios/etc2.2、nagios-plugins的安装[]#tar –xvzf nagios-plugins-1.4.4.tar[]#mkdir /usr/local/nagios-plugins[]#cd nagios-plugins-1.4.4[]#./configure --prefix=/usr/local/nagios-plugins[]#make all[]#make install安装完成以后在/usr/local/nagios-plugins会产生一个libexec的目录,将该目录全部移动到/usr/local/nagios目录下[]#cp /usr/local/nagios-plugins/libexec/usr/local/nagios/libexec2.3、imagepak-base的安装[]#tar –xvzf imagepak-base.tar.gz解压以后是base目录[]#cp –R base /usr/local/nagios/share/images/logos2.4、安装过程全部结束4、Nagios的设定:1、配置apache在apache的配置文件httpd.conf中追加(注意,要有image 这段,不然nagios不能显示图片,这三段顺序好象不能变,不然启动nagios的时候会提示错误)Alias /nagios/cgi-bin/images/"/usr/local/nagios/share/images/"&lt;Directory "/usr/local/nagios/share/images/"&gt;AllowOverride NoneOptions NoneOrder allow,denyAllow from allAuthName "Nagios Access"AuthType BasicAuthUserFile /usr/local/nagios/etc/.htpasswdRequire valid-user&lt;/Directory&gt;ScriptAlias /nagios/cgi-bin/ "/usr/local/nagios/sbin/" &lt;Directory "/usr/local/nagios/sbin/"&gt;AllowOverride NoneOptions NoneOrder allow,denyAllow from allAuthName "Nagios Access"AuthType BasicAuthUserFile /usr/local/nagios/etc/.htpasswdRequire valid-user&lt;/Directory&gt;Alias /nagios/ "/usr/local/nagios/share/"&lt;Directory "/usr/local/nagios/share/"&gt;AllowOverride NoneOptions NoneOrder allow,denyAllow from allAuthName "Nagios Access"AuthType BasicAuthUserFile /usr/local/nagios/etc/.htpasswdRequire valid-user&lt;/Directory&gt;2、设置访问权限在/usr/local/nagios/share目录下[]#/usr/local/www/bin/htpasswd –c/usr/local/nagios/etc/.htpasswd nagios这个apache目录根据安装目录的不同而不同,主要所以用.htpasswd这个命令生成用户名和密码3、配置nagios3.1、在/usr/local/nagios/etc下是nagios的配置模板文件.cfg-sample,把.cfg-sample文件全部拷贝成.cfg例如:[]#cp nagios.cfg-sample nagios.cfg全部拷贝完成即可.-----------------------------------------------------------修改minimal.cfg,把里面所有定义command的全部注释掉[]#vi /etc/minimal.cfg(这个我注释掉好象有问题待改正)-----------------------------------------------------------修改cgi.cfg 改use_authentication=1为use_authentication=0,即不用验证.不然有一些页面不会显示。

NAGIOS 安装与配置

NAGIOS 安装与配置

NAGIOS 安装与配置1 安装前的准备○1创建nagios用户和用户组#useradd –s /usr/sbin/nologin nagios#mkdir /usr/local/nagios#chown –R nagios.nagios /usr/local/nagios○2开启sendmail系统2编译安装nagios#tar –zxvf nagios-3.2.3.tar.gz#cd nagios-3.2.3#./configure --prefix=/usr/local/nagios指定nagios的安装目录/usr/local/nagios#make all#make installmake all是安装主程序#make install-init通过这个命令可以在/etc/rc.d/init.d创建启动脚本。

#make install-commandmode通过这个命令来配置目录权限。

#make install-config这个命令用来安装nagios示例配置文件,这里安装的路径是/usr/local/nagios/etc 3 安装nagios的插件注意,插件板本与nagios版本关联不大#tar -zxvf nagios-plugins-1.4.15.tar.gz#cd nagios-plugins-1.4.15#./configure --prefix=/usr/local/nagios#make#make install4 安装nagios的中文化插件#tar zxvf nagios-cn-3.2.3#cd nagios-cn-3.2.3#./configure#make all#make install5 安装与配置apache和php○1安装apache○2配置apache php找到User apacheGroup apache改为User nagiosGroup nagios找到DirectoryIndex index.html index.html.var改为DirectoryIndex index.html index.php增加AddType Application/x-httpd-php,php增加下面的seting for nagiosScriptAliax /nagios/cgi-bin "/usr/local/nagios/sbin"<Directory "usr/local/nagios/sbin">AuthType BasicAllowOverride NodeOptions ExecCGIOrder allow,denyAllow from allAuthName "Nagios Access" AuthuserFile /usr/local/nagios/etc/htpasswdRequire valid-user</Directory>Alias /nagios "/usr/local/nagios/share"<Directory "/usr/local/nagios/share">AuthType BasicOptions NoneAllowoverride NoneOrder allow,denyAllow from allAuthName "nagios Access" AuthUserFile /usr/local/nagios/etc/htpasswdRequire valid-user</Directory>○3创建nagios目录验证文件#htpasswd –c /usr/local/nagios/etc/htpasswd ixdba。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

12.配置和启动 nagios cd /usr/local/nagios/etc 里面如果有 cfg-sample,就把目录里的.cfg-sample 文件全部拷贝成.cfg 例如: cp nagios.cfg-sample nagios.cfg 没有的话就直接修改:
修改 vi cgi.cfg, use_authentication=1 改成 use_authentication=0, 即不用验证.不然有一些页面不会显示。
情况二: 如果还不行,从这个网站: 下载一下 Mudule 包,tar.gz 格式的! - Crypt::DES - Digest::MD5 - Digest::SHA1 - Digest::HMACcd - Net::SNMP 按以下操作顺序安装这些 Module: tar zxf <module>.tar.gz cd <module> perl Makefile.PL make test make install 完了以后 cd nagios_plugins ./install.sh (路径选默认,y/n 选 Y!)
6.安装 nagios nagios 之前的准备,特别需要安装 gd-devel, 另外安装 nagios 时需要加--with-gd-lib=/usr/lib --with-gd-inc=/usr/include 不然不能生成 statusmap.cgi 也就不能看状态图了!
groupadd nagios useradd -g nagios nagios passwd nagios mkdir /usr/local/nagios chown -R nagios:nagios /usr/local/nagios chmod 755 /usr/local/nagios/ usermod -G nagios apache usermod -G nagios nagios grep ^User /etc/httpd/conf/httpd.conf User apache 查看运行 apache 的用户
--with-gd-inc=/usr/include
make install-init //安装启动脚本到/etc/init.d/ make install-commandmode make install-config //安装初始配置文件到/usr/local/nagios
8.nagios-plugins 的安装 tar zxf nagios-plugins-1.4.14.tar.gz cd nagios-plugins-1.4.14 ./configure --prefix=/usr/local/nagios-plugins make make install 安装完成以后在/usr/local/nagios-plugins 会产生一个 libexec 的目录, 将该目录全部移动到/usr/local/nagios 目录下即可。 如下: mv /usr/local/nagios-plugins/libexec /usr/local/nagios/
10.现在配置 apache: 在 apache 的 httpd.conf 文件中加入如下内容: vi /etc/httpd/conf/httpd.conf ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/ <Directory "/usr/local/nagios/sbin/"> AllowOverride AuthConfig Options ExecCGI Order allow,deny Allow from all </Directory> Alias /nagios/ /usr/local/nagios/share/ <Directory "/usr/local/nagios/share"> Options None AllowOverride AuthConfig Order allow,deny Allow from all </Directory> 重启 apache service httpd restart #vi /usr/local/nagios/etc/objects/contacts.cfg 修改 nagiosadmin 这行其中的邮件地址为你的 email 地址,以将报警邮件发到你的邮箱
2. 关闭不需要的服务 ntsysv 以下仅列出需要启动的服务,未列出的服务一律推荐关闭: atd crond irqbalance microcode_ctl network sendmail sshd syslog snmpd httpd mysqld yum-updatesd
3.配置 yum 的地址,使用国内的 yum 源 使用这个命令让 centos 自动寻找速度快的更新源, 国内一般会自动选择网易的源. yum install -y yum-fastestmirror 也可以手动更改为国内网易的源: cd /etc/yum.repos.d/ mv CentOS-Base.repo CentOS-Base.repo.bak wget /CentOS-Base.repo rpm -import /centos/RPM-GPG-KEY-CentOS-5
不能解析域名的话: vi /etc/resolv.conf nameserver 202.96.209.5 202.96.209.5 是上海电信的 DNS
4.yum 安装需要的软件包和支持库: yum install -y httpd httpd-manual httpd-devel gd gd-devel perl-GD mysql-server mysql-devel php php-mysql php-gd php-pear perl-DBI perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils perl-Socket6 perl-IO-Socket-INET6 net-snmp-devel php-snmp dmidecode net-snmp-perl perl-Crypt-DES fping perl-Config-IniFiles graphviz gcc-c++ glib2-devel php-gd php-pdo php-ldap php-mbstring php-xml lib
7.Nagios 主程序安装: tar zxf nagios-3.2.1.tar.gz cd nagios-3.2.1 ./configure --prefix=/usr/local/nagios --enable-event-broker make all make all install
--with-gd-lib=/usr/lib
11.设置登陆 web 界面时 HTTP 验证的账号密码 htpasswd -c /usr/local/nagios/etc/ers nagiosadmin 重启动 apache service httpd restart 重启动 nagios service nagios restart
运维技术部 Nagios
(Nagios,报警声音,手机短信报警,)
安装配置手册 (For Monitor)
版本: V 1.0 作者:Kaiser
系统环境: OS:CenterOS 5.4 最小化安装的基础上选择以下包: 开发工具里选择:gcc*,Imake* 系统工具里选择:net-snmp* 语言里选择支持中文! 其他默认! 软件环境:(除了 nagios 我们手动编译安装以外,php, httpd 以及他们的支持库和组件通过 题!) 主要软件及版本: nagios-3.2.1 nagiosql303 nagios-snmp-plugins.1.1.1 nagios-plugins-1.4.14.tar nagios-nrpe_2.8.1 php-5.1.6-24.el5_4.5 httpd-2.2.3-31.el5.centos.4 net-snmp-5.3.2.2-7.el5_4.2 相关支持库及组件: php-mysql-5.1.6-24.el5_4.5 php-cli-5.1.6-24.el5_4.5 php-pdo-5.1.6-24.el5_4.5 php-xml-5.1.6-24.el5_4.5 php-common-5.1.6-24.el5_4.5 php-mysql-5.1.6-24.el5_4.5 php-snmp-5.1.6-24.el5_4.5 php-ldap-5.1.6-24.el5_4.5 php-mbstring-5.1.6-24.el5_4.5 php-devel-5.1.6-24.el5_4.5 php-pear-1.4.9-6.el5 php-gd-5.1.6-24.el5_4.5 httpd-devel-2.2.3-31.el5.centos.4 httpd-manual-2.2.3-31.el5.centos.4 net-snmp-libs-5.3.2.2-7.el5_4.2 net-snmp-utils-5.3.2.2-7.el5_4.2 php-snmp-5.1.6-24.el5_4.5 net-snmp-perl-5.3.2.2-7.el5_4.2 net-snmp-devel-5.3.2.2-7.el5_4.2 Crypt-DES-2.05 Digest-HMAC-1.02 Digest-MD5-2.39 Digest-SHA1-2.12 Net-SNMP-v6.0.0
9.安装 nagios-snmp-plugins #tar xzf nagios-snmp-plugins.1.1.1.tgz #cd nagios_plugins #perl -MCPAN -e shell 情况一: 一路回车.... 如果连接不上 ftp:///pub/CPAN/MIRRORED.BY 在他重新连接 ftp 的时候, ctrl+c 直到出现 Please enter your CPAN site: 的时候, 输入 /CPAN 回车 cpan> install Net::SNMP quit ./install.sh (路径选默认,y/n 选 Y!)
相关文档
最新文档