




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
Nagios安裝配置[1]-Linux 配置 -坐沙發(fā)上等戈多安裝問題 (我找到的中文版之中最好的一個(gè) ,我照著手冊裝了一下,不成功,轉(zhuǎn)而按照此文,最終成,限于篇幅原因就不在貼上來了,我自己的安裝步驟基本上和這篇相同)/index.php?play=search&make=view&id=282&key=nagios我的安裝步驟(操作系統(tǒng) centoslinxu4.3)1、所需軟件nagios-pluginsimagepak-basenrpeapache2、nagios安裝首先安裝apache 具體過程參考 手冊不在贅述w[]#addusernagios[]#groupaddnagios[]#mkdir/usr/local/nagios[]#./configure--prefix=/usr/local/nagios--with-gd-lib=/usr/local/lib--with-gd-inc=/usr/local/include上面命令用到的 libgd庫,在centos下的安裝可以用以下命令[]#yuminstallgd(gdbphp-gdglib-develgd-devellibpng-devellibpng10-devellibjpeg-develmod_perl-develglibcmod_perl)具體的可參考我上文給出的聯(lián)接[]#makeall[]#makeinstall[]#makeinstall-init ##Thisinstallstheinitscriptin/usr/local/etc/rc.d[]#makeinstall-commandmode[]#makeinstall-config ##將初始的配置文件安裝到/usr/local/nagios/etc2.2、nagios-plugins 的安裝[]#tar–[]#mkdir/usr/local/nagios-plugins[]#./configure--prefix=/usr/local/nagios-plugins[]#makeall[]#makeinstall安裝完成以后在/usr/local/nagios-plugins會(huì)產(chǎn)生一個(gè)libexec的目錄,將該目錄全部移動(dòng)到/usr/local/nagios目錄下[]#cp/usr/local/nagios-plugins/libexec/usr/local/nagios/libexec2.3、imagepak-base 的安裝[]#tar–解壓以后是 base目錄[]#cp–Rbase/usr/local/nagios/share/images/logos2.4、安裝過程全部結(jié)束4、Nagios的設(shè)定:1、配置apache在apache的配置文件httpd.conf中追加(注意,要有image這段,不然 nagios不能顯示圖片,這三段順序好象不能變,不然啟動(dòng)nagios的時(shí)候會(huì)提示錯(cuò)誤 )Alias/nagios/cgi-bin/images/"/usr/local/nagios/share/images/"<Directory"/usr/local/nagios/share/images/">AllowOverrideNoneOptionsNoneOrderallow,denyAllowfromallAuthName"NagiosAccess"AuthTypeBasicAuthUserFile/usr/local/nagios/etc/.htpasswdRequirevalid-user</Directory>ScriptAlias/nagios/cgi-bin/"/usr/local/nagios/sbin/"<Directory"/usr/local/nagios/sbin/">AllowOverrideNoneOptionsNoneOrderallow,denyAllowfromallAuthName"NagiosAccess"AuthTypeBasicAuthUserFile/usr/local/nagios/etc/.htpasswdRequirevalid-user</Directory>Alias/nagios/"/usr/local/nagios/share/"<Directory"/usr/local/nagios/share/">AllowOverrideNoneOptionsNoneOrderallow,denyAllowfromallAuthName"NagiosAccess"AuthTypeBasicAuthUserFile/usr/local/nagios/etc/.htpasswdRequirevalid-user</Directory>2、設(shè)置訪問權(quán)限在/usr/local/nagios/share目錄下[]#/usr/local/www/bin/htpasswd –c/usr/local/nagios/etc/.htpasswdnagios這個(gè)apache目錄根據(jù)安裝目錄的不同而不同 ,主要所以用.htpasswd 這個(gè)命令生成用戶名和密碼3、配置nagios3.1、在/usr/local/nagios/etc 下是nagios的配置模板文件.cfg-sample,把.cfg-sample文件全部拷貝成.cfg例如:[]#cpnagios.cfg-samplenagios.cfg全部拷貝完成即可 .修改minimal.cfg,把里面所有定義 command 的全部注釋掉[]#vi/etc/minimal.cfg(這個(gè)我注釋掉好象有問題 待改正)修改cgi.cfg 改use_authentication=1 為use_authentication=0, 即不用驗(yàn)證.不然有一些頁面不會(huì)顯示。建立所有的 cfg文件[]#touchcontactgroups.cfgcontacts.cfghostgroups.cfghosts.cfgservices.cfgtimeperiods.cfg[]#chownnagios.nagioscontactgroups.cfgcontacts.cfghostgroups.cfghosts.cfgservices.cfgtimeperiods.cfg然后檢查配置文件是否出錯(cuò)/usr/local/nagios/bin/nagios –v/usr/local/nagios/etc/nagios.cfg出現(xiàn)TotalWarnings:0TotalErrors: 0為正常出錯(cuò)的話,就是.cfg文件有問題 根據(jù)錯(cuò)誤提示 一個(gè)個(gè)修正3.5、啟動(dòng)后臺(tái)進(jìn)程/usr/local/nagios/bin/nagios-d/usr/local/nagios/etc/nagios.cfg/usr/local/etc/rc.d/nagiosstart3.6、(如果有些頁面看不到的話 .可以在cgi.cfg文件中把帶有authorized 的選項(xiàng)前的#號(hào)去掉即可)這些配置完以后,基本的 nagios配置完成。5、NRPE的安裝.及監(jiān)按指令的布署nrpe 安裝與使用1、遠(yuǎn)程主機(jī)的配置1.1、安裝openssl[]#yuminstallopenssl(openssl-devel 等等)1.2、安裝nrpe與配置[]#./configure--enable-ssl--with-ssl-lib=/usr/local/nagios/openssl/lib--with-kerberos-inc=/usr/local/nagios/openssl/include--enable-command-args[]#makeall[]#cpsample-config/nrpe.cfg/usr/local/nagios/etc[]#cpsrc/nrpe/usr/local/nagios/bin[]#vi/usr/local/nagios/etc/nrpe.cfg改成你允許的 IP 是nagios服務(wù)器)1.3、啟動(dòng)nrpe,端口為5666/usr/local/nagios/bin/nrpe-c/etc/nrpe.cfg-d1.4、安裝監(jiān)測的模塊nagios-plugins 的安裝tar–mkdir/usr/local/nagios-pluginscdnagios-plugins-1.4./configure--prefix=/usr/local/nagios-pluginsmakeallmakeinstall安裝完成以后在/usr/local/nagios-plugins會(huì)產(chǎn)生一個(gè)libexec的目錄,將該目錄全部移動(dòng)到/usr/local/nagios目錄下mv/usr/local/nagios-plugins/libexec/usr/local/nagios2、服務(wù)器上的配置2.1、安裝openssl[]#./config--prefix=/usr/local/nagios/openssl[]#make[]#makeinstall2.2、安裝nrpe(主要是使用 check_nrpe 模塊)[]#./configure--enable-ssl--with-ssl-lib=/usr/local/nagios/openssl/lib--with-kerberos-inc=/usr/local/nagios/openssl/include--enable-command-args[]#makeall[]#cpsrc/check_nrpe/usr/local/nagios/libexec2.3、nagios文件的配置vicheckcommands.cfg定義check_nrpe 命令'check_nrep'commanddefinitiondefinecommand{command_namecheck_nrpecommand_line/usr/local/nagios/libexec/check_nrpe-H$HOSTADDRESS$-c$ARG1$}定義檢查遠(yuǎn)程主機(jī)服務(wù)參見Timeperiods[me@mymachinenagios]vimtimeperiods.cfg‘24×7′timeperioddefinitiondefinetimeperiod{timeperiod_name24 ×7alias24HoursADay,7DaysAWeeksunday00:00-24:00monday00:00-24:00tuesday00:00-24:00wednesday00:00-24:00thursday00:00-24:00friday00:00-24:00saturday00:00-24:00}‘workhours’timeperioddefinitiondefinetimeperiod{timeperiod_nameworkhoursalias“Normal”WorkingHoursmonday08:00-17:00tuesday08:00-17:00wednesday08:00-17:00thursday08:00-17:00friday08:00-17:00}‘nonworkhourstimeperiod’definitiondefinetimeperiod{timeperiod_namenonworkhoursaliasNon-WorkHourssunday00:00-24:00monday00:00-09:00,17:00-24:00tuesday00:00-09:00,17:00-24:00wednesday00:00-09:00,17:00-24:00thursday00:00-09:00,17:00-24:00friday00:00-09:00,17:00-24:00saturday00:00-24:00}‘none’timeperioddefinitiondefinetimeperiod{timeperiod_namenonealiasNoTimeIsAGoodTime}Youcanspecifyasmanyoftheseasyouwant.Forinstance,sayyouhaveaneedtocontactfolksonlyontheweekends.Youcancreateatemplate “weekends”anduseonlyFriday,Saturday,Sundaywiththeappropriatetimesasyouseefit.Contacts/ContactGroupsContactsaresplitintotwodifferentfiles.Oneholdstheactualcontactoptions,andtheotherholdscontactstogetheringroups.ThegroupsarewhomyouspecifyNagiostocontactlateron.[me@mymachinenagios]vimcontacts.cfgservice_notification_optionsarew,u,c,r,f,nw=warningu=unknownc=criticalr=recoveryf=flappingn=nonehost_notification_optionsd,u,r,f,nd=downu=unreachabler=recoveryf=flappingn=nonedefinecontact{contact_namemealiasmeservice_notification_period24×7host_notification_period24×7service_notification_optionsc,rhost_notification_optionsd,rservice_notification_commandsnotify-by-emailhost_notification_commandshost-notify-by-emailemailme@myemailaddress.whatever}definecontact{contact_nameyoualiasyouservice_notification_periodworkhourshost_notification_periodworkhoursservice_notification_optionsc,rhost_notification_optionsd,rservice_notification_commandsnotify-by-emailhost_notification_commandshost-notify-by-emailemailyou@youremailaddress.whatever}Youcanchoosetodoasyouwish,butformypurposesIonlysetcontactsuptobenotifiedoncriticalandrecoveryalerts.IreallyhavenointerestinmostthingsI ’mmonitoringalertingmewhentheremaybeatemporaryglitch,orwhensomethingisinawarningstate,especiallyat4:00a.m.ThereasonIdon ’tisbecausea)IfrequentlychecktheNagiosCGIinterfacethroughouttheday,andb)allofmyalertsgetforwardedtoaticketingsystem.Withthatsaid,Idon ’twantunnecessaryticketsbeinggeneratedsimplybecauseapluginfailedtoexecutethistimearound.IfIwasveryinspired,Icouldsetupaseparatecontactandgrouptoreceiveonlythewarningandunknowns,andthenpipethesethroughadifferente-mailaddress.Again,completelyadaptivetoyourneeds.Also,I ’m-mailusingeonly.Mye-mailsystemtakescareofprocessingwherethealertsaregoing.However,youcouldsetupnagiostopipemessagesstraighttopagers.Again,checktheobjectconfigurationoptionsfortimeperiods.cfgonthedocs.Ifyouwanttoseethecommandsbeingprosecutedforalerts,checkout/etc/nagios/misccommands.cfg.Ontothecontactgroups.[me@mymachinenagios]vimcontactgroups.cfg‘einsteins’contactgroupdefinitionsdefinecontactgroup{contactgroup_nameeinsteinsaliaseinsteinsmembersme,you}Thisisasimpleexampleofcontactsandcontactgroups.Youcannestasmanypossibilitiesasyoureallywantto.Youcancreateasmanycontactsyouneedaswell.Itratherstraightforward.HostsandHostGroupsHostandhostgroupinformationisstoredinthetwofileshosts.cfgandhostgroups.cfg.Justasyoucanmixandmatchcontactsinvariouscontactgroups,youcandothesamethingwithhostnamesinhostgroups.IprefertocreatetemplateconfigurationsthatIcanleechoffoflater
’soninmyconfigurationfile.Itsavesyouanincredibleamountoftimetypingdowntheroad.[me@mymachinenagios]vimhosts.cfgGenerichostdefinitionsdefinehost{namegeneric-host;Generictemplatenamenotifications_enabled1;Hostnotificationsareenabledevent_handler_enabled1;Hosteventhandlerisenabledflap_detection_enabled1;Flapdetectionisenabledprocess_perf_data1;Processperformancedataretain_status_information1;Retainstatusinformationacrossprogramrestartsretain_nonstatus_information1;Retainnon-statusinformationacrossprogramrestartsregister0;DONTREGISTERTHISDEFINITION-ITSNOTAREALHOST,JUSTATEMPLATE!}Thiscreatesagenerictemplatethatanyhostcanuse.Notifiesnever,checks15timesbeforeshowingcriticalonCGIinterface,definehost{namebasic-hostusegeneric-hostcheck_commandcheck-host-alivemax_check_attempts15notification_interval0notification_periodnonenotification_optionsnregister0}Thiscreatesagenerichostthatyourrouterscanusemonitorshost(s)24×notifies7,ondownandrecovery,checks15timesbeforegoingcritical,notifiesthecontact_groupevery30minutesdefinehost{nameyour-routers-hostusegeneric-hostcheck_commandcheck-host-alivemax_check_attempts15notification_interval30notification_period24 ×7contact_groupseinsteinsnotification_optionsd,rregister0}definehost{usebasic-hosthost_namemymachine1aliasmymachine1}definehost{useyour-routers-hosthost_namerouter1aliasrouter1}Youcanbegintoseehowmuchtimepredefinedtemplatescansaveyoudowntheroadwhenaddinghosts.I’mmonitoringaround100hostsandover200services,sodoingthingsthetemplatewaycanreallybeproductiveinthelonghaul.Itcangetalittleconfusing,butsticktothedocsandyou ’lllearnprettyquickly.Whenitcomestoallofthetemplateobjectoptionseachfilecancontain,lookforthishttp://localhost(oryourIP)/nagios/docs/configobject.html.Thiswillhelpyoutremendously,becausetherearesomanyoptionsNagiosallowsyoutochoosefrom.IsplitthingsupbecauseIwantnotificationsonyour-routers-host,butIdon’twantnotificationonthebasic-hostcontainer.Startingtounderstandwhyyouusetemplates?Ok,nowontohostgroups.[me@mymachinenagios]vimhostgroups.cfgdefinehostgroup{hostgroup_namebasic-clientsaliasbasicclientsmembersmymachine1}definehostgroup{hostgroup_nameyour-routersaliasroutersmembersrouter1}That’saboutassimpleasthiscanget.Youspecifyyourclientsfromhosts.cfgintohostgroupsinthisfile.Youcansplitthemintomultiplegroups.Forinstance,mymachine1canlivewithinboththebasic-clientsandyour-routersgroupifyousodesired.Prettysimple ?ServicesTostart,you’regoingtoneedatleastoneservicetomonitor.Thiswouldbeasimplecheck-host-alive,orping.Again,Isplitthingsintotemplatestomakeiteasierdowntheroadjustasdemonstratedabove.[me@mymachinenagios]vimservices.cfgGenericservicedefinitiontemplatedefineservice{namegeneric-service;Genericservicenameactive_checks_enabled1;Activeservicechecksareenabledpassive_checks_enabled1;Passiveservicechecksareenabled/acceptedparallelize_check1;Activeservicechecksshouldbeparallelized(don ’tdisable)obsess_over_service1;Weshouldobsessoverthisservice(ifnecessary)check_freshness0;DefaultistoNOTcheckservice‘freshness’notifications_enabled1;Servicenotificationsareenabledevent_handler_enabled1;Serviceeventhandlerisenabledflap_detection_enabled1;Flapdetectionisenabledprocess_perf_data1;Processperformancedataretain_status_information1;Retainstatusinformationacrossprogramrestartsretain_nonstatus_information1;Retainnon-statusinformationacrossprogramrestartsregister0;DONTREGISTERTHISDEFINITION-ITSNOTAREALSERVICE,JUSTATEMPLATE!}Genericforallservicesdefineservice{usegeneric
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2030年中國紙漿模數(shù)據(jù)監(jiān)測研究報(bào)告
- 2020-2025年中國陶瓷刀具市場運(yùn)行態(tài)勢及行業(yè)發(fā)展前景預(yù)測報(bào)告
- 10爬山虎的腳 (教學(xué)設(shè)計(jì))2024-2025學(xué)年統(tǒng)編版語文四年級(jí)上冊
- 2025至2030年鐵文件柜項(xiàng)目投資價(jià)值分析報(bào)告
- Pardaxin-P5-TFA-生命科學(xué)試劑-MCE
- 2025至2030年中國水晶拉手?jǐn)?shù)據(jù)監(jiān)測研究報(bào)告
- 2025年凹凸拉鏈袋項(xiàng)目可行性研究報(bào)告
- 2025至2030年中國智能快速多用小籠包蒸爐數(shù)據(jù)監(jiān)測研究報(bào)告
- 2025年專業(yè)咨詢服務(wù)項(xiàng)目發(fā)展計(jì)劃
- 2025至2030年高性能功率因數(shù)補(bǔ)償電容器項(xiàng)目投資價(jià)值分析報(bào)告
- 第1課《我們的閑暇時(shí)光》教學(xué)設(shè)計(jì)
- 《中國傳統(tǒng)民歌欣賞》課件
- 模塊1鐵道線路養(yǎng)護(hù)與維修認(rèn)知《鐵道線路養(yǎng)護(hù)與維修》教學(xué)課件
- 高鐵無砟軌道精調(diào)精測課件
- 2024年企業(yè)規(guī)章制度修訂方案
- 聚焦任務(wù)的學(xué)習(xí)設(shè)計(jì)作業(yè)改革新視角
- 血管活性藥物靜脈輸注護(hù)理方法(中華護(hù)理學(xué)會(huì)團(tuán)體標(biāo)準(zhǔn)T CNAS 22-2021)
- 史上最完善IPD培訓(xùn)資料華為IPD培訓(xùn)資料
- 2024高二語文期末試卷(選必上、中)及詳細(xì)答案
- 《選材專項(xiàng)訓(xùn)練》課件
- 附著式升降腳手架安裝平臺(tái)和架體檢查驗(yàn)收表
評(píng)論
0/150
提交評(píng)論