Nagios is one of the power full monitoring system.
This script work well on OS: CentOS 64bit , Version 6.2
Copy all the red.
#!/bin/bash
# Copy this and paste into a file name: install-nagios.sh
# Make it executable by: chmod +x install-nagios.sh
# Run this file: ./install-nagios.sh
####################
# HowTheScriptDoes #
####################
# 1. Add Repo
echo ""
echo "Adding repo..."
echo ""
wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
# 2. Install dependencies
echo ""
echo "Install dependencies ..."
echo ""
yum -y install httpd php gcc glibc glibc-common gd gd-devel make net-snmp
# 3. Install Nagios
echo ""
echo "Instailling Nagios ..."
echo ""
yum -y install nagios*
# 4. Create user: nagiosadmin
echo ""
echo "Creating user: nagiosadmin ,Please Enter the Password: ..."
htpasswd /etc/nagios/passwd nagiosadmin
# 5. Start web service and Nagios
echo ""
echo "Starting web service and Nagios ..."
service httpd start
chkconfig nagios on
service nagios start
chkconfig httpd on
# 6. Allow port 80
echo ""
echo "Accepting Port 80 ..."
sed -i -e '/22/a \-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT' /etc/sysconfig/iptables
echo "Restarting service iptables ..."
service iptables restart
# 7. Finished,
echo ""
echo ""
echo "Enjoy, ... Access to your Nagios Server by: http://server-ip/nagios with your password."
No comments:
Post a Comment