2014年9月23日 星期二

Multi-Nagios Tactical Overview System

Multi-Nagios Tactical Overview System 


Purpose  : Monitoring aggregation tool with Nagios XI or Nagios Core.


Automated Installation

The process of installing MNTOS can be automated with a script that can be downloaded from:

         http://assets.nagios.com/downloads/nagiosxi/scripts/NagiosXI-MNTOS-install.sh

Follow the steps below to install MNTOS:

        1. Log in to the Nagios / Nagios XI server as the root user.

        2. Download the automated installation script to the /tmp directory.

             # cd /opt
             # wget http://assets.nagios.com/downloads/nagiosxi/scripts/NagiosXI-MNTOS-install.sh

        3. Make the script executable.

             # chmod +x NagiosXI-MNTOS-install.sh

        4. Execute the script.

             # ./NagiosXI-MNTOS-install.sh

           
 *Pre-download mntos-1.0.tar.gz、globe.png、NagiosXI-MNTOS-configure.py and put in /opt

=======================NagiosXI-MNTOS-install.sh==================================

#!/bin/sh

# Check whether we have sufficient privileges

if [ $(whoami) != "root" ]; then
echo "This script needs to be run as root/superuser."
exit 1
fi

# Install prerequisite packages
yum install -yq wget httpd php php-xml

# Download and install MNTOS from Exchange
cd /opt
#wget "http://exchange.nagios.org/components/com_mtree/attachment.php?link_id=528&cf_id=24" -O mntos-1.0.tar.gz.gz
#gunzip mntos-1.0.tar.gz.gz
#tar zxf mntos-1.0.tar.gz
#rm mntos-1.0.tar.gz
cd mntos-1.0
#wget "http://assets.nagios.com/downloads/nagiosxi/misc/globe.png" -O www/img/globe.png
#wget "http://assets.nagios.com/downloads/nagiosxi/scripts/NagiosXI-MNTOS-configure.py"
chmod +x NagiosXI-MNTOS-configure.py

# Make necessary changes to MNTOS configuration file
sed -i 's/contacts\=.*/contacts="\/opt\/mntos-1\.0\/"/' config.ini
sed -i 's/networks\=.*/networks="\/opt\/mntos-1\.0\/"/' config.ini
sed -i 's/xmloutput\=.*/xmloutput="\/opt\/mntos-1.0\/www\/"/' config.ini

# Walk through initial setup of contacts and networks to show in the interface
./NagiosXI-MNTOS-configure.py

# Make sure this server allows HTTP connections to view the dashboard
#iptables -I RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
#iptables save
#service iptables restart

# Update information from the remote Nagios servers via cron
echo '* * * * * /usr/bin/php /opt/mntos-1.0/mntos.php /dev/null 2>&1' > /etc/cron.d/mntos

# This line is here so it can be changed if the cron job is changed to run less than every minute (it's in seconds)
sed -i 's/refreshfreq\ =\ 60/refreshfreq\ =\ 60/' www/index.php

# Adjust permissions
chown -R nagios:apache .
chmod o-r networks.ini
chmod g+w .

# Create a virtual host definition for Apache
echo -e "\
Alias /mntos \"/opt/mntos-1.0/www\"\n\
\n\
<Directory \"/opt/mntos-1.0/www\">\n\
#  SSLRequireSSL\n\
  Options None\n\
  AllowOverride None\n\
  Order allow,deny\n\
  Allow from all\n\
</Directory>" > /etc/httpd/conf.d/mntos.conf

# Reload Apache configuration
service httpd restart

echo ""
echo "============================="
echo "MNTOS Installation Complete!"
echo "You can now view the MNTOS interface at http://"$(ifconfig | grep "inet\ addr" | head -n1 | sed 's/^[^:]*://' | sed 's/\ .*//')"/mntos/"
echo "============================="

=======================NagiosXI-MNTOS-install.sh=================================


After install...............................Execute config 


 ---------------------------------------contact.ini---------------------------------------------------------------

[WizardContact0001]

id=1

name="John"
address="Taipei"
zipcode="59701"
city="Taipei"
country="TW"
email="John@ggmail.com"
workphone="02-12345678"
profession="Nagios admin"
---------------------------------------------------------------------------------------------------------------------



----------------------------------------network.ini--------------------------------------------------------------

[NY]

id=1

location="Nagios:NY"
network="NY"
nagios="http://admin:password@nagios-ip/nagios/cgi-bin/tac.cgi"
public="http://web-ip/vshell/"
contacts=1
icon="img/globe.png"

[Alabama]
id=2
location="Nagios:Alabama"
network="Alabama"
nagios="http://admin:password@naigos-ip/nagios/cgi-bin/tac.cgi"
public="http://web-ip/vshell/"
contacts=1
icon="img/globe.png"
-------------------------------------------------------------------------------------------------------------------------


http://<nagios-ip>/mntos


沒有留言:

張貼留言