Computers Windows Internet

Nagios installation and configuration. Installing and configuring nagios on Ubuntu. Installing Nagios plugins

YURPMSH'PCHBOYS Nagios H TEBMSHOPK TSOYOY, NSC BLCHPECHBMY DMS UEVS DPCHPMSHOP RTPUFPTOPE NEUFP RPD UPMOGEN. rPUME FTEI RTEDSHCHDHEYI UVBFEK X YUYFBFEMEK OBLPRYMPUSH OELPFPTPE LPMYUEUFCHP CHPRTPUPCH. YFP OBBYUYF, UFP, OEUNPFTS ABOUT CHUE VSCHMSHE KHUREIY, RTYYMP CHTENS RTELTTBFIFSH TBUYTSFSH UCHPY CHMBDEOYS Y RETEKFI ABOUT YOFEOUYCHOSCHK RHFSH TBCHYFYS. UMEZLB ЪBNEDMYN UCHPK VEZ CHRETED Y ЪBKNENUS VMBZPHUFTPKUFCHPN ЪBICHBYUEOOPZP RTPUFTBOUFCHB. LBL PVSCHYUOP, CH OBYUBME UVBFSHY IPFEMPUSH VSHKHRPNSOHFSH FP PVUFPFSFEMSHUFCHP, UFP PRYUSCHCHBENSCHE DEKUFCHYS CHSHCHRPMOSMYUSH ABOUT IPUFE, TBVPFBAEEN RPD HRTBCHMEOYEN FreeBSD 4.8. pDOBLP RETETSYCHBFSh RP LFP RPCHPDH OE UFPYF, FBL LBL CHUE PVUHTSDBENSCHE RTYENSCH VHDHF PFMYUOP TBVPFBFSH U MAVSCHN DYUFTYVHFYCHPN Unix-RPDPVOSHCHI PRETBGYPOOSCHI UYUFEN, DMS LPFPTSHCHI UHEHEE Nagios. edYOUFCHEOOOSCHN EELPFMYCHSHCHN NPNEOPFPN NPCEF VSHCHFSH TBMYUYE CH YNEOBI DYTELFPTYK, ZDE TBURPMPTSYMYUSH Nagios Y PUFBMSHOPE CHURPNPZBFEMSHOPE RTPZTBNNNOPE PVEUREYUEOYE, OEEPVIPDYNPE GENERAL DMS. OBDEAUSH, U FYN NEMLYNY RTPVMEMBNY CHSH UNPCEFE TBPVTBFSHUS UBNPUFPSFEMSHOP.

RETCHSHCHN DEMPN IPFEMPUSH VSC OBHYUYFSH Nagios ZPCHPTYFSH ABOUT YUYUFPN THHUULPN SHCHLE. LBL CHUEZDB, CHURPNYOBEN, UFP CH FFPN NYTE OEF OYUEZP OECHPЪNPTSOPZP. rTYNETOP DECHSFSH NEUSGECH OBBD S BFOUR TBVPFS RP MPLBMYBGYY Nagios CHETUYY 1.06 beta. ъBFEN, RP NETE CHSHCHIPDB OPCHSHCHI CHETUYK RTPDHLFB, FB CE UHDSHVB RPUFYZMB PZHYGIBMSHOSHCHE TEMYSHCH 1.0 Y 1.1. NEFPDYLB THUIZHYLBGYS DMS CHUIEI CHETUYK PDYOBLPCHB, RPFPNH S VHDH PRYUSCHCHBFSH EE ABOUT RTYNET CHETUY 1.1, LBL OBYVPMEE UCHETSEK Y, OBDEAUSH, OBYVPMEE TBURTPUFTBOEOOPK. RMAU LP CHUENKH, YNEOOP LFB CHETUYS HUFBOCHMEOB H NEOS. yFBL, UFP CE OBN OHTSOP UDEMBFSh? RETCHSHCHN DEMPN ULBYUYCHBEN DYUFTYYVHFICH CHETUYY Nagios, LPFPTBS HUFBOPCHMEOB HCHBU U PZHYGYBMSHOPZP UBKFB http://www.nagios.org. ъBFEN ЪDEUSH htpp://onix.opennet.ru/files/, VETEN UPPFCHEFUFCHHAEYE ZHBKMSCH MPLBMYBGYY.

tBURBLPCHSCCHBEN DYUFTYVHFICH Y RBLEF MPLBMYBGYY CH MAVPE HDPVOPE NEUFP, OBRTYNET CH DYTELFPTYA / tmp.

# tar zxvf nagios-1.1.tar.gz # tar zxvf nagios_rus_1_1.tar.gz

lPRYTHEN CHUE OEPVVIPDINSCHE ZHBKMSCH YЪ RBLEFB MPLBMYЪBGYY CH TBURBLPCHBOOSCHK DYUFTYVHFICH Y êBFEN, LBL PVSCHYUOP, RTPCHPDYN LPOZHYZHTYTPCHBOYE.

# cp -R /tmp/nagios_eng_1_1/* /tmp/nagios-1.1/ # cd nagios-1.1 # ./configure --prefix=/usr/local/nagios --with-cgi-url=/nagios/cgi-bin --with-html-url=/nagios/ \ --with-nagios-user=nagios --with-nagios-grp=nagios --with-gd-lib=/usr/local/lib \ --with-gd -inc=/usr/local/include/gd

s DHNBA, PWYASUOSFSH OBOBYUEOYE LMAYUEK LPNBODSCH configure UNSHUMB UEF. rPFPNKh UTBYH TSE RETEIPDYN L LPNRYMSGYY.

# make all

rPUME FPZP, LBL FFPF RTPGEUU BLETHYFUS KHUREYOP, PUFBOBCHMYCHBEN DENPOB Nagios. Chue-FBLY TEKBFSH RP TsYCHPNKh OE PYUEOSH IPTPYP, Y RPDPVOSHCHE DEKUFCHYS NPZKhF ChSCHCHBFSH TBOPPPVTBOBOSHE UVPY CH ZHOLGYPOYTPCHBOY UYUFENSCH NPOYFPTYOZB.

# /usr/local/etc/nagios.sh stop

CHPF FERETSH NPTsOP URPLPKOP CHSHCHRPMOSFSH YOUFBMMSGYA.

# make install

h TEEKHMSHFBFE ZHBKMSCH YD DYTELFPTYY DYUFTYVHFYCHB DPMTSOSCH OBNEOYFSH FE ZHBKMSCH, LPFPTSHCHE Nagios YURPMSHЪPCHBM DP UEZPDOSYOEZP DOS. fBLYN PVTBPN, ZHBKMSCH Yb /tmp/nagios-1.1/html DPMTSOSCH RPRBUFSH H /usr/local/nagios/share/, B ULPNRYMYTPCHBOOSCHE ZHBKMSCH Yb /tmp/nagios-1.1/cgi H /usr/local/nagios/sbin/.

uOPCHB BRHUFYCH Nagios Y PVTBFYCHYUSH L Web-YOFETZEKUKH, DPMTSOSCH HCHYDEFSH YUFP-FP CHTPDE FBLPK LBTFYOLY.

uHDS RP CHUENKH, THUIZHYLBGYS RTPIMB VE UHYULB-VE ЪBDPTYOLY. UMEDHAEBS RTPVMENB, OHTSDBAEBSUS CH YURTBCHMEOYY - OETBVPFBAEBS LBTFB UEFY. RTY RPRSHFLE CHPURPMShHPCHBFSHUS RHOLFBNY "LBTFB UEFY" (statusmap.cgi) Y "3D LBTFB UEFY" (statuswrl.cgi)

rtyuyo ffpnh nptsef vshchfsh dche. RETCHBS: OE TBVPFBEF VYVMYPFELB GD, LPFPTHA NSCH HUFBOCHYMY CHNEUFE U Nagios. th CHFPTBS: H YURPMSHЪKHEPN OBNY VTBHJETE PFUHFUFFCHHEF YMY OERTBCHYMSHOP TBVPFBEF RPDLMAYUBENSCHK NPDHMSh DMS PFPVTBTSEOIS vrml.

yFBL, OBJOOEN U RECHPK RTPVMENSCH. eUMY CH RPNOYFE, RETED LPNRYMYTPCHBOYEN Nagios NSC YURPMSHЪPCHBMY LPNBODH configure. UMEDHEF PWTBFYFSH PUVPPE CHOYNBOYE ABOUT RBTBNEFTSHCH --with-gd-lib Y --with-gd-inc, LPFPTSHE HLBSCCHBAF OB DYTELFPTYY, ZDE H OBYEK UYUFENE OBIPDSFUS BLZPMPCHPYOSCHE Y VYVMYPFEYOSCHE JBKMSCHCH. lPNBODB configure RSCHFBEFUS BCHFPNBFYUEULY RPDLMAYUIFSH OHTSOSCHE JBKMSCH L RTPELFH, OP E CHUEZDB FFP HDBEFUS. pVSchYuOP B RTPGEUUE LPOZHYZHTYTPCHBOYS ON LTBO CHSCHCHPDSFUS UPPFCHEFUFCHHAEYE UPPVEEOYS, OP Chus RTPVMENB B FPN, YUFP FHDB CE USCHREFUS DPCHPMSHOP NOPZP RTPYUYI DYBZOPUFYYUEULYI UPPVEEOYK, J RPFPNH OBKFY J RPOSFSH AF YUFP OPL OHTSOP B FPN CHYOEZTEFE, DPCHPMSHOP UMPTSOP. DMS VPMEE FPYuOPZP DYBZOPUFYTPCHBOYS RTPVMENSCH PYUYUFYN DYUFTYVHFICH PF ZHBKMPCH, UPDBOOSHCHI CHTENS RTEDSHCHDHEEK LPNRYMSGYY LPNBODPK:

# make clean

bFEN RETEOBRTBCHYN CHUE UPPVEEOIS LPNBODSH configure H JBKM make.log c RPNPESHHA UMEDHAEK LPOUFTHLGYY.

# ./configure --prefix=/usr/local/nagios --with-cgi-url=/nagios/cgi-bin --with-html-url=/nagios/ \ --with-nagios-user=nagios - -with-nagios-grp=nagios --with-gd-lib=/usr/local/lib \ --with-gd-inc=/usr/local/include/gd > make.log

eUMMY ChP CHTENS LPNRPOPCHLY VYVMYPFELB GD OE OBKDEOB, FP CHOKHFTY ZHBKMB make.log UTEDY CHUEZP RTPUEZP VHDHF CHPF FBLIE OBDRYUY:

Checking for gdImagePng in -lgd (order 1)... no checking for gdImagePng in -lgd (order 2)... no checking for gdImagePng in -lgd (order 3)... no *** GD, PNG, and /or JPEG libraries could not be located... ********* Boutell's GD library is required to compile the statusmap, trends and histogram CGIs. Get it from http://www.boutell.com/ gd/, compile it, and use the --with-gd-lib and --with-gd-inc arguments to specify the locations of the GD library and include files. ll also need to make sure you have the png-devel and jpeg-devel libraries installed on your system. NOTE: After you install the necessary libraries on your system: 1. Make sure /etc/ld.so.conf has an entry for the directory in which the GD, PNG, and JPEG libraries are installed. 2. Run "ldconfig" to update the run-time linker options. 3. Run "make clean" in the Nagios distribution to clean out any old references to your previous compile. 4. Rerun the configure script. NOTE: If you can"t get the configure script to recognize the GD libs on your system, get over it and move on to other things. The CGIs that use the GD libs are just a small part of the entire Nagios package. Get everything else working first and then revisit the problem.Make sure to check the nagios-users mailing list archives for possible solutions to GD library problems when you resume your troubleshooting. ******************************************************* *

OH B CH UMKHYUBE, EUMY CHBN RPCHEMP Y CHSH OBYMY CH HLBBOOPN CHSCHY ZHBKME CHPF FBLPE:

Checking for gdImagePng in -lgd (order 1)... yes GD library was found!

OBYUYF U GD X CHBU CHUE H RPTSDLE, Y CH NPTSEFE URPLPKOP RPKFY RPRYFSH LPZHE, RPLB S TBUULBTCH PUFBMSHOSHCHN, LBL YЪVBCHYFSHUS PF RTPVMEN U FFK OEHMPCHYNPK VYVMYPFELPK. rp FTBDYGYY OBJOYOBEN IN FreeBSD. rPUNPFTEFSH, HUFBOBCHMYCHBMBUSH MY VYVMYPFELB GD CH LFH UYUFENKH UFBODBTFOSCHNY UTEDUFCHBNY, FP EUFSH U RPNPESHHA RBLEFPC YMY RPTFPCH, NPTsOP LPNBODPK:

#pkg_info | grep gd gd-1.8.4_6 A graphics library for fast image creation

FERETSCH NSCH OBEN RPMOPE OBCHBOYE RBLEFB. unNPFTYN LHDB, HUFBOPCHYMYUSH EZP ZHBKMSCH.

# pkg_-L gd-1.8.4_6 Information for gd-1.8.4_6: Files: /usr/local/bin/bdftogd /usr/local/bin/gd2copypal /usr/local/bin/gd2topng /usr/local/bin/ gdparttopng /usr/local/bin/gdtopng /usr/local/bin/pngtogd /usr/local/bin/pngtogd2 /usr/local/bin/webpng /usr/local/include/gd/gd.h /usr/local/ include/gd/gd_io.h /usr/local/include/gd/gdcache.h /usr/local/include/gd/gdfontg.h /usr/local/include/gd/gdfontl.h /usr/local/include/ gd/gdfontmb.h /usr/local/include/gd/gdfonts.h /usr/local/include/gd/gdfontt.h /usr/local/lib/libgd.a /usr/local/lib/libgd.so / usr/local/lib/libgd.so.2 /usr/local/share/doc/gd/index.html

yFBL, UHDS RP WHCHCHPDH, RBTBNEFTSH LPNBODSCH configure, PFOPUSEYEUS L VYVMYPFLE GD, DPMTSOSCH CHZMSDEFSH FBL --with-gd-lib=/usr/local/lib --with-gd-inc=/usr/local/include/gd.

dBCHBKFE RPUNPFTYN, LBL NPTsOP DPVYFSHUS RPPVOPZP YZHZHELFB DMC Linux-UYUFEN, PUOPCHBOOSCHI OB rpm. h LBYUEUFCHE RTYNETB CHPSHNEN ALT Linux.

# rpm -qa | grep gd libgd2-devel-2.0.4-alt2 gdm-2.4.4.5-alt1 gdk-pixbuf-loaders-0.22.0-alt2 gdk-pixbuf-0.22.0-alt2 libgd2-2.0.4-alt2 libgda2-1.0.0 -alt1 gnome2-utils-gdict-applet-2.4.0-alt2 libgda2-devel-1.0.0-alt1

h PFMYYUYE PF FreeBSD, CH Linux UYUFENBI VYVMYPFELB GD PVSCHYUOP TBDEMEOB ABOUT DCHB PFDEMSHOSHCHI RBLEFB. uHDS RP CHUENH, OBU YOFETEUKHAF rpm JBKMSCH libgd2 th libgd2-devel. RETCHSHCHK UPDETSYF DYOBNYUEULY ЪBZTHTSBENSCHE VYVMYPFELY, OH B CHFPTPK, UPPFCHEFUFCHEOOP, ЪBZPMCHPYOSCHE ZHBKMSCH.

# rpm -ql libgd2 /usr/lib/libgd.so.2 /usr/lib/libgd.so.2.0.4 # rpm -ql libgd2-devel /usr/include/gd.h /usr/include/gd_io.h /usr/include/gdcache.h /usr/include/gdfontg.h /usr/include/gdfontl.h /usr/include/gdfontmb.h /usr/include/gdfonts.h /usr/include/gdfontt.h /usr /lib/libgd.so /usr/share/doc/gd-2.0.4 /usr/share/doc/gd-2.0.4/index.html

OH Y OBLPOEG, HOYCHETUBMSHOSHCHK URPUW, RPDIPDSEIK DMS MAVPC Unix-RPDPVOPC PRETBGYPOOPK UYUFENSCH. yN NPTsOP CHPURPMShHPCHBFSHUS CH UMHYUBE, EUMY CHUE RTEDSHCHDHEYE RPRSHCHFLY OE DBMY OILBLYI TEEKHMSHFBFPCH. OHTSOP UBNPUFFPSFEMSHOP PFSHULBFS, HERE OBIPDSFUS JBKMSCH libgd.* th gd.h

#find / -name libgd.* /usr/lib/libgd.so.1.2 /usr/lib/libgd.so.1 /usr/lib/libgd.so #find / -name gd.h /usr/include/gd .h

FERETSCH NPTSEFE HCHETEOOP ULBBFSH, YUENH DPMTSOSCH VSHCHFSH TBCHOSCH RBTBNEFTSC --with-gd-lib Y --with-gd-inc Lpnbodsch configure. CHSHCHRPMOSEN HER UP CHUENY OEEPVIPDYNSCHNY OBUFTPKLBNY Y, LBL PRYUBOP CHSCHIE, RTPCHETSEN, OBKDEOB MY VYVMYPFELB GD. OH Y OBLPOEG, RTPCHPDYN LPNRYMSGYA Y YOUFBMMSGYA, OE GBVSCCH PUFBOCHYFSH DENPOB Nagios. RPUME LFPZP LBTFB UEFY (statusmap.cgi)


FERETSCH CHUE FE, LFP KHYMY RYFSH LPZHE, NPZHF CHPCHTBEBFSHUS. UEKYUBU NSCH OBYUOYEN RPYUOLKH 3D LBTFSCH. oE TBVPFBEF POB RP RTYUOYOE FPZP, UFP CHBY VTBHJET OE OBEF, UFP DEMBFS U vrml ZHBKMPN, LPFPTSCHK CHPCHTBEBEFUS CH PFCHEF OB BRTPUSCH L ULTYRFH statuswrl.cgi. DMS FPZP, YUFPVSCH CHUE ЪBTBVPFBMP LBL RPMPTSEOP, OHTSOP HUFBOPCHYFSH CH YURPMSHKHENSCHK VTBKHET NPDHMSh DMS TBVPFSCH U vrml, YMY PFDEMSHOHA RTPZTBNNKH, RTEDOBOBYUEOOHA DMS FEI CE GEMEK.

rTPZTBNNOPZP PVEUREYUEOYS, RPDIPDSEEP DMS LFPZP, OBRYUBOP CHP Y NBMEOSHLBS FEMETSLB. LBL PVSCHYUOP, RBMSHNB RETCHEOUFCHB RP LPMYUEUFCHH LENRMSTCH RTYOBDMETSYF Windows. BFEN YDEF MAC OS Y, OBLPOEG, VTPOPCHPE FTEFSHE NEUFP OBBOINBEF Linux.

yFBL, OBYUOEN U ZhBCHPTYFB. rTY OEPVIPDYNPUFY TBVPFBFSH RPD HRTBCHMEOYEN Windows MAC J UYUFEN With RTEDRPYUYFBA YURPMSHPCHBFSH Cortona VRML Client RP FPK RTPUFPK RTYYUYOE, YUFP IN UPCHNEUFYN have VPMSHYYOUFCHPN OBYVPMEE TBURTPUFTBOEOOSCHI VTBHETPCH, L YUYUMH LPFPTSCHI OEUPNOEOOP PFOPUSFUS Internet Explorer, Netscape Navigator, Mozilla, iCab. YOFETEUOSCHN ZHBLFPN SCHMSEFUS FP PVUFPSFEMSHUFCHP, UFP LFPF RPDLMAYUBENSCHK NPDHMSh NPTsOP YURPMSHЪPCHBFSH DBTS YЪ PZHYUOSCHI RTYMPTSEOIK Microsoft PowerPoint, Microsoft Word. l UTCBMEOYA, TBTBVPFUYLY Cortona RPYENH-FP TEYYMY RPMOPUFSHHA RTPYZOPTYTPCHBFSH Linux. ULBYUBFSH DYUFTYVHFICH NPTsOP U UBKFB http://www.parallelgraphics.com/products/cortona/download/ . uFP DEMBFSh RPUME UPCHETEOYS LFPZP UBLTBNEOFBMShOPZP DEKUFCHB, NSC PVUHDYN OENOZP RPDOEE.

UMEDHAEBS DPUFPKOBS OBEZP CHOYNEBOYS RTPZTBNNB OBSCCHCHBENBS Cosmo player J CHEF RP FFPNH BDTEUX http://ca.com/cosmo/html/ . tBVPFBEF CH CHYDE PFDEMSHOPSZP RTYMPTSEOIS Y, LPOEYUOP TSE, FPMSHLP RPD Windows Y MAC.

ExpressVR-LPOLCHTEOF Cortona DMS RPD DTKHZINY PLASTBGHIPOSTY UYUFENBNY OE TYCHEF, RPRESCHPL илурбуй ОЕЕН РТEDTRYYYNBEFY, SHDS RP RPUMEDOYN PERODEOGYSN, ULPTEE CHEUZP, YUET 'OELPFTPE CHESTEL VKHDAF PLOPUBFEMSHOP CHSChPHEUEO REPUTN'SPFYCHYLPN. rTEDOBOBBYUEO FPMSHLP DMS Netscape Navigator and Internet Explorer. ULBYUBFSH DYUFTYYVHFICH NPTsOP PFUADB http://members.aol.com/maxmac/vrml/download.html .

FreeWRL - PFDEMSHOPE RTYMPSEOYE, TBVPFBAEEEE H LBYUEUFCHE UBNPUFPSFEMSHOPZP vrml VTBHJETB. JHOLGYPOYTHEF ABOUT RMBFJPTNBI Linix J MAC J TBURPMBZBEFUS RP CRC BDTEUX http://www.crc.ca/FreeWRL/ .

about UBNPN DEME, RTPZTBNN, RPDIPDSEYI DMS OBYI GEMEK, ZPTBDP VPMSHIE, YUEN CHSH NPZMY VSH RPDHNBFSH. with RPUFBTMBUS HRPNSOHFSH MYYSH OBYVPMEE Y'CHEUFOSHCHE Y' OII. eUMMY CE CHSC IPFIFE OERTENEOOP PZMBUIFSH CHEUSH URYUPL, FP CHBN OHTSOP RTPCHEUFY RPYUL RP UMPCHH vrml ABOUT UMEDHAEIE WETCHETBI, CH OBTPDE MBULPPCHP GENERAL UPZHFPNPZYMSHOILBNY:


http://freshmeat.net/
http://tucows.com/
http://filesearch.ru/

l UPTSBMEOYA, Nagios RPLB OE HNEEF UBNPUFPSFEMSHOP UFTPIFSh LBTFH UEFY, VPMEE YMY NEOEE RTYVMYTSEOOHA L TEBMSHOPNKH TBURPMPTSEOYA OBVMADBENSCHI PVYAELFCH CHOKHFTY OEE. oEUNPFTS ABOUT FP, UFP X OBU EUFSH DCHE RPDUEFY ABOUT LBTFE, CHUE NBYYOSCH PFPVTTBTSBAFUS FBL, LBL VHDFP SOY OBIPDSFUS H PDOPN Y FPN CE UEFECHPN PVMBLE, FP EUFSH CHUE UCHBMEOP CH PDOH LHYUH. at PDOPC UFPTPOSCH, LFP HRTPEBEF RTPGEDHTH TYUPCHBOYS LBTFSCH, OP U DTHZPK, HUMPTSOSEF TJOYOSH BDNYOYUFTBFPTB. rTEDUFBCHSHFE UEVE UYFHBGYA, LPZDB YU UFTPS CHSHIPDYF NBYOB Inner_Firewall. RTY UMEDHAEEN GYLME CHSHCHRPMOEOIS RTPCHETPL OBU BUSCHRMEF MBCHYOB HCHEDPNMEOYS P LTYFYYUEULPN UPUFPSOYY IPUFPC Inner_Firewall, WWW, Mail, 3com_Dmz th Outer_Firewall. IPFS ABOUT UBNPN DEME OE TBVPFBEF FPMSHLP RETCHSHCHK Y CHUEI CHCHYERETEYUMEOOOSCHI LPNRSHAFETCH. rPMHYUBEFUS, UFP BDNYOYUFTBFPT DPMTSEO UBNPUFPSFEMSHOP DPZBDBFSHUS, UFP RTYCHEMP L FBLYN NBUUPCHSHCHN UVPSN. DMS FPZP, UFPVSCH CHRTEDSH YЪVETSBFSH RPDPVOSCHI OERTYSFOPUFEK, OBN OEVPVIPDYNP PVYASUOYFSH Nagios, LBL RPUFTPEOB OBYB UEFSH Y LBLYN PVTBBPN DPVYTBFSHUS DP EE UBNSHCHI HDBMEOOSHCHI HZPMLCH. DEMBEFUS LFP U RPNPESH UPDBOYS PFOPIEOYK "TPDYFEMSH" - "RPFPNPL" NETsDH CHUENY OBYNY IPUFBNY. rPUME FBLYI YЪNEOEOYK LTYFYYUEULIE HCHEDPNMEOYS VHDHF RTYIPDYFSH FPMSHLP DMS LPNRSHAFETB Inner_Firewall, CHUE PUFBMSHOCHE NBYYOSCH, ЪBDEKUFCHPCHBOOSCH CH DBOOPK RTPVMENE, RPMHYUBF UVBOPFHU "OO". uPZMBUYFEUSH, LFP CHUE-FBLY VPMEE UPPFCHEFUFCHHEF DEKUFCHYFEMSHOPNH RPMPTSEOIA CHEEK H LPOFTPMYTHENSCHI UEFSI.

rTBTPDYFEMEN CHUEI LPNRSHAFETCH UYUYFBEFUS NBYOB, ABOUT LPFPTPK TBVPFBEF RTPGEUU UYUFENSCH NPOYFPTYOZB. y HCE PF OEZP UFTPIYFUS GERPYULB.

DMS RTBCHIMSHOPK DYBZOPUFYLY OERPMBDPL YETBTIYS DPMTSOB CHSCHZMSDEFSH FBL, LBL YЪPVTBTSEOP ABOUT RTEDSCHDHEEK WEEN. at FPYULY ЪTEOYS Nagios, VSCHCHBAF DCHB CHYDB IPUFCH - "MPLBMSHOSHCHE" Y "HDBMEOOSHCHE". mPLBMSHOSHCHNY UYUYFBAFUS FE, LFP OBIPDYFUS CH FPN CE UEFECHPN UEZNEOFE, UFP Y UYUFENB NPOYFPTYOZB. NECDH OYNY OE DPMTSOP VSHFSH OH NBTYTHFYBFPTPCH, OH NETSUEFECHSCHI LTBOCH. eUMMY VSCH OBU VSCHMY OEHRTBCHMSENSCHE LPNNHFBFPTSCH, OE RPDDBAEYEUS NPOYFPTYOZH, FP MPLBMSHOSHCHNY IPUFBNY UYUYFBMYUSH VSC Linux Y Win_2000. OP CH CHCHSKY U FEN, UFP NETsDH ONY EUFSH RTPNETSHFPYUOPE ЪCHEOP CH CHYDE LPNNHFBFPTB 3com_Lan, LPFPTSCHK NPTsOP RPDCHETZOHFSH NPOYFPTYOZH, POY RETEIPDSF CH TBBTSD HDBMEOOSHCHI. b EDIOUFCHEOOOSCHN MPLBMSHOSHCHN UVBOPCHYFUS 3com_Lan.

dPVYFSHUS LFPZP NPTsOP RTYNEOEOYEN FESB parents H PRTEDEMEOYY IPUFCH. uFPYF PVTBFIFSH CHOYNBOYE ABOUT FPF UFTBOOSCHK ZhBLF, UFP JYTNEOOBS DPLHNEOFBHYS CH TBDEME "Determining Status and Reachability of Network Hosts" FFPF FZ RPYENH-FP OBSHCHCHBEF parent_hosts. IPFS EUMY RPLPRBFSHUS CH YUIPDOSCHI FELUFBI Nagios, FP RPOINBEN, UFP OB UBNPN DEME DPMTSEO VSCFSh RTPUFP parents. eUMMY CH PRYUBOYY IPUFCH OHEHLPUOYFEMSHOP RTYDETZYCHBFSHUS HLBBOYS YURPMSHJPCHBFSH FZ parent_host, FP RTY RPRSHFLE UDEMBFSH nagios reload

Running configuration check... Nagios 1.1 Copyright (c) 1999-2003 Ethan Galstad ( [email protected]) Last Modified: 06-02-2003 License: GPL Reading configuration data... Error: Could not add object property in file "/usr/local/nagios/etc/hosts.cfg" on line 74. ***> One or more problems were encountered while processing the config files... Check your configuration file(s) to ensure that they contain valid directives and data definitions. If you are upgrading from a previous version of Nagios, you should be aware that some variables/definitions may have been removed or modified in this version. Make sure to read the HTML documentation on the main and host config files, as well as the "Whats New" section to find out what has changed. failed - aborting reload.

pYYVLB VHDEF YNEOOP ABOUT FPK UFTPL, HERE IS WHAT RPSCHMSEFUS FZ parent_host. DHNBA, DTHZYI DPLBFEMSHUFCH OE OKHTSOP.

nBYOSCH, UYUYFBAEYEUS MPLBMSHOSHCHNY RP PFOPYEOYA L Nagios, OBIPDSFUS ABOUT PDOH UFKhREOSHLH OYCE CH YETBTIYY, Y RPFPNH OE DPMTSOSCH YURPMSHЪPCHBFSH FEZ parents CH UCHPEN PRYUBOYY. CHUE PUFBMSHOSHCHE NBYOSCH, PFOPUSEYEUS L ZTHRRE HDBMEOOSHCHI, CH CHCHYEHLBBOOPN FEZE RYYHF YNS VMYTSBKYEZP TPDYFEMS. fBLYN PWTBPN, DMS IPUFPC Inner_Firewall, Linux Y Win_2000 TPDYFEMEN SCHMSEFUS 3com_Lan. h UCHPA PUETEDSH, Inner_Firewall HLBBO TPDYFEMEN DMS 3com_Dmz. b 3com_Dmz CHSHCHRPMOSEF FH CE TPMSh DMS IPUFCH WWW, Outer_Firewall, Mail.

yFBL, TBYPVTBCHYUSH U RPOSFYEN YETBTIYY, RPUNPFTYN, LBL POP CHMYSEF ABOUT PFPVTBTSOYE OBYI UEFEK ABOUT LBTFE.


DHNBA, CHSCHZMSDYF DPCHPMSHOP CHEYUBFMSAEE. lBLPC YЪ URPUPVPCH PFPVTBTSEOIS LBTFSCH VKHDEF YURPMSHЪPCHBFSHUS RP HNPMYUBOYA, HLBSCHCHBEF RBTBNEFT default_statusmap_layout. dMS FTEINETOPK LBTFSh FBLPK RBTBNEFT OBSHCHCHBEFUS, UPPFCHEFUFCHEOOP, default_statuswrl_layout. pVB LFYI RBTBNEFTB ULTSCHCHBAFUS CHOHFTY ZHBKMB cgi.cfg. LTPNE ЪBNEFOPZP U RETCHPZP CHZMSDB MPUlb, NShch, L FPNKh CE, RTYPVTEMY VPMEE FPYuOPE DYBZOPUFYTPCHBOYE UEFECHSCHI OERPMBDPL.

CHUE LFP, LPOEYUOP, IPTPYP, OP DHYB FTEVHEF YuEZP-FP VPMEE LTBUYCHPZP. fBL CE IPFEMPUSH VSC HNEFSH UBNPUFPSFEMSHOP HLBSCCHBFSH TBURPMPTSEOYE FEI YMY YOSCHI PVYAELFCH ABOUT LBTFBI. fBLBS ЪBDBYUB OBN RP RMEYUKH, Y UEKYUBU CHSH OBHYUYFEUSH HRTBCHMSFSH CHBTSOEKYNY RBTBNEFTBNY PFTYUPCHLY UEFECHSCHI LBTF. DMS Obübmbm Nwby TBDBDIN LBCDPH IPUFH YUTCHYUKH RP Ltbuichpk Ylpol, B Obfen TBBRPMPZHIN YI FBL, UFPVSHT Sing Nblinbmshop Upkrobdbmi at Oboyan Tyukholpn, PuppschbSush About LPFPTPN Nushchbmi Upesin Weefek. fHF OBN ABOUT RPNPESH RTYIPDSF DCHB OPCHSHCHI ZHBKMB. RETCHSHCHK YJ OYI, hosttextinfo.cfg, PFCHEYUBEF BL DPVBCHPYUOSCHE BFTYVHFSCH IPUFCH, B CHFPTPK, serviceextinfo.cfg, CHSHCHRPMOSEF FH TSE ZHHOLGYA DMS UETCHYUPCH.

LUFBFY, OE UBVKHDSHFE ULBYUBFSH PFUADB http://nagios.org/download/extras.html

jFBL, OBYUEN U JBKMB hosttextinfo.cfg.

define hosttextinfo(
# FEZ, U LPFPTPZP DPMTSOP OBJOYOBFSHUS PRYUBOYE IPUFB

host_name 3com_Lan
# JNS IPUFB, L LPFPTPNH PFOPUYFUS PRYUBOYE

icon_image3Com.png
# YNS ZHBKMB YLPOLY, LPFPTBS VKHDEF PFPVTTBTSBFSHUS TSDPN U YNEOEN IPUFB
# YLPOLB NPTSEF VSHCHFSH CH ZHPTNBFE GIF, PNG YMY JPG. NPTSEF UPDETTSBFSh CHOKHFTY
# UEVS RTPJUOSCHE PVMBUFY. CEMBFEMSHOP, UFPVSh YLPOLY VSCHMY TBNETPN 40x40
# RELUEMEK. tBURPMBZBFSHUS SOY DPMTSOSCH CH DYTELFPTYY logos.

icon_image_alt 3Com LAN Switch
# OBDRYUSH, PFPVTBTSBENBS, EUMY

vrml_image 3Com.png
# yNS ZHBKMB, LPFPTSCHK VKhDEF YURPMSHЪPCHBFSHUS LBL FELUFHTTB DMS LHVB,
# YЪPVTBTSBAEEZP IPUF ABOUT FTEINETOPK LBTFE.
# nPTSEF VSHCHFSH CH ZHPTNBFE PNG, JPG, GIF. lBTFYOLB OE DPMTSOB UPDETTSBFSh
# RTPJUOSCHI PVMBUFEK, YOBYUE FFP VKhDEF ChSCHZMSDEFSH PYUEOSH UFTBOOP. dPMTSOB
# ITBOYFSHUS CH FPK TSE DYTELFPTYY, UFP Y YILPOLB, PRYUBOOBS FEZPN icon_image

statusmap_image 3Com.gd2
# yNS ZhBKMB, ZDE ITBOIFUS YЪPVTBTSEOIE, LPFPTPE VKHDEF YURPMSHЪPCHBFSHUS LBL YLPOLB
# IPUFB ABOUT RMPULPK UEFECPC LBTFE. nPCEF VSHCHFSH CH JPTNBFE PNG, JPG, GIF,
# OP CHUE-FBLY MKHYUYE, EUMY DMS LFPZP ZHBMB VKhDEF YURPMSHЪPCHBFSHUS ZHPTNBF GD2,
# RPFPNH UFP DMS LBTsDPZP GYLMB TYUPCHBOYS LBTFSh YLPOLB VHDEF UOPCHB Y UOPCHB
# RTYCHPDYFSHUS L CHYDH, HDPVOPNH DMS VYVMYPFELY GD. b
# ЪTS CHSHCHRPMOSFSH PDOY Y FE CE VEURPMEOSCHE CHCHUYUMEOIS. NPTSEF UPDETTSBFSh CHOKHFTY
# UEVS RTPJUOSCHE PVMBUFY. CEMBFEMSHOP UFPVSh YLPOLY VSCHMY TBNETPN 40x40
# RELUEMEK. tBURPMBZBFSHUS SOY DPMTSOSCH CH DYTELFPTYY logos.
# PVCHUOP LFB DYTELFPTYS OBIPDYFUS H /usr/local/nagios/share/images/logos

2d_coords 160.99
# dCHNETOSCHE LPPTDJOBFSCH FPYULY, CH LPFPTPK VKHDEF OBIPDIFSHUS GEOPHT YLPOLY IPUFB
# ABOUT RPULPK LBTFE. NPZHF VSHCHFSH FPMSHLP RPMPTSYFEMSHOSHCHNY YUYUMBNY.
# tYUPCHBOYE LBTFSCH OBJOYOBEFUS YJ FPYULY 0.0 LPFPTBS SCHMSEFUS CHETIOYIN MECHSHCHN HZMPN LBTFSCH.
# LPPTDYOBFSCH RETEYUMSAPHUS H UMEDHAEEN RPTSDLE x, y,

3d_coords 20.0,32.0,6.0
# LPPTDYOBFSCH GEOFTB LHVB, UYNCHPMYITHAEEZP IPUF H RTPUFTBOUFCHE FTEINETOPC
# LBTFS. NPZHF VSHCHFSH LBL RPMPTSYFEMSHOSHCHNY, FBL Y PFTYGBFEMSHOSHCHNY YUYUMBNY.
# TBNET PDOPC UFPTPOSCH LHVB 0.5 EDYOYG.
# pFTYUPCHLB LBTFSCH OBJOYOBEFUS GEOFTB FTEINETOPK LBTFSCHK, LPFPTSCHK
# OBIPDYFUS H FPULE U LPPTJOBFBNY 0.0, 0.0, 0.0.
# LPPTDYOBFSCH RETEYUMSAPHUS H UMEDHAEEN RPTSDLE x, y, z
notes_url http://192.168.80.2/nagios/notes/3com_lan.txt
# UUSCHMLB ABOUT BDTEU, RP LPFPTPNH METSYF ZHBKM
# RTY EEMLE ABOUT UREGEIBMSHOSHCHK OBYUPL CH VTBHJETE VHDEF PFLTSCHF YFP ZHBKM
# fp rpmop dms
# YBVMPO PRYUBOYS IPUFB Nagios. obrtynet, fbn nptsop obryubfsh dboosche, pfcheyubaeye
# ABOUT CHPRTPU, LFP Yb BDNYUFTBFPTPCH PFCEEUBEF bHRTBCHMEOYE FFYN UETCHETPN. th L LPNKh
# PVTBEBFSHUS CH UMHYUBE RTPVMEN.
# pVTBFIFE CHOYNBOYE ABOUT URL, YURPMSHEKHENSCHK DMS HLBBOYS RHFSH L ZHBKMH. DMS FPZP, YuFPVShch
# ZhBKMSCH U ЪBRYULBNY NPTsOP VSCHMP ITBOIFSH ABOUT FPN CE IPUFE, UFP Y Nagios, S UPDBM
# DYTELFPTYA /usr/local/nagios/share/notes
# YNEOOP RP FBLPNH URL.
}

define hosttextinfo(
host_name Win_2000
notes_url http://listios.lan.domain.ru/Win_2000.html
# LUFBFY, UFPYF PFNEFYFSH, UFP DPVBCHPYUOSCHE BRYULY P IPUFBI NPZHF ITBOIFSH
# OE FPMSHLP ABOUT FPN CE IPUFE, ZDE TBVPFBEF Nagios, OP Y ABOUT MAVPN DTHZPN.
# zMBCHOPE, UFPVSh FBN TBVPFBM web-REPORT URL VSCHM RTBCHIMSHOP RTPRYUBO
icon_image win40.png
icon_image_alt Windows workstation
vrml_image win40.png
statusmap_image win40.gd2
2d_coords 163.195
3d_coords 15.0,38.0,6.0
}

define hosttextinfo(
host_name Linux
notes_url http://10.10.5.7/hostinfo.pl?host=Linux1
# h LBYUEUFCHE URL DMS ITBOOEIS DPVBCHPYUOSCHI BRYUPL NPTsOP YURPMSHЪPCHBFSH DBCE
# CGI. h BCHYUYNPUFY PF DBOOSHI, RETEDBOOSCHI H BRTPUE, CHSH VKHDEF RPMHYUBFSH
# UCHEDEOYS P FPN YMY YOPN IPUFE.
icon_image_alt Linux Workstation
vrml_image mandrake.gd2
statusmap_image mandrake.gd2
2d_coords 60,198
3d_coords 30.0,38.0,6.0
}

define hosttextinfo(
host_name Mail
notes_url http://192.168.80.2/nagios/notes/mail.html
icon_image MailServer.png
icon_image_alt Mail Server
vrml_imageMailServer.png
statusmap_image MailServer.gd2
2d_coords 520,183
3d_coords 20.0,44.0,6.0
}

define hosttextinfo(
host_name WWW
notes_url http://192.168.80.2/nagios/notes/www_notes.html
icon_image openbsd.png
icon_image_alt WWW Server
vrml_image openbsd.gd2
statusmap_image openbsd.gd2
2d_coords 439,186
3d_coords 20.0,54.0,6.0
}

define hosttextinfo(
host_name Inner_Firewall
notes_url http://192.168.80.2/nagios/notes/inner_fw_notes.html
icon_image freebsd40.png
icon_image_alt Inner Firewall
vrml_imagefreebsd40.png
statusmap_image freebsd40.gd2
2d_coords 326.96
3d_coords 17.0,55.0,6.0
}

define hosttextinfo(
host_name Outer_Firewall
notes_url http://192.168.80.2/nagios/notes/outer_fw_notes.html
icon_image firebox_small.png
icon_image_alt Outer Firewall
vrml_image firebox_small.png
statusmap_image firebox_small.gd2
2d_coords 620.80
3d_coords 16.0,42.0,6.0
}

define hosttextinfo(
host_name 3com_Dmz
notes_url http://192.168.80.2/nagios/notes/3com_dmz.html
icon_image3Com.png
icon_image_alt 3Com DMZ LAN Switch
vrml_image 3Com.png
statusmap_image 3Com.gd2
2d_coords 480.73
3d_coords 14.0,56.0,6.0
}

FERETSH RTYYMP UBNPE CHTHENS PVUHDYFSH UPDETSYNPE JBKMB serviceextinfo.cfg. rTYOGYRSCH RPUFTPEOYS PVPYI ZHBKMPCH DPCHPMSHOP UIPTSY.

define serviceextinfo(
host_name WWW
# yNS IPUFB, ABOUT LPFPTPN TBVPFBEF UETCHYU

service_description HTTP
# YNS WETCHYUB YJ JBKMB services.cfg


# XCE NOPZPLTBFOP CHYDEOOSHCHK OBNY URL VMS DPRPMYFEMSHOSHCHI BRUEPL

icon_image apache.png
# yNS ZHBKMB YLPOLY, LPFPTBS VHDEF PFPVTBTSBFSHUS TSDPN U YNEOEN UETCHYUB
# YLPOLB NPTSEF VSHCHFSH CH ZHPTNBFE GIF, PNG YMY JPG. NPTSEF UPDETTSBFSh CHOKHFTY
# UEVS RTPJUOSCHE PVMBUFY. CEMBFEMSHOP, UFPVSh YLPOLY VSCHMY TBNETPN 40x40
# RELUEMEK. tBURPMBZBFSHUS SOY DPMTSOSCH CH DYTELFPTYY logos.
# PVCHUOP LFB DYTELFPTYS OBIPDYFUS H /usr/local/nagios/share/images/logos

icon_image_alt Web Service
# OBDRYUSH, PFPVTBTSBENBS, EUMY web-UETCHETH OE HDBEFUS BLZTHYFSH YLPOLH RTYCHSBOOHA,
# L WETCHYUKH
}

define serviceextinfo(
host_name WWW
service_description SMTP
notes_url http://192.168.80.2/nagios/notes/service_www.html
icon_image apache.png
icon_image_alt Web Service
}

define serviceextinfo(
host_name Mail
service_description SMTP
notes_url http://192.168.80.2/nagios/notes/service_smtp.html
icon_image smtp.png
icon_image_alt Web Service
}

define serviceextinfo(
host_name Mail
service_description POP3
notes_url http://192.168.80.2/nagios/notes/service_pop3.html
icon_image pop3_imap.png
icon_image_alt Web Service
}

define serviceextinfo(
host_name Mail
service_description IMAP
notes_url http://192.168.80.2/nagios/notes/service_imap.html
icon_image pop3_imap.png
icon_image_alt Web Service
}

DMS FPZP, UFPVSCH Nagios HCHYDEM UPDBOOSCHE OBNY ZHBMShch hostextinfo.cfg, serviceextinfo.cfg, OHTSOP CHOEUFI H JBKM cgi.cfg UMEDHAEEE DYTELFYCHSHCH.

xedtemplate_config_file=/usr/local/nagios/etc/hostextinfo.cfg xedtemplate_config_file=/usr/local/nagios/etc/serviceextinfo.cfg

with DKHNBA, ChSCH UNPTSEFE UBNPUFPSFEMSHOP RPMPTSYFSH ZHBKMSCH YLPOPL CH DYTELFPTYA /usr/local/nagios/share/images/logos/. lUFBFY, UFPYF PVSBFEMSHOP HVEDYFSHUS, YUFP Chueh ZHBKMSCH, UPDBCHBENSCHE CHBNY, RTYOBDMETSBF RPMSHPCHBFEMA PF YNEOY LPFPTPZP TBVPFBEF the Nagios, YOBYUE BL VHDEFE PYUEOSH DPMZP OEDPHNECHBFSH, RPYUENH OYLBLYI YNEOEOYK B LBTFBI OE CHYDOP, IPMF Chueh UDEMBOP FPYUOP, LBL B FPK UFBFSHE. L FBLYN ZHBKMBN PFOPUSFUS hostextinfo.cfg serviceextinfo.cfg

LUFBFY, UPDBCHBFSH UBNPUFPSFEMSHOP ZHBKMSCH YLPOPL CH ZHPTNBFE VYVMYPFELY GD DPCHPMSHOP RTPUFP. NS ZPCHPTYMY PV LFYI ZHBKMBI PE CHTENS PVUHTSDEOYS FEZB statusmap_image ZHBKMB hosttextinfo.cfg. DMS LFPZP OHTSOP CHЪSFSH ZHBKMSCH YLPOLY CH ZhPTNBFE png Y RTEPVTBBPCHBFSH EZP H ZhPTNBF GD U RPNPESHHA HFIMYFSHCH pngtogd2, RPUFBCHMSCHYEKUS CHNEUFE U VYVMYPFELPK GD. CEMBFEMSHOP, UFPVSCH UPDBCHBENSCHK ZHBKM VSCHM UPITBOEO VE LPNRTEUUIY YЪPVTBTSEOIS. FP RPCHPMYF HCHEMYYUYFSH ULPTPUFSH TBVPFSCH ZHOLGYK VYVMYPFELY GD, PFCHEYUBAEYI SB OBZTHLKH CH RBNSFSH Y TYUPCHBOYE YLPOPL CHOHFTY YOFETZHEKUB Nagios. eUMY DBOOSCHE CHOKHFTY ZHBKMB OE UTSBFSCH, OBBYUF OE OHTSOP FTBFIFSH CHTENS ABOUT YI TBURBLPCHLH. hyuyfshchchbs Nbmshchk tbnet obyi lbtfyopl, utsbfye oe rtyouef oylbpk chshchzpdshch.

OBRTYNET, DMS LPOCHETFBGYY ZHBKMB www.png H www.gd2 OKHTSOP RPDBFSH UMEDHAEHA LPNBODH.

$ /usr/local/bin/png2gd2 www.png www.gd2 4000 1

with DKHNBA, U RETCHCHNY DCHNS RBTBNEFTBNY CHUE SUOP. ftEFYK HLBSHCHCHBEF TBNET RPTGYY LPDYTPCHBOYS, Y YUEFCHETFSHKK - LFP, UPPFCHEFUFCHEOOP, OBMYYUYE LPNRTEUUYY. rPUME OELPFPTPZP LPMYUEUFCHB OBVMADEOYK ЪBNEYUEOP, YuFP Ch LBYUEUFCHE TBEBNETB RPTGYY LPDYTPCHBOYS NPTsOP RYUBFSH LBLPE HZPDOP YUYUMP. DMS YUIPDOSHI ZHBKMPCH NBMPZP TBNETB, L LPFPTSCHN PFOPUSFUS Y OBYY YLPOLY, FFPF RBTBNEFT UNSHUMB OE YNEEF.

th OE ЪBVHDSHFE RPDBFSH RTPGEUUH nagios LPNBODH reload, LPFPTBS ЪBUFBCHYF EZP PVOCHYFSH LPOZHYZHTBGYA. np FreeBSD ffp pwwwop DEMBEFUS FBL /usr/local/etc/rc.d/nagios.sh reload.

eUMY EUFSH TSEMBOYE, NPTsOP OBTYUPCHBFSH UCHPY UPVUFCHEOOOSCHE YLPOLY Y YURPMSH'CHBFSH YI CHNEUFP UFBODBTFOSCHI. with YNEOOP FBL RPUFHRIM U WETCHYUBNY HTTP, SMTP, POP3 AND IMAP. DMS HTTP YURPMSHЪPCHBMPUSH RETP, RPFETSOOPE YODEKGEN Apache, B DMS CHUEI PUFBMSHOSHCHI YЪPVTTBTSEOIE PFLTSCHFPZP Y BLTSCHFPZP RPYUFCHPZP LPOCHETFB. th IPFS LBTFYOLY RPMKHYUYMYUSH TBNETPN YUHFSH VPMEE, YUEN 40x40 RYLUEMEK, Nagios TBVPFBM U OYNY DPCHPMSHOP IPTPYP. rPMAVPCBFSHUS ABOUT TEEKHMSHFBF NPTsOP ABOUT UMEDHAEEK LBTFYOL.


FERETSH H LBTsDPZP IPUFB Y UETCHYUB EUFSHOE FPMSHLP MYUOBS YLPOLB, OP Y ABOUT UFTBOYUL U RPDTPVOK YOZHPTNBGEK P LBTsDPN YЪ OYI CHPOYLMP CHPF FBLPE YЪPVTTSEOYE.

eUMMY OBTSBFSH OB OEZP, FP NPTsOP RPYUYFBFSH DPRPMOIFEMSHOSHE UCHEDEOYS YJ ZHBKMB, LPFPTSCHK NSCH PRYUBMY FEZPN notes_url.

lPPTDYOBFSch FPYUEL, B LPFPTSCHI DPMTSOSCH TYUPCHBFSHUS YLPOLY J PVYAELFSCH OBYYI IPUFPCH RMPULPK OF TH FTEINETOPK LBTFBI UEFY, OE VHDHF YURPMSHPCHBFSHUS Nagios DP FEI RPT, RPLB NShch OE CHSCHUFBCHYN PEF FBLYN PVTBPN OBYUEOYS FEZPCH default_statusmap_layout J default_statuswrl_layout B ZHBKME cgi.cfg.

default_statusmap_layout=0 default_statuswrl_layout=0

eUMY CHUE UDEMBMY RTBCHYMSHOP, FP RMPULBS LBTFB UEFY VKhDEF ChSCHZMSDEFSH CHPF FBL. CHREYUBFMSEF, OE RTBCHDB MY?


fTEINETOBS LBTFB ChSchZMSDYF FPTS DPCHPMSHOP IPTPYP. y UBNPE RTJSFOPE CH LFPN FP, UFP CH FTEINETOPE RTPUFTBOUFCHP NPTsOP DPVBCHYFSH, OBRTYNET, RPDTPVOSHCHK NBLEF EDBOIS, CH LPFPTPN LFB UEFSH OBIPDIFUS, Y RPUFBCHYFSH UETCHETB CH OHTSOSHI. oP PV LFPN NSC RPZPCHPTYN H DTHZPK UFBFSH. OH B EUMY CHNEUFP CHPCDEMEOOOPK LBTFSCH ABOUT LTBO RPSCHYMBUSH UMEDHAEBS OBDRYUSH:

You have not supplied any host drawing coordinates, so you cannot use this layout method. Read the FAQs for more information on specifying drawing coordinates or select a different layout method.

OBBYUYF, ChSCH YUFP-FP OBRHFBMY U FEZBNY LPPTDYOBF PFTYUPCHLY.

eEE PDOPK Y RPMEOSCHI CHPNPTSOPUFEK, LPFPTHA NSCH UEZPDOS YIKHYUYN, VKhDEF HNEOYE DPVBCHMSFSH CH UFTBOIGSHCH, UPDBCHBENSCHE Nagios, UCHPY CHUFBCHLY Y BAZPMCHLY. lBTsDBS UFTBOYGB NPTsEF YNEFSH DCHB ЪBZPMCHLB Y DCHE CHUFBCHLY. pVSCHYUOP FBLYN PVTBYPN CH FELUF UFTBOIGSHCH NPTsOP CHUFBCHMSFSH LPTRPTTBFICHOKHA UYNCHPMYLKH, URTBCHPYUOSCHE FEMEZHPOSHCH Y RTPUYE UCHEDEOYS, PFOPUSEYEUS L CHSCHVTBOOPK UFTBOYGE.


CHUE BZPMPCHLY UFTBOIG Y CHUFBCHLY DEMSFUS ABOUT ZMPVBMSHOSH AND MPLBMSHOSHCHE. zMPVBMSHOSCHE DEKUFCHHAF ABOUT CHUE UFTBOIGSHCH cgi, B FELUFSCH, ЪBRYUBOOSHCH CH ZHBKMBI ЪBZPMPCHLPC Y TBTSCHCHPCCH UFTBOIG, CHUFBCHMSAFUS CH OBYUBMP Y LPOEG FEZB UFTBOIGSHCH, UPDBCHBENPK cgi. pVSCHUOP FELUF UFTBOIGSHCH RPUME PVTBVPFLY CHSCHZMSDYF FBL:

ZMPVBMSHOSHCHK ЪBZPMCHPL MPLBMSHOSHCHK ЪBZPMCHPL RETCHPOBYUBMSHOSHCHK FELUF ZMPVBMSHOBS CUFBCHLB MPLBMSHOBS CUFBCHLB

DBCHBKFE RPUNPFTYN, UFP OHTSOP UDEMBFSH DMS FPZP, UFPVSH LFP TBVPFBMP ABOUT RTYNET ZHBKMB status.cgi. h DYTELFPTYY /usr/local/nagios/share/ssi

Common-footer.ssi - ZhBKM ZMPVBMShOPZP ЪBZPMCHLB common-header.ssi - ZhBKM ZMPVBMShOPK ČUFBCHLY status-footer.ssi - ZhBKM MPLBMShOPZP ЪBZPMCHLB status-header.ssi - ZhBKM MPLBMShOPK HUFBCHLY

with DHNBA, CHUE HCE UPPVTBJMY, UFP YNS DMS ZHBKMPCH MPLBMShOPZP ЪBZPMCHLB Y MPLBMSHOPK CHUFBCHLY PVTBHEFUS U RPNPESHHA UTBEYCHBOYS YNEOY RPDPRSHFOPZP ZHBKMB cgi U OBDRYUSNY -footer.ssi Y. oHTsOP RPNOYFSH, YUFP UPDETTSYNPE CHUEI CHSCHYERETEYUYUMEOOSCHI ZHBKMPCH RETED DPVBCHMEOYEN B GEMECHPK ZHBKM OYLBL PVTBVBFSCHCHBEFUS OE, OP EUFSH UPDBFSH DYOBNYYUEULYE BZPMPCHLY J CHUFBCHLY VE VEHNOSCHI HIYETEOYK OE RPMHYUYFUS, RPFPNH YUFP RFU CHPNPTSOPUFY YURPMSHPCHBFSH B LBYUEUFCHE ZEOETBFPTB DBOOSCHI cgi YMY YUFP-MYVP DTHZPE. rPMHYUBEFUS, UFP CHLMAYUBENSCHE ZHBKMSCH DPMTSOSCH UPDETTSBFSH CH UEVE FPMSHLP YUYUFSHCHK html.

dBCHBKFE TBUUNPFTYN UPDETTSYNPE CHUEI ZHBKMPCH, RTYNEOSCHYIUS H FP RTYNETE:

jBKM common-footer.ssi


rp CHPRTPUBN FEIRPDDETZLY PVTBEBFSHUS ABOUT [email protected] YMY
http://onix.opennet.ru


jBKM common-header.ssi




jBKM status-footer.ssi


tBEDEMYFEMSH UFTBOIGSHCH status.cgi



jBKM status-header.ssi


feufpchshchk bzpmpchpl status.cgi


lBL CHSC NPZMY HVEDYFSHUS, CHUE LFP TBVPFBEF DPCHPMSHOP RTPUFP. eEE PDOK CHLHUOPUFSHHA, LPFPTPK S U CHBNY RPDEMAUSH, VKHDEF URPUPVOPUFSH RTYCHSCHCHBFSH RTPIZTSCHCHBOYE CHHLPCHSCHI ZHBKMPCH L PRTEDEMEOOOSCHN UPVSCHFISN. obrtynet, NPS UYUFENB NPOYFPTYOZB RTY HNYTBOY LBLPZP MYVP UETCHYUB OBYUYOBEF YЪPVTBTSBFSH TsBMPVOP NSCHYUBEKHA LPTPCHKH. fBLBS ChPЪNPTSOPUFSH PYUEOSH RPMEOB DMS BDNYOYUFTBFPTPCH, LPFPTSCHE OE IPFSF RPUFPSOOP UNPFTEFSH ABOUT web-YOFETZEKU Nagios OHTSOP CHUEZP MYYSH PFLTSCHFSH H VTBHETE YMY RTYLTERYFSH ABOUT Active Desktop PDOH YЪ LFYI UFTBOIG tac.cgi, status.cgi. RPUME LFPZP NPTsOP NYOYNYYTPCHBFSH VTBHET Y BOINBFSHUS UCHPYNY DEMBNY. LBL FPMSHLP UMHYUYFUS LBLPE-MYVP YOFETEUKHAEYE OBU UPVSCHFIYE, Nagios OBYUOEF CHPURTPIYCHPDYFSH BCHL, UCHSBOOSHCHK U OIN. DMS PUHEEUFCHMEOYS OBYI CEMBOYK EUFSH UMEDHAEIE FEZY:

Host_unreachable_sound - IPUF OEDPUFHREO host_down_sound - IPUF OE TBVPFBEF service_critical_sound - UETCHYU B LTYFYYUEULPN UPUFPSOYY service_warning_sound - UETCHYU B UPUFPSOYY RTEDHRTETSDEOYS service_unknown_sound - UPUFPSOYE UETCHYUB OEYCHEUFOP normal_sound - Chueh TBVPFBEF PFMYYUOP, OEF OYLBLYI RTPVMEN

prgya normal_sound RTBLFYUEULY OILFP OE YURPMSHHEF. OP ABOUT CHUSLYK UMHYUBK WITH TEYM HER HRPNSOHFSH.

LCA FPZP YUFPVSCH CHHLPCHPE PRPCHEEEOYE BTBVPFBMP, OHTSOP RPNEUFYFSH ZHBKMSCH CHHLPCH H ZHPTNBFE wav CHOHFTSH DYTELFPTYY / usr / local / nagios / share / media /, LBL CHUEZDB, P OE BVSCHFSH RTBCHBI RPMSHPCHBFEMS J RTYOBDMETSOPUFY ZHBKMPCH. b ЪBFEN DPVBCHYFSH UMEDHAEYE BRYUY CH ZHBKM cgi.cfg.

Host_unreachable_sound=hostunreachable.wav host_down_sound=host down.wav service_critical_sound=servicecritical.wav service_warning_sound=servicewarning.wav service_unknown_sound=service unknown.wav normal_sound=noproblem.wav

h UMHYUBE,EUMY CH RTPGEUUE NPOYFPTYOZB VHDEF PVOBTHSEOP PDOCHTENEOOP OEULPMSHLP RTPVMEN, Nagios OBYUOEF RTPIZTSCHCHBFSH BCHL DMS OBYVPMEE LTYUOPK YЪ OII. rPUME DEUSFLB YMY DCHHI RPCHFPTEOYK PDOPZP Y FPZP TSE ЪCHHLB CHBN, OVERCHETOP, ЪBIPYUEFUS PFLMAYUYFSH ЪCHHL. UDEMBPSH LFP DPCHPMSHOP MEZLP: OHTSOP RTPUFP CHPKFY CH TETSYN HRTBCHMEOYS UETCHYUPN YMY IPUFPN Y RPDBFSH LPNBODH RPDFCHETSDEOYS RTPVMENSCH.

rPUME RPDPVOPK PVTBVPFLY ЪBRYUY CH FBVMYGE UETCHYUPCH YMY IPUFCH RTYNHF CHPF FBLPK CHYD.


with DHNBA, ABOUT UEZPDOS ICHBFIF ZTSCHEFSH ZTBOYF OBKHLY, Y RPTB DBFSH NPZBN PFDPIOHFSH. rPJCHPMA UEVE RRPTPEBFSHUS U CHBNY CH LFH TBDPUFOHA NYOHPHH.

Nagios is an open source information systems monitoring program. The product is practically the standard for monitoring systems. It allows (including):

  • monitor hosts (processor load, disk usage, logs, etc.) with a variety of operating systems - Windows, Linux, AIX, Solaris, etc.;
  • control network services (SMTP, POP3, HTTP, SSH, etc.);
  • connect additional extension modules (plugins) in any programming language (Shell, C++, Perl, Python, PHP, C#, etc. - the module architecture must be open), use your own methods for checking services;
  • perform parallel checks of systems (to improve performance);
  • send alerts in case of problems via e-mail, SMS messages, etc.;
  • automatically respond to service or host events.

Installing Nagios

Nagios is an open source project that is available for installation both in source codes and in prepared packages for various Linux clones. It is clear that the installation from source is more recent than the prepared packages.

Installation from prepared packages is carried out according to the rules of the corresponding version of the operating system. For example, for Ubuntu the command would look something like this:

apt-get install nagios2

This ensures that all libraries required for it to work are installed and is the simplest method recommended for normal users.

The procedure for quick installation of the program on Ubuntu is described on the website in the documentation section (http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html). Please note that the installation from source must be followed by the installation of the necessary plugins and add-ons.

After the installation is complete, you can check the operation of the program by opening the http://localhost/nagios/ page (instead of localhost, you should use the name of the Nagios server if you open the page from a remote computer). When prompted for authorization parameters, you must enter the name nagiosadmin and the password that you assigned to this account in the previous steps.

On fig. 7.14 shows one of the pages of the program - the structure of a small system controlled by Nagios (the scheme is built automatically in Nagios).

Rice. 7.14.
Network diagram in Nagios

A little about the logic of Nagios

Nagios can be conditionally represented as two parts: a server (actually, its installation was discussed in the previous subsection) and a client, i.e. a system that is controlled with or without an agent installed.

There are various versions of agents installed on operating systems. Most often, for Linux-based systems, the NRPE program is used (the link to this plugin is available on the official Nagios website - http://www.nagios.org/), and for Windows computers - NSClient++ (http://trac. nakednuns.org /nscp/).

    Note

    Historically, the first Windows client was a variant of the NPRE program. For compatibility purposes, NSClient++ retains the protocol used by NPRE. In the client settings, you can specify the use of any work option, or both (some plugins, for example, are developed for a specific version of the client). Note that in some cases NPRe provides more control, such as making it easy to set up scripts to run on the controlled system itself.

Note that each client must be configured as described in the following sections.

With the help of clients, active monitoring of work takes place: the server initiates a command specified by the settings on the client and analyzes the received data. In addition, a passive mode of operation is possible in cases where data is sent to the server at the initiative of the client. For example, this is how SNMP traps are handled.

As already mentioned, special commands (or programs) are run on the Nagios server to receive information from the client. In terms of Nagios, these commands are called plugins.

    Note

    Plugins are easy to find on the Web: Nagios has a link to projects on SourceForge.net, you can use the plugin exchange site http://www. monitoringexchange.org/ and other sources.

In order for the monitoring system to be able to use them, such commands must be described in a special configuration file - commands.cfg. It is these descriptions in terms of Nagios that are called control commands.

In addition to describing the command itself, the monitoring system needs to know which systems to check, how often to run the check command, whether it is necessary to take breaks in its use (for example, not to execute on certain days of the week or at specified periods of the day, etc.). The set of such settings in Nagios is usually called a service, and they are defined by a separate block in the file that describes the parameters of the controlled system. Since there are many parameters in the service (about a dozen and a half) and many of them are usually repeated, it is customary to describe the repeating parts in templates (template), and simply point to such a template directly in the service description (template descriptions are stored in the templates.cfg file). Please note that nesting is allowed in templates: some of the parameters can be separated into a separate template and used in other descriptions.

Each controlled system must be described in the Nagios configuration. For convenience, this is done in separate files (by device types), which are included in the overall configuration when the server starts. Initially, links to these files "by directions" are commented out, so if you need to start monitoring any class of devices, first of all, you should delete the "#" symbol in the corresponding line of the nagios.cfg file, and then add the system description block to the appropriate file.

As a result, Nagios periodically executes the specified commands on monitored systems, collects the results, and notifies operators in the event of a critical event. Control results can be saved (by default, performance data is not stored) and presented in a graphical form for analysis (see the section "Graphing in Nagios"). Nagios also allows you to assign commands that will be executed when events occur. In this way, you can automatically troubleshoot problems that occur.

If the system will control many computers and devices, then it is convenient to group them. In Nagios, you can create groups of computers (devices) and services. For example, if you want to monitor the status of all services on servers, then you should create a group that includes the names of these systems. And if you want to monitor the status of, for example, a DNS name resolution service that runs on multiple physical systems, then it is convenient to create a group for the service: it will be enough to see the status of the entire group as normal to be sure that DNS services are working on all computers . This can simplify administration and monitoring settings.

Of the general configuration settings, we also note the parameters of operators - those people to whom the program will send messages in the event of certain events. In Nagios, individual operators can also be combined into groups and configured to send messages of a certain type to a specific group of specialists. You can also set up time periods. They can be used to apply, for example, different types of control on weekdays and weekends, for different ways of notifying administrators (for example, by e-mail during the day, and by pager at night), etc.

Alerts can be escalated: in the event of repeated events, an alert can be sent up the hierarchy to the next specialist.

Structure of Nagios Configuration Files

The list of standard Nagios configuration files is given in Table. 7.1.

Table 7.1.
List of Nagios configuration files

File name

Purpose

Basic configuration file. Contains the name and address of the Nagios administrator, links to configuration files imported at system startup

Resource description file. Contains synonyms to hide the actual location paths of Nagios commands from the end user to improve security

Web server settings options. This file describes additional Nagios users and the permissions granted to them.

Object folders, etc.

Folders with individual files that are imported into the configuration when Nagios starts. These folders are described in the nagios.cfg file

Description of Nagios commands

Nagios commands are described in the commands.cfg file (the default path is /usr/local/nagios/etc/object/commands.cfg).

In practice, in the commands.cfg file, you usually need to specify the location of the executable, its name, which will be used in Nagios, and the parameters of the launch line. By default, the configuration file of the installed system already contains some descriptions of typical verification commands (ping checks - check_ping, http server checks - check_http and many others). Based on these samples, you can easily create your own verification teams, although they usually use ready-made designs, which, for almost any control option, can be easily found on the Web. The following is an example of a description of the simplest command - checking the reachability of a host using the ping command:

This description creates a command named check-host-alive, using the check_ping command from the installed Nagios utilities as the executable. The symbols enclosed in dollar signs indicate the variables used. In terms of Nagios, these are macros (macros) that are replaced by values ​​at the time of execution. Since we are usually used to a different definition of macros, we will refer to these names as variables throughout this book. $hostaddress$ is traditionally replaced when called with the name of the system under test, and $arg1$, $arg2$, etc. - sequentially with the arguments specified in the service description. The keys w and c define the values ​​that will be used to generate the warning (w) or error (c) status. As a rule, you can specify absolute or relative values ​​(or both: in a typical configuration, for example, the w parameter is specified as 3000.0.80%). The last switch (-p) specifies that the ping command should send five probe packets.

Nagios Services

Services are usually described in configuration files separately for each type of controlled systems (in the general Nagios configuration, such files are imported by the cgf_file=... directives in the nagios.cfg file). Building configuration files starts with template descriptions, followed by host descriptions and then service descriptions.

In a service description, you can no longer repeat common values ​​from templates, so a typical service definition might look something like this:

In this example, the service named Memory Usage uses the settings from the generic-service template for the host described under the name winserver to operate. As a command, the service runs check_nt with the command line options memuse and -w 80 -c 90 (the second options specify which return value of used memory should be considered critical - 90%, and which should be set to warning - from 80 to 90%; themselves parameters are listed through the symbol "!").

Usually, the same command can be used to control devices of the same type. In this case, in the description of the service, it is enough to list all such devices separated by commas:

You can define dependencies for services. This is done in order to hide the "extra" warnings. For example, if some of the systems are located in the local network after the router, then you can determine their dependence on this device. It is clear that if this router fails, then all devices behind it will be inaccessible. Configuring a dependency will allow, in the event of a dependency failure, to hide warnings about the unavailability of dependent devices until the switch is restored and not to check the status of the corresponding services on them.

Description of controlled systems in Nagios

For convenience, different types of controlled systems are usually described in different configuration files. The list of typical configuration files used is given in usr/local/nagios/etc/nagios.cfg, and some of the files are commented out. So, if you need to control switches in the network, then uncomment the line #cfg_file=/usr/local/nagios/etc/objects/switch.cfg, etc.

The description of the host itself (it will be contained in the windows.cfg file, or switch.cfg, or printer.cfg, etc.) can minimally look like this in this case:

There are two parameters that can be included in the host description that will determine the actions to be taken in the event of a system failure:

Nagios will execute the check-host-alive command and as soon as a change in the state of the host is detected, the server-reboot program will be executed. In this way, you can, for example, start stopped services on monitored servers, reboot systems, etc.

For convenience of analysis, hosts can be combined into groups. To do this, you need to describe the group in the configuration file as follows:

Just as for services, for hosts, you can describe the dependencies of some systems on others.

Description of time parameters

Time parameters are used in various configurations: in descriptions of hosts (the period when you need to monitor and the period when you need to send messages), services and contacts (periods when you can send messages by hosts and by services). The syntax for defining a new period is easily understood from the examples included in the /usr/local/nagios/etc/objects/timeperiods.cfg file.

It is necessary to give a name to the template in the description and list line by line the time ranges that are included in it. Moreover, you can use the names of the days of the week, months and serial numbers (last / first Monday of the month). Time periods can be listed separated by commas. If necessary, periods described in another template can be excluded from one template by using the exclude directive followed by enumeration of time periods (separated by commas).

Using Nagios built-in control commands

With a standard installation of Nagios and plugins, it contains a number of commands (plugins) that can be used to control systems. A list of them is given in Table. 7.2.

Table 7.2.
List of Nagios plugins

Utility

Purpose

Controlling updates to Linux systems using apt-get commands. Allows you to start the update process when configured accordingly

Breezecom Wi-Fi Signal Strength Control

This plugin allows you to run commands on a remote system using the SSH protocol

Checking the connection of CLAMD (antivirus program) with a remote host

Checking the Status of Hosts in a Linux Cluster

Checking the availability of DHCP servers on the network

Checking the DNS service on the host (using the dig command)

Checking disk space usage (native and mounted disks)

Checking the usage volume of drives connected via the SMB protocol (usually these are drives from Windows systems)

Checking DNS Server Operation Using nslookup

Tuning plugin: simply returns the numeric parameter and string described when it was run

Checking when files were created

Flexlm license manager service check

Checking ftp connection to remote host

Checking the status of Hewlett Packard printers with an installed JetDirect card (checking is carried out using the SNMP protocol)

Checking http connections to a remote system. The check can be carried out both over the HTTP protocol and over the HTTPS protocol. You can control the connection establishment time, the validity period of the server certificates, as well as the server response (by searching for some specified string in the response, including the use of regular expressions)

Checking remote hosts via ICMP protocol

Checking the status of a local disk (on a Linux system) using S.M.A.R.T. technology

check_ifoperstatus

Checking the status of the network interface on a given Linux system

Checking the status of a network interface on a given Linux system

Checking the operation of a remote host via the IMAP protocol. You can analyze the server response to the imap request string sent to it

Checking the Nagios IRCD Plugin

Testing a JABBER connection to a remote host

Checking the LDAP server (you can send a request to search for the corresponding attribute)

The same check of the LDAP server, only using secure connections (using the SSL protocol)

Checking Linux Boot

Checking Linux system logs for some sequence of characters

Checking the number of messages in the mail server queue (works with different versions of sendmail, qmail)

Checks the given variable in the MRTG (Multi Router Traffic Grapher) log for minimum/maximum values ​​(check_mrtgtraf should be used to control performance parameters)

Checks the outgoing and incoming traffic values ​​of the switches recorded in the MRTG log. Requires initial installation of MRTG package (http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html)

Checks the state of the Nagios process on the local machine

Checking the NNTP connection to the specified host

The same, but using the NNTPS protocol

NRPE Nagios Plugin

This plugin collects data from the NSClient service on Windows systems

Checking the NTP server. It is recommended to use check_ntp_peer instead of this plugin

Checking the NTP server. Allows you to evaluate, including the jitter (jitter) of the time signal

This plugin checks the time difference between a local server and a specified remote time server

Used to collect data from Novell servers. Requires installation of additional packages

Checks the connection to the Oracle server, allows you to evaluate the size of the databases and the availability of free space, the state of the cache buffers, etc.

Checks the status of the Over-CR collector daemon on a remote system (http://www.molitor.org/overcr)

Tests a connection to a remote system using ping packets

Checking remote hosts using the POP protocol. Allows you to send a query string to the mail server and parse the server response

Checks the status of Linux system processes

Checks the status of the REAL service (RTCP connections)

Checks the status of an RPC service on the specified host

Checks the status of hardware sensors on a Linux system. Information from sensors is obtained using the lm_sensors package

Verifies an IMAP secure channel connection to the server. Controlled response time and content (by analyzing the response to a given request), the validity of certificates

Checks the SMTP connection to the server. The mail server response can be parsed for the given strings. Response time is also controlled

Scanning remote systems (and getting data from them) via SNMP

Verifies a POP connection over a secure channel to the server. Controlled response time and content (by analyzing the response to a given request), the validity of certificates

Checking the connection to the SSH server

Checks the SMTP connection over a secure channel to the server. The mail server response can be parsed for the given strings. Response time is also controlled

Checks for free space in the swap file of the local system

Checking the TCP connection to the specified system. The presence of a response, its time, the presence of specified strings in the response, etc. are checked.

Checking the time on the specified host

Checking the UDP connection to the specified system. The presence of a response, its time, the presence of specified strings in the response, etc. are checked.

Checking the status of uninterruptible power supplies on a local or remote Linux system. The plugin requires UPSD daemon (http://www.networkupstools.org) to be installed on the system.

Checking the number of users logged on locally

Checking the WI-FI signal level

Each of these plugins contains help information describing the features of its use (displaying help on the command<плагин>-h).

In order to use the plugin for system monitoring, Nagios must describe the command that uses it. The commands.cfg file contains some of the most commonly used examples of system control. In practical use of Nagios, this file should be extended with your own control commands.

Monitoring Windows Servers in Nagios

Several different agents have been developed for monitoring Windows-based systems. The most commonly used of these are NSClient++, NC_NET (http://sourceforge.net/projects/nc-net) and OpMonAgent (http://www.opmon.org/project/opmonagent.zip). The functionality of these agents is almost identical, so we will consider the use of the NSClient++ agent, which, in the author's opinion, is the most popular agent from the mentioned list.

The NSClient++ agent is available from http://trac.nakednuns.org/nscp/. This program can be downloaded both as an archive (zip) and as an installation file (msi), and different versions of the agent should be used for 32-bit and 64-bit platforms. If you downloaded the archive, then you need to unzip it to the desired folder and install the Windows service with the command

NSClient++ -install

It is more convenient to use an msi file, since in this case the installation wizard will immediately add some of the settings to the agent configuration based on the results of your answers (Fig. 7.15).

Rice. 7.15.
Configuring NSClient++ program settings.
The user settings entered during the installation phase will be saved by the program in the configuration file

After installation, you must allow the service to interact with the desktop, for which you should open the properties of the service ( Control panel | Administration | Services| find the NSClientpp... service (the full name depends on the version) and open its properties) and enable the option Allow desktop interaction.

Before starting the service, necessarily check its settings. To do this, open the nsc.ini file (in the agent's installation folder) and uncomment those lines that correspond to the program modules that are supposed to be used for system monitoring. Sufficiently detailed descriptions of the configuration parameters are given in the plugin documentation at http://trac. nakednuns.org/nscp/wiki/doc/Configuration.

When setting up a configuration, you should proceed from the principle that you should not include more options than are currently necessary. For example, if you do not plan to receive information through WMI queries, then you should not load the CheckWMI.dll module.

Pay attention to the ability to run the agent in diagnostic mode. In this case, you can both see potential errors in the configuration file and debug your own queries (Fig. 7.16).

Rice. 7.16.
NSClient++ program window in diagnostic mode

To run NSClient++ in diagnostic mode, just type

NSClient++ /test

In the NSClient++ window, you can, firstly, see the results of loading all modules, and secondly, enter your own commands and see the results of both requests from the Nagios server and local commands. On fig. 7.16 shows the plugin debugging window, in which the CheckDriveSize ShowAll MinWarnFree=20% MinCritFree=10% Drive=D:\ command is entered and the system response is visible.

The NSClient++ plugin allows you to control the parameters shown in Table. 7.3. Usage details are detailed in the technical documentation (http://trac.nakednuns.org/nscp/wiki/CheckCommands) and it is easy to write your own Windows health monitoring commands from the available examples.

Table 7.3.
Windows settings controlled by NSClient++

Parameter

Description

Controls the size of a file or folder

Controls the amount of free or used space on hard drives or removable drives (the type of drive can be selected in the command)

Controls files based on their creation date, last access time, file write, or file size

Looks for error messages in the log file. Since there are usually a lot of such messages, the use of this control heavily loads the system.

Monitors CPU usage for a configurable period of time

Controls system uptime

CheckServiceState

Monitors the state of the Windows service (a critical message is generated if the actual state of the service does not match the one specified as a parameter in the command). You can monitor all services at the same time by setting an exception. As the name of the service, you must specify the one that is displayed in the properties of the service

Monitors the state of Windows processes. In fact, it allows you to monitor the state of the process found by the name of the executable file. Can also be controlled by the number of simultaneously running processes

Monitors the state of virtual and physical memory; the parameter of the number of written memory pages is available (committed pages)

Monitors performance counter values. Counter objects are desirable - for ease of use - to be set in the descriptions of commands (services)

CheckAlwaysOK
CheckAlwaysCRITICAL
CheckAlwaysWARNING
CheckMultiple
CheckOK
CheckCRITICAL
CheckWARNING
CheckVersion

The so-called helpers. They return a predetermined value (which one can be judged by the name of the command). Used in the process of setting up and debugging the system

The listed list is not limited to the ability to control Windows systems. You can add controllable parameters, for example, through the use of external scripts.

Windows system monitoring can be performed using various protocols. The most commonly used protocols are NSClient and NRPE (for "passive" monitoring, you can also use the NSCA protocol, which you can read more about in the online documentation). In practice, you can use any of them, you only need to enable / disable the corresponding modules in the client settings file (nsc.ini). At the same time, in the opinion of the author, the NRPE protocol is somewhat more flexible in use and provides data exchange encryption. When using the NRPE protocol, the command syntax is built as follows:

check_nrpe ... -c<команда>-a<аргументы>

For example, checking available physical memory can be done like this:

check_nrpe -H 192.168.0.9 -c CheckMem -a MaxWarn=70% MaxCrit=>80% type=physical

Monitoring of Windows systems based on WMI

NSClient++ includes the CheckWMI.dll module, which allows you to control a Windows system using the WMI toolkit.

The CheckWMI module actually consists of two submodules: CheckWMIValue and CheckWMI. The CheckWMIValue module is optimized to control numerical values. For example, the current processor load (this is the number of percentages of the load) or the monitor resolution (the number of pixels), etc. In this command, you can simply specify the parameters to be controlled and the minimum/maximum values ​​allowed for them, for example, like this:

CheckWMIValue "(!LANG:Query=Select PelsWidth from win32_DisplayConfiguration" !}
MinCrit=640 MinWarn=800 Check:Width=PelsWidth

The command shown here is written for use in debug mode (nsclient++ /test). It queries the horizontal display resolution and reports a critical condition if it is equal to or less than 640, and issues a warning if the value does not exceed 800. Of the features of using this command, we note that after the query string (which is enclosed in quotes) you need to write parameters of minimum / maximum values ​​and only then specify the name of the parameter that is controlled by the command (PelsWidth). Let us also explain the Check option used on the command line. After Check, you must enter the name of the parameter that will be used in the control system (you can also save the name from the description in WMI, but it is often more convenient to enter your own name), and the name corresponding to the class object (the one that is displayed, for example, in the WMI viewer Object Browser).

Other examples (including options for the Nagios configuration) are available at http://trac.nakednuns.org/nscp/wiki/CheckWMIValue.

The CheckWMI module should be used when either parsing a string parameter returned from a WMI query or querying multiple values ​​is expected. When using CheckWMI, query strings become somewhat more complicated due to the need for filters. CheckWMI syntax is described at http://nsclient.org/nscp/wiki/CheckWMI/ CheckWMI. By their construction, CheckWMI queries are similar to filters used to analyze system operation logs.

Monitoring Linux Servers in Nagios

Linux servers are monitored using the NRPE plugin, which must be installed as a plugin on the Nagios server and as a daemon on the monitored Linux system. For installation, both the prepared version and the source codes of the plugin can be used.

In addition to the standard set, the administrator can use any of the available plug-ins that are widely represented on the Internet when monitoring.

Using the NRPE protocol, you can call the check_nrpe command on a monitored host to check another host. In this way, you can control a certain subnet through one computer. With this organization of control, both the NRPE protocol daemon and the plugin must be installed on the host used as a proxy.

System monitoring using SNMP protocol

To work via the SNMP protocol, the appropriate plugin must be installed in Nagios. It is included with the Nagios plugins, but it can only be used if the net-snmp package has been installed first. Therefore, if you intend to use the SNMP module, this package must be downloaded from the http://net-snmp.sourceforge.net/ server, then the plugins must be recompiled and reinstalled. The author would recommend that on a new installation, first run the make clean command, which would clear the settings of the previous installation.

    Note

    On the site http://net-snmp.sourceforge.net/ the required package is presented only in source codes or in RPM format.

After configuring the SNMP monitoring capability, you need to test 1 functionality on the simplest queries. For example, check the duration of the device:

/usr/local/nagios/libexec/check_snmp -H<адрес_устройства>-C -o
sysUpTime. 0

In response, you should receive something like this:

SNMP OK - Timeticks: (622339555) 72 days, 0:43:15.55 |

The check_snmp command can ask for a parameter that takes a numeric value and check if its value is within a certain range. So, you can specify values ​​for the warning and critical status (switches -w and -c) or a range of values ​​(separated by a colon). Please note that if you want, for example, the returned number in the range from a to b (b > a) to be interpreted as a critical value, then the range must be specified b: a. If you specify a range in the "usual" form, like a:b, then if the returned value falls within this range, then the result will be considered a normal state, and if it does not, then as a warning or critical (depending on the key used). In addition, the command can check the returned string value (the value with which the response is checked should be specified in the -s switch) or even check using regular expressions (switches -r, -R). You can also check several parameters in a request at once, listing their OIDs separated by commas, like this:

After the request is compiled and debugged, it is enough to describe the new command in the commands.cfg file and add the necessary services to the description files of controlled devices.

On the web, you can find a sufficient number of examples of configuring Nagios to control devices using the SNMP protocol that can be put into practice. For example, http://wiki.nagios.org/index.php/Howtos:snmp-apc-smart-ups contains a description of the settings with which you can monitor the status of uninterruptible power supplies from APC (battery status, voltage parameters, temperature etc.).

Switching equipment monitoring

Active network equipment - switches, hubs, modems, etc. are controlled via SNMP protocol (managed models). You can get the status of equipment ports, issue warnings if a certain number of packet transmission errors occur on the ports, monitor the temperature of the device and the number of VPN sessions. You just need to select the appropriate identifiers according to the description for monitoring via the SNMP protocol. In most cases, this is sufficient for control.

However, in addition to the specified parameters, administrators often want to know the real load of the equipment, the percentage of bandwidth used. These values ​​cannot be obtained by querying one or another hardware status parameter. They are calculated based on the analysis of periodically received data. One of the most popular programs, MRTG, was created especially for such monitoring. Its switch parameter processing capabilities are used by Nagios.

The MRTG program collects statistics from active equipment using the SNMP protocol, which, using the check_mrtgtraf plugin, is subsequently transferred to Nagios for display.

After installing the MRTG program, you need to create settings files in which you specify the devices and parameter values ​​that the program will collect. These settings should be given in the /etc/mrtg.conf file. Forming the MRTG configuration is a rather complicated task, so the package provides a special program that will automatically poll the device and generate a configuration file - cfgmaker. When you run it, you need to specify the community string and the device address as parameters. The output of the program should be redirected to a file, the values ​​from which we then simply import into the settings file. It is convenient to use the name (or address) of the polled device as the name of such a file:

cfgmaker [email protected] address > /etc/mrtg/address.cfg

Based on the results of the cfgmaker command, it is enough to leave in the configuration file those data blocks that are supposed to be analyzed for a given device. Considering that according to the file information, the program creates titles and service descriptions on the chart pages, it makes sense to correct the names and descriptions of those positions that are supposed to be displayed on the charts. Since it makes no sense to analyze the bandwidth by ports to which end devices (servers, workstations) are connected, it is advisable to keep bandwidth monitoring only for trunk ports (ports that are connected to other switches or hubs).

After editing the settings file, you can run the mrtg program, specifying the device configuration as a parameter. For systems with UTF-8 encoding, the run command will look like this:

env LANG=C /usr/bin/mrtg /etc/mrtg.cfg

When installing the MRTG package, the system is configured to automatically collect information from the switches once every five minutes. If desired, this period can be increased by editing the /etc/cron.d/mrtg file accordingly.

Performance graphs for individual device ports can be viewed by opening the http://nagiosserver/mrtg/ folder in the browser and selecting the appropriate file. If desired, you can create a common index file to simplify the display. This is done using the indexmaker command. The necessary keys for generating the file can be easily specified from the help information after calling indexmaker -h.

As long as the setup described above, you can use the Nagios check_mrtg and check_mrtgtraf commands to collect performance data. The check_mrtgtraf command requires the following parameters:

check_mrtgtraf -F -a -w inbound,outbound -c inbound,outbound -e expiration_period

In this example, the -a parameter specifies whether the maximum value (max) for the analysis period will be taken into account or the program will evaluate the average value (avg). After the w and c keys, pairs of limits for outgoing and incoming traffic on this port are indicated. Which port the system will monitor data on is determined by the selected log file. On fig. 7.17 shows an example of a graph generated by the mrtg package.

Rice. 7.17.
Switch Port Load Schedule

Using your own monitoring programs

Nagios makes it easy to create custom plugins to monitor any system. As such, any executable files can be used. It is only necessary to ensure that they report the shutdown code in accordance with Table. 7.4.

Table 7.4.
Nagios System Monitor Return Codes

When creating scripts, keep in mind that they will be run on behalf of the monitoring agent service. By default, this service has maximum rights for the local system, but cannot interact with computers on the network. If you intend to use scripts to collect data from other computers, then you must either script connection operations with the appropriate account settings, or configure the agent to run as a different name.

Plotting in Nagios

The Nagios commands that monitor systems return not only status (good or bad), but also data on specific parameters (for example, percentage of disk usage or number of users logged on to the system). This data is not stored by default, but can be used, for example, to draw graphs for the respective services.

To implement this feature, you need to install an additional plugin. One of the most popular plugins for creating graphs in Nagios is the nagiosgraph package, available for download from http://sourceforge.net/projects/nagiosgraph/.

On fig. Figure 7.18 shows an example of a page for monitoring the status of services, on which, when the mouse cursor is hovered over the corresponding parameter, a graph of its change is dynamically displayed. If desired, the administrator can proceed to the selection of a schedule for any service and for a given period of time.

Rice. 7.18.
Dynamic Chart Page Example

Setting up the Nagios interface

Many add-ons have been developed for Nagios that allow you to customize the display of monitoring data according to the needs of the administrator. For example, instead of a tactical overview (Figure 7.19), you can use customizable network maps, on which Nagios will display the status of each device.

Rice. 7.19.
The default way to display summary system status in Nagios

On fig. Figure 7.20 (example from the site http://www.nagvis.org) shows a real version of the monitoring map built using the NagVis package.

Rice. 7.20.
Network status display when using the NagVis package

In this case, Nagios will display real-time indicators for devices and links. At the same time, it is possible to display summary states by groups (of hosts and services), values ​​of actual traffic along communication lines, etc. on the map. It is clear that such representations are very convenient in practical use.

1 Examples use SNMP version 1. Real-world environments typically use version 3, so the examples need to be supplemented with authentication parameters.

Benefits and new opportunities for system monitoring

Tracking and analyzing large amounts of information about the status of different computers (for example, the degree of processor and network card utilization) is a lot of effort, but open source Nagios (see section ) successfully copes with the tasks of monitoring and real-time alerting.

It is extremely important to understand that Nagios is not a tool for measuring system operation parameters, for example, the degree of processor utilization, but a utility that issues monitoring results in the form of "working", "unreliable" and "faulty" states. This feature of Nagios helps the operator to focus on the most important and critical issues based on predefined and customizable criteria.

Nagios software implements functionality to report the amount of time lost due to downtime, which can be useful for tracking the quality of service delivery according to a service level agreement (SLA). As will be shown in subsequent articles, Nagios also offers features for downtime accounting and creating dependencies on services and systems. This introductory article shows how easy it is to create small, customized solutions for specific monitoring requirements.

Installation

Most Linux® distributions ship with a built-in version of Nagios. In this case, the product easily integrates with the Apache Web server. To activate or update such a configuration, you must run the command:

yum install nagios

or apt-get install nagios-text . The binaries for the AIX® platform are available for download from the NagiosExchange Web site (see section ).

For other platforms, the Nagios source code can be downloaded from the Nagios.org Web site (see section ). The following developer tools are required to create Nagios from scratch.

  • Instruments:
    • autoconf
    • automake
  • Executable files:
    • libgd
    • openssl
  • Packages (libraries and header files)

Many plugins related to SNMP (Simple Network Management Protocol) will also require Perl and the Net::SNMP package.

Once Nagios is installed and configured, it can be accessed via the standard URL http://your.host.name/nagios . Shows which systems and services are enabled or disabled.

Setting up Nagios

By default, all Nagios configuration files are located in the /etc/nagios directory. Apache-related configuration files can be conveniently linked to the Apache configuration directory using links. The configuration is divided into several files, each of which is dedicated to separate configuration fragments.

The first components to set up are contacts and contact groups. Contacts are the people who are notified when a system or service goes down. By default, Nagios offers email and pager notifications, but extensions allow you to send notifications via Jabber protocol and many other methods that may be convenient in various circumstances.

Contacts are stored in the contacts.cfg file and are defined as shown in Listing 1.

Listing 1. Configuration 1: Basic contact information
define contact( contact_name jdoe alias John Due service_notification_commands notify-by-email host_notification_commands host-notify-by-emailes email [email protected] }

Contacts can be grouped, and instead of individuals who need to be notified when a system or service status changes, Nagios will notify the appropriate group. Sometimes it makes sense to specify a user multiple times to define different addresses or commands to send notifications and then add all the ways to contact the user to the contact group they belong to ().

Listing 2. Configuration 2: Grouping contacts
define contactgroup( contactgroup_name server-admins alias Server Administrators members jdoe,albundy )

The next step is to set up the systems that Nagios will monitor. You must add each computer that has services that you want to monitor or periodically check for activity. The configuration file to store the system is the hosts.cfg file. Listing 3 shows an example of a computer definition.

Listing 3. Configuration 3: Adding a new computer
define host( host_name ubuntu_1_2 alias Ubuntu test server address 192.168.1.2 check_command check-host-alive max_check_attempts 20 notifications_enabled 1 event_handler_enabled 0 flap_detection_enabled 0 process_perf_data 1 retain_status_information 1 retain_nonstatus_information 1 notification_interval 60 notification_period 24x7)

The last step in the Nagios configuration is defining the services for the configured systems. The example shown in Listing 4 uses a predefined ping plugin for Nagios that sends ICMP (Internet Control Message Protocol) pings to determine if the computer is responding or not.

Listing 4. Configuration 4: Adding a new service
define service( use service-template host_name ubuntu_1_2 service_description PING check_period 24x7 contact_groups server-admins notification_options c,r check_command check_ping!300.0,20%!1000.0,60% )

After preparing this configuration, you need to restart the Nagios daemon, and then, after waiting a few seconds while Nagios initializes, check if the ping services appeared in the admin web interface.

Writing plugins for Nagios

The most interesting aspect of Nagios is that you can easily write your own plugin for it, which requires you to learn a few simple rules. To manage a plugin, Nagios simply spawns a child process each time it requests the state of a service and uses the output and return code of that command to determine the state. Service state return codes are interpreted as follows:

  • OK- return code 0 - means that the service is working normally;
  • WARNING- return code 1 is a warning signal that the service may have problems;
  • CRITICAL- return code 2 - critical state of the service;
  • UNKNOWN- return code 3 - unknown service status.

The last state simply means that the plugin was unable to determine the state of the service. This can happen, for example, as a result of an internal error.

Listing 5 is an example Python script that tests UNIX® OS boot average. It assumes that a level above 2.0 is a warning condition and a level above 5.0 is a critical condition. These values ​​are hardwired into the code, and the last minute load average is always used as well.

Listing 5. Python plugin - working plugin example
#!/usr/bin/env python import os,sys (d1, d2, d3) = os.getloadavg() if d1 >= 5.0: print "GETLOADAVG CRITICAL: Load average is %.2f" % (d1) sys. exit(2) elif d1 >= 2.0: print "GETLOADAVG WARNING: Load average is %.2f" % (d1) sys.exit(1) else: print "GETLOADAVG OK: Load average is %.2f" % (d1) sys.exit(0)

Having prepared a small executable component, we need to register this plugin with Nagios and create a service definition that will check the load average.

It's quite simple: first, a file /etc/nagios-plugins/config/mygetloadavg.cfg is created with the content shown below, and the service is added to the services.cfg file, as shown in the example below. Let me remind you that localhost must be present in the hosts.cfg configuration file.

Listing 6. Plugin example - Nagios registration
define command( command_name check_mygetloadavg command_line /path/to/check_getloadavg )
Listing 7. Creating a service using the sample plugin
define service( use service-template host_name localhost service_description LoadAverage check_period 24x7 contact_groups server-admins notification_options c,r check_command check_mygetloadavg )

Writing a complete plugin

The previous example showed the limitations of a "hard-coded" plugin that does not allow configuration changes at runtime. In practice, it is better to create configurable plugins, then it will be possible to create and maintain only one plugin, register it as a separate plugin in Nagios, and pass warning and critical level adjustment arguments to it under different circumstances. The following example also includes usage messages, this is especially useful for plugins that are used or maintained by multiple developers or administrators.

Another useful trick is to catch all exceptions and return UNKNOWN in the service status report so that Nagios can appropriately notify the event. Plugins that allow exceptions to "escape" most often return a value of 1, which is treated by Nagios as a WARNING state. It is important that the plugin correctly distinguish between WARNING (warning) and UNKNOWN (unknown) states. It's worth noting that normally notifications for individual WARNING states are disabled, but it's not a good idea to disable notifications for UNKNOWN states.

Writing a Python Plugin

The assumptions above (run-time parametrization, usage reporting, and improved exception handling) result in a plug-in whose source code is several times larger than the previous one. However, this adds safe error handling and the ability to reuse the plugin in different situations.

Listing 8. Python plugin - complete plugin for getting load average data
#!/usr/bin/env python import os import sys import getopt def usage(): print """Usage: check_getloadavg [-h|--help] [-m|--mode 1|2|3] \ [ -w|--warning level] [-c|--critical level]" Mode: 1 - last minute ; 2 - last 5 minutes 3 - last 15 minutes" Warning level defaults to 2.0 Critical level defaults to 5.0""" sys.exit(3) try: options, args = getopt.getopt(sys.argv, "hm:w:c:", "- -help --mode= --warning= --critical=",) except getopt.GetoptError: usage() sys.exit(3) argMode = "1" argWarning = 2.0 argCritical = 5.0 for name, value in options: if name in ("-h", "--help"): usage() if name in ("-m", "--mode"): if value not in ("1", "2", "3" ): usage() argMode = value if name in ("-w", "--warning"): try: argWarning = 0.0 + value except Exception: print "Unable to convert to floating point value\n" usage() if name in ("-c", "--critical"): try: argCritical = 0.0 + value except Exception: print "Unable to convert to floating point value\n" usage() try: (d1, d2, d3) = os.getloadavg() except Exception: print "GETLOADAVG UNKNOWN: Error while getting load average" sys.exit(3) if argMode == "1": d = d1 elif argMode == "2": d = d2 elif argMode = = "3": d = d3 if d >= argCritical: print "GETLOADA VG CRITICAL: Load average is %.2f" % (d) sys.exit(2) elif d >= argWarning: print "GETLOADAVG WARNING: Load average is %.2f" % (d) sys.exit(1) else: print "GETLOADAVG OK: Load average is %.2f" % (d) sys.exit(0)

To use a new plugin, you must register it in the /etc/nagios-plugins/config/mygetloadavg2.cfg file, as shown in Listing 9.

Listing 9. Python plugin - Nagios registration
define command( command_name check_mygetloadavg2 command_line /path/to/check_getloadavg2 -m $ARG1$ -w $ARG2$ -c $ARG3$ )

You also need to add or change an entry for this service in the services.cfg file, as shown in Listing 10. Note that the exclamation mark! separates plugin parameters. As before, localhost needs to be defined in the hosts.cfg configuration file.

Listing 10. Creating a service using the Python plugin
define service( use service-template host_name localhost service_description LoadAverage2 check_period 24x7 contact_groups server-admins notification_options c,r check_command check_mygetloadavg2!1!3.0!6.0 )

Writing a Tcl Plugin

The last example is a plugin written in Tcl that checks exchange rates from xmethods.net using SOAP (Simple Object Access Protocol) and WSDL (Web Services Description Language) technology. SOAP provides the plugin with the current exchange rates to compare them with the configured values. If the value is within the warning range, then the state is considered to be OK . If the value is above or below the warning level, but not below the critical limit, then the state is considered to be WARNING . Otherwise, the state is considered CRITICAL unless a network failure occurs, in which case the state is set to UNKNOWN .

The plugin recognizes configurable parameters so that different rates can be checked with different ranges to check. It can also be used to check the exchange rates of various countries (Listing 11).

Listing 11. Tcl plugin - check current exchange rates
#!/usr/bin/env tclsh # parse arguments package require cmdline set options ( (country1.arg "" "Country 1") (country2.arg "" "Country 2") (lowerwarning.arg "" "Lower warning limit ") (upperwarning.arg "" "Upper warning limit") (lowercritical.arg "" "Lower critical limit") (uppercritical.arg "" "Upper critical limit") ) array set opt ​​)] # if the user didn't supply all arguments, # then show help message for each necessary ( if ($opt($necessary) == "") ( set argv "-help" catch (cmdline::geoptions argv $options (: )) usage puts stderr $usage exit 3 ) ) # load package TclWebServices package require WS::Client if ( 1] ) error]) ( # if for some reason the course could not be loaded, report it puts "EXCHANGERATE UNKNOWN: $error" exit 3 ) if (($result< $opt(lowercritical)) || ($result >$opt(uppercritical))) ( puts "EXCHANGERATE CRITICAL: rate is $result" exit 2 ) if (($result< $opt(lowerwarning)) || ($result >$opt(upperwarning))) ( puts "EXCHANGERATE WARNING: rate is $result" exit 1 ) puts "EXCHANGERATE OK: rate is $result" exit 0

Now we need to register this command so that Nagios knows how to call it. In order to do this, you need to create a file /etc/nagios-plugins/config/exchangerate.cfg with content similar to the previous configurations and the following command definition:

command_line /path/to/check_exchangerate -country1 $ARG1$ -country2 $ARG2$ -lowercritical \ $ARG3$ -lowerwarning $ARG4$ -upperwarning $ARG5$ -uppercritical $ARG6$

The command name check_exchangerate is used in the example below.

Then you need to create a service that will use the created plugin to track exchange rates. The following is an example of a service definition that associates the service with the localhost server. While the check is not actually tied to any real computer, it still needs to be bound to the system. If the check includes calling the SOAP methods of servers within the monitored network, then you need to add a real server to be monitored and bind the service to this server. The code in checks that the exchange rate of the British pound against the Japanese yen is between 225 and 275.

Listing 12. Adding the Tcl plugin as a new service
define service( use service-template host_name localhost service_description EXCHANGERATE check_period 24x7 contact_groups other-admins notification_options c,r check_command check_exchangerate!England!Japan!200!225!275!300 )

Conclusion

Nagios can be used to monitor all types of software and computer hardware. The ability to create your own plugins allows you to monitor everything that the Nagios server can talk to. You can use any programming language that accepts arguments from the command line and supports return codes for this, so the possibilities are almost limitless!

An experienced system administrator can extend the SOAP example with Tcl or any other language to interact with Web services on the Intranet and write plug-ins to verify that these services function correctly.

You can also use C plugins or the C programming features built into your dynamic language (Pyinline in Python, Inline in Perl, or Critcl in Tcl) to combine the combination of OS system APIs in C with a plugin written in a high-level language.

Another Nagios feature worth looking at is passive validation. The Nagios monitoring process covered in this article relies on executable components to determine the status with a short lifecycle, run those components, and get results from them. With passive checking, Nagios does not run status checking plugins, and individual applications send status change messages periodically or when the state of a service changes. Such an application can receive alerts from various sources, accumulate them and pass the prepared summary information to Nagios. Nagios can also assume that a service has gone down if it doesn't send notifications for a certain period of time. The implementation of passive validation with Nagios will be described in the next article.

The advantage of plugins for Nagios is the ease with which they can be created and shared. Nagios plugins are useful in situations that network and system administrators deal with, and in most cases it is reuse of the results of work that someone has already done before. Like the popular Wiki and Web resources, it doesn't take much effort to contribute with a helpful example, while the combined power of all the plugins available is great.

Before configuring nagios, you need to install the necessary dependencies

# apt install build-essential apache2 php libapache2-mod-php7.0 php-gd libgd-dev mailutils

And add a user and group on behalf of which nagios will run

# useradd nagios # groupadd nagcmd # usermod -a -G nagcmd nagios # usermod -a -G nagcmd www-data

Go to the build directory and download the source code for nagios and plugins

# cd /usr/src/ # wget https://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.2.3/nagios-4.2.3.tar.gz # wget https:// nagios-plugins.org/download/nagios-plugins-2.1.4.tar.gz

Unzip downloaded archives

# tar xzvf nagios-4.2.3.tar.gz # tar xzvf nagios-plugins-2.1.4.tar.gz

Let's go to the directory with the nagios source code and configure

# cd nagios-4.2.3 # ./configure --prefix=/etc/nagios --with-command-group=nagcmd --with-httpd-conf=/etc/apache2/sites-available --with-mail= /usr/bin/mail

Let's build

# make all

Install nagios

# make install

Install an init script in /etc/init.d and enable auto start

# make install-init # update-rc.d nagios defaults

Set the permissions on the directory for storing external batch files

# make install-commandmode

Install nagios configuration files

# make install-config

Set up the nagios config for apache

# make install-webconf

Copy the event processing scripts of external batch files to the folder with nagios and set the owner to the folder

# cp -R contrib/eventhandlers/ /etc/nagios/libexec/ # chown -R nagios:nagios /etc/nagios/libexec/eventhandlers

Let's check the installed configuration

# /etc/nagios/bin/nagios -v /etc/nagios/etc/nagios.cfg

# make # make install

Enable the nagios configuration in apache and activate the necessary add-ons

# a2ensite nagios # a2enmod rewrite cgi

Restart the apache service

# service apache2 restart

Let's start nagios and check the status

# service nagios start # service nagios status ● nagios.service - Nagios Loaded: loaded (/etc/systemd/system/nagios.service; enabled; vendor preset: enabled) Active: active (running)

Add a nagios administrator

# htpasswd -c /etc/nagios/etc/htpasswd.users nagiosadmin

Now let's deal with the nagios configuration files.

/etc/nagios/etc/ cgi.cfg- defines the settings for the web interface, as well as access rights to the nagios web console.

/etc/nagios/etc/ htpasswd.users- database of users and their passwords for accessing the nagios web interface.

/etc/nagios/etc/ nagios.cfg— contains the main settings and paths to *.cfg files.

/etc/nagios/etc/ resource.cfg- a variable is defined here, up to the directory with plugins.

/etc/nagios/etc/objects/ commands.cfg- contains command definitions.

/etc/nagios/etc/objects/ contacts.cfg- defines the mail contacts to which nagios notifications will be sent.

/etc/nagios/etc/objects/ templates.cfg- contains templates for contacts, hosts and services.

/etc/nagios/etc/objects/ timeperiods.cfg- contains definitions of time periods.

/etc/nagios/etc/objects/ localhost.cfg- configuration for monitoring the nagios server itself. It defines the host itself, the host group for linux servers and monitoring services.

/etc/nagios/etc/objects/ printer.cfg- configuration for monitoring the printer. It defines an arbitrary printer, a host group for printers, and monitoring services.

/etc/nagios/etc/objects/ switch.cfg- configuration for monitoring the switch. It defines an arbitrary switch, a host group for switches, and monitoring services.

/etc/nagios/etc/objects/ windows.cfg- configuration for monitoring an arbitrary windows host. It defines an arbitrary windows host, a host group for windows servers and monitoring services.

The description shows that localhost.cfg, printer.cfg, switch.cfg and windows.cfg contain host group definitions. For convenience, it makes sense to separate them into a separate file /etc/nagios/etc/objects/ hostgroups.cfg. Accordingly, they need to be commented out in the original file. Description of the same object should not be repeated in different configuration files. We will also add the file /etc/nagios/etc/objects/ servicegroups.cfg, in which the service groups will be defined. Since this publication is setting up monitoring for linux and windows hosts, we will define groups for them. For printers and switches, groups are defined by analogy. We will also create the /etc/nagios/etc/servers/ folder, which will store the files that define the hosts to monitor. Let's make the appropriate changes to the nagios.cfg file

# nano /etc/nagios/etc/nagios.cfg . . . # You can specify individual object config files as shown below: cfg_file=/etc/nagios/etc/objects/commands.cfg cfg_file=/etc/nagios/etc/objects/contacts.cfg cfg_file=/etc/nagios/etc/objects /timeperiods.cfg cfg_file=/etc/nagios/etc/objects/templates.cfg # Definitions for hostgroups and servicegroups cfg_file=/etc/nagios/etc/objects/hostgroups.cfg cfg_file=/etc/nagios/etc/objects/servicegroups.cfg# Definitions for monitoring the local (Linux) host cfg_file=/etc/nagios/etc/objects/localhost.cfg # Definitions for monitoring a Windows machine #cfg_file=/etc/nagios/etc/objects/windows.cfg # Definitions for monitoring a router/switch #cfg_file=/etc/nagios/etc/objects/switch.cfg # Definitions for monitoring a network printer #cfg_file=/etc/nagios/etc/objects/printer.cfg # You can also tell Nagios to process all config files (with a .cfg # extension) in a particular directory by using the cfg_dir # directive as shown below: cfg_dir=/etc/nagios/etc/servers#cfg_dir=/etc/nagios/etc/printers #cfg_dir=/etc/nagios/etc/switches #cfg_dir=/etc/nagios/etc/routers . . .

Create files for the host and service groups and set the rights to them

# cd /etc/nagios/etc/objects/ # touch hostgroups.cfg servicegroups.cfg # chown nagios:nagios hostgroups.cfg servicegroups.cfg # chmod 664 hostgroups.cfg servicegroups.cfg

Create directory /etc/nagios/etc/ servers/ and set rights to it

# mkdir /etc/nagios/etc/servers/ # chown nagios:nagios /etc/nagios/etc/servers/ # chmod 775 /etc/nagios/etc/servers/

Add to hostgroups.cfg definitions of host groups for linux and windows servers from localhost.cfg and windows.cfg, respectively

# nano /etc/nagios/etc/objects/hostgroups.cfg # Define an optional hostgroup for Linux machines # All hosts that use the linux-server template will automatically be a member of this group define hostgroup( hostgroup_name linux-servers ; The name of the hostgroup alias Linux Servers ; Long name of the group ) # Define a hostgroup for Windows machines # All hosts that use the windows-server template will automatically be a member of this group define hostgroup( hostgroup_name windows-servers ; The name of the hostgroup alias Windows Servers ; Long name of the group )

Since the path to windows.cfg is commented out in nagios.cfg, commenting out the definition of host groups in windows.cfg is not necessary, but in localhost.cfg it is a mandatory action

# nano /etc/nagios/etc/objects/localhost.cfg . . . # Define an optional hostgroup for Linux machines #define hostgroup( # hostgroup_name linux-servers ; The name of the hostgroup # alias Linux Servers ; Long name of the group # members localhost ; Comma separated list of hosts that belong to this group # ) . . .

When a windows server object is created, it automatically becomes a member of the windows-servers group. This action is defined in the templates.cfg file. In order for linux servers to automatically fall into the linux-servers group, you need to make the following change

# nano /etc/nagios/etc/objects/templates.cfg . . . # Linux host definition template - This is NOT a real host, just a template! define host( name linux-server ; The name of this host template use generic-host ; This template inherits other values ​​from the generic-host template check_period 24x7 ; By default, Linux hosts are checked round the clock check_interval 5 ; Actively check the host every 5 minutes retry_interval 1 ; Schedule host check retries at 1 minute intervals max_check_attempts 10 ; Check each Linux host 10 times (max) check_command check-host-alive ; Default command to check Linux hosts notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day ; Note that the notification_period variable is being overridden from ; the value that is inherited from the generic-host template! notification_interval 120 ; Resend notifications every 2 hours notification_options d,u,r ; Only send notifications for specific host states contact_groups admins ; Notifications get sent to the admins by default hostgroups linux-servers ; Host groups that linux servers should be a member of register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! ) . . .

To set up a notification, you need to specify the email of the system administrator in contacts.cfg

# nano /etc/nagios/etc/objects/contacts.cfg . . . define contact( contact_name nagiosadmin ; Short name of user use generic-contact ; Inherit default values ​​from generic-contact template (defined above) alias Nagios Admin ; Full name of user email [email protected] website ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ****** } . . .

# service nagios restart

You can check the performance of alerts in the following way, select “Hosts” on the left in the web interface, then click on “localhost”, click on “Send custom host notification” in the menu on the right, write anything in the “Comment” line and click “Commit”.

An alert should be sent to the mail specified in contacts.cfg.


A little about plugins

The /etc/nagios/libexec folder contains installed plugins. At the beginning of the article, it was noted that nagios receives all information through plugins. For example, let's look at the uptime of the system

# /etc/nagios/libexec/check_uptime Uptime OK: 0 day(s) 3 hour(s) 52 minute(s) | uptime=232.000000;;;

Most plugins work only with arguments, for example, let's see the status of the system swap file

# /etc/nagios/libexec/check_swap -w 20 -c 10 SWAP OK - 100% free (2044 MB out of 2044 MB) |swap=2044MB;0;0;0;2044

There are two arguments -w 20 and -c 10.

w - warning, when 20% of free space remains, a warning event will occur.

c - critical, when 10% of free space remains, the critical event will occur.

There are also plugins local and "general". The above examples are local. For example, the check_swap plugin will not be able to check the status of the paging file on a remote host, but the check_ping plugin can check the availability of both local and remote hosts

# /etc/nagios/libexec/check_ping -H localhost -w 100.0.20% -c 500.0.60% PING OK - Packet loss = 0%, RTA = 0.04 ms|rta=0.036000ms;100.000000;500.000000;0.000000 pl= 0%;20;60;0 # /etc/nagios/libexec/check_ping -H 192.168.1.16 -w 100.0.20% -c 500.0.60% PING OK - Packet loss = 0%, RTA = 0.27 ms|rta= 0.273000ms;100.000000;500.000000;0.000000pl=0%;20;60;0


A little about NRPE

NRPE - Nagios Remote Plugin Executor. In order for nagios to receive information from remote hosts, such as disk or CPU usage, the nrpe plugin is used. Nagios accesses, via the nrpe plugin, an nrpe server installed on a remote linux/unix host. The nrpe server runs the local plugins and passes the information to the nagios server. Important! nrpe server and plugin must be the same version, otherwise errors may occur.


Installing the NRPE Plugin

Before installing the nrpe plugin, you need to install the dependency

# apt install libssl-dev

You can download the latest version of nrpe from the nagios website. Go to the build directory, download and unzip the latest version of nrpe

# cd /usr/src/ # wget https://github.com/NagiosEnterprises/nrpe/archive/3.0.1.tar.gz # tar xzvf 3.0.1.tar.gz

Let's go to the folder with nrpe and configure

Let's build and install the nrpe plugin

# make check_nrpe # make install-plugin

Add nrpe support to /etc/nagios/etc/objects/commands.cfg

# nano /etc/nagios/etc/objects/commands.cfg . . . # "check_nrpe" command definition define command( command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ ) . . .

After the changes made, you need to restart the nagios service

# service nagios restart


Installing the NRPE Server

On the linux host that we will be monitoring, we need to install the nrpe server and plugins.

Install the required dependencies

# apt install build-essential libssl-dev

Go to build directory, download nrpe, plugins and unzip them

# cd /usr/src/ # wget https://github.com/NagiosEnterprises/nrpe/archive/3.0.1.tar.gz # wget https://nagios-plugins.org/download/nagios-plugins-2.1. 4.tar.gz # tar xzvf 3.0.1.tar.gz # tar xzvf nagios-plugins-2.1.4.tar.gz

Let's go to the directory with nrpe and configure

# cd nrpe-3.0.1 # ./configure --prefix=/etc/nagios

Let's build

# make nrpe

Add a user and group on behalf of which the nrpe server will run

# make install-groups-users

Let's install the server and the configuration file

# make install-daemon # make install-config

Install start script

# make install-init # systemctl enable /lib/systemd/system/nrpe.service

Let's go to the directory with the source code of the plugins and configure

# cd /usr/src/nagios-plugins-2.1.4/ # ./configure --prefix=/etc/nagios --with-nagios-user=nagios --with-nagios-group=nagios

Build and install plugins

# make # make install

In /etc/nagios/etc/nrpe.cfg we will allow the nagios server to receive information about the system, as well as specify the true name of the disk partition to be monitored, in a predefined command

Nano /etc/nagios/etc/nrpe.cfg . . . allowed_hosts=127.0.0.1, 192.168.1.13 . . . command=/etc/nagios/libexec/check_users -w 5 -c 10 command=/etc/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 command=/etc/nagios/libexec/check_disk -w 20% -c 10% -p /dev/ sda1 command=/etc/nagios/libexec/check_procs -w 5 -c 10 -s Z command=/etc/nagios/libexec/check_procs -w 150 -c 200 . . .

192.168.1.13 should be replaced with the address of your nagios server.
Start nrpe server and check its status

# service nrpe start # service nrpe status ● nrpe.service - Nagios Remote Program Executor Loaded: loaded (/lib/systemd/system/nrpe.service; enabled; vendor preset: enabled) Active: active (running)


Adding a linux host to the monitoring system

To do this, we will create a linux-server.cfg file in the servers folder

# nano /etc/nagios/etc/servers/linux-serv.cfg define host( use linux-server host_name linux-serv alias linux-serv address 192.168.1.12 ) define service( use generic-service host_name linux-serv service_description CPU Load check_command check_nrpe!check_load ) define service( use generic-service host_name linux-serv service_description Current Users check_command check_nrpe!check_users ) define service( use generic-service host_name linux-serv service_description /dev/sda1 Free Space check_command check_nrpe!check_sda1 ) define service( use generic-service host_name linux-serv service_description Total Processes check_command check_nrpe!check_total_procs ) define service( use generic-service host_name linux-serv service_description Zombie Processes check_command check_nrpe!check_zombie_procs )

192.168.1.12 needs to be replaced with the address of your linux server.
The use directive points to the name of a template in templates.cfg that defines the default settings. In order for the new host to appear in the web interface, you need to restart the nagios service

# service nagios restart

To check if nrpe is working, you can run the command

# /etc/nagios/libexec/check_nrpe -H 192.168.1.12 NRPE v3.0.1

To check a specific service, you need to add an argument with the name of the check

# /etc/nagios/libexec/check_nrpe -H 192.168.1.12 -c check_sda1 DISK OK - free space: /var/tmp 14549 MB (85% inode=88%);| /var/tmp=2527MB;14411;16212;0;18014

We defined the name of the check in the nrpe.cfg file

Command[ check_sda1]=/etc/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1

and in the linux-serv.cfg file

Define service( use generic-service host_name linux-serv service_description /dev/sda1 Free Space check_command check_nrpe! check_sda1 }


Windows host monitoring

The nt plugin is used to monitor windows hosts. By default, it is included in the base plugins and does not need to be installed separately. Through nt, the nagios plugin accesses the NSClient++ installed on the windows host. NSClient++ accesses certain modules that tell it information about the system. NSClient++ sends the received information to nogios server.


Installing NSClient++

On windows host you need to install NSClient++. Download the latest version and run as administrator.

Click "Next"

Click "Next" again

Choose "Typical"

Specify the address of the nagios server, password and leave the first two checkboxes. Click "Next"

Click "Install"

Click "Finish"


Adding a windows host to the monitoring system

To do this, we will create a windows-serv.cfg file in the servers folder

# nano /etc/nagios/etc/servers/windows-serv.cfg define host( use windows-server host_name windows-serv alias My Windows Server address 192.168.1.33 ) define service( use generic-service host_name windows-serv service_description NSClient++ Version check_command check_nt!CLIENTVERSION ) define service( use generic-service host_name windows-serv service_description Uptime check_command check_nt!UPTIME ) define service( use generic-service host_name windows-serv service_description CPU Load check_command check_nt!CPULOAD!-l 5,80,90 ) define service( use generic-service host_name windows-serv service_description Memory Usage check_command check_nt!MEMUSE!-w 80 -c 90 ) define service( use generic-service host_name windows-serv service_description C:\ Drive Space check_command check_nt!USEDDISKSPACE!-lc -w 80 -c 90 ) define service( use generic-service host_name windows-serv service_description VMTools check_command check_nt!SERVICESTATE!-d SHOWALL -l VMToo ls ) define service( use generic-service host_name windows-serv service_description Explorer check_command check_nt!PROCSTATE!-d SHOWALL -l explorer.exe )

192.168.1.33 must be replaced with the address of your windows server.
If a password was specified when installing the NSClient++ client, you need to add it to commands.cfg

# nano /etc/nagios/etc/objects/commands.cfg . . . # "check_nt" command definition define command( command_name check_nt command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s MegaPass-v $ARG1$ $ARG2$ ) . . .

And restart the nagios service

# service nagios restart


Service group definition

A service group groups together hosts that are subject to certain service checks. Let's create a CPU Load service group, and unite the hosts to check the processor load.

# nano /etc/nagios/etc/objects/servicegroups.cfg define servicegroup( servicegroup_name cpuload alias CPU Load members linux-serv,CPU Load, localhost,Current Load, windows-serv,CPU Load )

Group members are defined in the members directive according to the principle
members= ,,,,…,n>,n>

To make the group available, you need to restart the nagios service

# service nagios restart


Location of host links on the map

By default, all hosts on the map are connected to Nagios Process. There are times when you need to override this behavior. For example, the connection should not come from Nagios Process, but from another point on the map (as an example, a server connection through a switch). This is done by adding the parents directive to the host description section. For an illustrative example, let's change the windows-serv connection from Nagios Process to linux-serv

# nano /etc/nagios/etc/servers/windows-serv.cfg define host( use windows-server host_name windows-serv alias My Windows Server address 192.168.1.33 parents linux-serv } . . .

And restart the nagios service

# service nagios restart

In the first case, all hosts had a connection with Nagios Process, in the second case, the windows-serv connection starts from linux-serv.


Enable icons

nagios has the ability to enable icons next to the host name. The icons are located in the /etc/nagios/share/images/logos folder. You can use a ready-made set, you can download from the Internet. To enable the display of icons, you need to add the following lines to templates.cfg

# nano /etc/nagios/etc/objects/templates.cfg . . . # Linux host definition template - This is NOT a real host, just a template! define host( name linux-server ; The name of this host template use generic-host ; This template inherits other values ​​from the generic-host template check_period 24x7 ; By default, Linux hosts are checked round the clock check_interval 1 ; Actively check the host every 5 minutes retry_interval 1 ; Schedule host check retries at 1 minute intervals max_check_attempts 10 ; Check each Linux host 10 times (max) check_command check-host-alive ; Default command to check Linux hosts notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day ; Note that the notification_period variable is being overridden from ; the value that is inherited from the generic-host template! notification_interval 120 ; Resend notifications every 2 hours notification_options d,u,r ; Only send notifications for specific host states contact_groups admins ; Notifications get sent to the admins by default hostgroups linux-servers ; Host groups that linux servers sho uld be a member of icon_image linux40.png statusmap_image linux40.gd2 register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! ) # Windows host definition template - This is NOT a real host, just a template! define host( name windows-server ; The name of this host template use generic-host ; Inherit default values ​​from the generic-host template check_period 24x7 ; By default, Windows servers are monitored round the clock check_interval 5 ; Actively check the server every 5 minutes retry_interval 1 ; Schedule host check retries at 1 minute intervals max_check_attempts 10 ; Check each server 10 times (max) check_command check-host-alive ; Default command to check if servers are "alive" notification_period 24x7 ; Send notification out at any time - day or night notification_interval 30 ; Resend notifications every 30 minutes notification_options d,r ; Only send notifications for specific host states contact_groups admins ; Notifications get sent to the admins by default hostgroups windows-servers ; Host groups that Windows servers should be a member of icon_image win40.png statusmap_image win40.gd2 register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE ) . . .

Restarting the nagios service

# service nagios restart

Nagios (Nagios Ain "t Gonna Insist On Sainthood)- an open source program designed to monitor computer systems and networks. It monitors, monitors the status of nodes and services, alerts the administrator if any of the services stop (or resume) their work.

In today's article, we'll show you how to install Nagios 4.1 on the Ubuntu 15.04.

You can test and see what Nagios and other programs / services / PBX are like by going to the section.

Training

Make sure your server has a fully working LAMP, if not installed, before continuing, install LAMP server. Let's install the following components:

sudo apt-get install build-essential libgd2-xpm-dev apache2-utils unzip

Create a Nagios user and group

Create a new user account nagios and group nagcmd:

Sudo useradd -m nagios
sudo passwd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data

Download Nagios and plugins for it

On the official website, the latest version is listed as 4.1.0 release candidate 2, and download it.

cd /usr/src
sudo wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.0rc2.tar.gz

Downloading plugins

Sudo wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz

Installing Nagios

Go to the folder where we downloaded Nagios and plugins and unzip using the command:

Sudo tar xzf nagios-4.1.0rc2.tar.gz

cd nagios-4.1.0rc2/

Run the following commands to compile and install Nagios:

Sudo ./configure --with-command-group=nagcmd
sudo make all
sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode

Installing the web interface Nagios:

sudo make install-webconf

If you receive the following error during the installation process:

/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
/usr/bin/install: cannot create regular file '/etc/httpd/conf.d/nagios.conf': No such file or directory
Makefile:296: recipe for target "install-webconf" failed
make: *** Error 1

Nagios tries to create nagios.conf file inside /etc/httpd.conf/directory, but in systems ubuntu nagios.conf files should be placed in /etc/apache2/sites-enabled/directory. We then use another command instead of sudo make install-webconf

sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-enabled/nagios.conf

Let's create an account Nagiosadmin to enter the web interface Nagios. Be sure to remember the password you set, you will need it when logging into the Web interface.

sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache for the new settings to take effect:

sudo systemctl restart apache2

We return to the folder where we downloaded the plugins and unzip the plugins:

cd /usr/src
tar xzf nagios-plugins-2.0.3.tar.gz

Go to the unzipped directory:

cd nagios-plugins-2.0.3/

Run the following commands to compile and install plugins:

Sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
sudo make
sudo make install

Launching Nagios

Checking nagios.conf for errors:

sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, run Nagios and add it to autorun:

Sudo service nagios start
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

If at startup Nagios you saw the following error:

Failed to start nagios.service: Unit nagios.service failed to load: No such file or directory.

[....] Starting nagios (via systemctl): nagios.serviceFailed to start nagios.service: Unit nagios.service failed to load: No such file or directory.failed!

To fix it, you need to copy /etc/init.d/skeleton in /etc/init.d/nagios

sudo cp /etc/init.d/skeleton /etc/init.d/nagios

edit /etc/init.d/nagios:

sudo nano /etc/init.d/nagios

By adding the following at the very end:

DESC="Nagios"
NAME=nagios
DAEMON=/usr/local/nagios/bin/$NAME
DAEMON_ARGS="-d /usr/local/nagios/etc/nagios.cfg"
PIDFILE=/usr/local/nagios/var/$NAME.lock

We save and exit.

The final touch - we give the rights to execute:

sudo chmod +x /etc/init.d/nagios

and run Nagios:

sudo /etc/init.d/nagios start

Now in the browser enter http://nagios-server-ip/nagios, in the username field enter nagiosadmin and the password that we set during the installation process.



Click on “Host” in the left pane of the console. You will see that Nagios is currently not monitoring any host other than itself.



This completes our installation. Following the instructions, we installed Nagios 4.1 on Ubuntu 15.04