Difference between revisions of "Nagios"

From SME Server
Jump to navigationJump to search
(Reworked installation instructions)
Line 7: Line 7:
  
 
This contrib installs Nagios Version 2.9 and was tested on SME Releases 7.1.2, 7.1.3 and 7.2.
 
This contrib installs Nagios Version 2.9 and was tested on SME Releases 7.1.2, 7.1.3 and 7.2.
It provides all packgages needed to setup a SME Server as a central Nagios monitoring server and all packages needed to monitor SME Servers via the NRPE (Nagios Remote Plugin Executer).
+
It provides all packages needed to setup a SME Server as a central Nagios monitoring server and all packages needed to monitor SME Servers via the NRPE (Nagios Remote Plugin Executer).
  
  
Line 15: Line 15:
  
  
The base packages and all dependencies are installed via yum from the Centos and DAG repostitories. Additionally the following packages are included in this contrib:
+
These packages are provided by the contib. All other dependend packages will be installed via yum from the Centos and DAG repostitories.  
  
 
{| border="1" cellpadding="3" cellspacing=0
 
{| border="1" cellpadding="3" cellspacing=0
Line 37: Line 37:
 
|-
 
|-
 
| nagios-plugins-generic RPM|| A generic plugin. [http://www.my-plugin.de/wiki/doku.php/projects:check_generic:start Read more...]
 
| nagios-plugins-generic RPM|| A generic plugin. [http://www.my-plugin.de/wiki/doku.php/projects:check_generic:start Read more...]
|-
 
| Mail-SendEasy-CLI RPM<br>perl-Mail-SendEasy RPM|| Provide /usr/bin/mailsend, a more powerful replacement for the /bin/mail command. Run <code>mailsend --help</code> for help.
 
 
|-
 
| smeserver-ajaxterm RPM|| Web-based terminal. Linked into the Nagios Home menu. See [[Ajaxterm]]
 
 
|-
 
|-
 
| nagios-nuvola-1.0.3.tar.gz || Nuvola GUI theme
 
| nagios-nuvola-1.0.3.tar.gz || Nuvola GUI theme
Line 50: Line 45:
  
 
=== Download ===
 
=== Download ===
[http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/nagios smeserver-nagios-complete-1.0.1.tgz]
+
Download the packages and files from http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/nagios/packages/ manually or run the the script [http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/nagios/packages/wgetall wgetall] to download all in one go.
 +
bash < wgetall
  
  
 
=== Installation ===
 
=== Installation ===
Download and unpack the tarball on your central Nagios server and on all other SME Servers you want to monitor:<br>
 
tar xzf smeserver-nagios-complete-1.0.1.tgz
 
cd smeserver-nagios-complete-1.0.1
 
Edit install.sh and set the variable NAGIOS_CENTRAL_SERVER to the IP address of your central Nagios server. Use the local IP if you check the servers over the local network or over a VPN, otherwise use the WAN IP.
 
  
 +
==== Configure the dag repositoy ====
 +
{{Repository|dag}}
 +
 +
==== Installation of a central Nagios server ====
 +
/usr/bin/yum --enablerepo=dag localinstall \
 +
  smeserver-nagios-1.0.5-0.noarch.rpm \
 +
  smeserver-nagios-backup-1.0.2-0.noarch.rpm \
 +
  perl-Nagios-Plugin-0.17-1.rf.noarch.rpm \
 +
  smeserver-nagios-plugins-mysql-1.0.0-0.noarch.rpm \
 +
  nagios-plugins-generic-1.0.0-0.el4.rf.noarch.rpm
 +
 +
/usr/bin/yum --enablerepo=dag install \
 +
  nagios-plugins \
 +
  nagios-plugins-nrpe \
 +
  nagios-plugins-setuid \
 +
  nagios-of-plugins-0.9.4-1.of.noarch.rpm
 +
 +
Configure global access with password required
 +
config set nagios service Name Nagios PublicAccess global-pw
 +
expand-template /etc/httpd/conf/httpd.conf
 +
service httpd-e-smith restart
 +
 +
Test the installation by pointing your browser to ''<nowiki>https://nagios_central_server_ip/nagios/</nowiki>''
 +
 +
Browser login in as admin.
 +
 +
===== Install the Nuvola theme (optional) =====
 +
The Nuvola theme provides a nice and modern GUI. The screenshot above was made with the Nuvola theme installed.
 +
cd /usr/share/nagios
 +
rm -rf config.js images index.html main.html side side.html stylesheets
 +
cd -
 +
tar --strip-path=1 -C /usr/share/nagios -xzf nagios-nuvola-1.0.3.tar.gz
 +
chmod a+r -R /usr/share/nagios
 +
Empty your browser cache and reload the Nagios page.
 +
 +
===== Integrate Ajaxterm in the Nuvola theme Home menu (optional) =====
 +
Install the [[Ajaxterm]] contrib and run
 +
patch -p0 /usr/share/nagios/side/dtree_data.js < dtree_data.js.patch
 +
Empty your browser cache and reload the Nagios page.
  
==== Central Nagios server installation ====
+
===== Install additional logo icons (optional) =====
cd smeserver-nagios-complete-1.0.1
+
This installs a set of icons, including the SME server logo. The logos can be used in the ''hostextinfo{}'' sections. A preview of the logos can be found [http://wiki.contribs.org/images/d/d0/Nagios-logos.jpg here].
./install.sh central
 
Test the installation by pointing your browser to <code>https:<b></b>//nagios_central_server_ip/nagios/</code><br>
 
Basic login in as admin.
 
  
 +
tar --strip-path 1 -C /usr/share/nagios/images/logos -xzf nagios-icons-nx.tgz
 +
chown nagios.root  /usr/share/nagios/images/logos/*
 +
chmod 644  /usr/share/nagios/images/logos/*
  
==== NRPE installation on the servers to monitor ====
+
==== NRPE installation on the SME servers to be monitored by the central Nagios server====
  cd smeserver-nagios-complete-1.0.1
+
  /usr/bin/yum --enablerepo=dag localinstall \
  ./install.sh nrpe
+
  smeserver-nagios-nrpe-1.0.2-0.noarch.rpm \
If the server is behind a firewall, you must forward port 5666/tcp to the server.<br>
+
  smeserver-nagios-backup-1.0.2-0.noarch.rpm \
 +
  perl-Nagios-Plugin-0.17-1.rf.noarch.rpm \
 +
  smeserver-nagios-plugins-mysql-1.0.0-0.noarch.rpm \
 +
  nagios-plugins-generic-1.0.0-0.el4.rf.noarch.rpm
 +
 
 +
===== NRPE configuration =====
 +
Create a the NRPE configuration file /etc/nrpe.cfg. Use the nrpe.cfg provided by this conrib as a starting point.
 +
Add the IP address of your central Nagios server to the variable ''allowed_hosts''. Use the local IP of the central Nagios server if you check the server over the local network or over a VPN, otherwise use the WAN IP.
 +
 
 +
Restart the service
 +
  service nrpe restart
 +
 
 +
===== Allow the central Nagios server to access the NRPE service =====
 +
Add the IP address of the your central Nagios to ''Local Networks'' in the server-manager.
 +
 
 +
Configure the TCP wrapper. This is required for SSL connections to the NRPE.
 +
config setprop nrpe HostsAllow "127.0.0.1 NAGIOS_CENTRAL_SERVER_IP"
 +
expand-template /etc/hosts.allow
 +
 
 +
===== Allow the Nagios plugins to be executed as root (optional) =====
 +
A few plugins only work when they are executed as root. This configures the ''sudoers'' configuration.
 +
config setprop nrpe sudoPlugins yes
 +
expand-template /etc/sudoers
 +
 
 +
If the NRPE SME server is behind a firewall, you must forward port 5666/tcp to the server.<br>
 
Test the installation by running this command on the central Nagios server:<br>
 
Test the installation by running this command on the central Nagios server:<br>
 
  /usr/lib/nagios/plugins/check_nrpe -H IPADDRESS
 
  /usr/lib/nagios/plugins/check_nrpe -H IPADDRESS
Line 76: Line 131:
 
  NRPE v2.5.1
 
  NRPE v2.5.1
  
=== Configuration ===
+
==== NSCA installation (Distributed Monitoring) ====
 +
{{Warning box|This is untested and may not work as expected}}
 +
{{Incomplete}}
 +
/usr/bin/yum --enablerepo=dag localinstall \
 +
  smeserver-nagios-nsca-1.0.1-0.noarch.rpm \
 +
  smeserver-nagios-backup-1.0.2-0.noarch.rpm \
 +
  perl-Nagios-Plugin-0.17-1.rf.noarch.rpm \
 +
  smeserver-nagios-plugins-mysql-1.0.0-0.noarch.rpm \
 +
  nagios-plugins-generic-1.0.0-0.el4.rf.noarch.rpm
 +
 
 +
/usr/bin/yum --enablerepo=dag install \
 +
  nagios-plugins \
 +
  nagios-plugins-nrpe \
 +
  nagios-plugins-setuid \
 +
  nagios-of-plugins-0.9.4-1.of.noarch.rpm
 +
 
 +
===== NSCA configuration =====
 +
see http://nagios.sourceforge.net/docs/2_0/distributed.html
 +
 
 +
=== Nagios configuration ===
 
It is strongly recommended to read the [http://www.nagios.org/docs/ Nagios and NRPE documentation] to understand the principles of operation before you start to configure Nagios.
 
It is strongly recommended to read the [http://www.nagios.org/docs/ Nagios and NRPE documentation] to understand the principles of operation before you start to configure Nagios.
  
Line 85: Line 159:
  
 
==== Hints ====
 
==== Hints ====
* place all your configuration files in /etc/nagios/, the Logfile /var/log/nagios/nagios.log, the Log-Archives in /var/log/nagios/archives/ and the status file in /var/log/nagios/status.dat. These are the default settings. Leave them unchanged. The smeserver-nagios-backup RPM requires these settings to work properly.
+
* place all your configuration files in /etc/nagios/, the Logfile /var/log/nagios/nagios.log, the Log-Archives in /var/log/nagios/archives/ and the status file in /var/log/nagios/status.dat. These are the default settings. Leave them unchanged. The ''smeserver-nagios-backup'' RPM requires these settings to work properly.
 
* Set the following in /etc/nagios/cgi.cfg to grant full accces to the user admin:
 
* Set the following in /etc/nagios/cgi.cfg to grant full accces to the user admin:
 
  use_authentication=1
 
  use_authentication=1
Line 96: Line 170:
 
  authorized_for_all_service_commands=admin
 
  authorized_for_all_service_commands=admin
  
* On the NRPE Server you find a /etc/nagios/nrpe.cfg with many predefined commands. Modify them to fit your needs.
+
* it is a good idea to make your Nagios server as independent as possible from the infrastructure it monitors, i.e., use a dedicated hardware, network, mail- and pager system, firewall and internet connection if possible.  
* It is a good idea to make your Nagios server as independent as possible from the infrastructure it monitors. That means use a dedicated hardware, network, firewall and internet connection if possible. Consider to setup a second Nagios somewhere inside your network, which monitors your central Nagios server.  
+
* consider to setup a second Nagios somewhere on your network, which monitors your central Nagios server. Then you need to install the NRPE also on the central server.
* in /usr/share/nagios/images/logos you find logo images that can be used in the hostextinfo{} sections. Click [http://wiki.contribs.org/images/d/d0/Nagios-logos.jpg here] to view the logos.
 
 
 
 
 
=== Additional information ===
 
* The install.sh script installs all available packages, including a few which are not necessarily needed for running Nagios, e.g. smeserver-ajaxterm. Feel free to comment out those package names in install.sh you do not want to have installed.
 
* If you plan a distributed Nagios setup, you need the NSCA packages. Remove the comments of the NSCA package names in install.sh to get them installed. The NSCA setup is not used (and will not be used) by the author and therefore untested. They may not work as expected.
 
 
 
  
 
=== References ===
 
=== References ===
perl-Nagios-Plugin: http://members.financial.com/~cmr/rpmforge/perl-Nagios-Plugin/<br>
+
* Nagios: http://www.nagios.org/
nagios-of-plugins: http://www.nagiosexchange.org/Plugin_Packages.52.0.html?&tx_netnagext_pi1%5Bp_view%5D=323<br>
+
* perl-Nagios-Plugin: http://members.financial.com/~cmr/rpmforge/perl-Nagios-Plugin/
Nuvola theme: http://www.nagiosexchange.org/Image_Packs.75.0.html?&tx_netnagext_pi1%5Bp_view%5D=252&tx_netnagext_pi1%5Bpage%5D=10%3A10<br>
+
* nagios-of-plugins: http://www.nagiosexchange.org/Plugin_Packages.52.0.html?&tx_netnagext_pi1%5Bp_view%5D=323
Temptrax Plugin: http://www.nagiosexchange.org/Environmental.60.0.html?&tx_netnagext_pi1%5Bp_view%5D=246&tx_netnagext_pi1%5Bpage%5D=20%3A10<br>
+
* Nuvola theme: http://www.nagiosexchange.org/Image_Packs.75.0.html?&tx_netnagext_pi1%5Bp_view%5D=252&tx_netnagext_pi1%5Bpage%5D=10%3A10
Nagios books: ''"Nagios : system and network monitoring / Wolfgang Barth / ISBN 1-59327-070-4"'', ''"Building a Monitoring Infrastructure with Nagios / David Josephsen / ISBN 0-13-223693-1"''
+
* Temptrax Plugin: http://www.nagiosexchange.org/Environmental.60.0.html?&tx_netnagext_pi1%5Bp_view%5D=246&tx_netnagext_pi1%5Bpage%5D=20%3A10
 +
* Nagios books: ''"Nagios : system and network monitoring / Wolfgang Barth / ISBN 1-59327-070-4"'', ''"Building a Monitoring Infrastructure with Nagios / David Josephsen / ISBN 0-13-223693-1"''
 
----
 
----
 
[[Category: Contrib]]
 
[[Category: Contrib]]

Revision as of 12:13, 19 November 2007

Maintainer

Michael Weinberger


Introduction

Nagios is a host and service monitor designed to inform you of network problems before your clients, end-users or managers do. Read more...

This contrib installs Nagios Version 2.9 and was tested on SME Releases 7.1.2, 7.1.3 and 7.2. It provides all packages needed to setup a SME Server as a central Nagios monitoring server and all packages needed to monitor SME Servers via the NRPE (Nagios Remote Plugin Executer).


Nagios-screenshot-8.png Statusmap screenshot of a sample Nagios configuration


These packages are provided by the contib. All other dependend packages will be installed via yum from the Centos and DAG repostitories.

Package Purpose
smeserver-nagios RPM integrates Nagios service into the SME Server
smeserver-nagios-nrpe RPM integrates NRPE service into the SME Server
smeserver-nagios-nsca RPM integrates NSCA service into the SME Server (needed in a Distributed Installation)
smeserver-nagios-backup RPM Nagios backup integration. Includes Nagios configuration and status data into the SME standard backup
perl-Nagios-Plugin RPM a family of perl modules to streamline writing Nagios plugins
nagios-plugins-temptrax RPM Plugins for the Sensatronics Ethernet Temperature Devices E4/E16/F
smeserver-nagios-plugins-mysql RPM Plugin that checks the mysqld service on a smeserver
nagios-of-plugins RPM Additional plugins written by Gavin Carr of Open Fusion
nagios-plugins-generic RPM A generic plugin. Read more...
nagios-nuvola-1.0.3.tar.gz Nuvola GUI theme
nagios-icons-nx.tgz additional useful icons, inlucding the SME logo


Download

Download the packages and files from http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/nagios/packages/ manually or run the the script wgetall to download all in one go.

bash < wgetall


Installation

Configure the dag repositoy

The following command will configure the dag repository on SME Server. EDIT NOT COMPLETE!


To create an entry in the database for the epel repository we open put the following commands in a terminal window or in a shell window:

/sbin/e-smith/db yum_repositories set epel repository \

Name 'SME Server - epel' \
BaseURL 'http://<http://download.fedoraproject.org/pub/epel/7/$basearch' \
EnableGroups yes \
GPGCheck yes \
Visible no \
status disabled

To enable the changes:

    signal-event yum-modify

Just to be sure, give yum a fresh start:

    yum clean all

After adding it to the database we have to update the changes to the configuration file:

signal-event yum-modify

Installation of a central Nagios server

/usr/bin/yum --enablerepo=dag localinstall \
 smeserver-nagios-1.0.5-0.noarch.rpm \
 smeserver-nagios-backup-1.0.2-0.noarch.rpm \
 perl-Nagios-Plugin-0.17-1.rf.noarch.rpm \
 smeserver-nagios-plugins-mysql-1.0.0-0.noarch.rpm \
 nagios-plugins-generic-1.0.0-0.el4.rf.noarch.rpm 
/usr/bin/yum --enablerepo=dag install \
 nagios-plugins \
 nagios-plugins-nrpe \
 nagios-plugins-setuid \
 nagios-of-plugins-0.9.4-1.of.noarch.rpm

Configure global access with password required

config set nagios service Name Nagios PublicAccess global-pw
expand-template /etc/httpd/conf/httpd.conf
service httpd-e-smith restart

Test the installation by pointing your browser to https://nagios_central_server_ip/nagios/

Browser login in as admin.

Install the Nuvola theme (optional)

The Nuvola theme provides a nice and modern GUI. The screenshot above was made with the Nuvola theme installed.

cd /usr/share/nagios
rm -rf config.js images index.html main.html side side.html stylesheets
cd -
tar --strip-path=1 -C /usr/share/nagios -xzf nagios-nuvola-1.0.3.tar.gz
chmod a+r -R /usr/share/nagios

Empty your browser cache and reload the Nagios page.

Integrate Ajaxterm in the Nuvola theme Home menu (optional)

Install the Ajaxterm contrib and run

patch -p0 /usr/share/nagios/side/dtree_data.js < dtree_data.js.patch

Empty your browser cache and reload the Nagios page.

Install additional logo icons (optional)

This installs a set of icons, including the SME server logo. The logos can be used in the hostextinfo{} sections. A preview of the logos can be found here.

tar --strip-path 1 -C /usr/share/nagios/images/logos -xzf nagios-icons-nx.tgz
chown nagios.root  /usr/share/nagios/images/logos/*
chmod 644  /usr/share/nagios/images/logos/*

NRPE installation on the SME servers to be monitored by the central Nagios server

/usr/bin/yum --enablerepo=dag localinstall \
 smeserver-nagios-nrpe-1.0.2-0.noarch.rpm \
 smeserver-nagios-backup-1.0.2-0.noarch.rpm \
 perl-Nagios-Plugin-0.17-1.rf.noarch.rpm \
 smeserver-nagios-plugins-mysql-1.0.0-0.noarch.rpm \
 nagios-plugins-generic-1.0.0-0.el4.rf.noarch.rpm 
NRPE configuration

Create a the NRPE configuration file /etc/nrpe.cfg. Use the nrpe.cfg provided by this conrib as a starting point. Add the IP address of your central Nagios server to the variable allowed_hosts. Use the local IP of the central Nagios server if you check the server over the local network or over a VPN, otherwise use the WAN IP.

Restart the service

service nrpe restart
Allow the central Nagios server to access the NRPE service

Add the IP address of the your central Nagios to Local Networks in the server-manager.

Configure the TCP wrapper. This is required for SSL connections to the NRPE.

config setprop nrpe HostsAllow "127.0.0.1 NAGIOS_CENTRAL_SERVER_IP"
expand-template /etc/hosts.allow
Allow the Nagios plugins to be executed as root (optional)

A few plugins only work when they are executed as root. This configures the sudoers configuration.

config setprop nrpe sudoPlugins yes
expand-template /etc/sudoers

If the NRPE SME server is behind a firewall, you must forward port 5666/tcp to the server.
Test the installation by running this command on the central Nagios server:

/usr/lib/nagios/plugins/check_nrpe -H IPADDRESS

Expected result:

NRPE v2.5.1

NSCA installation (Distributed Monitoring)

Warning.png Warning:
This is untested and may not work as expected


Incomplete.png Incomplete:
This article or section needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page


/usr/bin/yum --enablerepo=dag localinstall \
 smeserver-nagios-nsca-1.0.1-0.noarch.rpm \
 smeserver-nagios-backup-1.0.2-0.noarch.rpm \
 perl-Nagios-Plugin-0.17-1.rf.noarch.rpm \
 smeserver-nagios-plugins-mysql-1.0.0-0.noarch.rpm \
 nagios-plugins-generic-1.0.0-0.el4.rf.noarch.rpm 
/usr/bin/yum --enablerepo=dag install \
 nagios-plugins \
 nagios-plugins-nrpe \
 nagios-plugins-setuid \
 nagios-of-plugins-0.9.4-1.of.noarch.rpm
NSCA configuration

see http://nagios.sourceforge.net/docs/2_0/distributed.html

Nagios configuration

It is strongly recommended to read the Nagios and NRPE documentation to understand the principles of operation before you start to configure Nagios.

When changes to the nagios configuration were made, the service must be restarted:

service nagios restart

When nrpe.cfg was changed the nrpe service must be restarted:

service nrpe restart

Hints

  • place all your configuration files in /etc/nagios/, the Logfile /var/log/nagios/nagios.log, the Log-Archives in /var/log/nagios/archives/ and the status file in /var/log/nagios/status.dat. These are the default settings. Leave them unchanged. The smeserver-nagios-backup RPM requires these settings to work properly.
  • Set the following in /etc/nagios/cgi.cfg to grant full accces to the user admin:
use_authentication=1
authorized_for_system_information=admin
authorized_for_system_commands=admin
authorized_for_configuration_information=admin
authorized_for_all_hosts=admin
authorized_for_all_host_commands=admin
authorized_for_all_services=admin
authorized_for_all_service_commands=admin
  • it is a good idea to make your Nagios server as independent as possible from the infrastructure it monitors, i.e., use a dedicated hardware, network, mail- and pager system, firewall and internet connection if possible.
  • consider to setup a second Nagios somewhere on your network, which monitors your central Nagios server. Then you need to install the NRPE also on the central server.

References