Thursday, May 10, 2007

Veritas VCS and Nagios

Here is a quick insight into getting Nagios with Apache working on a Linux RHEL based system. I set this up on CentOS 4.4 and used YUM to install Nagios. I also created the Volumes and File systems in VxVM but I will leave that part out and show just how simple it is to get Nagios clustered in VCS. This assumes you have two VCS nodes setup called 'nagiosa' and 'nagiosb'. Once you finish this and add some storage and what else you need for your setup enable the resources and bring them online!

# Make the config writable
haconf -makerw

# Create New Nagios Service Group
hagrp -add NagiosSG
hagrp -modify NagiosSG SystemList nagiosa 0 nagiosb 1
hagrp -modify NagiosSG AutoStartList nagiosa
hagrp -modify NagiosSG Parallel 0

# Create Nagios Application resource
hares -add nagsvc Application NagiosSG
hares -modify nagsvc Critical 0
hares -modify nagsvc User root
hares -modify nagsvc StartProgram /sbin/service nagios start
hares -modify nagsvc StopProgram /sbin/service nagios stop
hares -modify nagsvc CleanProgram
hares -modify nagsvc PidFiles /var/run/nagios.pid

# Create Apache web server resource
hares -add apachesvc Apache NagiosSG
hares -modify apachesvc Critical 0
hares -modify apachesvc ServerRoot /etc/httpd
hares -modify apachesvc DetailMonitor 0
hares -modify apachesvc Port 80
hares -modify apachesvc Address 0.0.0.0
hares -modify apachesvc ConfigFile /etc/httpd/conf/httpd.conf

# Link Apache to Nagios so Apache must come up first
hares -link nagsvc apachesvc

# Save and close the config
haconf -dump -makero