Installing Nagios on Ubuntu Extending Nagios with custom plugins Installing nagios ubuntu server 14.04

When something breaks in the system or starts to behave in an unusual way, users suffer in unison. Therefore, in this case, you need to notify someone about the breakdown as soon as possible. It would be even better to anticipate the occurrence of problems in advance. This note will describe the installation and configuration of Nagios, which allows you to quite successfully solve such problems.

Invariants

Most systems have a number of invariants that should never be violated. Here are some examples of possible violations:

  • Load average on one of the machines has become more than X;
  • There is less than X free memory on one of the machines;
  • One of the machines has less than X free disk space;
  • Too many open file descriptors on machine X;
  • The percentage is very hot, the disk will soon fall apart, a small UPS charge;
  • High network traffic, disk io, low swap, and so on;
  • One of the hosts is not pinging or is pinging with too much RTT;
  • Something stopped resolving via DNS;
  • Newer versions of installed packages are available;
  • Suspiciously many users logged into one of the machines;
  • There is critical errors in logs for the last X minutes;
  • The number of non-critical errors in the last X minutes exceeded Y;
  • Laying or slowly responding PostgreSQL , Redis , RabbitMQ , ...;
  • SSL certificate will expire soon;
  • The 99th percentile of service response time is much longer than usual;
  • Mail, SMS, push notifications do not go, ...;
  • You need to top up the balance in a third-party service (AWS , Logentries , ...);
  • Suspiciously high costs in a third-party service;
  • In the test environment, it was not possible to recover from the backup from the sale;
  • The service became unavailable from Zelenograd and South Africa;
  • According to the internal health checks of the service, we ran into one of the thread pools;

As you can see, in almost any service, you can easily find two dozen invariants, or even more, that should never be violated, and which are quite easy to monitor automatically. If something breaks, we start sending letters to admins, SMS to superiors, and making phone calls to coders.

Installing Nagios

By the way, thanks to my acquaintance with Nagios, I began to understand people who advocate manual sharding and manual failover much better. But this is perhaps a topic for a separate note.

How are you monitoring your system?

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 VSH HRPNSOHFSH 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 RTPZTBNNOPE 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 CHPURPMShPCHBFSHUS 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. пВЩЮОП Ч РТПГЕУУЕ ЛПОЖЙЗХТЙТПЧБОЙС ОБ ЬЛТБО ЧЩЧПДСФУС УППФЧЕФУФЧХАЭЙЕ УППВЭЕОЙС, ОП ЧУС РТПВМЕНБ Ч ФПН, ЮФП ФХДБ ЦЕ УЩРЕФУС ДПЧПМШОП НОПЗП РТПЮЙИ ДЙБЗОПУФЙЮЕУЛЙИ УППВЭЕОЙК, Й РПЬФПНХ ОБКФЙ Й РПОСФШ ФП, ЮФП ОБН ОХЦОП Ч ЬФПН ЧЙОЕЗТЕФЕ, ДПЧПМШОП УМПЦОП. 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 RBLEFPCH 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 PB 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, UFPVSCH CHUE ЪBTBVPFBMP LBL RPMPTSEOP, OHTSOP HUFBOPCHYFSH CH YURPMSHKHENSCHK VTBKHET NPDHMSh DMS TBVPFSCH U vrml, YMY PFDEMSHOHA RTPZTBNNKH, RTEDOBOBYEOOKHA 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. рТЙ ОЕПВИПДЙНПУФЙ ТБВПФБФШ РПД ХРТБЧМЕОЙЕН Windows Й MAC УЙУФЕН С РТЕДРПЮЙФБА ЙУРПМШЪПЧБФШ Cortona VRML Client РП ФПК РТПУФПК РТЙЮЙОЕ, ЮФП ПО УПЧНЕУФЙН У ВПМШЫЙОУФЧПН ОБЙВПМЕЕ ТБУРТПУФТБОЕООЩИ ВТБХЪЕТПЧ, Л ЮЙУМХ ЛПФПТЩИ ОЕУПНОЕООП ПФОПУСФУС 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 рПД ДТХЗЙНЙ ПРЕТБГЙПООЩНЙ УЙУФЕНБНЙ ОЕ ЦЙЧЕФ, РПРЩФПЛ ЬЛУРБОУЙЙ ОЕ РТЕДРТЙОЙНБЕФ Й, УХДС РП РПУМЕДОЙН ФЕОДЕОГЙСН, УЛПТЕЕ ЧУЕЗП, ЮЕТЕЪ ОЕЛПФПТПЕ ЧТЕНС ВХДЕФ ПЛПОЮБФЕМШОП ЧЩФЕУОЕО УЧПЙН НОПЗПЖХОЛГЙПОБМШОЩН РТПФЙЧОЙЛПН. 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 MBULPPDE OBSHCHCHBENSHI 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 RPDPVOSHI OERTYSFOPUFEK, OBN OEPVIPDYNP PVYASUOYFSH Nagios, LBL RPUFTPEOB OBYB UEFSH Y LBLYN PVTBBPN DPVYTBFSHUS DP EE UBNSHI HDBMEOOSHCHI HZPMLCH. DEMBEFUS LFP U RPNPESH UPDBOYS PFOPIEOYK "TPDYFEMSH" - "RPFPNPL" NETsDH CHUENY OBYNY IPUFBNY. rPUME FBLYI YNEOEOYK LTYFYYUEULYE HCHEDPNMEOYS VHDHF RTYIPDYFSH FPMSHLP DMS LPNRSHAFETB Inner_Firewall, CHUE PUFBMSHOSHESH 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 RPYUENKh-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 okubmb, Tbdbdine LBCDPNH IPUFH YETHECHYUKH RP LTBUICHPK YLPOLOLA, B CHBFEN TBBRPMPTSIN YI FBL, UFPVSHSHENBMShop UPCHRBDBM, Puopchchbesush on the LPFPTPTPTPTPTPTPTPTPTPTPTPTPTPTPTPTPTPTPTPTPTPTPTPPTPTPTPPTPTPTPTPTPTPTPTPTPPTPTPTPPTPPTPPN 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/. лУФБФЙ, УФПЙФ ПВСЪБФЕМШОП ХВЕДЙФШУС, ЮФП ЧУЕ ЖБКМЩ, УПЪДБЧБЕНЩЕ ЧБНЙ, РТЙОБДМЕЦБФ РПМШЪПЧБФЕМА, ПФ ЙНЕОЙ ЛПФПТПЗП ТБВПФБЕФ Nagios, ЙОБЮЕ ЧЩ ВХДЕФЕ ПЮЕОШ ДПМЗП ОЕДПХНЕЧБФШ, РПЮЕНХ ОЙЛБЛЙИ ЙЪНЕОЕОЙК Ч ЛБТФБИ ОЕ ЧЙДОП, ИПФС ЧУЕ УДЕМБОП ФПЮОП, ЛБЛ Ч ЬФПК УФБФШЕ. 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.

лППТДЙОБФЩ ФПЮЕЛ, Ч ЛПФПТЩИ ДПМЦОЩ ТЙУПЧБФШУС ЙЛПОЛЙ Й ПВЯЕЛФЩ ОБЫЙИ ИПУФПЧ ОБ РМПУЛПК Й ФТЕИНЕТОПК ЛБТФБИ УЕФЙ, ОЕ ВХДХФ ЙУРПМШЪПЧБФШУС Nagios ДП ФЕИ РПТ, РПЛБ НЩ ОЕ ЧЩУФБЧЙН ЧПФ ФБЛЙН ПВТБЪПН ЪОБЮЕОЙС ФЕЗПЧ default_statusmap_layout Й default_statuswrl_layout Ч ЖБКМЕ 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 LPTRPTBFICHOKHA UYNCHPMYLKH, URTBCHPYUOSCHE FEMEZHPOSHCH Y RTPUYE UCHEDEOYS, PFOPUSEYEUS L CHSHVTBOOPK 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. оХЦОП РПНОЙФШ, ЮФП УПДЕТЦЙНПЕ ЧУЕИ ЧЩЫЕРЕТЕЮЙУМЕООЩИ ЖБКМПЧ РЕТЕД ДПВБЧМЕОЙЕН Ч ГЕМЕЧПК ЖБКМ ОЙЛБЛ ОЕ ПВТБВБФЩЧБЕФУС, ФП ЕУФШ УПЪДБФШ ДЙОБНЙЮЕУЛЙЕ ЪБЗПМПЧЛЙ Й ЧУФБЧЛЙ ВЕЪ ВЕЪХНОЩИ ХИЙЭТЕОЙК ОЕ РПМХЮЙФУС, РПФПНХ ЮФП ОЕФ ЧПЪНПЦОПУФЙ ЙУРПМШЪПЧБФШ Ч ЛБЮЕУФЧЕ ЗЕОЕТБФПТБ ДБООЩИ cgi ЙМЙ ЮФП-МЙВП ДТХЗПЕ. 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 - ИПУФ ОЕДПУФХРЕО host_down_sound - ИПУФ ОЕ ТБВПФБЕФ service_critical_sound - УЕТЧЙУ Ч ЛТЙФЙЮЕУЛПН УПУФПСОЙЙ service_warning_sound - УЕТЧЙУ Ч УПУФПСОЙЙ РТЕДХРТЕЦДЕОЙС service_unknown_sound - УПУФПСОЙЕ УЕТЧЙУБ ОЕЙЪЧЕУФОП normal_sound - ЧУЕ ТБВПФБЕФ ПФМЙЮОП, ОЕФ ОЙЛБЛЙИ РТПВМЕН

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

дМС ФПЗП ЮФПВЩ ЪЧХЛПЧПЕ ПРПЧЕЭЕОЙЕ ЪБТБВПФБМП, ОХЦОП РПНЕУФЙФШ ЖБКМЩ ЪЧХЛПЧ Ч ЖПТНБФЕ wav ЧОХФТШ ДЙТЕЛФПТЙЙ /usr/local/nagios/share/media/, ЛБЛ ЧУЕЗДБ, ОЕ ЪБВЩФШ П РТБЧБИ РПМШЪПЧБФЕМС Й РТЙОБДМЕЦОПУФЙ ЖБКМПЧ. 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.

A popular monitoring solution, nagios allows you to implement scalable systems. Configuration for distributed systems is a lengthy process, in the framework of the article we will implement monitoring of one service on a remote host.

Configuration work will be performed on a server with an operating system CentOS 7, nrpe client will also use CentOS 7

Install the plugin on the client nrpe and allow connection to the server in its settings.

Nagios installation and configuration of the monitoring server

We start the configuration on the machine that will act as a nagios server. Install the necessary packages:

yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp unzip

nagios works through Apache, so httpd is in the list of installed packages

We go to the root directory with temporary files and download the latest releases of nagios and nagios-plugins into it using wget

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.2.8.tar.gz

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

Create a system user and group

Adding the nagios user to the nagcmd group

usermod -a -G nagcmd nagios

usermod -a -G nagios,nagcmd apache

Since we use CentOS httpd does not run as the www-data user, but as the apache user

To avoid conflicts of rights in the future, add the apache user to the nagios, nagcmd groups

Extract the contents of the downloaded archive

tar -zxvf nagios-4.2.0.tar.gz

Go to the directory with nagios files

In the future, we will install both nagios and nrpe from the source

./configure --with-command-group=nagcmd

Specify the nagcmd group as an option during assembly

Compiling

make install-commandmode

Recursively copy the library directory to /usr/local on the server

cp -R contrib/eventhandlers /usr/local/nagios/libexec

We also recursively change the owner and group of the owner of directories and files on nagios

chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

We try to run and see the version of nagios by specifying the path to the main configuration file

Add nagios to startup - the system will run it every time at startup

systemctl enable nagios

Starting the service

We perform similar operations with the web server

Set the nagios user password

With help htpasswd generate a file that will restrict access for the nagiosadmin user

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

The installation of the main package is now complete. We open the Internet browser and enter the ip-address of the server in the search box, then /nagios and get into the web interface

Setting up service monitoring on a remote host

We go to another server machine that will act as a nagios client
Go to the directory /tmp/

Unpack nagios-plugins-2.1.2

tar -zxvf nagios-plugins-2.1.2

cd nagios-plugins-2.1.2

Compiling with nagios user and group

./configure --with-command-user=nagios --with-nagios-group=nagios

Now install nrpe plugin

First, additionally install from the openssl-devel repository, if it is already installed, skip the step (the package must also be present on the nagios server)

yum -y install openssl-devel

You can also install from the repository

yum install nagios-plugins-all nagios-plugins-nrpe

If you need a fresh version, so
Downloading the package

wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz

Unpack tar.gz

tar -zxvf nrpe-2.15.tar.gz

Compiling in the same way as before

Go to nagios server

We try to connect from the server specifying after the key -H client IP address

We get connection refused and go to configure the plugin

We start nrpe on the client and add the service to startup

Open the main configuration file and specify the IP address of the server as the value in the allowed_hosts section

mcedit /etc/nrpe/nrpe.cfg

allowed_hosts = 10.11.27.11

Back to the server

/usr/local/nagios/libexec/check_nrpe -H 10.11.27.44

Now our attempt is successful and we see the nagios version

Open the main config again

Remove the comment mark from the line with cfg_dir(cfg_dir=/usr/local/nagios/etc/servers)

Create a directory and change to it

mkdir /usr/local/nagios/etc/servers

cd /usr/local/nagios/etc/servers

Determine the hosts that will be monitored. Hosts can have any names, nagios will see all files with cfg extension

We prescribe the host parameters, the meaning of the directives is clear from the name. There can be much more of these directives in case of need for fine-tuning monitoring, here we consider the basic working configuration

define host (
use linux server
host_name cenos11
alias just nagios client
address 10.11.27.44
max_check_attempts 5
check_period 24×7
notification_interval 30
notification_period 24×7

}

Add a config for the service we are monitoring. Now we restrict ourselves to checking the presence of a ping to the host

{
use generic service
host_name cenos11
service_description PING
check_command check_ping!100.0.20%!500.0.50%
}

The check_command command was used, an excerpt from the manual regarding it says the following:

check_ping -H -w ,% -c ,%
[-p packets] [-t timeout] [-4|-6]

Accordingly, with a loss of 20% of packets, we will receive a warning, with a loss of 50% - ALERT

Run again and make sure there are no errors

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

Restarting the service

systemctl restart nagios

We go to the web interface and see that the service on the remote host that we monitor is displayed there (in the configuration shown in the screenshot, monitoring of a number of other resources is configured). The configuration of the monitoring server with basic functionality is now complete.

Setting up ALERTs in nagios

Open the main configuration file and, if necessary, uncomment the line cfg_file=/usr/local/nagios/etc/objects/contacts.cfg:

mcedit /usr/local/nagios/etc/nagios.cfg

In the file, we define the contact email address for sending notifications:

mcedit /usr/local/nagios/etc/objects/contacts.cfg

define contact (
contact_name nagiosadmin
use generic-contact
alias Nagios Admin
email [email protected]

}

Restarting the service

cyctemctl restart nagios

Additional software can also be used with which, for example, SMS messages can be sent with ALERT concerning essential services. A working Nagios server has been received, installation and configuration on this is completed.

For servers, you can install Nagios server and client on the same machine, but it's much easier to use a different package, such as .

In large networks, monitoring of strategic objects such as routers, web servers and file storage is simply necessary, the sooner a malfunction is determined, the sooner it will be fixed!
As a monitoring system, I suggest using Nagios.
Platform selected for installation ubuntu 10.10 , using the built-in installer, install nagios :

It should be noted that in this case apache you can not configure, since the basic configuration is enough.
Now let's create a file that will describe the parameters of the hosts. Go to setting :

cd /etc/nagios3/conf.d nano myhosts.cfg

In file myhosts.cfg assign each device an address and a description:

define host ( host_name Server-terminals alias Server terminals address 192.168.1.2 use generic-host ) define host ( host_name Server-www alias Server www address 192.168.1.12 use generic-host ) define host ( host_name Server-firewall alias Server firewall address 192.168 .1.21 use generic-host ) define host ( host_name Server-statistic alias Server statistic address 192.168.1.20 use generic-host ) define host ( host_name Server-ad alias Server ad address 192.168.1.14 use generic-host ) define host ( host_name modem -ad alias Server ad address 10.0.0.1 parents Server-ad use generic-host ) define host ( host_name modem-www alias Server ad address 172.16.0.3 parents Sever-www use generic-host ) define host ( host_name modem-statistic alias Server ad address 192.168.0.253 parents Server-statistic use generic-host )

Parameter parents we indicate to which device, logically, this object will connect, thus it becomes possible to correct the network map.
We can view all declared hosts on the tab hosts browser and they will look like this:


Next, we need to add the declared devices to groups, depending on the further verification method, one computer can be added to several groups at the same time. Editing the group file :

Now that the groups have been created, we will set the parameters for checking, in this case we will check for ping, and with a high percentage of lost packets nagios will notify us by changing the color of an individual node on the map.
And so we edit the services file:

We want to replace the logo of the displayed item on the map nagios , the logos are in /usr/share/nagios/htdocs/images/logos , when changing the logo, you just need to specify a new image located at the specified path.
Editing:

namely the parameter default_statuswrl_layout to the value from 0 before 5 .
I also change the page refresh period, in seconds, with the parameter refresh_rate
Now, in the image and likeness, you will be able to add computers and groups on your own, I think this is the end of the simple setup. In the future, I will write about additional settings related to the notification system.

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

Majority Linux distributions® come with an embedded 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.

  • Tools:
    • 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 individual people 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 average download value over the last minute is also always used.

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 /etc/nagios-plugins/config/mygetloadavg.cfg file is created with the following content, 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 configuration file hosts.cfg .

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, which 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 Nagios treats 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 Tcl plugin 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 failed to load, 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, we need to create a file /etc/nagios-plugins/config/exchangerate.cfg with contents 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. Although 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 command-line arguments 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 plugins to check the status, but individual applications send status change messages periodically or when the state of the 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 reusing 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.

Internet