libcats.org
Главная

Nagios: system and network monitoring

Обложка книги Nagios: system and network monitoring

Nagios: system and network monitoring

Книга Nagios: system and network monitoring Nagios: system and network monitoringКниги Компьютерные сети Автор: Wolfgang Barth Год издания: 2005 Формат: pdf Издат.:No Starch Press Страниц: 462 Размер: 7 ISBN: 1-59327-070-4 Язык: Русский0 (голосов: 0) Оценка: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.ContentsIntroduction 15From Source Code to a Running Installation 231 Installation 251.1 Compiling the Source Code . . . . . . . . . . . . . . . . . . . . . . 261.2 Installing and Testing Plugins . . . . . . . . . . . . . . . . . . . . . 301.2.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 301.2.2 Plugin test . . . . . . . . . . . . . . . . . . . . . . . . . . 321.3 Configuration of the Web Interface . . . . . . . . . . . . . . . . . 331.3.1 Setting Up Apache . . . . . . . . . . . . . . . . . . . . . . 331.3.2 User Authentication . . . . . . . . . . . . . . . . . . . . . 342 Nagios Configuration 372.1 The Main Configuration File nagios.cfg . . . . . . . . . . . . . . . 382.2 Objects—an Overview . . . . . . . . . . . . . . . . . . . . . . . . . 412.3 Defining the Machines to Be Monitored, with host . . . . . . . . . 442.4 Grouping Computers Together with hostgroup . . . . . . . . . . . 462.5 Defining Services to Be Monitored with service . . . . . . . . . . . 472.6 Grouping Services Together with servicegroup . . . . . . . . . . . 502.7 Defining Addressees for Error Messages: contact . . . . . . . . . . 502.8 The Message Recipient: contactgroup . . . . . . . . . . . . . . . . 522.9 When Nagios Needs to Do Something: the command Object . . . 532.10 Defining a Time Period with timeperiod . . . . . . . . . . . . . . . 542.11 Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542.12 Configuration Aids for Those Too Lazy to Type . . . . . . . . . . . . 562.12.1 Defining services for several computers . . . . . . . . . . . 562.12.2 One host group for all computers . . . . . . . . . . . . . . 572.12.3 Other configuration aids . . . . . . . . . . . . . . . . . . . 572.13 CGI Configuration in cgi.cfg . . . . . . . . . . . . . . . . . . . . . 572.14 The Resources File resource.cfg . . . . . . . . . . . . . . . . . . . . 593 Startup 613.1 Checking the Configuration . . . . . . . . . . . . . . . . . . . . . . 613.2 Getting Monitoring Started . . . . . . . . . . . . . . . . . . . . . . 633.2.1 Manual start . . . . . . . . . . . . . . . . . . . . . . . . . 633.2.2 Automatic start . . . . . . . . . . . . . . . . . . . . . . . . 643.2.3 Making configuration changes come into effect . . . . . . 643.3 Overview of the Web Interface . . . . . . . . . . . . . . . . . . . . 64In More Detail . . . 694 Nagios Basics 714.1 Taking into Account the Network Topology . . . . . . . . . . . . . 724.2 Forced Host Checks vs. Periodic Reachability Tests . . . . . . . . . . 754.3 States of Hosts and Services . . . . . . . . . . . . . . . . . . . . . 755 Service Checks and How They Are Performed 795.1 Testing Network Services Directly . . . . . . . . . . . . . . . . . . . 815.2 Running Plugins via Secure Shell on the Remote Computer . . . . 825.3 The Nagios Remote Plugin Executor . . . . . . . . . . . . . . . . . 825.4 Monitoring via SNMP . . . . . . . . . . . . . . . . . . . . . . . . . 835.5 The Nagios Service Check Acceptor . . . . . . . . . . . . . . . . . . 846 Plugins for Network Services 856.1 Standard Options . . . . . . . . . . . . . . . . . . . . . . . . . . . 876.2 Reachability Test with Ping . . . . . . . . . . . . . . . . . . . . . . 886.2.1 check_icmp as a service check . . . . . . . . . . . . . . . 906.2.2 check_icmp as a host check . . . . . . . . . . . . . . . . . 916.3 Monitoring Mail Servers . . . . . . . . . . . . . . . . . . . . . . . . 926.3.1 Monitoring SMTP with check_smtp . . . . . . . . . . . . . 926.3.2 POP and IMAP . . . . . . . . . . . . . . . . . . . . . . . . 956.4 Monitoring FTP and Web Servers . . . . . . . . . . . . . . . . . . . 976.4.1 FTP services . . . . . . . . . . . . . . . . . . . . . . . . . . 976.4.2 Web server control via HTTP . . . . . . . . . . . . . . . . . 986.4.3 Monitoring Web proxies . . . . . . . . . . . . . . . . . . . 1016.5 Domain Name Server under Control . . . . . . . . . . . . . . . . . 1056.5.1 DNS check with nslookup . . . . . . . . . . . . . . . . . . 1066.5.2 Monitoring the name server with dig . . . . . . . . . . . . 1076.6 Querying the Secure Shell Server . . . . . . . . . . . . . . . . . . . 1086.7 Generic Network Plugins . . . . . . . . . . . . . . . . . . . . . . . 1106.7.1 Testing TCP ports . . . . . . . . . . . . . . . . . . . . . . . 1106.7.2 Monitoring UDP ports . . . . . . . . . . . . . . . . . . . . 1126.8 Monitoring Databases . . . . . . . . . . . . . . . . . . . . . . . . . 1146.8.1 PostgreSQL . . . . . . . . . . . . . . . . . . . . . . . . . . 1156.8.2 MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1196.9 Monitoring LDAP Directory Services . . . . . . . . . . . . . . . . . 1216.10 Checking a DHCP Server . . . . . . . . . . . . . . . . . . . . . . . . 1246.11 Monitoring UPS with the Network UPS Tools . . . . . . . . . . . . 1267 Testing Local Resources 1337.1 Free Hard Drive Capacity . . . . . . . . . . . . . . . . . . . . . . . 1347.2 Utilization of the Swap Space . . . . . . . . . . . . . . . . . . . . . 1367.3 Testing the System Load . . . . . . . . . . . . . . . . . . . . . . . . 1377.4 Monitoring Processes . . . . . . . . . . . . . . . . . . . . . . . . . 1387.5 Checking Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 1417.5.1 The standard plugin check_log . . . . . . . . . . . . . . . 1427.5.2 The modern variation: check_logs.pl . . . . . . . . . . . . 1437.6 Keeping Tabs on the Number of Logged-in Users . . . . . . . . . . 1447.7 Checking the System Time . . . . . . . . . . . . . . . . . . . . . . 1457.7.1 Checking the system time via NTP . . . . . . . . . . . . . . 1457.7.2 Checking system time with the time protocol . . . . . . . 1467.8 Regularly Checking the Status of the Mail Queue . . . . . . . . . . 1477.9 Keeping an Eye on the Modification Date of a File . . . . . . . . . 1487.10 Monitoring UPSs with apcupsd . . . . . . . . . . . . . . . . . . . . 1497.11 Nagios Monitors Itself . . . . . . . . . . . . . . . . . . . . . . . . . 1507.11.1 Running the plugin manually with a script . . . . . . . . . 1517.11.2 check_nagios as a tool for CGI programs . . . . . . . . . . 1527.12 Hardware Checks with LM Sensors . . . . . . . . . . . . . . . . . . 1527.13 The Dummy Plugin for Tests . . . . . . . . . . . . . . . . . . . . . 1548 Manipulating Plugin Output 1558.1 Negating Plugin Results . . . . . . . . . . . . . . . . . . . . . . . . 1558.2 Inserting Hyperlinks with urlize . . . . . . . . . . . . . . . . . . . 1569 Executing Plugins via SSH 1579.1 The check_by_ssh Plugin . . . . . . . . . . . . . . . . . . . . . . . 1589.2 Configuring SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1609.2.1 Generating SSH key pairs on the Nagios server . . . . . . . 1609.2.2 Setting up the user nagios on the target host . . . . . . . 1619.2.3 Checking the SSH connection and check_by_ssh . . . . . 1619.3 Nagios Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 16210 The Nagios Remote Plugin Executor (NRPE) 16510.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16610.1.1 Distribution-specific packages . . . . . . . . . . . . . . . . 16610.1.2 Installation from the source code . . . . . . . . . . . . . . 16710.2 Starting via the inet Daemon . . . . . . . . . . . . . . . . . . . . . 16810.2.1 xinetd configuration . . . . . . . . . . . . . . . . . . . . . 16810.2.2 inetd configuration . . . . . . . . . . . . . . . . . . . . . 16910.3 NRPE Configuration on the Computer to Be Monitored . . . . . . . 17010.3.1 Passing parameters on to local plugins . . . . . . . . . . . 17110.4 Nagios Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 17210.4.1 NRPE without passing parameters on . . . . . . . . . . . . 17210.4.2 Passing parameters on in NRPE . . . . . . . . . . . . . . . 17310.4.3 Optimizing the configuration . . . . . . . . . . . . . . . . 17310.5 Indirect Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17411 Collecting Information Relevant for Monitoring with SNMP 17711.1 Introduction to SNMP . . . . . . . . . . . . . . . . . . . . . . . . . 17811.1.1 The Management Information Base . . . . . . . . . . . . . 17911.1.2 SNMP protocol versions . . . . . . . . . . . . . . . . . . . 18311.2 NET-SNMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18411.2.1 Tools for SNMP requests . . . . . . . . . . . . . . . . . . . 18411.2.2 The NET-SNMP daemon . . . . . . . . . . . . . . . . . . . 18711.3 Nagios’s Own SNMP Plugins . . . . . . . . . . . . . . . . . . . . . 19611.3.1 The generic SNMP plugin check_snmp . . . . . . . . . . . 19611.3.2 Checking several interfaces simultaneously . . . . . . . . . 20111.3.3 Testing the operating status of individual interfaces . . . . 20311.4 Other SNMP-based Plugins . . . . . . . . . . . . . . . . . . . . . . 20511.4.1 Monitoring hard drive space and processes with nagiossnmp-plugins . . . . . . . . . . . . . . . . . . . . . . . . 20511.4.2 Observing the load on network interfaces with checkiftraffic. . . . . . . . . . . . . . . . . . . . . . . . . . . . 20711.4.3 The manubulon.com plugins for special application purposes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20912 The Nagios Notification System 21512.1 Who Should be Informed of What, When? . . . . . . . . . . . . . . 21612.2 When Does a Message Occur? . . . . . . . . . . . . . . . . . . . . 21712.3 The Message Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . 21712.3.1 Switching messages on and off systemwide . . . . . . . . 21812.3.2 Enabling and suppressing computer and service-relatedmessages . . . . . . . . . . . . . . . . . . . . . . . . . . . 21912.3.3 Person-related filter options . . . . . . . . . . . . . . . . . 22112.3.4 Case examples . . . . . . . . . . . . . . . . . . . . . . . . 22212.4 External Notification Programs . . . . . . . . . . . . . . . . . . . . 22412.4.1 Notification via e-mail . . . . . . . . . . . . . . . . . . . . 22512.4.2 Notification via SMS . . . . . . . . . . . . . . . . . . . . . 22712.5 Escalation Management . . . . . . . . . . . . . . . . . . . . . . . . 23112.6 Dependences between Hosts and Services as a Filter Criterion . . . 23412.6.1 The standard case: service dependencies . . . . . . . . . . 23412.6.2 Only in exceptional cases: host dependencies . . . . . . . 23813 Passive Tests with the External Command File 23913.1 The Interface for External Commands . . . . . . . . . . . . . . . . 24013.2 Passive Service Checks . . . . . . . . . . . . . . . . . . . . . . . . . 24113.3 Passive Host Checks . . . . . . . . . . . . . . . . . . . . . . . . . . 24213.4 Reacting to Out-of-Date Information of Passive Checks . . . . . . 24314 The Nagios Service Check Acceptor (NSCA) 24714.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24814.2 Configuring the Nagios Server . . . . . . . . . . . . . . . . . . . . 24914.2.1 The configuration file nsca.cfg . . . . . . . . . . . . . . . 24914.2.2 Configurung the inet daemon . . . . . . . . . . . . . . . . 25114.3 Client-side Configuration . . . . . . . . . . . . . . . . . . . . . . . 25214.4 Sending Test Results to the Server . . . . . . . . . . . . . . . . . . 25314.5 Application Example I: Integrating syslog and Nagios . . . . . . . . 25414.5.1 Preparing syslog-ng for use with Nagios . . . . . . . . . . 25514.5.2 Nagios configuration: volatile services . . . . . . . . . . . 25714.5.3 Resetting error states manually . . . . . . . . . . . . . . . 25814.6 Application Example II: Processing SNMP Traps . . . . . . . . . . . 26014.6.1 Receiving traps with snmptrapd . . . . . . . . . . . . . . 26014.6.2 Passing on traps to NSCA . . . . . . . . . . . . . . . . . . 26114.6.3 The matching service definition . . . . . . . . . . . . . . . 26315 Distributed Monitoring 26515.1 Switching On the OCSP/OCHP Mechanism . . . . . . . . . . . . . . 26615.2 Defining OCSP/OCHP Commands . . . . . . . . . . . . . . . . . . . 26715.3 Practical Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . 26915.3.1 Avoiding redundancy in configuration files . . . . . . . . . 26915.3.2 Defining templates . . . . . . . . . . . . . . . . . . . . . . 27016 The Web Interface 27316.1 Recognizing and Acting On Problems . . . . . . . . . . . . . . . . 27516.1.1 Comments on problematic hosts . . . . . . . . . . . . . . 27616.1.2 Taking responsibility for problems: acknowledgements . . 27816.2 An Overview of the Individual CGI Programs . . . . . . . . . . . . . 27916.2.1 Variations in status display: status.cgi . . . . . . . . . . . 27916.2.2 Additional information and control center: extinfo.cgi . . 28416.2.3 Interface for external commands: cmd.cgi . . . . . . . . . 28816.2.4 The most important things at a glance: tac.cgi . . . . . . 29016.2.5 Network plan: the topological map of the network (statusmap.cgi) . . . . . . . . . . . . . . . . . . . . . . . . . . 29116.2.6 Navigation in 3D: statuswrl.cgi . . . . . . . . . . . . . . . 29316.2.7 Querying the status with a cell phone: statuswml.cgi . . . 29516.2.8 Analyzing disrupted partial networks: outages.cgi . . . . . 29516.2.9 Querying the object definition with config.cgi . . . . . . . 29516.2.10 Availability statistics: avail.cgi . . . . . . . . . . . . . . . 29616.2.11 What events occur, how often? histogram.cgi . . . . . . . 29816.2.12 Filtering log entries after specific states: history.cgi . . . . 29916.2.13 Who was told what, when? notifications.cgi . . . . . . . 30016.2.14 Showing all logfile entries: showlog.cgi . . . . . . . . . . 30116.2.15 Evaluating whatever you want: summary.cgi . . . . . . . 30116.2.16 Following states graphically over time: trends.cgi . . . . . 30316.3 Planning Downtimes . . . . . . . . . . . . . . . . . . . . . . . . . 30416.3.1 Maintenance periods for hosts . . . . . . . . . . . . . . . 30516.3.2 Downtime for services . . . . . . . . . . . . . . . . . . . . 30616.4 Additional Information on Hosts and Services . . . . . . . . . . . . 30716.4.1 Extended host information . . . . . . . . . . . . . . . . . 30716.4.2 Extended service information . . . . . . . . . . . . . . . . 31016.5 Configuration Changes through the Web Interfaces: the Restart Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31117 Graphic Display of Performance Data 31317.1 Processing Plugin Performance Data with Nagios . . . . . . . . . . 31417.1.1 The template mechanism . . . . . . . . . . . . . . . . . . 31417.1.2 Using external commands to process performance data . . 31717.2 Graphs for the Web with Nagiosgraph . . . . . . . . . . . . . . . . 31717.2.1 Basic installation . . . . . . . . . . . . . . . . . . . . . . . 31817.2.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 31917.3 Preparing Performance Data for Evaluation with Perf2rrd . . . . . 32517.3.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 32617.3.2 Nagios configuration . . . . . . . . . . . . . . . . . . . . . 32617.3.3 Perf2rrd in practice . . . . . . . . . . . . . . . . . . . . . . 32717.4 The Graphics Specialist drraw . . . . . . . . . . . . . . . . . . . . . 33017.4.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 33017.4.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 33117.4.3 Practical application . . . . . . . . . . . . . . . . . . . . . 33217.5 Automated to a Large Extent: NagiosGrapher . . . . . . . . . . . . 33617.5.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 33617.5.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 33817.6 Other tools and the limits of graphic evaluation . . . . . . . . . . . 349Special Applications 35118 Monitoring Windows Servers 35318.1 NSClient and NC Net . . . . . . . . . . . . . . . . . . . . . . . . . 35418.1.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 35418.1.2 The check_nt plugin . . . . . . . . . . . . . . . . . . . . . 35518.1.3 Commands which can be run with NSClient and NC Net . 35618.1.4 Advanced functions of NC Net . . . . . . . . . . . . . . . 36318.2 NRPE for Windows: NRPE NT . . . . . . . . . . . . . . . . . . . . . 37118.2.1 Installation and configuration . . . . . . . . . . . . . . . . 37218.2.2 Function test . . . . . . . . . . . . . . . . . . . . . . . . . 37318.2.3 The Cygwin plugins . . . . . . . . . . . . . . . . . . . . . . 37318.2.4 Perl plugins in Windows . . . . . . . . . . . . . . . . . . . 37419 Monitoring Room Temperature and Humidity 37719.1 Sensors and Software . . . . . . . . . . . . . . . . . . . . . . . . . 37819.1.1 The PCMeasure software for Linux . . . . . . . . . . . . . 37819.1.2 The query protocol . . . . . . . . . . . . . . . . . . . . . . 37919.2 The Nagios Plugin check_pcmeasure . . . . . . . . . . . . . . . . 37920 Monitoring SAP Systems 38320.1 Checking without a Login: sapinfo . . . . . . . . . . . . . . . . . . 38420.1.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . 38420.1.2 First test . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38420.1.3 The plugin check_sap.sh . . . . . . . . . . . . . . . . . . . 38620.2 Monitoring with SAP’s Own Monitoring System (CCMS) . . . . . . 38820.2.1 CCMS—a short overview . . . . . . . . . . . . . . . . . . . 38820.2.2 Obtaining the necessary SAP usage permissions for Nagios 39020.2.3 Monitors and templates . . . . . . . . . . . . . . . . . . . 39220.2.4 The CCMS plugins . . . . . . . . . . . . . . . . . . . . . . 39420.2.5 Performance optimization . . . . . . . . . . . . . . . . . . 398Appendixes 399A Rapidly Alternating States: Flapping 401A.1 Flap Detection with Services . . . . . . . . . . . . . . . . . . . . . 402A.1.1 Nagios configuration . . . . . . . . . . . . . . . . . . . . . 403A.1.2 The history memory and the chronological progression ofthe changes in state . . . . . . . . . . . . . . . . . . . . . 404A.1.3 Representation in the Web interface . . . . . . . . . . . . 404A.2 Flap Detection for Hosts . . . . . . . . . . . . . . . . . . . . . . . . 406B Event Handlers 409B.1 Execution Times for the Event Handler . . . . . . . . . . . . . . . . 410B.2 Defining the Event Handler in the Service Definition . . . . . . . . 411B.3 The Handler Script . . . . . . . . . . . . . . . . . . . . . . . . . . . 411B.4 Things to Note When Using Event Handlers . . . . . . . . . . . . . 413C Writing Your Own Plugins: Monitoring Oracle with theInstant Client 415C.1 Installing the Oracle Instant Client . . . . . . . . . . . . . . . . . . 416C.2 Establishing a Connection to the Oracle Database . . . . . . . . . . 417C.3 A Wrapper Plugin for sqlplus . . . . . . . . . . . . . . . . . . . . . 417C.3.1 How the wrapper works . . . . . . . . . . . . . . . . . . . 418C.3.2 The Perl plugin in detail . . . . . . . . . . . . . . . . . . . 419D An Overview of the Nagios Configuration Parameters 423D.1 The Main Configuration File nagios.cfg . . . . . . . . . . . . . . . 424D.2 CGI Configuration in cgi.cfg . . . . . . . . . . . . . . . . . . . . . 443D.2.1 Authentication parameters . . . . . . . . . . . . . . . . . 443D.2.2 Other Parameters . . . . . . . . . . . . . . . . . . . . . . . 444Index 447
EPUB | FB2 | MOBI | TXT | RTF
* Конвертация файла может нарушить форматирование оригинала. По-возможности скачивайте файл в оригинальном формате.
Популярные книги за неделю:
Только что пользователи скачали эти книги: