Nagios29详细安装攻略Word格式.docx

上传人:b****4 文档编号:6567258 上传时间:2023-05-06 格式:DOCX 页数:57 大小:765.90KB
下载 相关 举报
Nagios29详细安装攻略Word格式.docx_第1页
第1页 / 共57页
Nagios29详细安装攻略Word格式.docx_第2页
第2页 / 共57页
Nagios29详细安装攻略Word格式.docx_第3页
第3页 / 共57页
Nagios29详细安装攻略Word格式.docx_第4页
第4页 / 共57页
Nagios29详细安装攻略Word格式.docx_第5页
第5页 / 共57页
Nagios29详细安装攻略Word格式.docx_第6页
第6页 / 共57页
Nagios29详细安装攻略Word格式.docx_第7页
第7页 / 共57页
Nagios29详细安装攻略Word格式.docx_第8页
第8页 / 共57页
Nagios29详细安装攻略Word格式.docx_第9页
第9页 / 共57页
Nagios29详细安装攻略Word格式.docx_第10页
第10页 / 共57页
Nagios29详细安装攻略Word格式.docx_第11页
第11页 / 共57页
Nagios29详细安装攻略Word格式.docx_第12页
第12页 / 共57页
Nagios29详细安装攻略Word格式.docx_第13页
第13页 / 共57页
Nagios29详细安装攻略Word格式.docx_第14页
第14页 / 共57页
Nagios29详细安装攻略Word格式.docx_第15页
第15页 / 共57页
Nagios29详细安装攻略Word格式.docx_第16页
第16页 / 共57页
Nagios29详细安装攻略Word格式.docx_第17页
第17页 / 共57页
Nagios29详细安装攻略Word格式.docx_第18页
第18页 / 共57页
Nagios29详细安装攻略Word格式.docx_第19页
第19页 / 共57页
Nagios29详细安装攻略Word格式.docx_第20页
第20页 / 共57页
亲,该文档总共57页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

Nagios29详细安装攻略Word格式.docx

《Nagios29详细安装攻略Word格式.docx》由会员分享,可在线阅读,更多相关《Nagios29详细安装攻略Word格式.docx(57页珍藏版)》请在冰点文库上搜索。

Nagios29详细安装攻略Word格式.docx

再说报警功能,如果监控系统发现问题不能报警那就没有意义了,所以报警也是nagios很重要的功能之一。

但是,同样的,nagios自身也没有报警部分的代码,甚至没有插件,而是交给用户或者其他相关开源项目组去完成。

nagios安装,是指基本平台,也就是nagios软件包的安装。

它是监控体系的框架,也是所有监控的基础。

打开nagios官方的文档,会发现nagios基本上没有什么依赖包,只要求系统是linux或者其他nagios支持的系统。

不过如果你没有安装apache(http服务),那么你就没有那么直观的界面来查看监控信息了,所以apache姑且算是一个前提条件。

关于apache的安装,网上有很多,照着安装就是了。

安装之后要检查一下是否可以正常工作。

原文链接[url]

3.Nagios定义的监控状态

nagios定义了4中监控状态,代表不同的严重级别,除了OK代表正常不用关心外,其余3种都要引起重视.如下表

状态

代码

颜色

正常

OK

绿色,

警告

WARNING

黄色,

严重

CRITICAL

红色,

未知错误

UNKOWN

深黄色

4.所用软件

nagios-2.9.tar.gz

nagios-plugins-1.4.9.tar.gz

nrpe-2.8.1.tar.gz

NSClient++-0.2.7.zip

前三个的下载地址:

[url]http:

//www.nagios.org[/url],

后一个的[url]

5.总体目标

学习嘛,总要有个目标,很简单,就是看到下面这张图

具体信息如下表

要监控的服务

是否活动

是否开启ftp

磁盘使用情况

是否开启ssh

cpu负载

swap分区使用情况

主进程数

当前登陆用户

僵尸进程数

是否开启80端口

是否启动W3SVC服务

内存使用情况

运行时间

NSClient客户端版本(NSClient是一个windows下的nagios客户端)

C盘使用情况

D盘使用情况

explorer进程运行情况

其中蓝色字体的服务是外部服务,也就是说不需要登陆被监控机,直接在外部就可以进行检查.例如我们需要检查被监控机是否打开80端口,就可以在别的一台机器上telnet被监控机的80端口即可.

绿色字体表示是内部服务,意思是必须登陆到被监控机上才能查看.因为它们属于”本地信息”(nagios将之称为LOCAL).很容易理解,你不登陆到被监控机上,如何知道当前磁盘的使用情况呢?

nagios是不是很强大,基本上对监控对象的任何信息都可以一手掌握了.而且不用登陆到目的机就可以看到那台机器私密的”本地信息”,比木马还厉害啊.但是别误会,这可不是什么木马.nagios有着十分安全的措施.

这确实是一个庞大的工程,你想想这还只是三台机器而已都已经监控这么多服务了,那要是多个几十台怎么办,不用紧张,从现在开始,跟我动手吧.

家庭作业,将所用的软件下载好,配置好监控机192.168.0.111上的apache.

二. 

基本安装和配置

本部分主要参考官方文档和田逸的文章<

<

看我出招之:

我用Nagios(技术细节)>

>

来修改完成.

最后达到如下的功能

监控机自身的信息,包括主机信息以及对外提供的服务

被监控机对外提供的服务

如下所有的操作都在监控机192.168.0.111上进行

1.安装nagios主程序

解压缩

tar-zxvfnagios-2.9.tar.gz

cdnagios-2.9

编译,指定安装目录为/usr/local/nagios

./configure--prefix=/usr/local/nagios

输出如下信息

***Configurationsummaryfornagios2.904-10-2007***:

GeneralOptions:

-------------------------

Nagiosexecutable:

nagios

Nagiosuser/group:

nagios,nagios

Commanduser/group:

EmbeddedPerl:

no

EventBroker:

yes

Install${prefix}:

/usr/local/nagios

Lockfile:

${prefix}/var/nagios.lock

Initdirectory:

/etc/rc.d/init.d

HostOS:

linux-gnu

WebInterfaceOptions:

------------------------

HTMLURL:

//localhost/nagios/[/url]

CGIURL:

//localhost/nagios/cgi-bin/[/url]

Traceroute(usedbyWAP):

/usr/sbin/traceroute

Reviewtheoptionsaboveforaccuracy. 

Iftheylookokay,

type'

makeall'

tocompilethemainprogramandCGIs.

makeall

***Compilefinished***

IfthemainprogramandCGIscompiledwithoutanyerrors,you

cancontinuewithinstallingNagiosasfollows(type'

make'

withoutanyargumentsforalistofallpossibleoptions):

makeinstall

Thisinstallsthemainprogram,CGIs,andHTMLfiles

使用makeinstall来安装主程序,CGI和HTML文件

makeinstall-init

Thisinstallstheinitscriptin/etc/rc.d/init.d

使用makeinstall-init在/etc/rc.d/init.d安装启动脚本

makeinstall-commandmode

-Thisinstallsandconfigurespermissionsonthe

directoryforholdingtheexternalcommandfile

使用makeinstall-commandmode来配置目录权限

makeinstall-config

-Thisinstalls*SAMPLE*configfilesin/usr/local/nagios/etc

You'

llhavetomodifythesesamplefilesbeforeyoucan

useNagios. 

ReadtheHTMLdocumentationformoreinfo

ondoingthis. 

Payparticularattentiontothedocson

objectconfigurationfiles,astheydeterminewhat/how

thingsgetmonitored!

使用makeinstall-commandmode来安装示例配置文件,安装的路径是/usr/local/nagios/etc.

***SupportNotes*******************************************

IfyouhavequestionsaboutconfiguringorrunningNagios,

pleasemakesurethatyou:

-Lookatthesampleconfigfiles

-ReadtheHTMLdocumentation

-ReadtheFAQsonlineat[url]http:

//www.nagios.org/faqs[/url]

beforeyoupostaquestiontooneofthemailinglists.

Alsomakesuretoincludepertinentinformationthatcould

helpothershelpyou. 

Thismightinclude:

-WhatversionofNagiosyouareusing

-Whatversionofthepluginsyouareusing

-Relevantsnippetsfromyourconfigfiles

-RelevanterrormessagesfromtheNagioslogfile

FormoreinformationonobtainingsupportforNagios,visit:

//www.nagios.org/support/[/url]

*************************************************************

Enjoy.

很多人都不注意安装过程中的输出信息,直到makeinstall出错了才到处找人求救,而实际上输出的内容包含很多有价值的信息,例如安装路径,版本,每一步做什么,接下来的步骤等.尤其是输出的最后一屏信息,我个人建议好好的读一下.例如上面就列出了很多有价值的信息,我们只需要按照他说的做就行了.

安装

输出如下错误

cd./base&

&

makeinstall

make[1]:

Enteringdirectory`/home/yahoon/nagios/nagios-2.9/base'

makeinstall-basic

make[2]:

/usr/bin/install-c-m775-onagios-gnagios-d/usr/local/nagios/bin

/usr/bin/install:

invaliduser`nagios'

非法用户nagios

***[install-basic]Error1

Leavingdirectory`/home/yahoon/nagios/nagios-2.9/base'

***[install]Error2

make:

按照文档说明增加用户,修改权限

[root@localhostnagios-2.9]# 

useraddnagios

mkdir/usr/local/nagios

chownnagios.nagios/usr/local/nagios

查看目录权限

[root@localhostnagios-2.9]#ll/usr/local

drwxr-sr-x 

2nagios 

nagios 

4096Jul1011:

14nagios

看到nagios目录的权限已经被正确修改了

重新执行makeinstall输出信息如下

***Mainprogram,CGIsandHTMLfilesinstalled***

YoucancontinuewithinstallingNagiosasfollows(type'

-Thisinstallstheinitscriptin/etc/rc.d/init.d

Leavingdirectory`/home/yahoon/nagios/nagios-2.9'

执行如下命令来安装脚本

执行

输出信息如下

/usr/bin/install-c-m775-onagios-gnagios-d/usr/local/nagios/var/rw

chmodg+s/usr/local/nagios/var/rw

***Externalcommanddirectoryconfigured***

/usr/bin/install-c-m775-onagios-gnagios-d/usr/local/nagios/etc

/usr/bin/install-c-m664-onagios-gnagiossample-config/nagios.cfg/usr/local/nagios/etc/nagios.cfg-sample

/usr/bin/install-c-m664-onagios-gnagiossample-config/cgi.cfg/usr/local/nagios/etc/cgi.cfg-sample

/usr/bin/install-c-m660-onagios-gnagiossample-config/resource.cfg/usr/local/nagios/etc/resource.cfg-sample

/usr/bin/install-c-m664-onagios-gnagiossample-config/template-object/localhost.cfg/usr/local/nagios/etc/localhost.cfg-sample

/usr/bin/install-c-m664-onagios-gnagiossample-config/template-object/commands.cfg/usr/local/nagios/etc/commands.cfg-sample

***Sampleconfigfileinstalled***

Remember,theseare*SAMPLE*configfiles. 

llneedtoread

thedocumentationformoreinformationonhowtoactuallydefine

services,hosts,etc.tofityourparticularneeds.

IfyouhavequestionsaboutconfiguringNagiosproperly,please:

*BEFORE*youpostaquestiontooneofthemailinglists.

验证程序是否被正确安装。

切换目录到安装路径(这里是/usr/local/nagios),看是否存在etc、bin、 

sbin、 

share、 

var这五个目录,如果存在则可以表明程序被正确的安装到系统了。

后表是五个目录功能的简要说明:

bin

Nagios执行程序所在目录,nagios文件即为主程序

etc

Nagios配置文件位置,初始安装完后,只有几个*.cfg-sample文件

sbin

NagiosCgi文件所在目录,也就是执行外部命令所需文件所在的目录

Share

Nagios网页文件所在的目录

Var

Nagios日志文件、spid 

等文件所在的目录

var/archives

Emptydirectoryforthe 

archivedlogs

var/rw

externalcommandfile

2.安装插件

tar-zxvfnagios-plugins-1.4.9.tar.gz

cdnagios-plugins-1.4.9

编译,指定路径为之前nagios的安装路径

./configure--prefix=/usr/local/nagios/

make

ls/usr/local/nagios/libexec/

会显示安装的插件文件,即所有的插件都安装在libexec这个目录下

将apache的运行用户加到nagios组里面

从httpd.conf中过滤出当前的apache运行用户

grep^User/usr/local/apache2/conf/httpd.conf

我的是vpopmail,下面将这个用户加入nagios组

usermod-Gnagiosvpopmail

3.修改apache配置

修改apache的配置文件,增加nagios的目录,并且访问此目录需要进行身份验证

vi/usr/local/apache2/conf/httpd.conf,在最后增加如下内容

#settingfornagios20070707

ScriptAlias/nagios/cgi-bin/usr/local/nagios/sbin

Directory"

/usr/local/nagios/sbin"

OptionsExecCGI

AllowOverrideNone

Orderallow,deny

Allowfromall

AuthName"

NagiosAccess"

AuthTypeBasic

AuthUserFile/usr/local/n

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2