![第二階段視頻2-39nagios監(jiān)控_第1頁](http://file4.renrendoc.com/view/72e8f5414d0f05b7e40afab1f540cf43/72e8f5414d0f05b7e40afab1f540cf431.gif)
![第二階段視頻2-39nagios監(jiān)控_第2頁](http://file4.renrendoc.com/view/72e8f5414d0f05b7e40afab1f540cf43/72e8f5414d0f05b7e40afab1f540cf432.gif)
![第二階段視頻2-39nagios監(jiān)控_第3頁](http://file4.renrendoc.com/view/72e8f5414d0f05b7e40afab1f540cf43/72e8f5414d0f05b7e40afab1f540cf433.gif)
![第二階段視頻2-39nagios監(jiān)控_第4頁](http://file4.renrendoc.com/view/72e8f5414d0f05b7e40afab1f540cf43/72e8f5414d0f05b7e40afab1f540cf434.gif)
![第二階段視頻2-39nagios監(jiān)控_第5頁](http://file4.renrendoc.com/view/72e8f5414d0f05b7e40afab1f540cf43/72e8f5414d0f05b7e40afab1f540cf435.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
NagiosNagiosWindowx,Un,Route,tch,具有報(bào)警功能,是一個(gè)網(wǎng)絡(luò)監(jiān)控系統(tǒng)。它可以監(jiān)視你指定的主機(jī)和服務(wù),并在那些設(shè)備“變壞”和“變好”的時(shí)候通知管理員。態(tài)恢復(fù)后發(fā)出正常的郵件或短信通知。NagiosCoreLinux當(dāng)然,它在其他的Unix系統(tǒng)下應(yīng)該也能進(jìn)行工作。Nagios os界面很不美觀,可以更換主題 //Nagios插件 NagiosC/SB/S優(yōu)點(diǎn) 1:監(jiān)控網(wǎng)路服務(wù)狀態(tài)2:監(jiān)控主機(jī)資源(處理器符合,硬盤利用率3:拓展,根據(jù)自己的需求實(shí)現(xiàn)拓展檢測功能(插件開發(fā)4:7:8:WEBNagiosNagiosNagiosNagios會(huì)維持一個(gè)隊(duì)列,所有插件返回來的狀態(tài)信息都進(jìn)入隊(duì)列,Nagios首開始讀取信息,并進(jìn)行處理后,把狀態(tài)結(jié)果通過web顯示出來。Nagios提供了許多插件,利用這些插件可以方便的監(jiān)控很多服務(wù)狀態(tài)。安裝完成后,在nagios主目錄下的/libexec里放有nagios自帶的可以使用的所有插件,如,check_diskcheck_loadCPU等等。每一個(gè)插件可以通過運(yùn)行./check_xxx–h來查看其使用方法和功能。獲取數(shù)據(jù)的方式:主動(dòng)發(fā)送、NRPESNMP、Nagios通過NRPE來遠(yuǎn)端管理服務(wù)Nagioscheck_nrpe插件,并告訴check_nrpe去檢SSL,check_nrpe連接遠(yuǎn)端機(jī)子上的NRPENRPE運(yùn)行本地的各種插件去檢測本地的服務(wù)和狀態(tài)最后,NRPEcheck_nrpe,check_nrpe再把結(jié)果送到Nagios狀態(tài)隊(duì)列中。NagiosNagiosLAMP #Nagios插件,用于存放腳本和命令 #也就是Nsclient++,用來監(jiān)控Windows,分為64為何32位版本 Nagios NagiosLAP(zabbixLNMPLAP[root@XueGod63~]#yuminstall-ygccglibcglibc-commonphpgdgd-devellibpnglibmnglibjpegzlib[root@XueGod63~]#yuminstall-yhttpd;servicehttpdNagios[root@XueGod63~]#useraddnagios Nagios用nologin的shell,nagios會(huì)用到[root@XueGod63~]#groupaddnagcmd [root@XueGod63~]#usermod-Gnagcmdnagios //將Nagios和apache加入該組[root@XueGod63~]#usermod-GnagcmdNagiosnrpe-nagios-plugins-2.1.1.tar.gznrpe-nagios-plugins-2.1.1.tar.gzGeneralNagiosexecutable:Nagiosuser/group:GeneralNagiosexecutable:Nagiosuser/group:#Commanduser/group:#EmbeddedPerl:EventBroker:Install${prefix}:/ #Lockfile:Checkresultdirectory:Initdirectory:Apacheconf.ddirectory:/etc/httpd/conf.d #Apacheconf.d配置Mailprogram:HostOS:linux-WebInterfaceHTMLURL: #CGIURL:http://localhost/nagios/cgi-Traceroute(usedbyWAP):Reviewtheoptionsaboveforaccuracy.Iftheylooktype'makeall'tocompilethemainprogramandCGIs.[root@XueGod63nagios]#makeall//根據(jù)上面提示,Makeall****CompilefinishedIfthemainprogramandCGIscompiledwithoutanyerrors,youcancontinuewithinstallingNagiosasfollows(type'make'withoutanyargumentsforalistofallpossibleoptions):#makeThisinstallsthemainprogram,CGIs,andHTMLmakeinstall-Thisinstallstheinitscriptinmakeinstall-Thisinstallsandconfigurespermissionsonthedirectoryforholdingtheexternalcommandfilemakeinstall-Thisinstalls*SAMPLE*configfilesinYou‘llhavetomodifythesesamplefilesbeforeyouuseNagios.ReadtheHTMLdocumentationformoreondoingthis.Payparticularattentiontothedocsobjectconfigurationfiles,astheydeterminethingsgetmakeinstall-ThisinstallstheApacheconfigfileforthewebmakeinstall- #ThisinstallstheExfoliationthemeforthewebmakeinstall-classicui Thisinstallstheclassicthemefortheweb***SupportNotesIfyouhavequestionsaboutconfiguringorrunningpleasemakesurethatLookatthesampleconfigReadthedocumentationontheNagiosLibrarybeforeyoupostaquestiontooneofthemailingAlsomakesuretoincludepertinentinformationthathelpothershelpyou.ThismightWhatversionofNagiosyouareWhatversionofthepluginsyouareRelevantsnippetsfromyourconfigRelevanterrormessagesfromtheNagioslogFormoreinformationonobtainingsupportforNagios,[root@XueGod63nagios]#makeinstall&&makeinstall-init&&makeinstall-commandmode&&makeinstall-config&&make安裝生成即//makeinstall-init 安裝生成/etc/rc.d/init.d/nagios啟動(dòng)腳//makeinstall- 下的nagios//makeinstall- nagios 安裝Nagios的WEB配置文件到Apacheconf.d[root@XueGod63nagios]#cd/root/Nagios;config.inc.phpconfig.inc.php rss-corefeed.phpphp imagesindex.phpmain.phprobots.txtrss-newsfeed.phpssimakeinstall-init[root@XueGod63Nagios]#ls #其實(shí)就是在makeinstall-configNagios[root@XueGod63Nagios]#lscgi.cfgcgi.cfgnagios.cfgobjects#pluginresource.cfg:定義了很多資源變量的調(diào)[root@XueGod63Nagios]#ls#[root@XueGod63Nagios]#vimAliasAlias/nagiosNagios[root@XueGod63Nagios]#ll#Nagios#nagios配置文件所在目錄,初始安裝只有幾個(gè)*.cfg#NagiosCgi#Nagios#日志文件,pidnagios[root@XueGod63Nagios]#vim##系##機(jī),時(shí)間#模板(#監(jiān)控本機(jī)相關(guān)配置文 #(用 # # # #[root@XueGod63Nagios]#vimnagios.cfg###URL后面加上/nagios###Nagios[root@XueGod63Nagios]#servicehttpdvim/etc/httpd/conf.d/nagios.conf[root@XueGod63Nagios]#vimAliasAlias/nagios<Directory"/usr/local/nagios/share">#SSLRequireSSLOptionsNoneAllowOverrideNoneOrderallow,denyAllowfromall#Order##Denyfrom#AllowfromAuthName"NagiosAccess"AuthTypeAuthUserFile/usr/local/nagios/etc/htpasswd.usersRequirevalid-user[root@XueGod63Nagios]#htpasswd--cc[[root@XueGod63Nagios]#cat#[root@XueGod63Nagios]#servicehttpdrestart 用戶名是nagiosadmin,密碼123456)##nagiosnagiosadminnagios,binnagios[root@XueGod63Nagios]#/usr/local/nagios/bin/nagios--v=--verify-configTotalTotalTotal [root@XueGod63Nagios]#/usr/local/nagios/bin/nagios-Nagios-plugins為了后面的實(shí)驗(yàn)要求,我們先把mysql客戶端安裝了yuminstallmysqlmysql-下面[root@XueGod63Nagios]#tarxvfnagios-plugins-2.1.1.tar.gz-[root@XueGod63Nagios]#cd/usr/local/src/nagios-plugins-2.1.1/[root@XueGod63nagios-plugins-2.1.1]#./configure--with-nagios-user=nagios--with-nagios-[root@XueGod63nagios-plugins-2.1.1]#make&&makeinstall; check_ifoperstatuscheck_mysql_queryNagios[root@XueGod63Nagios]#servicehttpdrestart;servicenagiosNagios(指定主配置文件需要加載的配置文件—1:原理數(shù)據(jù)收集,數(shù)據(jù)呈現(xiàn)2Nagiosnrpe5:創(chuàng)建Nagios運(yùn)行用戶和組,加入我們的運(yùn)行組6:主程序安裝,./configure–with-command-group=nagcmd(makeall7:htpasswdweb認(rèn)證用戶并測試登陸8Nagios-pluginsNFS[root@XueGod63Nagios]#cd/usr/local/nagios/etc/objects[root@XueGod63objects]#cplocalhost.cfg [root@XueGod63objects]#vimdefinedefine}check/usr/local/nagios/libexec/目錄下檢測格式:check_tcp!端口號(hào) [root@XueGod63objects]#/etc/init.d/nfsrestart[root@XueGod63objects]#showmount-e3 NFSExportExportlistfor/tmplocalhost[root@XueGod63objects]#vim[root@XueGod63objects]#/usr/local/nagios/bin/nagios-TotalTotalTotal [root@XueGod63objects]#servicenagios nagiosNFS[root@XueGod63objects]#servicenfsstop NFS后有一個(gè)Re-schedulethenextcheckofthisservice,強(qiáng)制刷新修改Nagios默認(rèn)的主題:把主題包解壓到對(duì)應(yīng)的目錄下[root@xuegod63~]#unzipvautour_style.zip-d/usr/local/nagios/share/ replace/usr/local/nagios/share/images/ack.gif?[y]es,[n]o,[A]ll,[N]one,[r]ename:Ainflating:NagiosMYSQL【監(jiān)控任何一臺(tái)服務(wù)器,工作流程是定義主機(jī),定義服務(wù),定義命令 MySQLServerXueGod64[root@XueGod64~]#yuminstall-ymysql-servermysql[root@XueGod64~]#servicemysqldrestart[root@XueGod64~]#mysql mysql>createdatabasenagiosdb;mysql>grantselectonnagiosdb.*tonagiosdb@'3';mysql>exitXueGod63Nagios[root@XueGod63objects]#vim##Definitionsformonitoringthelocal(Linux)[root@XueGod63objects]#vimdefinedefine # #IP 片statusmap_image ##2D#3D}[root@XueGod63objects]#vimdefinedefine }define}[root@XueGod63objects]#vimdefinedefine $USER1$/check_mysql-H$HOSTADDRESS$-u-d}Uptime:1810Threads:1Uptime:1810Threads:1Questions:6Slowqueries:0Opens:15Flushtables:1Opentables:8Queriespersecondavg:0.3|Connections=4c;;;Open_files=16;;;Open_tables=8;;;Qcache_free_memory=0;;;Qcache_hits=0c;;;Qcache_inserts=0c;;;Qcache_lowmem_prunes=0c;;;he_not_cached=0c;;;Qcache_queries_in_cache=0;;;Queries=6c;;;Table_locks_waitedTable_locks_waited=0c;;;Threads_connected=1;;;Threads_running=1;;;Uptime=1check_commandcommand.cfg才能使用,而command.cfg中的command_line中使用的命令,必須在/usr/local/Nagios/libexecplugins手動(dòng)檢測command.cfg的命令有效性mysqlplugins才會(huì)生成yuminstallmysqlmysql-[root@XueGod64~]#servicemysqldstop //XueGod64[root@XueGod63objects]#/usr/local/nagios/libexec/check_mysql-H-unagiosdb-dcan'tcan'tconnecttoMySQLserveron'4'[root@XueGod63objects]#servicenagiosrestart[root@XueGod64~]#servicemysqldstart去停掉數(shù)據(jù)庫[root@XueGod64~]#servicemysqld定義監(jiān)控httpd服務(wù):先手動(dòng)測試下:/usr/local/nagios/libexec/check_tcpH4p[root@XueGod63objects]#vimdefinedefine #IP 片statusmap_image ##2D#3D}[root@XueGod63objects]#vimdefinedefine }[root@XueGod63objects]#vimdefinedefine $USER1$/check_tcp-H$HOSTADDRESS$-p}[root@XueGod63objects]#servicenagios私有信息,包括默認(rèn)的硬盤使用,進(jìn)程數(shù)目,SWAPNRPEnrpe插NRPEcheck_nrpe,NRPENagioscheck_nrpecheck_nrpenrpe工作原SSLnrpe不需要安裝NAGIOS服務(wù)端NRPE1:nagios2:NRPE(makeinstall-daemon-configmakeinstall-xinetd)3:配置我們xinted服務(wù),允許誰來拿數(shù)據(jù)4:解決依[root@XueGod63Nagios]#yuminstall-yopensslopenssl-devel[root@XueGod64~]#yuminstall-yopensslopenssl-develSSL服務(wù)端安裝[root@XueGod63Nagios]#tarxvfnrpe-2.15.tar.gz-C/usr/local/src/[root@XueGod63Nagios]#cd/usr/local/src/nrpe-2.15/[root@XueGod63nrpe-2.15]#./configure&&make&&makeinstall[root@XueGod63nrpe-2.15]#makeinstall-plugin&&makeinstall-[root@XueGod63nrpe-2.15]#cd/root/Nagios/;ls #nrpe客戶端配[root@XueGod63objects]#cd[root@XueGod63Nagios]#scpnagios-plugins-2.1.1.tar.gznrpe-2.15.tar.gz[root@XueGod64~]#useradd-s/sbin/nologinnagios[root@XueGod64~]#groupaddnagcmd[root@XueGod64~]#usermod-Gnagcmdnagios[root@XueGod64~]#tarxvfnagios-plugins-2.1.1.tar.gz-C/usr/local/src/[root@XueGod64~]#tarxvfnrpe-2.15.tar.gz-C/usr/local/src/[root@XueGod64~]#cd/usr/local/src/nagios-plugins-2.1.1/[root@XueGod64nagios-plugins-2.1.1]#./configure&&make&&makeinstall[root@XueGod64nagios-plugins-2.1.1]#cd../nrpe-2.15/[root@XueGod64nrpe-2.15]#./configure&&make&&makeinstall[root@XueGod64nrpe-2.15]#makeinstall-daemon-config 用make-install-plugin#default:#description:NRPE(NagiosRemotePluginExecutor)servicenrpe{#default:#description:NRPE(NagiosRemotePluginExecutor)servicenrpe{== ==== =-c/usr/local/nagios/etc/nrpe.cfg--log_on_failure+==nagios服務(wù)器地址235nrpeIP#2:#iptables-L不加-n參數(shù),80轉(zhuǎn)->www}echo#NRPE">># 客戶端nrpe命[root@XueGod64~]#vim-w38%-c35%-p/dev/sda1-w42%-c43%-pcommand[check_swap]=/usr/local/nagios/libexec/check_swapw20-c10%#-w-C為告急sda242%[root@XueGod64~]#servicexinetd服務(wù)端手動(dòng)測NRPE[root@XueGod63Nagios]#/usr/local/nagios/libexec/check_nrpeNRPE[root@xuegod73[root@xuegod73~]#/usr/local/nagios/libexec/check_nrpe-H4-cDISKOK-freespace:/20752MB(74%#CHECK_NRPE:Error-CouldnotcompleteSSLhandshake.定義被監(jiān)控主define define statusmap_image}定義需要監(jiān)控的服[root@XueGod63objects]#vimdefinedefineRoot#/root}defineTotal}defineCurrent}定義NRPE監(jiān)控命[root@XueGod63objects]#vimdefinedefine $USER1$/check_nrpe-H$HOSTADDRESS$-c}$ARG1$表示調(diào)用后面的參數(shù)。[root@XueGod63objects]#servicenagios前端監(jiān)rootpartition[root@XueGod64~]#ddif=/dev/zeroof=1.txtcount=100[root@XueGod64~rm-rf 1:(2:NRPE定義主機(jī),定義服務(wù)(check_nrpe!check_ping),定義命令(check_nrpe)還有一個(gè)定義命令(客戶端做command[check_adfadf])-w–cxinetdroot@XueGod63Nagios]#yuminstall-ysendmail[root@XueGod63Nagios]#/etc/init.d/sendmailstart[root@XueGod63Nagios]#chkconfigsendmailonsendmail --configdefinedefineNagios }[root@XueGod63objects]#servicenagios[root@XueGod64~]#servicemysqld [root@XueGod64~]#/etc/init.d/mysqld 139Windows大概步驟下載安裝windows代理插修改配置文件NSC.INI1、去掉在[modulesCheckWMI.dllRemoteConfiguration.dll;啟動(dòng)服務(wù)nsclient++.exe啟動(dòng)代理服務(wù),并設(shè)置服務(wù)和桌面交互Nagios主控端配置修改主配置文件,啟用監(jiān)控windows配置文件編輯這個(gè)配置文件,修改監(jiān)控主機(jī)信息vimdefineusegeneric-servicehost_namewinserverservice_descriptionUptimecheck_commandcheck_nt!UPTIME}defineusegeneric-servicehost_namewinserverservice_descriptionCPULoadcheck_commandcheck_nt!CPULOAD!-ldefineusegeneric-servicehost_nameservice_descriptionMemorycheck_commandcheck_nt!MEMUSE!-w80-c機(jī)器的機(jī)器的defineusegeneric-servicehost_nameservice_descriptionC:\Drivecheck_commandcheck_nt!USEDDISKSPACE!-lc-w80-cdefineusegeneric-servicehost_namewinserverservice_descriptionW3SVCcheck_commandcheck_nt!SERVICESTATE!-dSHOWALL-l}defineusegeneric-servicehost_namewinserverservice_descriptionExplorercheck_commandcheck_nt!PROCSTATE!-dSHOWALL-l}定義監(jiān)控命令vi##這個(gè)命令已經(jīng)存在,只需要添加-s123456就可以指定密definecommand{command_namecheck_ntcommand_line$USER1$/check_nt-H$HOSTADDRESS$-p12489-s456-v$ARG1$}注意:這里的-s123456密碼一定要windows配置文件的密碼保持一致,重啟如果修改好Nagios配置文件,需要驗(yàn)證你的配置文件并重啟動(dòng)Nagios。件。一定要保證驗(yàn)證過程中不再有出錯(cuò)信息后再啟動(dòng)或重啟動(dòng)Nagios!詳細(xì)配置參考/uid-24426415-id-pnp4nagiosprocess_perfdata.plrrdtoolnagiosPnp4nagios使用的是RRDtool工具來實(shí)現(xiàn)畫圖的[root@XueGod63Nagios]#yuminstall-yrrdtoolphp-gdperl-Time-HiRes[root@XueGod63Nagios]#tarxvfpnp4nagios-0.6.25.tar.gz[root@XueGod63Nagios]#cdpnp4nagios-0.6.25[root@XueGod63pnp4nagios-0.6.25]#./configure--prefix=/usr/local/pnp4nagios--with-nagios-[root@XueGod63pnp4nagios-0.6.25]#makeall&&makeinstall&&makeinstall-webconf&&makeinstall-config&&makeinstall-init[root@XueGod63pnp4nagios-0.6.25]#makefullinstallpnp4naigos和nagios[root@XueGod63pnp4nagios]###修改以下幾個(gè)內(nèi)#修#取消注[root@XueGod63pnp4nagios]###'process-host-perfdata'commanddefinitiondefinecommand{ /usr/bin/perl/usr/local/pnp4nagios/libexec/process_perfdata.pl-dHOSTPERFDATA}#'process-service-perfdata'commanddefinitiondefinecommand{ /usr/bin/perl/usr/local/pnp4nagios/libexec/p}[root@XueGod63pnp4nagios]#definedefinehost action_url/pnp4nagios/index.php/graph?host=$HOSTNAME$' 1}defines
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2025學(xué)年廣東省廣州市部分學(xué)校高二上學(xué)期期中考試歷史試卷
- 2025年企業(yè)內(nèi)部控制完善咨詢合同
- 2025年住宅小區(qū)機(jī)動(dòng)車停放安全與管理協(xié)議
- 2025年高效酸霧凈化器項(xiàng)目規(guī)劃申請(qǐng)報(bào)告模式
- 2025年企業(yè)并購協(xié)議問答
- 2025年建筑施工照明設(shè)備安裝安全策劃協(xié)議書
- 2025年水利項(xiàng)目施工勞務(wù)合同
- 2025年酒類銷售合作合同
- 2025年醫(yī)院安保人員雇傭合同范本
- 2025年住宅建設(shè)項(xiàng)目合同管理與績效
- MBTI量表完整版本
- 護(hù)理操作-吸痰
- 重癥肺炎的基本知識(shí)宣教
- 中醫(yī)適宜技術(shù)-腕踝針
- 初二上勞動(dòng)技術(shù)課件電子版
- 創(chuàng)業(yè)計(jì)劃書模板-創(chuàng)業(yè)計(jì)劃書-商業(yè)計(jì)劃書模板-項(xiàng)目計(jì)劃書模板-商業(yè)計(jì)劃書30
- 醫(yī)院護(hù)理帶教老師競聘課件
- 四川虹科創(chuàng)新科技有限公司高強(qiáng)超薄耐摔玻璃智能制造產(chǎn)業(yè)化項(xiàng)目環(huán)境影響報(bào)告
- 多聯(lián)機(jī)空調(diào)系統(tǒng)設(shè)計(jì)課件
- 燭之武退秦師 全市一等獎(jiǎng)
- 提高高中教學(xué)質(zhì)量的幾點(diǎn)建議
評(píng)論
0/150
提交評(píng)論