Thursday, April 7, 2016

Instalacija nagios-a

********************************Instalacija LAMP
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-7
sudo yum install httpd
sudo systemctl start httpd.service
sudo systemctl enable httpd.service

sudo yum install mariadb-server mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation
root/root
sudo systemctl enable mariadb.service

sudo yum install php php-mysql
sudo systemctl restart httpd.service
yum search php-
yum info php-fpm
sudo yum install php-fpm





********************************INSTALACIJA NAGIOS

https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-centos-7

sudo yum install gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel xinetd unzip

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios


Preuzmi fajl: https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
tar xvf nagios-*.tar.gz
cd nagios-*
./configure --with-command-group=nagcmd
make all

sudo make install
sudo make install-commandmode
sudo make install-init
sudo make install-config
sudo make install-webconf


sudo usermod -G nagcmd apache


**********************************Install Nagios Plugins
cd ..
Preuzmi fajl: http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
tar xvf nagios-plugins-*.tar.gz
cd nagios-plugins-*
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
make
sudo make install


***************************************Install NRPE
Preuzmi fajl: http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
tar xvf nrpe-*.tar.gz
cd nrpe-*
./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu

make all
sudo make install
sudo make install-xinetd
sudo make install-daemon-config


sudo vi /etc/xinetd.d/nrpe
only_from = 127.0.0.1 192.168.0.0/16
sudo service xinetd restart



***************************************Configure Nagios
sudo vi /usr/local/nagios/etc/nagios.cfg
odkomentarisati:
#cfg_dir=/usr/local/nagios/etc/servers
sudo mkdir /usr/local/nagios/etc/servers

*************************************Configure Nagios Contacts
sudo vi /usr/local/nagios/etc/objects/contacts.cfg

************************************Configure check_nrpe Command
sudo vi /usr/local/nagios/etc/objects/commands.cfg
na kraju fajla dodati:
define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

***********************************Configure Apache
Kreiranje korisnika nagiosadmin:
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Ubaci password: nagiosadmin

sudo systemctl start nagios.service
sudo systemctl restart httpd.service

*******************************Optional: Restrict Access by IP Address
sudo vi /etc/httpd/conf.d/nagios.conf
komentarisati
Order allow,deny
Allow from all
odkomentarisati i dodati vasu adresu. Linije ce se pojaviti dva puta u fajlu
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
*********************************RESTART
sudo systemctl restart nagios.service
sudo systemctl restart httpd.service


*******************************Accessing the Nagios Web Interface
http://ipaddresa/nagios
nagiosadmin
nagiosadmin

*******************************Ispravljanje greŠke
Error: Could not stat() command file '/usr/local/nagios/var/rw/nagios.cmd'!
komanda koja je na kraju reŠila problem je:
setenforce 0


service httpd restart
service nagios restart


**********************************PROVERA KONFIGURACIJE
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

No comments:

Post a Comment