Thursday, March 12, 2015

Quick install nagios server



yum -y install wget unzip perl gcc gd gd-devel rrdtool httpd httpd-devel openssl openssl-devel php graphviz-php php-gd
yum -y install java-1.7.0-openjdk
chkconfig httpd on
cd /root
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.5.1.tar.gz
tar zxf nagios-3.5.1.tar.gz
useradd nagios
cd nagios
./configure
./make install
make nagios
make cgis
make contrib
make modules
make install-init
make install-base
make install-cgis
make install-html
make install-config
make install-commandmode
make fullinstall
make install-exfoliation
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
tar zxf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
./configure
make install
wget http://iweb.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
tar zxf nrpe-2.15.tar.gz
cd nrpe-2.15
./configure --enable-command-args
make all
make install
make install-daemon
make install-daemon-config
make install-plugin
cd /usr/local/nagios/etc/objects/
mv commands.cfg commands.cfg-bak
wget http://$admin_host/nagios/commands.cfg
mkdir -p /usr/local/nagios/etc/init.d
cd /usr/local/nagios/etc/init.d
wget http://$admin_host/nagios/init.d/nrpe
cd /etc/init.d
ln -s /usr/local/nagios/etc/init.d/nrpe
chmod 754 /usr/local/nagios/etc/init.d/nrpe
chkconfig nrpe on
tar czvf /var/www/html/nagios.tar.gz /usr/local/nagios/ /etc/init.d/nrpe --exclude=/usr/local/nagios/share --exclude=/usr/local/nagios/var/ --exclude=/usr/local/nagios/sbin --exclude=/usr/local/nagios/var --exclude=/usr/local/nagios/lost+found
touch /usr/local/nagios/etc/htpasswd.users
htpasswd -b /usr/local/nagios/etc/htpasswd.users nagiosadmin XXXXXXX
service httpd restart
service nagios restart
service nrpe restart


No comments:

Post a Comment