Вы находитесь на странице: 1из 20

NAGIOS Installation

Prerequisites

During portions of the installation you'll need to have root access to your machine.

Make sure you've installed the following packages on your Fedora installation before continuing.

 Apache
 PHP
 GCC compiler
 GD development libraries

You can use yum to install these packages by running the following commands (as root):

yum install httpd php

yum install gcc glibc glibc-common

yum install gd gd-devel

1) Create Account Information

Create a new nagios user account and give it a password.

/usr/sbin/useradd -m nagios

passwd nagios

Create a new nagcmd group for allowing external commands to be submitted through the web
interface. Add both the nagios user and the apache user to the group.

/usr/sbin/groupadd nagcmd

/usr/sbin/usermod -a -G nagcmd nagios

/usr/sbin/usermod -a -G nagcmd apache

2) Download Nagios and the Plugins

Download the source code tarballs of both Nagios and the Nagios plugins (visit
http://www.nagios.org/download/ for links to the latest versions). These directions were tested
with Nagios 3.1.1 and Nagios Plugins 1.4.11.

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-
3.2.3.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-
plugins-1.4.11.tar.gz

3) Compile and Install Nagios

tar xzf nagios-3.2.3.tar.gz


cd nagios-3.2.3
[root@localhost]# ./configure --with-command-group=nagcmd
[root@localhost]# make all
[root@localhost]# make install
[root@localhost]# make install-config
[root@localhost]# make install-commandmode

5. Configure the web interface.


[root@localhost]# make install-webconf
[root@localhost# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

6. Compile and install nagios plugins


[root@localhost]# tar xvf nagios-plugins-1.4.11.tar.gz
[root@localhost]# cd nagios-plugins-1.4.11
[root@localhost]# ./configure --with-nagios-user=nagios --with-nagios-
group=nagios
[root@localhost]# make
[root@localhost]# make install

Note: On Red Hat, the ./configure command mentioned above did not work and was hanging at
the when it was displaying the message: checking for redhat spopen problem… Add –enable-
redhat-pthread-workaround to the ./configure command as a work-around for the above problem
as shown below.

[root@localhost]# ./configure --with-nagios-user=nagios --with-nagios-


group=nagios --enable-redhat-pthread-workaround

7. Start Nagios

 Add the nagios to the startup routine:

[root@localhost]# chkconfig --add nagios


[root@localhost]# chkconfig nagios on
 Verify to make sure there are no errors in the nagios configuration file:

[root@localhost]# /usr/local/nagios/bin/nagios -v
/usr/local/nagios/etc/nagios.cfg

Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-
flight check

 Start the nagios

[root@localhost]# service nagios start


Starting nagios: done.

8. Login to web interface

Nagios Web URL: http://localhost/nagios/


Use the userid, password that was created from step#5 above.

How To Monitor Remote Linux Host using Nagios 3.0

II. 6 steps to install Nagios plugin and NRPE on remote host.

1. Download Nagios Plugins and NRPE Add-on


2. Create nagios account
3. Install Nagios Plugins
4. Install NRPE
5. Setup NRPE to run as daemon
6. Modify the /usr/local/nagios/etc/nrpe.cfg

III. 4 Configuration steps on the server to monitor remote host:

1. Download NRPE Add-on


2. Install check_nrpe
3. Create host and service definition for remote host
4. Restart the nagios service

Following three steps will happen on a very high level when Nagios (installed on the nagios-
servers) monitors a service (for e.g. disk space usage) on the remote Linux host.

1. Nagios will execute check_nrpe command on nagios-server and request it to monitor disk
usage on remote host using check_disk command.
2. The check_nrpe on the nagios-server will contact the NRPE daemon on remote host and
request it to execute the check_disk on remote host.
3. The results of the check_disk command will be returned back by NRPE daemon to the
check_nrpe on nagios-server.

Following flow summarizes the above explanation:

Nagios Server (check_nrpe) —–> Remote host (NRPE deamon) —–> check_disk

Nagios Server (check_nrpe) <—– Remote host (NRPE deamon) <—– check_disk (returns
disk space usage)

7 steps to install Nagios Plugins and NRPE on the remote host

1. Download Nagios Plugins and NRPE Add-on

Download following files from Nagios.org and move to /home/downloads:

 nagios-plugins-1.4.11.tar.gz
 nrpe-2.12.tar.gz

2. Create nagios account


[remotehost]# useradd nagios
[remotehost]# passwd nagios

3. Install nagios-plugin
[remotehost]# cd /home/downloads
[remotehost]# tar xvfz nagios-plugins-1.4.11.tar.gz
[remotehost]# cd nagios-plugins-1.4.11
[remotehost]# export LDFLAGS=-ldl

[remotehost]# ./configure --with-nagios-user=nagios --with-nagios-


group=nagios --enable-redhat-pthread-workaround
[remotehost]# make
[remotehost]# make install

[remotehost]# chown nagios.nagios /usr/local/nagios


[remotehost]# chown -R nagios.nagios /usr/local/nagios/libexec/

4. Install NRPE
[remotehost]# cd /home/downloads
[remotehost]# tar xvfz nrpe-2.12.tar.gz
[remotehost]# cd nrpe-2.12

[remotehost]# ./configure
[remotehost]# make all
[remotehost]# make install-plugin
[remotehost]# make install-daemon
[remotehost]# make install-daemon-config
[remotehost]# make install-xinetd

5. Setup NRPE to run as daemon (i.e as part of xinetd):

 Modify the /etc/xinetd.d/nrpe to add the ip-address of the Nagios monitoring server to the
only_from directive. Note that there is a space after the 127.0.0.1 and the nagios
monitoring server ip-address (in this example, nagios monitoring server ip-address is:
192.168.1.2)

only_from = 127.0.0.1 192.168.1.2

 Modify the /etc/services and add the following at the end of the file.

nrpe 5666/tcp # NRPE

 Start the service

[remotehost]#service xinetd restart

 Verify whether NRPE is listening

[remotehost]# netstat -at | grep nrpe


tcp 0 0 *:nrpe *:* LISTEN

 Verify to make sure the NRPE is functioning properly

[remotehost]# /usr/local/nagios/libexec/check_nrpe -H localhost


NRPE v2.12

6. Modify the /usr/local/nagios/etc/nrpe.cfg

The nrpe.cfg file located on the remote host contains the commands that are needed to check the
services on the remote host. By default the nrpe.cfg comes with few standard check commands
as samples. check_users and check_load are shown below as an example.

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c
30,25,20

In all the check commands, the “-w” stands for “Warning” and “-c” stands for “Critical”. for e.g.
in the check_disk command below, if the available disk space gets to 20% of less, nagios will
send warning message. If it gets to 10% or less, nagios will send critical message. Change the
value of “-c” and “-w” parameter below depending on your environment.
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p
/dev/hda1

Note: You can execute any of the commands shown in the nrpe.cfg on the command line on
remote host and see the results for yourself. For e.g. When I executed the check_disk command
on the command line, it displayed the following:

[remotehost]#/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1


DISK CRITICAL - free space: / 6420 MB (10% inode=98%);|
/=55032MB;51792;58266;0;6474
# The following examples use hardcoded command arguments...

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10

command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20

command[check_hda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda2

command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z

command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200

command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%

command[check_http]=/usr/local/nagios/libexec/check_http -H 127.0.0.1 -w 5 -c 10

command[check_mysql]=/usr/local/nagios/libexec/check_mysql -H localhost -u root -p

command[check_ping]=/usr/local/nagios/libexec/check_ping -H 10.10.12.40 -w 100.0,20% -c 500,50% -p


5

4 Configuration steps on the server to monitor remote host:

. 1. Download NRPE Add-on

Download nrpe-2.12.tar.gz from Nagios.org and move to /home/downloads:

2. Install check_nrpe on the nagios monitoring server


[nagios-server]# tar xvfz nrpe-2.12.tar.gz
[nagios-server]# cd nrpe-2.1.2
[nagios-server]# ./configure
[nagios-server]# make all
[nagios-server]# make install-plugin

./configure will give a configuration summary as shown below:


*** Configuration summary for nrpe 2.12 05-31-2008 ***:

General Options:
————————-
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios

Note: I got the “checking for SSL headers… configure: error: Cannot find ssl headers” error
message while performing ./configure. Install openssl-devel as shown below and run the
./configure again to fix the problem.

[nagios-server]# rpm -ivh openssl-devel-0.9.7a-43.16.i386.rpm krb5-devel-


1.3.4-47.i386.rpm zlib-devel-1.2.1.2-1.2.i386.rpm e2fsprogs-devel-1.35-12.5.
el4.i386.rpm
warning: openssl-devel-0.9.7a-43.16.i386.rpm: V3 DSA signature: NOKEY, key ID
db42a60e
Preparing… ########################################### [100%]
1:e2fsprogs-devel ########################################### [ 25%]
2:krb5-devel ########################################### [ 50%]
3:zlib-devel ########################################### [ 75%]
4:openssl-devel ########################################### [100%]

Verify whether nagios monitoring server can talk to the remotehost.

[nagios-server]#/usr/local/nagios/libexec/check_nrpe -H 192.168.1.3
NRPE v2.12

Note: 192.168.1.3 in the ip-address of the remotehost where the NRPE and nagios plugin was
installed as explained in Section II above.

4. Create host and service definition for remotehost


define host{

use server40 ; Name of host template to use

host_name server40 ; This host definition will inherit all variables that are defined

alias server40 ; in (or inherited by) the linux-server host template definition.

address 10.10.12.40

}
define service{
use generic-service
service_description Root Partition
contact_groups admins
check_command check_nrpe!check_disk
}

4. Restart the nagios service

Restart the nagios as shown below and login to the nagios web (http://nagios-server/nagios/) to
verify the status of the remotehost linux sever that was added to nagios for monitoring.

[nagios-server]# service nagios reload

How To Monitor Remote Windows Machine Using Nagios on Linux

I. Overview
II. 4 steps to install nagios on remote windows host

1. Install NSClient++ on the remote windows server


2. Modify the NSClient++ Service
3. Modify the NSC.ini
4. Start the NSClient++ Service

III. 6 configuration steps on nagios monitoring server

1. Verify check_nt command and windows-server template


2. Uncomment windows.cfg in /usr/local/nagios/etc/nagios.cfg
3. Modify /usr/local/nagios/etc/objects/windows.cfg
4. Define windows services that should be monitored.
5. Enable Password Protection
6. Verify Configuration and Restart Nagios.

I. Overview

.
Following three steps will happen on a very high level when Nagios (installed on the nagios-
server) monitors a service (for e.g. disk space usage) on the remote Windows host.

1. Nagios will execute check_nt command on nagios-server and request it to monitor disk usage on
remote windows host.
2. The check_nt on the nagios-server will contact the NSClient++ service on remote windows host
and request it to execute the USEDDISKSPACE on the remote host.
3. The results of the USEDDISKSPACE command will be returned back by NSClient++ daemon to the
check_nt on nagios-server.

Following flow summarizes the above explanation:

Nagios Server (check_nt) —–> Remote host (NSClient++) —–> USEDDISKSPACE


Nagios Server (check_nt) <—– Remote host (NSClient++) <—– USEDDISKSPACE (returns
disk space usage)

II. 4 steps to setup nagios on remote windows host

1. Install NSClient++ on the remote windows server

Download NSCP 0.3.1 (NSClient++-Win32-0.3.1.msi) from NSClient++ Project. NSClient++ is


an open source windows service that allows performance metrics to be gathered by Nagios for
windows services. Go through the following five NSClient++ installation steps to get the
installation completed.

(1) NSClient++ Welcome Screen

(2) License Agreement Screen

(3) Select Installation option and location. Use the default option and click next.
(4) Ready to Install Screen. Click on Install to get it started.

(5) Installation completed Screen.

2. Modify the NSClient++ Service

Go to Control Panel -> Administrative Tools -> Services. Double click on the “NSClientpp
(Nagios) 0.3.1.14 2008-03-12 w32″ service and select the check-box that says “Allow service to
interact with desktop” as shown below.
3. Modify the NSC.ini

(1) Modify NSC.ini and uncomment *.dll: Edit the C:\Program Files\NSClient++\NSC.ini file
and uncomment everything under [modules] except RemoteConfiguration.dll and CheckWMI.dll

[modules]
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
; You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; * *
; * N O T I C E ! ! ! - Y O U H A V E T O E D I T T H I S *
; * *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
NRPEListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
;CheckWMI.dll
;
; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION
ENVIROMNEMTS!
;RemoteConfiguration.dll
; NSCA Agent is a new beta module use with care!
NSCAAgent.dll
; LUA script module used to write your own "check deamon" (sort of) early
beta.
LUAScript.dll
; Script to check external scripts and/or internal aliases, early beta.
CheckExternalScripts.dll
; Check other hosts through NRPE extreme beta and probably a bit dangerous!

NRPEClient.dll

(2) Modify NSC.ini and uncomment allowed_hosts. Edit the C:\Program


Files\NSClient++\NSC.ini file and Uncomment allowed_host under settings and add the ip-
address of the nagios-server.

;# ALLOWED HOST ADDRESSES


; This is a comma-delimited list of IP address of hosts that are allowed to
talk to the all daemons.
; If leave this blank anyone can access the deamon remotly (NSClient still
requires a valid password).
; The syntax is host or ip/mask so 192.168.0.0/24 will allow anyone on that
subnet access
allowed_hosts=192.168.1.2/255.255.255.0

Note: allowed_host is located under [Settings], [NSClient] and [NRPE] section. Make sure to
change allowed_host under [Settings] for this purpose.

(3) Modify NSC.ini and uncomment port. Edit the C:\Program Files\NSClient++\NSC.ini file
and uncomment the port# under [NSClient] section

;# NSCLIENT PORT NUMBER


; This is the port the NSClientListener.dll will listen to.
port=12489

(4) Modify NSC.ini and specify password. You can also specify a password the nagios server
needs to use to remotely access the NSClient++ agent.

[Settings]
;# OBFUSCATED PASSWORD
; This is the same as the password option but here you can store the
password in an obfuscated manner.
; *NOTICE* obfuscation is *NOT* the same as encryption, someone with access
to this file can still figure out the
; password. Its just a bit harder to do it at first glance.
;obfuscated_password=Jw0KAUUdXlAAUwASDAAB
;
;# PASSWORD
; This is the password (-s) that is required to access NSClient remotely. If
you leave this blank everyone will be able to access the daemon remotly.
password=My2Secure$Password

4. Start the NSClient++ Service

Start the NSClient++ service either from the Control Panel -> Administrative tools -> Services -
> Select “NSClientpp (Nagios) 0.3.1.14 2008-03-12 w32″ and click on start (or) Click on “Start -
> All Programs -> NSClient++ -> Start NSClient++ (Win32) . Please note that this will start the
NSClient++ as a windows service.

Later if you modify anything in the NSC.ini file, you should restart the “NSClientpp (Nagios)
0.3.1.14 2008-03-12 w32″ from the windows service.

III. 6 configuration steps on nagios monitoring server

1. Verify check_nt command and windows-server template

Verify that the check_nt is enabled under /usr/local/nagios/etc/objects/commands.cfg

# 'check_nt' command definition


define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}

Verify that the windows-server template is enabled under


/usr/local/nagios/etc/objects/templates.cfg

# Windows host definition template - This is NOT a real host, just a


template!
define host{
name windows-server ; The name of this host template
use generic-host ; Inherit default values from the
generic-host template
check_period 24x7 ; By default, Windows servers are
monitored round the clock
check_interval 5 ; Actively check the server every 5
minutes
retry_interval 1 ; Schedule host check retries at 1
minute intervals
max_check_attempts 10 ; Check each server 10 times (max)
check_command check-host-alive ; Default command to check if
servers are "alive"
notification_period 24x7 ; Send notification out at any time -
day or night
notification_interval 30 ; Resend notifications every 30
minutes
notification_options d,r ; Only send notifications for
specific host states
contact_groups admins ; Notifications get sent to the
admins by default
hostgroups windows-servers ; Host groups that Windows servers
should be a member of
register 0 ; DONT REGISTER THIS - ITS JUST A
TEMPLATE
}

2. Uncomment windows.cfg in /usr/local/nagios/etc/nagios.cfg


# Definitions for monitoring a Windows machine
cfg_file=/usr/local/nagios/etc/objects/windows.cfg {name window machine}

3. Modify /usr/local/nagios/etc/objects/windows.cfg

By default a sample host definition for a windows server is given under windows.cfg, modify
this to reflect the appropriate windows server that needs to be monitored through nagios.

# Define a host for the Windows machine we'll be monitoring


# Change the host_name, alias, and address to fit your situation

define host{
use windows-server ; Inherit default values from a
template
host_name remote-windows-host ; The name we're giving to this host
alias Remote Windows Host ; A longer name associated with the
host
address 192.168.1.4 ; IP address of the remote
windows host
}

4. Define windows services that should be monitored.

Following are the default windows services that are already enabled in the sample windows.cfg.
Make sure to update the host_name on these services to reflect the host_name defined in the
above step.

define service{
use generic-service
host_name remote-windows-host
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
define service{
use generic-service
host_name remote-windows-host
service_description Uptime
check_command check_nt!UPTIME
}
define service{
use generic-service
host_name remote-windows-host
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
define service{
use generic-service
host_name remote-windows-host
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
define service{
use generic-service
host_name remote-windows-host
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
define service{
use generic-service
host_name remote-windows-host
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
define service{
use generic-service
host_name remote-windows-host
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}

5. Enable Password Protection

If you specified a password in the NSC.ini file of the NSClient++ configuration file on the
Windows machine, you’ll need to modify the check_nt command definition to include the
password. Modify the /usr/local/nagios/etc/commands.cfg file and add password as shown
below.

define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s
My2Secure$Password -v $ARG1$ $ARG2$
}

6. Verify Configuration and Restart Nagios.

Verify the nagios configuration files as shown below.

[nagios-server]# /usr/local/nagios/bin/nagios -v
/usr/local/nagios/etc/nagios.cfg

Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight
check

Restart nagios as shown below.

[nagios-server]# /etc/rc.d/init.d/nagios stop


Stopping nagios: .done.

[nagios-server]# /etc/rc.d/init.d/nagios start


Starting nagios: done.

INSTALLATION OF NAGIOSGRAPH
Install Pre-Requisites

PERL modules

Carp: 1.04

CGI: 3.55

Data::Dumper: 2.131

File::Basename: 2.74

File::Find: 1.10

MIME::Base64: 3.07

POSIX: 1.09

RRDs: 1.4004

Time::HiRes: 1.9724

optional

GD: 2.45
yum install perl-rrdtool perl-GD

perl -MCPAN -e shell

cpan[1]> install Nagios::Object

cpan[2]> install GD

cpan[3]> install CGI

cpan[3]> exit

These instructions assume an overlay layout, with nagios at /usr/local/nagios

- Extract nagiosgraph into a temporary location:


cd /tmp
tar xzvf nagiosgraph-x.y.z.tgz

- Copy the contents of etc into your preferred configuration location:


mkdir /etc/nagiosgraph
cp /tmp/nagiosgraph-1.4.4/etc/* /etc/nagiosgraph

- Copy insert.pl to a location from which it can be executed:


cp - Copy insert.pl to a location from which it can be executed:
cp /tmp/nagiosgraph-1.4.4/lib/insert.pl /usr/local/nagios/libexec

- Edit the perl scripts in the cgi and lib directories, modifying the
"use lib" line to point to the directory from the previous step.

vi /tmp/nagiosgraph-1.4.4/cgi/*.cgi /tmp/nagiosgraph-1.4.4/lib/insert.pl
(edit all file where use lib)

- Copy insert.pl to a location from which it can be executed:


cp /tmp/nagiosgraph-1.4.4/lib/insert.pl /usr/local/nagios/libexec

- Copy CGI scripts to a script directory served by the web server:


cp /tmp/nagiosgraph-1.4.4/cgi/*.cgi /usr/local/nagios/sbin

- Copy CSS and JavaScript files to a directory served by the web server:
cp /tmp/nagiosgraph-1.4.4/share/nagiosgraph.css /usr/local/nagios/share
cp /tmp/nagiosgraph-1.4.4/share/nagiosgraph.js /usr/local/nagios/share
- Edit /etc/nagiosgraph/nagiosgraph.conf. Set at least the following:
logfile = /var/log/nagiosgraph.log
cgilogfile = /var/log/nagiosgraph-cgi.log
perflog = /var/nagios/perfdata.log
rrddir = /var/nagios/rrd
mapfile = /etc/nagiosgraph/map
nagiosgraphcgiurl = /nagios/cgi-bin
javascript = /nagios/nagiosgraph.js
stylesheet = /nagios/nagiosgraph.css

- Set permissions of "rrddir" (as defined in nagiosgraph.conf) so that


the *nagios* user can write to it and the *www* user can read it:
mkdir /var/nagios/rrd
chown nagios.nagcmd /var/nagios/rrd
chmod 755 /var/nagios/rrd

- Set permissions of "logfile" so that the *nagios* user can write to it:
touch /var/log/nagiosgraph.log
chown nagios.nagcmd /var/log/nagiosgraph.log
chmod 644 /var/log/nagiosgraph.log

- Set permissions of "cgilogfile" so that the *www* user can write to it:
touch /var/log/nagiosgraph-cgi.log
chown nagios.apache /var/log/nagiosgraph-cgi.log
chmod 644 /var/log/nagiosgraph-cgi.log

- Ensure that the *nagios* user can create and delete perfdata files:
chown nagios.nagcmd /var/nagios
chmod 755 /var/nagios

- In the Nagios configuration file (nagios.cfg) add this:


process_performance_data=1
service_perfdata_file=/var/nagios/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
- In the Nagios commands file (commands.cfg) add this:

define command {
command_name process-service-perfdata
command_line /usr/local/nagios/libexec/insert.pl
}

- Check the nagios configuration

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

- Restart nagios

/etc/init.d/nagios restart

- Verify that nagiosgraph is working by running showconfig.cgi

http://server/nagios/cgi-bin/showconfig.cgi

- Try graphing some data by running show.cgi

http://server/nagios/cgi-bin/show.cgi

- In the Nagios configuration, add a template for graphed services:

define service {
name graphed-service
action_url /nagiosgraph/cgi-
bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$'
onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()'
rel='/nagiosgraph/cgi-
bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&period=week&rrdopts=-
w+450+-j
register 0
}

- Enable graph links for services by appending the graphed-service to


existing
service definitions in the Nagios configuration:

define service {
use local-service,graphed-service
...
}

- Replace the Nagios action icon with the nagiosgraph graph icon:
mv /usr/local/nagios/share/images/action.gif
/usr/local/nagios/share/images/action.gif-orig
cp share/graph.gif /usr/local/nagios/share/images/action.gif

- In the nagiosgraph SSI file, set the URL for nagiosgraph.js:


vi share/nagiosgraph.ssi
src="/nagiosgraph/nagiosgraph.js" -> src="/nagios/nagiosgraph.js"

- Install the nagiosgraph SSI file:


cp share/nagiosgraph.ssi /usr/local/nagios/share/ssi/common-header.ssi

- Add links to graphs in the Nagios sidebar (side.php or side.html):

<ul>
<li><a href="/nagios/cgi-bin/show.cgi" target="main">Graphs</a></li>
<li><a href="/nagios/cgi-bin/showhost.cgi" target="main">Graphs by
Host</a></li>
<li><a href="/nagios/cgi-bin/showservice.cgi" target="main">Graphs by
Service</a></li>
<li><a href="/nagios/cgi-bin/showgroup.cgi" target="main">Graphs by
Group</a></li>
</ul>

- Check the nagios configuration

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

- Restart nagios

/etc/init.d/nagios restart

Вам также может понравиться