1. Trang chủ
  2. » Công Nghệ Thông Tin

Nagios: System and Network Monitoring potx

463 608 2

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 463
Dung lượng 6,51 MB

Nội dung

www.it-ebooks.info Nagios www.it-ebooks.info www.it-ebooks.info Wolfgang Barth Nagios System andNetwork Monitoring Munich SanFrancisco www.it-ebooks.info NAGIOS. Copyright c  2006 OpenSource PressGmbH Allrightsreserved. No part of this work maybereproducedortransmittedinany form or by anymeans, electronic or mechanical, includingphotocopying,recording,orbyany informationstorageorretrievalsystem, withoutthe prior writtenpermission of thecopyright ownerand thepublisher. Printedonrecycledpaper in theUnitedStatesofAmerica. 12345678910—09 08 07 06 No Starch Pressand theNoStarch Presslogo areregisteredtrademarksofNoStarch Press, Inc. Otherproduct and companynames mentionedhereinmay be thetrademarksoftheir respective owners.Ratherthanuse atrademark symbol with everyoccurrence of atrademarked name,weare usingthe namesonlyinaneditorialfashionand to the benefit of thetrademark owner, with no intentionofinfringement of thetrademark. Publisher: William Pollock CoverDesign: Octopod Studios U.S. editionpublishedbyNoStarch Press, Inc. 555 De HaroStreet,Suite 250, SanFrancisco, CA 94107 phone: 415.863.9900; fax: 415.863.9950; info@nostarch.com;http://www.nostarch.com Original edition c  2005 OpenSource PressGmbH PublishedbyOpenSource PressGmbH, Munich, Germany Publisher: Dr.Markus Wirtz Original ISBN 3-937514-09-0 For informationontranslations, pleasecontact OpenSource PressGmbH, Amalienstr.45Rg, 80799 M ¨ unchen, Germany phone+49.89.28755562; fax+49.89.28755563; info@opensourcepress.de;http://www.opensourcepress.de Theinformationinthisbook is distributed on an “AsIs” basis, withoutwarranty. While everyprecautionhas been takeninthe preparationofthiswork, neitherthe author norOpenSource PressGmbHnor No Starch Press, Inc. shall have anyliabilitytoany person or entity with respecttoany loss or damage caused or allegedtobecaused directly or indirectly by theinformationcontained in it. LibraryofCongressCataloging-in-Publication Data Barth, Wolfgang Nagios :system and network monitoring /Wolfgang Barth 1st ed. p. cm. Includes index. ISBN 1-59327-070-4 1. Computer networks Management Automation. I. Title. TK5105.5.B374 2005 004.6 dc22 2005026745 www.it-ebooks.info Contents Introduction 15 From Source Code to aRunning Installation 23 1Installation 25 1.1Compilingthe Source Code 26 1.2Installingand TestingPlugins 30 1.2.1Installation 30 1.2.2Plugintest 32 1.3Configuration of theWeb Interface 33 1.3.1SettingUpApache 33 1.3.2UserAuthentication 34 2Nagios Configuration 37 2.1The Main Configuration File nagios.cfg 38 2.2Objects—an Overview 41 2.3Defining theMachines to Be Monitored,with host 44 2.4GroupingComputersTogether with hostgroup 46 2.5Defining Services to Be Monitored with service 47 2.6GroupingServices Together with servicegroup 50 2.7Defining Addressees for ErrorMessages: contact 50 2.8The Message Recipient: contactgroup 52 2.9WhenNagios NeedstoDoSomething: the command Object 53 2.10 DefiningaTime Period with timeperiod 54 5 www.it-ebooks.info Contents 2.11 Templates 54 2.12 Configuration Aids for ThoseToo Lazy to Type 56 2.12.1Defining servicesfor severalcomputers. 56 2.12.2One host groupfor allcomputers 57 2.12.3Other configuration aids 57 2.13 CGIConfiguration in cgi.cfg 57 2.14 TheResources File resource.cfg 59 3Startup61 3.1Checking theConfiguration 61 3.2GettingMonitoringStarted 63 3.2.1Manualstart 63 3.2.2Automatic start. 64 3.2.3Making configuration changescomeintoeffect 64 3.3Overviewofthe WebInterface 64 In More Detail 69 4Nagios Basics 71 4.1Taking into Account theNetworkTopology 72 4.2ForcedHostChecks vs.PeriodicReachabilityTests 75 4.3States of Hostsand Services 75 5Service Checksand HowTheyAre Performed79 5.1Testing Network Services Directly 81 5.2Running Pluginsvia Secure Shellonthe Remote Computer 82 5.3The Nagios Remote Plugin Executor 82 5.4Monitoringvia SNMP 83 5.5The Nagios ServiceCheck Acceptor 84 6Pluginsfor NetworkServices 85 6.1StandardOptions 87 6.2ReachabilityTestwithPing 88 6.2.1 check_icmp as aservicecheck 90 6 www.it-ebooks.info Contents 6.2.2 check_icmp as ahostcheck 91 6.3MonitoringMailServers 92 6.3.1MonitoringSMTPwith check_smtp 92 6.3.2POP andIMAP 95 6.4MonitoringFTP andWeb Servers 97 6.4.1FTP services 97 6.4.2Web servercontrol via HTTP 98 6.4.3MonitoringWeb proxies 101 6.5DomainNameServerunder Control 105 6.5.1DNS check with nslookup 106 6.5.2Monitoringthe name serverwith dig 107 6.6Queryingthe Secure ShellServer 108 6.7Generic Network Plugins 110 6.7.1Testing TCPports 110 6.7.2MonitoringUDP ports 112 6.8MonitoringDatabases 114 6.8.1PostgreSQL 115 6.8.2MySQL 119 6.9MonitoringLDAP DirectoryServices 121 6.10 Checking aDHCPServer. 124 6.11 MonitoringUPS withthe Network UPS Tools 126 7Testing LocalResources 133 7.1FreeHardDrive Capacity 134 7.2Utilizationofthe SwapSpace. 136 7.3Testing theSystem Load 137 7.4MonitoringProcesses 138 7.5Checking LogFiles 141 7.5.1The standardplugin check_log 142 7.5.2The modern variation: check_logs.pl 143 7.6KeepingTabsonthe Number of Logged-in Users 144 7.7Checking theSystem Time 145 7.7.1Checking thesystem time via NTP. 145 7 www.it-ebooks.info Contents 7.7.2Checking system time withthe time protocol 146 7.8Regularly Checking theStatusofthe Mail Queue 147 7.9KeepinganEye on theModification Date of aFile 148 7.10 MonitoringUPSswith apcupsd 149 7.11 Nagios MonitorsItself 150 7.11.1Running thepluginmanually withascript 151 7.11.2 check_nagios as atool for CGIprograms. 152 7.12 Hardware Checks withLMSensors 152 7.13 TheDummy Plugin for Tests 154 8Manipulating Plugin Output155 8.1NegatingPluginResults 155 8.2Inserting Hyperlinks with urlize 156 9Executing Pluginsvia SSH 157 9.1The check_by_ssh Plugin 158 9.2Configuring SSH 160 9.2.1GeneratingSSH keypairs on theNagios server. 160 9.2.2Settingupthe user nagios on thetargethost 161 9.2.3Checking theSSH connectionand check_by_ssh 161 9.3Nagios Configuration 162 10 TheNagios RemotePlugin Executor(NRPE)165 10.1Installation 166 10.1.1Distribution-specificpackages. 166 10.1.2Installation from thesourcecode 167 10.2Startingvia theinetDaemon 168 10.2.1 xinetd configuration 168 10.2.2 inetd configuration 169 10.3NRPEConfiguration on theComputer to Be Monitored 170 10.3.1Passing parametersontolocal plugins 171 10.4Nagios Configuration 172 10.4.1NRPEwithout passing parameterson 172 10.4.2Passing parametersoninNRPE 173 8 www.it-ebooks.info Contents 10.4.3Optimizingthe configuration 173 10.5IndirectChecks 174 11 Collecting Information Relevantfor Monitoring with SNMP 177 11.1IntroductiontoSNMP 178 11.1.1The Management Information Base. 179 11.1.2SNMPprotocolversions 183 11.2NET-SNMP 184 11.2.1Toolsfor SNMP requests 184 11.2.2The NET-SNMP daemon 187 11.3Nagios’s OwnSNMPPlugins 196 11.3.1The genericSNMPplugin check_snmp 196 11.3.2Checking severalinterfaces simultaneously. 201 11.3.3Testing theoperating status of individualinterfaces 203 11.4Other SNMP-basedPlugins 205 11.4.1Monitoringharddrive space andprocesseswith nagios- snmp-plugins 205 11.4.2Observingthe load on networkinterfaces with check- iftraffic 207 11.4.3The manubulon.com pluginsfor specialapplicationpur- poses 209 12 TheNagios Notification System 215 12.1Who Should be InformedofWhat, When?. 216 12.2WhenDoesaMessage Occur? 217 12.3The Message Filter 217 12.3.1Switchingmessagesonand off systemwide 218 12.3.2Enablingand suppressing computer andservice-related messages 219 12.3.3Person-related filter options 221 12.3.4Caseexamples 222 12.4ExternalNotification Programs 224 12.4.1Notification via e-mail 225 12.4.2Notification via SMS 227 9 www.it-ebooks.info [...]... occurred With personnel resources becoming more and more scarce, no IT department can really afford to regularly check all systems manually Networks that are growing more and more complex especially demand the need to be informed early on of disruptions that have occurred or of problems that are about to happen Nagios, the Open Source tool for system and network monitoring, helps the administrator to detect... from a central location Other tools for network monitoring Nagios is not the only tool for monitoring systems and networks The most wellknown “competitor,” perhaps on an equal footing, is Big Brother (BB) Despite a number of differences, its Web interface also serves the same purpose as that of Nagios: displaying to the administrator what is in the “green area” and what is not The reason why the author... descriptions and treatments of all options and features These are examined in the second part of the book Chapter 4 looks at the details of service and host checks, and in particular introduces their dependency on network topologies The options available to Nagios for implementing service checks and obtaining their results is described in Chapter 5 This is followed by the presentation of individual standard... About This Book This book is directed at network administrators who want to find out about the condition of their systems and networks using an Open Source tool It describes Nagios version 2.0, which is somewhat different from its predecessors in its configuration The plugins, on the other hand, lead their own lives, are to a great extent independent of Nagios, and are therefore not restricted to a particular... Hosts 406 B Event Handlers 409 B.1 Execution Times for the Event Handler 410 B.2 Defining the Event Handler in the Service Definition 411 B.3 The Handler Script 411 B.4 Things to Note When Using Event Handlers 413 13 www.it-ebooks.info Contents C Writing Your Own Plugins: Monitoring Oracle with the Instant Client 415... plugins, which are described in detail in Chapter 17 Networks are rarely homogeneous, that is, equipped only with Linux and other Unix-based operating systems For this reason Chapter 18 demonstrates what utilities can be used to integrate and monitor Windows systems Chapter 19 uses the example of a low-cost hardware sensor to show how room temperature and humidity can be monitored simply yet effectively... page and the documentation They are blocked off from access to other functions There is a good reason for this: apart from status queries and other display functions, Nagios has the ability to send commands via the Web interface The interface for external commands is used for this purpose (Section 13.1, page 240) If this is active, checks can be switched on and off via the Web browser, for example, and. .. further host and service checks The software puts administrators in a position where they can more quickly detect the actual cause and rectify the situation The suppliers of information The great strength of Nagios—even in comparison with other network monitoring tools—lies in its modular structure: the Nagios core does not contain one single test Instead it uses external programs for service and host... 338 17.6 Other tools and the limits of graphic evaluation 349 Special Applications 18 Monitoring Windows Servers 351 353 18.1 NSClient and NC Net 354 18.1.1 Installation 354 18.1.2 The check_nt plugin 355 18.1.3 Commands which can be run with NSClient and NC Net 356 18.1.4 Advanced functions of... service provider was responsible for the network connections (VPN and ISDN) between branch and head office, for whom something like this “just doesn’t happen” The end result: many hours spent searching for the error, an irritated boss (the meeting for which the e-mail was urgently required has long since finished), and a sweating admin With a properly configured Nagios system, the adminstrator would already . situationfromacentrallocation. Othertoolsfor network monitoring Nagios is notthe only tool for monitoring systemsand networks.The most well- known“competitor,”perhaps. check_icmp as ahostcheck 91 6.3MonitoringMailServers 92 6.3.1MonitoringSMTPwith check_smtp 92 6.3.2POP andIMAP 95 6.4MonitoringFTP andWeb Servers 97 6.4.1FTP

Ngày đăng: 23/03/2014, 07:20

TỪ KHÓA LIÊN QUAN