# ------------------------------------------
# 1. test the newly built  and copied plugins
# ------------------------------------------

cd /srv/app/nagios-3.3.1/libexec
./check_ping -H localhost -w 3000.0,80% -c 5000.0,100% -p 5
./check_snmp_load.pl -H localhost -C SECro -w 60,55,50 -c 90,85,80 -T netsl
./check_http -H localhost

# ------------------------------------------
# 2. Install a Nagios sample configuration
# ------------------------------------------

cd /home/sw/source/nagios/nagios-3.3.1/nagios
make install-config

cat <<EndOfCmdConfig >> /srv/app/nagios-3.3.1/etc/objects/commands.cfg

define command{
  command_name    check_snmp_load
  command_line    \$USER1\$/check_snmp_load.pl -H \$HOSTADDRESS\$ -C \$ARG1\$ -T \$ARG2\$ -w \$ARG3\$ -c \$ARG4\$ \$ARG5\$
}
EndOfCmdConfig

tail -5 /srv/app/nagios-3.3.1/etc/objects/commands.cfg

cat <<EndOfSvcConfig >> /srv/app/nagios-3.3.1/etc/objects/localhost.cfg

###############################################################################
# Define a servicegroup for load checks, load_check_localhost becomes a member
###############################################################################
define servicegroup{
  servicegroup_name        load-checks ; The name of the hostgroup
  alias                    Performance Checks ; Long name of the group
}
###############################################################################
# Server load performance check via SNMP
###############################################################################
define service {
  use                           local-service
  host_name                     localhost
  service_description           os_cpu_load
  check_command                 check_snmp_load!NAGcom!netsl!20,15,10!30,25,20
  contact_groups                admins
  servicegroups                 load-checks
}
EndOfSvcConfig

tail -19 /srv/app/nagios-3.3.1/etc/objects/localhost.cfg
cd

# ------------------------------------------
# 3. Verify the Nagios sample configuration
# ------------------------------------------

/srv/app/nagios-3.3.1/bin/nagios -v /srv/app/nagios-3.3.1/etc/nagios.cfg

# ------------------------------------------
# 4. Start the new Nagios instance
# ------------------------------------------

ps -ef |grep nagios
touch /var/lock/nagios-3.3.1.lock; chown nagios:nagios /var/lock/nagios-3.3.1.lock
/srv/app/nagios-3.3.1/bin/nagios -d /srv/app/nagios-3.3.1/etc/nagios.cfg
ps -ef |grep nagios
tail /srv/app/nagios-3.3.1/var/nagios.log 

# ------------------------------------------
# 5. Configure the new Nagios web GUI
# ------------------------------------------
mv /srv/app/nagios-3.3.1/share /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1
mv /srv/app/nagios-3.3.1/sbin /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1/cgi-bin
ln -s /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1 /srv/app/nagios-3.3.1/share
ln -s /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1/cgi-bin /srv/app/nagios-3.3.1/sbin

cd /srv/app/nagios-3.3.1
ls -l share sbin
cd

# ------------------------------------------
# 6. Enable guest webGUI access for testing
# ------------------------------------------

sed 's/^#default_user_name=guest/default_user_name=guest/' -i /srv/app/nagios-3.3.1/etc/cgi.cfg
sed 's/nagiosadmin/guest/' -i /srv/app/nagios-3.3.1/etc/cgi.cfg

grep guest /srv/app/nagios-3.3.1/etc/cgi.cfg

# ------------------------------------------
# 6. Enable customized WebGUI colors (CSS)
# The stylesheet changed in large parts, we cannot simply copy the old one over
# Our adjusted stylesheet uses bg-images for sidebar menu items and takes them from the global servers image directory
# ------------------------------------------
cp /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1/stylesheets/common.css /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1/stylesheets/common.css.orig
cp /home/sw/source/nagios/nagios-3.3.1-20110812-common.css /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1/stylesheets/common.css

# ------------------------------------------
# 7. Install additional system/OS logo icons 
# ------------------------------------------
cd /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1/images
tar xf /home/sw/source/nagios/nagios-logos-20100622.tar

# ------------------------------------------
# replace the notes.gif with the graph image
# ------------------------------------------
cp /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1/images/notes.gif /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1/images/notes.gif.orig
cp /srv/www/std-root/nagios.frank4dd.com/nagios/images/notes.gif /srv/www/std-root/nagios.frank4dd.com/nagios-3.3.1/images/notes.gif

# ------------------------------------------
# Install the nagiosgraph cgi stylesheet
# ------------------------------------------
# in my case, nagiosgraph uses the site-global /style/frank4dd-style.css - no action here

vi side.php
< Nagios
---
> Nagios

  • Home
  • Documentation
  • a---
  • Nagios Live Home
  • Back to Frank4DD
  • Documentation