Nagios 3 on Cygwin

Don’t think Nagios can be fully built on Cygwin. I still have one compile error related to ICMP include files. Basically, Cygwin doesn’t have a valid ICMP port and icmp.h file is empty. Other than that, I got it to build and run thanks to all the related discussions out there.

Install on Cygwin

Solutions for “error: storage size of ‘hints’ isn’t known” Error

* Download cygwin-1.5.25-15-ipv6-0.23.zip from http://win6.jp/Cygwin/.
* Unzip at Cygwin root diretory.

cd \
unzip cygwin-1.5.25-15-ipv6-0.23.zip
cd cygwin-1.5.25-15-ipv6-0.23
tar cvf ipv6.tar bin lib usr
cp ipv6.tar ..
cd ..
tar xvf ipv6.tar
cd bin
mv cygwin1.dll cygwin1.dll.old
mv new-cygwin1.dll cygwin1.dll

Download and Install

Install Cygwin dependencies

* Graphics/gd
* Graphics/jpeg
* Graphics/libgd-devel
* Graphics/libpng
* Web/Apache2
* Web/Apache2-devel

Compile and Install Nagios Core

* Download Nagios core from http://www.nagios.org/download/

mkdir -p /opt/nagios /etc/nagios /var/nagios
cd /cygdrive/c/sw/nagios/
gunzip nagios-3.2.0.tar.gz
tar xf nagios-3.2.0.tar
cd nagios-3.2.0
sh configure \
    --prefix=/opt/nagios \
    --sysconfdir=/etc/nagios \
    --localstatedir=/var/nagios \
    --libexecdir=/opt/nagios/plugins \
    --with-nagios-user=ming-lj\
    --with-nagios-group=mkgroup-l-d \
    --with-command-group=mkgroup-l-d \
    --with-mail=/usr/sbin/ssmtp.exe \
    --enable-cygwin
# Comment out all occurrences of modules in MakeFile file to avoid helloworld.c error.
make all
make install
make install-commandmode
make install-config

Download and Install Nagios Plug-ins

* Install Cygwin dependencies
– System/procps. This is needed since Cywin ps command is not compatible to Linux ps command (procps does).
– System, Net/ping
* Download Nagios plug-ins from http://www.nagios.org/download/plugins/

gunzip nagios-plugins-1.4.14.tar.gz
tar xf nagios-plugins-1.4.14.tar
cd cd nagios-plugins-1.4.14
 
# Global replace 127.0.0.1 to 64.233.169.99 which is for www.google.com. This is needed in order for ping to succeed.
 
sh configure \
    --prefix=/opt/nagios \
    --sysconfdir=/etc/nagios \
    --localstatedir=/var/nagios \
    --libexecdir=/opt/nagios/plugins \
    --with-nagios-user=Ming-LJ \
    --with-nagios-group=mkgroup-l-d \
    --with-ipv6=no \
    --with-ps-command="`which procps` -eo 's uid pid ppid vsz rss pcpu etime comm args'" \
    --with-ps-format='%s %d %d %d %d %d %f %s %s %n' \
    --with-ps-cols=10 \
    --with-ps-varlist='procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos'    
 
#####################
# Edit plugins/Makefile          
# Move negate$(EXEEXT) urlize$(EXEEXT) to the end
# Append $(EXEEXT) to check_dns, check_by_ssh, check_swap, check_nt
#####################
libexec_PROGRAMS = check_apt$(EXEEXT) check_cluster$(EXEEXT) \
  check_disk$(EXEEXT) check_dummy$(EXEEXT) check_http$(EXEEXT) \
  check_load$(EXEEXT) check_mrtg$(EXEEXT) \
  check_mrtgtraf$(EXEEXT) check_ntp$(EXEEXT) \
  check_ntp_peer$(EXEEXT) check_nwstat$(EXEEXT) \
  check_overcr$(EXEEXT) check_ping$(EXEEXT) check_real$(EXEEXT) \
  check_smtp$(EXEEXT) check_ssh$(EXEEXT) check_tcp$(EXEEXT) \
  check_time$(EXEEXT) check_ntp_time$(EXEEXT) check_ups$(EXEEXT) \
  check_users$(EXEEXT) check_procs$(EXEEXT) check_nagios$(EXEEXT) \
  check_dns$(EXEEXT) check_by_ssh$(EXEEXT) check_swap$(EXEEXT) check_nt$(EXEEXT) \
  negate$(EXEEXT) urlize$(EXEEXT)
 
#####################
# Add to plugins/config.h file #
#####################
#define PS_COLS 10
#define PS_COMMAND "/usr/bin/procps -eo 's uid pid ppid vsz rss pcpu etime comm args'"
#define PS_FORMAT "%s %d %d %d %d %d %f %s %s %n"
#define PS_USES_PROCETIME "yes"
#define PS_VARLIST procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos
#define PING_COMMAND "/usr/bin/ping"
 
make -i all
make -i install

References

http://www.debianhelp.co.uk/nagiosinstall.htm
http://nagios.sourceforge.net/docs/3_0/toc.html

This entry was posted in cygwin, unix. Bookmark the permalink.