NAGIOS INSTALLATION & CONFIGURATION
ü Login as root .
ü Move the nagios core package from desktop to a directory /usr/local/nagios. If it is not there then create it ……… #mkdir /usr/local/nagios
ü #mv nagios…tar.gz /usr/local/nagios
ü # cd /usr/local/nagios
ü # tar xzvf nagios….tar.gz
ü # ls
ADDING USERS & GROUPS
ü # adduser nagios
ü # groupadd nagcmd
Adding nagios and Apache users to nagcmd:
ü # usermod –G nagcmd nagios
ü # usermod –G nagcmd Apache
[ Apache user will be automatically created if httpd package is installed. ]
ü Changing user and group owner for /usr/local/nagios-
# chown nagios.nagios /usr/local/nagios
ü Then ...
# cd /usr/local/nagios
# ls
As we have already extracted nagios core package that was in tar.gz form , we will see one folder for nagios.
# cd nagios-3.0.3
# ./configure –prefix=/usr/local/nagios
--with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios/
--with-nagios-user=nagios --with-nagios-group=nagios
--with-command-group=nagcmd
Compiling binaries-
# make all
[compiles nagios and CGIs. (compiles—error checking for the source code)]
[compiles nagios and CGIs. (compiles—error checking for the source code)]
Installing binraies
# make install
[Installing binaries and HTML files i.e the documentation and the main webpage
[Installing binaries and HTML files i.e the documentation and the main webpage
# make install-init Installing init script to /etc/rc.d/init.d/nagios
# make install-commandmode
# make install-config
[To get configuration files like main,resource and CGI configuration files installed.]
[To get configuration files like main,resource and CGI configuration files installed.]
HOW TO CHECK NAGIOS IS INSTALLED OR NOT ?
# cd /usr/local/nagios
# ls
We should get five directories as
etc ------ Contains Main, resource,CGI configuration files
bin ------ Contains Nagios core program
share ---- Contains HTML files for web interface and online documentation.
Sbin ----- Contains CGIs
Var ------ Contains logfiles, status files etc.
Libexec –
NAGIOS PLUG-INS:
Nagios plug-ins are installed in libexec directory.
Here we moved the nagos plug-in package from Desktop to /usr/local/nagios/libexec. But it is not compulsory to extract the package in side the libexec directory. Where ever we extract, it will be installed in libexec.
# mv nagios-plugins…tar.gz /usr/local/nagios/libexec
# cd /usr/local/nagios/libexec
# tar xxvf nagios-plugin-…tar.gz
# ls
# cd nagios-plugins-1.4.13
# ./configure –prefix=/usr/local/nagios --with-nagios-user=nagios
–with-nagios-group=nagios
It may show some RedHat soaping or some problem related to RedHat.
Then try---
# ./configure –enable-redhat-pthread-workaround [preferable]
Or
# ./configure –disable-redhat-pthread
Then
# make all
# make install
Nagios plug-ins are installed.
3) Post install Configuration of Nagios
Edit apache’s httpd.conf file. (the location of the httpd.conf file may differ)vim /etc/httpd/conf/httpd.conf
Add the following line at the end of the file.Include /etc/httpd/conf/nagios.conf
Create the file ‘/etc/httpd/conf/nagios.conf’.vi /etc/httpd/conf/nagios.conf
Add the following contents to this file.————————————————-
ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/
<Directory /usr/local/nagios/sbin/>
AllowOverride AuthConfig
Options ExecCGI
Allow from all
Order allow,deny
</Directory>
Alias /nagios/ /usr/local/nagios/share/
<Directory /usr/local/nagios/share/>
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
————————————————–
<Directory /usr/local/nagios/share/>
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
————————————————–
Make sure the updations done with http is fine and restart apache.
#service httpd restart
Create ‘.htaccess’ file in ‘/usr/local/nagios/share/’ and ‘/usr/local/nagios/sbin/’.#touch /usr/local/nagios/share/.htaccess
#touch /usr/local/nagios/sbin/.htaccess - securing access to CGI files.
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
ls -l /usr/local/nagios/etc/htpasswd.users
chmod o+r /usr/local/nagios/etc/htpasswd.users
service httpd restart
5)Advanced Nagios Configurations.
Rename the sample files to the real names.cd /usr/local/nagios/etc/
for i in *sample ; do mv $i `echo "$i" |sed s/-sample//` ; done
check_external_commands=1
Physical_html_path=/usr/local/nagios/share
use_authentication=1
authorized_for_system_information=nagiosadmin
authorized_for_configuration_information=nagiosadmin
authorized_for_system_commands=nagiosadmin
authorized_for_all_services=nagiosadmin
authorized_for_all_hosts=nagiosadmin
authorized_for_all_service_commands=nagiosadmin
authorized_for_all_host_commands=nagiosadmin
If the authentication for the cgi files in side /usr/local/nagios/sbin directory are not enabled, then we won’t be able to r
submit passive checks for a particular service for a particular host in nagios manually.
No comments:
Post a Comment