Nagios Checks for Sahana

From Nagios Wiki

Jump to: navigation, search

Contents

[edit] Purpose

This HOWTO will explain how one can:

(a) Quickly install Sahana on CentOS 4.x (using the single server cd),

(b) Quickly install Nagios on (using the same CentOS cd)

(c) How to set up Sahana to to be remotely monitored by a separate Nagios server.

(Those needing help using Sahana should consult Sahana's documentation)

[edit] Installing CentOS 4.x

  • Grab latest CentOS Server CD ISO
  • Do a minimal install (with as few packages as possible)
  • Turn off SELinux (if you leave this on, you will likely experience many problems trying to get Nagios working)
  • Reboot

(Follow this process for both the Nagios and the Sahana server)

[edit] Sahana


[edit] Installing LAMP Components Necessary for Sahana

yum -y install httpd mysql-server php-mysql php-gd mysql-devel
/etc/init.d/httpd start
chkconfig --add httpd
/etc/init.d/mysqld start
chkconfig --add mysqld

[edit] Installing Sahana

cd /tmp
wget http://easynews.dl.sourceforge.net/sourceforge/sahana/sahana2-0.4.0-stable.rpm
rpm -i sahana2-0.4.0-stable.rpm
ln -s /var/www/sahana /var/www/html/sahana

[edit] Post Install on Sahana

Point web browser to:

http://(ip address)/sahana

[edit] First Page

Make sure all prerequisites are fufilled:

Welcome to Sahana. Please follow the following steps to setup the Sahana system

First we need to check if all the relevant dependancies for the Sahana system to be install are available on your system

Key: *req - Fields tagged with this have to be filled to submit the form successfully
PHP libraries

The following checks if all the relevant Sahana libraries are installed

Sahana needs PHP version 4 or higher. The current version is 4.3.9
PHP Version *req [Help]
PHP-GD library *req [Help]
MySQL library *req [Help]
File and Directory Permissions

The following checks if certain files and directories have write persmissions for Sahana to function
www/tmp/ is writable? *req [Help]
dir conf/ is writable? [Help]

All the dependancies are OK and you may move to the next step

[edit] Second Page

Sahana Database Setup - Step 2

Key: *req - Fields tagged with this have to be filled to submit the form successfully
Database Database Types MySQL 4.1 or above
Database Host:Port *req
Database Name *req
Database User *req
Database Password *req
Schema's to Install Default Item Categories

[edit] Third Page

Sahaha Web Setup - Step 3

Please follow the following steps to setup the Sahana configuration

Key: *req - Fields tagged with this have to be filled to submit the form successfully
Settings root (admin) Password *req [Help]
Access Control Disable Enable
Theme Default Theme
Configuration File

The next step is to write the configuration file sysconf.inc in the Sahana /conf directory.

[edit] Installing Nagios Components on Sahana Server

cd /tmp/
wget http://dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.3.6-1.el4.rf.*.rpm
rpm -i rpmforge-release-0.3.6-1.el4.rf.*.rpm
yum -y update
yum -y install nagios-plugins-nrpe nagios-nrpe
chkconfig --add nagios
/etc/init.d/nagios start

[edit] Nagios

Nagios actively polls Sahana according to the instructions in /etc/nagios/sahana-services.cfg, and Sahana (via the /etc/nagios/nrpe.cfg file) gives Nagios visibility "inside" the guts of the server.

[edit] Nagios Server Configuration

wget http://dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.3.6-1.el4.rf.*.rpm
rpm -i rpmforge-release-0.3.6-1.el4.rf.*.rpm
yum -y update
yum install nagios*
chkconfig --add nagios
/etc/init.d/nagios start

[edit] LAMP components necessary for Nagios

yum -y install httpd php mysql mysql-server php-mysql httpd-manual
/etc/init.d/mysqld start
chkconfig mysqld on
/etc/init.d/httpd start
chkconfig httpd on

[edit] Apache Configuration of Nagios Server

  • htpasswd -c /etc/nagios/htpasswd.users nagiosadmin (then put in your password)
  • vim /etc/nagios/cgi.cfg
# AUTHENTICATION USAGE
use_authentication=1
# SYSTEM/PROCESS INFORMATION ACCESS
authorized_for_system_information=nagiosadmin
# CONFIGURATION INFORMATION ACCESS
authorized_for_configuration_information=nagiosadmin
# SYSTEM/PROCESS COMMAND ACCESS
authorized_for_system_commands=nagiosadmin
# GLOBAL HOST/SERVICE VIEW ACCESS
authorized_for_all_services=nagiosadmin
authorized_for_all_hosts=nagiosadmin
# GLOBAL HOST/SERVICE COMMAND ACCESS
authorized_for_all_service_commands=nagiosadmin
authorized_for_all_host_commands=nagiosadmin

bounce Apache service:

/etc/init.d/httpd restart

[edit] nagios.cfg

vim /etc/nagios/nagios.cfg

files to change

[edit] sahana-services.cfg

vim /etc/nagios/sahana-services.cfg


service checks
(in progress)

[edit] commands.cfg

vim /etc/nagios/commands.cfg

add:

#Sahana commands
#Use the ! ("bang") to pass these parameters in correctly
#in /etc/nagios/sahana-services.cfg
#
#e.g. check_ping!100.0,20%!500.0,60%

define command{
    command_name    check_nrpe
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
    }

[edit] Sahana Server Configuration

[edit] nrpe.cfg

vim /etc/nagios/nrpe.cfg

add following:

#The following examples use hardcoded command arguments...
#modify '/usr/lib/nagios/plugins' path to reflect your $NAGIOS_PLUGINS directory (if different)
#modify the warning (-w) and critical (-c) levels to reflect your environment

command[check_sahana_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_sahana_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20

#Use (something like) 'fisk -l' or 'cat /proc/partitions' on Sahana to show
#any other partitions that need mounting
#
#e.g.
#
#fdisk -l
#Disk /dev/sda: 53.6 GB, 53687091200 bytes
#255 heads, 63 sectors/track, 6527 cylinders
#Units = cylinders of 16065 * 512 = 8225280 bytes
#   Device Boot      Start         End      Blocks   Id  System
#/dev/sda1   *           1          13      104391   83  Linux
#/dev/sda2              14        6527    52323705   8e  Linux LVM

command[check_sahana_disk1]=/usr/lib/nagios/plugins/check_disk -w 20 -c 10 -p /dev/sda1
command[check_sahana_disk2]=/usr/lib/nagios/plugins/check_disk -w 20 -c 10 -p /dev/sda2

command[check_sahana_mysql]=/usr/lib/nagios/plugins/check_mysql

#Checks for zombie processes (e.g. ps -el | grep 'Z')

command[check_sahana_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z

#Dependencies of procs can be found by typing 'ps -e -o pid,args --forest'
#on Sahana. Or you can use top or htop.

command[check_sahana_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200

#'grep MemTotal /proc/meminfo' on Sahana server to show total RAM
#'free -m' shows free memory in system

command[check_sahana_swap]=/usr/lib/nagios/plugins/check_swap -w 50% -c 20%

command[check_sahana_httpd]=/usr/lib/nagios/plugins/check_procs -c 1:9 -C httpd
command[check_sahana_mysql_proc]=/usr/lib/nagios/plugins/check_procs -c 1:9 -C mysqld
command[check_sahana_init_proc]=/usr/lib/nagios/plugins/check_procs -c 1:9 -C init
command[check_sahana_cron_proc]=/usr/lib/nagios/plugins/check_procs -c 1:9 -C crond
command[check_sahana_sendmail_proc]=/usr/lib/nagios/plugins/check_procs -c 1:9 -C sendmail

command[check_sahana_sshd_proc]=/usr/lib/nagios/plugins/check_procs -c 1:9 -C sshd
command[check_sahana_mail_queue]=/usr/lib/nagios/plugins/check_mailq -w 5 -c 100 -M sendmail

Personal tools
Advertisement