Nagios nagiosgraph configuration method in Linux system

Source: Internet
Author: User

Principle:

By using the service_perfdata_file_processing_command instruction, each service data that is monitored by Nagios is passed to the/usr/local/nagiosgraph/bin/ insert.pl script processing, production RRD files.

Here's the Nagiosgraph configuration:

1. Get component

The code is as follows Copy Code
# wget http://downloads.sourceforge.net/project/nagiosgraph/nagiosgraph/1.4.4/nagiosgraph-1.4.4.tar.gz
# TAR-XZF Nagiosgraph-1.4.4.tar.gz
# CD nagiosgraph-1.4.4

2. Testing environmental Requirements

The code is as follows Copy Code
#./install.pl--check-prereq
Checking Required PERL Modules
Carp ... 1.04
Cgi... 3.15
Data::D umper ... 2.121_08
File::basename ... 2.74
File::find ... 1.10
Mime::base64 ... 3.07
Posix... 1.09
Rrds ... 1.2027
Time::hires ... 1.9717
Checking optional PERL modules
Gd... 2.35
Checking Nagios Installation
Found Nagios At/usr/local/nagios/bin/nagios
Checking Web Server Installation
Found Apache AT/USR/SBIN/HTTPD

What Perl modules are missing, install those modules, and pay attention to the version requirements.

3. Installation

The code is as follows Copy Code
./install.pl--install

Press the ENTER key all the way.

4. Edit Nagios.cfg File

Under Nagios.conf file, add the following

The code is as follows Copy Code
# process Nagios performance data using Nagiosgraph
Process_performance_data=1
Service_perfdata_file=/tmp/perfdata.log
service_perfdata_file_template= $LASTSERVICECHECK $| | $HOSTNAME $| | $SERVICEDESC $| | $SERVICEOUTPUT $| | $SERVICEPERFDATA $
Service_perfdata_file_mode=a
Service_perfdata_file_processing_interval=30
Service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph

5. Edit Commands.cfg File

Add the following content

The code is as follows Copy Code
#########################################
#
# Nagiosgraph
#
# command to process Nagios performance data for Nagiosgraph
Define Command {
Command_name Process-service-perfdata-for-nagiosgraph
command_line/usr/local/nagiosgraph/bin/insert.pl
}

6. Modify the httpd.conf file

Add the following content

The code is as follows Copy Code
Include/usr/local/nagiosgraph/etc/nagiosgraph-apache.conf

7. Restart Service

The code is as follows Copy Code
#/etc/init.d/httpd Restart
#/etc/init.d/nagios Restart

8. View Nagiosgraph configuration information

In the browser input: http://10.0.100.125/nagiosgraph/cgi-bin/showconfig.cgi URL view.

9. Define Action URL
Modify the Templates.cfg file and add the following:
define service {
        name nagiosgraph
        action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$
        register 0
}
10. Add the drawing you need
By default, services that enable performance data will be plotted.
Examples are as follows:
define service {
    use                 MongoDB,nagiosgraph
    hostgroup_name          MongoDB_Servers
    service_description     Mongo Memory Usage
    check_command           check_mongodb!12345!''!''!memory!130!260
      servicegroups           Mongodbservices
}
After adding, there will be an icon below
11. The effect is as follows
12. Each service item will have a RRD file
Under the/USR/LOCAL/NAGIOSGRAPH/VAR/RRD directory of each Autonomous machine directory
For performance data cannot be generated, the drawing cannot be drawn, nagiosgraph no data available information appears, and the following information is viewed Nagiosgraph.log:
322207-tue APR 8 17:18:36 2014 insert.pl warn Output/perfdata not recognized:
322279:hostname:x.x.x.x
322299-servicedesc:mongo Free Connections
322334-output:ok–6 percent (819 connections) used
322385-perfdata:
PerfData is empty, this needs us to analyze output information. By/usr/local/nagiosgraph/etc/map This file, you define a regular expression to handle, which is a Perl script that maps output information to PerfData.

Map How to customize regular expressions the next section, please pay attention.

Original from: ttlsa.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.