星期二, 1月 08, 2008

Nagios installation and configuration tips

### Environment###

Client IP address: 10.6.116.59

Node1 (Server) IP address:
10.6.116.64
192.1.1.1

Node2 IP address: 192.1.1.2
################

[ipvsadm section]

tar zxvf ipvsadm-1.24.tar.gz
cd ipvsadm-1.24
Modify Makefile and libipvs/Makefile for /usr/src/linux/include to /usr/src/kernels/2.6.15xxx/include
make;make install
ipvsadm -C
ipvsadm -A -t 10.6.116.64:80 -s rr
ipvsadm -a -t 10.6.116.64:80 -r 192.1.1.2:80 -w 1
ipvsadm -a -t 10.6.116.64:80 -r 192.1.1.3:80 -w 2
ipvsadm -A -t 10.6.116.64:23
ipvsadm -a -t 10.6.116.64:23 -r 192.1.1.2:23 -w 1
ipvsadm -a -t 10.6.116.64:23 -r 192.1.1.3:23 -w 2
ipvsadm

[ab section]
cd /usr/local/apache2/bin
./ab -n 100 node3/

[webmin section]

tar zxvf webmin-1.300.tar.gz
cd webmin-1.300
./setup.sh /usr/local/webmin

[nagios section]

tar zxvf nagios-1.0.tar.gz
adduser nagios
passwd nagios
./configure
make all;make install
make install-init
make install-config

For /usr/local/apache2/conf/httpd.conf modification

######

## For Nagios Use Only ## ScriptAlias /nagios/cgi-bin/ "/usr/local/nagios/sbin/" Alias /nagios "/usr/local/nagios/share/"## Finish ##
## For Nagios Use Only##AllowOverride AuthConfigOptions +ExecCGIAddHandler cgi-script .cgi .plAllow from allOrder allow,deny
Options NoneAllowOverride AuthConfigOrder allow,denyAllow from all## Finish ##

######
Try it…
http://localhost/nagios/

[nagiosplus section]
tar zxvf nagios-plugins-1.4.3.tar.gz
cd nagios-plugins-1.4.3/
./configure
make;make install

[nagios configuration]
cd /usr/local/nagios/etc
make all sample file to cfg file
all cfg file as notes, use minimal.cfg to be default

(cgi.cfgminimal.cfgnagios.cfgcheckcommands.cfgmiscommands.cfgresource.cfg)


Only need to modify the minimal.cfg file as followings
contact area

####

define contact{ contact_name juergen alias Juergen Chiu service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,r service_notification_commands notify-by-email host_notification_commands host-notify-by-email email juergen@localhost.localdomain }

####
contactgroup area

####

define contactgroup{ contactgroup_name Cluster-Manager alias Cluster Administrators members juergen }

####
host area

####

define host{ host_name node2 alias Cluster Server 2 address 192.1.1.2 check_command check-host-alive max_check_attempts 10 notification_interval 120 notification_period 24x7 notification_options d,r contact_groups Cluster-Manager }

####
hostgroup area

####

define hostgroup{ hostgroup_name Juergen alias Cluster Servers members node2,node3 }

####
service area
####

define service{ host_name node2 service_description HTTP is_volatile 0 check_period 24x7 max_check_attempts 3 normal_check_interval 3 retry_check_interval 1 contact_groups Cluster-Manager notification_interval 120 notification_period 24x7 notification_options w,u,c,r check_command check_http }

####

Modify cgi.cfg file for authentication (use_authentication=0)
Remark the checkcommands.cfg and misccommands.cfg line in nagios.cfg file
add the notes into minimal to add the check_http function

####

define command{ command_name check_http command_line $USER1$/check_http -H $HOSTADDRESS$ }

####

[nagios startup section]
cd /usr/local/nagios/bin
"./nagios -v ../etc/nagios.cfg" to check the config status
./nagios ../etc/nagios.cfg

沒有留言: