131 lines
3.6 KiB
Plaintext
131 lines
3.6 KiB
Plaintext
README.Slackware
|
|
================
|
|
|
|
This file contains some basic instructions to get nagios installed and
|
|
running on your computer.
|
|
|
|
0) Before running the SlackBuild Script
|
|
---------------------------------------
|
|
|
|
0.1) Create nagios group & user
|
|
|
|
Before even running the SlackBuild script, create the necessary 'nagios'
|
|
user and group. The SlackBuild script will remind you if these do not exist.
|
|
|
|
The suggested UID and GID is 213, but you can change this as needed:
|
|
|
|
# groupadd -g 213 nagios
|
|
# useradd -u 213 -d /var/nagios -s /bin/bash -g nagios nagios
|
|
|
|
0.2) Add 'apache' to 'nagios' group
|
|
|
|
For several nagios scripts to run without problems, you need to add the
|
|
'apache' user to the 'nagios' group, so that it can write to the
|
|
/var/nagios/rw directory:
|
|
|
|
# usermod -G nagios apache
|
|
|
|
0.3) Select DOCROOT
|
|
|
|
The standard SlackBuild script puts the nagios files in /var/www/htdocs
|
|
This is fine for a stock Slackware installation, but if your 'DOCROOT'
|
|
lives in another directory, you can specify it when starting the SlackBuild
|
|
script like this:
|
|
|
|
# DOCROOT=/your/docroot/dir ./nagios.SlackBuild
|
|
|
|
1) Post-installation
|
|
--------------------
|
|
|
|
After building & installing the nagios package, there are some additional
|
|
steps to take.
|
|
|
|
1.1) Check /etc/nagios/nagios.cfg & /etc/nagios/cgi.cfg
|
|
|
|
These are the basic configuration files for the nagios server. Do read the
|
|
documentation to understand what all the different settings mean.
|
|
|
|
1.2) Edit /etc/httpd/extra/nagios.conf
|
|
|
|
To be able to view the documentation, edit this file.
|
|
After the "<Directory "/var/www/htdocs/nagios">" line, change:
|
|
|
|
Options None
|
|
|
|
to read:
|
|
|
|
Options FollowSymLinks
|
|
|
|
1.3) Edit /etc/httpd/httpd.conf
|
|
|
|
Now you need to add the extra/nagios.conf file as an included file. To
|
|
accomplish this, after the "DocumentRoot /srv/httpd/htdocs" line, add:
|
|
|
|
Include /etc/httpd/extra/nagios.conf
|
|
|
|
1.4) Create access file
|
|
|
|
The /etc/httpd/extra/nagios.conf file defines /etc/nagios/htpasswd.users
|
|
as the file with the authorized users.
|
|
To create this file with a standard user called 'nagiosadmin', type:
|
|
|
|
# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
|
|
|
|
then type the password you choose twice.
|
|
|
|
To add other users, delete users, etc., check the man page for htpasswd:
|
|
|
|
# man htpasswd
|
|
|
|
1.5) Restart httpd
|
|
|
|
# /etc/rc.d/rc.httpd restart
|
|
|
|
1.6) Put startup command in /etc/rc.d/rc.local:
|
|
|
|
# Start nagios:
|
|
if [ -x /etc/rc.d/rc.nagios ]; then
|
|
echo "Starting nagios..."
|
|
/etc/rc.d/rc.nagios start
|
|
fi
|
|
|
|
1.7) Put shutdown command in /etc/rc.d/rc.local_shutdown:
|
|
|
|
# Stop nagios:
|
|
if [ -x /etc/rc.d/rc.nagios ]; then
|
|
echo "Stopping nagios..."
|
|
/etc/rc.d/rc.nagios stop
|
|
fi
|
|
|
|
1.8) Make /etc/rc.d/rc.nagios executable:
|
|
|
|
# chmod +x /etc/rc.d/rc.nagios
|
|
|
|
1.9) Start nagios:
|
|
|
|
# /etc/rc.d/rc.nagios start
|
|
|
|
2) Adding hosts, routers, switches, etc.
|
|
----------------------------------------
|
|
|
|
Lot of documentation is included in this package and should be read to fully
|
|
understand how to add hosts, routers, switches, etc.
|
|
|
|
To add functionality, build & install the nagios-plugins on your server.
|
|
|
|
To monitor external Linux hosts, install the nrpe package on them, together
|
|
with the nagios-plugins.
|
|
|
|
To monitor Windows hosts, install NSClient++ on them.
|
|
|
|
Do check the http://wiki.nagios.org pages for some useful information.
|
|
|
|
3) Growing log files
|
|
--------------------
|
|
|
|
If you are monitoring several items, your log files can grow considerably.
|
|
Nagios keeps a history of all logs in /var/nagios/archives/.
|
|
After a few months this can be quite a bit of information, so consider
|
|
creating some kind of clean-up or compacting script (Left as an exercise to
|
|
the reader :) )
|