Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Script to ease installation of Nagios, it assumes you have internet connection and need nagios downloaded, if you already have it downloaded move to it's folder and comment out next three lines
- # comment these out if you already have nagios downloaded
- cd /var/tmp
- apt-get -y install build-essential
- apt-get -y install libgd2-xpm-dev
- apt-get -y install xinetd
- apt-get -y install mcrypt
- apt-get -y install libcurl4-openssl-dev
- wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.3.1.tar.gz
- wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
- wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
- wget http://prdownloads.sourceforge.net/sourceforge/nagios/nsca-2.7.2.tar.gz
- # comment these out if you already have nagios downloaded
- echo "Please enter account that will run Nagios"
- read NAGUSER
- echo "Please enter installation path withoud leading and trailing / (ie. nagios-czech)"
- read NAGIOS
- echo "Please enter www address where you want to see Nagios, without leading and trailing / (ie. nagios-czech will result in http://localhost/nagios-czech as your page)"
- read DOHLED
- echo "Please enter username for webaccess - it will also be granted admin permissions for web"
- read NAGWEBUSER
- echo "Please enter instance name (ie. nagios-czech this will put configs in /nagios-czech/SCRIPTS"
- read NAGIOSINIT
- echo "*************"
- echo "*** RECAP ***"
- echo "*************"
- echo "You entered: $NAGUSER as username under which will Nagios run"
- echo "You entered: $NAGIOS as path for installation"
- echo "You entered: $DOHLED as desired webpage for Nagios"
- echo "You entered: $NAGWEBUSER as user for web access"
- echo "You entered: $NAGIOSINIT as instance name for SCRIPTS"
- echo "You will be prompted for passwords during installation"
- echo "*************"
- echo "*** RECAP ***"
- echo "*************"
- tar -zxvf nagios-3.3.1.tar.gz
- tar -zxvf nagios-plugins-1.4.15.tar.gz
- tar -zxvf nrpe-2.12.tar.gz
- tar -zxvf nsca-2.7.2.tar.gz
- cd nagios
- useradd -m $NAGUSER
- usermod -a -G $NAGUSER www-data
- passwd $NAGUSER
- ./configure --with-nagios-user=$NAGUSER --with-nagios-group=$NAGUSER --with-command-user=$NAGUSER --with-command-group=$NAGUSER --prefix=/$NAGIOS --exec-prefix=/$NAGIOS/exec --with-htmurl=/$DOHLED --with-cgiurl=/$DOHLED/cgi-bin --with-httpd-conf=/$DOHLED/SCRIPTS --with-init-dir=/$DOHLED/SCRIPTS
- sed -i 's:for file in includes/rss/\*;:for file in includes/rss/\*.\*;:g' ./html/Makefile
- sed -i 's:for file in includes/rss/extlib/\*;:for file in includes/rss/extlib/\*.\*;:g' ./html/Makefile
- make all
- make install
- make install-init
- make install-config
- make install-commandmode
- make install-webconf
- htpasswd -c /$NAGIOS/etc/htpasswd.users $NAGWEBUSER
- sed -i "s/nagiosadmin/$NAGWEBUSER/g" /$NAGIOS/etc/cgi.cfg
- cd ..
- cd nagios-plugins-1.4.15
- ./configure --prefix=/$NAGIOS --exec-prefix=/$NAGIOS/exec --with-nagios-user=$NAGUSER --with-nagios-group=$NAGUSER --with-cgiurl=/$DOHLED/cgi-bin
- make
- make install
- cd ..
- cd nrpe-2.12
- ./configure --prefix=/$NAGIOS --exec-prefix=/$NAGIOS/exec --with-nagios-user=$NAGUSER --with-nagios-group=$NAGUSER --with-cgiurl=/$DOHLED/cgi-bin
- make all
- make install
- make install-plugin
- make install-daemon
- make install-daemon-config
- make install-xinetd
- cd ..
- cd nsca-2.7.2
- ./configure --prefix=/$NAGIOS --exec-prefix=/$NAGIOS/exec --with-nagios-user=$NAGUSER --with-nagios-group=$NAGUSER --with-cgiurl=/$DOHLED/cgi-bin
- make all
- make install
- cp /$DOHLED/SCRIPTS/nagios /etc/init.d/$NAGIOSINIT
- cp /$DOHLED/SCRIPTS/nagios.conf /etc/apache2/conf.d/$NAGIOSINIT.conf
- ln -s /etc/init.d/$NAGIOSINIT /etc/rcS.d/S99nagios
- /etc/init.d/apache2 reload
- /etc/init.d/$NAGIOSINIT checkconfig
- /etc/init.d/$NAGIOSINIT start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement