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.

  1.  
  2. cd \
  3. unzip cygwin-1.5.25-15-ipv6-0.23.zip
  4. cd cygwin-1.5.25-15-ipv6-0.23
  5. tar cvf ipv6.tar bin lib usr
  6. cp ipv6.tar ..
  7. cd ..
  8. tar xvf ipv6.tar
  9. cd bin
  10. mv cygwin1.dll cygwin1.dll.old
  11. mv new-cygwin1.dll cygwin1.dll
  12.  

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/

  1.  
  2. mkdir -p /opt/nagios /etc/nagios /var/nagios
  3. cd /cygdrive/c/sw/nagios/
  4. gunzip nagios-3.2.0.tar.gz
  5. tar xf nagios-3.2.0.tar
  6. cd nagios-3.2.0
  7. sh configure \
  8. --prefix=/opt/nagios \
  9. --sysconfdir=/etc/nagios \
  10. --localstatedir=/var/nagios \
  11. --libexecdir=/opt/nagios/plugins \
  12. --with-nagios-user=ming-lj\
  13. --with-nagios-group=mkgroup-l-d \
  14. --with-command-group=mkgroup-l-d \
  15. --with-mail=/usr/sbin/ssmtp.exe \
  16. --enable-cygwin
  17. # Comment out all occurrences of modules in MakeFile file to avoid helloworld.c error.
  18. make all
  19. make install
  20. make install-commandmode
  21. make install-config
  22.  

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/

  1.  
  2. gunzip nagios-plugins-1.4.14.tar.gz
  3. tar xf nagios-plugins-1.4.14.tar
  4. cd cd nagios-plugins-1.4.14
  5.  
  6. # 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.
  7.  
  8. sh configure \
  9. --prefix=/opt/nagios \
  10. --sysconfdir=/etc/nagios \
  11. --localstatedir=/var/nagios \
  12. --libexecdir=/opt/nagios/plugins \
  13. --with-nagios-user=Ming-LJ \
  14. --with-nagios-group=mkgroup-l-d \
  15. --with-ipv6=no \
  16. --with-ps-command="`which procps` -eo 's uid pid ppid vsz rss pcpu etime comm args'" \
  17. --with-ps-format='%s %d %d %d %d %d %f %s %s %n' \
  18. --with-ps-cols=10 \
  19. --with-ps-varlist='procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos'
  20.  
  21. #####################
  22. # Edit plugins/Makefile
  23. # Move negate$(EXEEXT) urlize$(EXEEXT) to the end
  24. # Append $(EXEEXT) to check_dns, check_by_ssh, check_swap, check_nt
  25. #####################
  26. libexec_PROGRAMS = check_apt$(EXEEXT) check_cluster$(EXEEXT) \
  27. check_disk$(EXEEXT) check_dummy$(EXEEXT) check_http$(EXEEXT) \
  28. check_load$(EXEEXT) check_mrtg$(EXEEXT) \
  29. check_mrtgtraf$(EXEEXT) check_ntp$(EXEEXT) \
  30. check_ntp_peer$(EXEEXT) check_nwstat$(EXEEXT) \
  31. check_overcr$(EXEEXT) check_ping$(EXEEXT) check_real$(EXEEXT) \
  32. check_smtp$(EXEEXT) check_ssh$(EXEEXT) check_tcp$(EXEEXT) \
  33. check_time$(EXEEXT) check_ntp_time$(EXEEXT) check_ups$(EXEEXT) \
  34. check_users$(EXEEXT) check_procs$(EXEEXT) check_nagios$(EXEEXT) \
  35. check_dns$(EXEEXT) check_by_ssh$(EXEEXT) check_swap$(EXEEXT) check_nt$(EXEEXT) \
  36. negate$(EXEEXT) urlize$(EXEEXT)
  37.  
  38. #####################
  39. # Add to plugins/config.h file #
  40. #####################
  41. #define PS_COLS 10
  42. #define PS_COMMAND "/usr/bin/procps -eo 's uid pid ppid vsz rss pcpu etime comm args'"
  43. #define PS_FORMAT "%s %d %d %d %d %d %f %s %s %n"
  44. #define PS_USES_PROCETIME "yes"
  45. #define PS_VARLIST procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos
  46. #define PING_COMMAND "/usr/bin/ping"
  47.  
  48. make -i all
  49. make -i install
  50.  

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.