Monday, May 17, 2021

Installing and setting up Nagios

 Nagios open source comes as raw code, so we need gcc compiler to compile as it was written in c.


Apache

php

gcc compiler

gd

perl

make


yum install httpd php gcc glibc* gd gd-devel


Installation.


1) Create account info

useradd -m nagios

passwd nagios


groupadd nagcmd

usermod -a -G nagcmd nagios

usermod -a -G nagcmd apache


2) Download nagios core

We need to download core and plugin tar(the plugi tar will have all plugins and core will have deamon)


3) extract both tars

go to nagios folder.

./configure--with-command-group=nagcmd

The above step will make sure that the core we extracted will be compatiable to the OS version so that make will be easy.

then run 

make all

above step will create compiled files from that folders raw code.


4) make install

make install-init

make install-config

make install-commandmode

make install-webconf


5) Create nagiosadmin

this user will have admin access to ui

htpasswd-b-c /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadmin


6) service httpd restart


------------------


Install nagios plugins.


1) plugins complied will be using the libexec directory to store its files.

/usr/local/nagios/libexec


2) making sure the files that need to be compiled to be in for correct OS corresponding

./configure--with-nagos-user=nagios--with-nagios-group=nagios


3) make


4) make install


5) verify in libexec directory where all plugins .

If you want some thing else download correspondingly and keep it into that directory.


6) Verify sample nagios configuration default ones.

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


7) servive nagios start


8) verify by ps -ef | grep nagios


---------------


http interface:

localhost/nagios


------------

Directory structure:

/usr/local/nagios/bin -- binary files (nagios, nagiossstat)

/usr/local/nagios/sbin -- CGI files(ex: tac.cgi)

/usr/local/nagios/libexec -- plugins (ex:check_ping)

/usr/local/nagios/share-- php files

/usr/local/nagios/etc -- configuration files

/usr/local/nagios/var -- logs, lock


***

No comments:

Post a Comment