README-main 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. $OpenBSD: README-main,v 1.3 2016/07/11 09:17:45 kirby Exp $
  2. +-----------------------------------------------------------------------
  3. | Running pnp4nagios on OpenBSD
  4. +-----------------------------------------------------------------------
  5. General
  6. =======
  7. Pnp4nagios has no default runtime dependencies to a monitoring tool,
  8. as well as to a monitoring webinterface or web server. Example
  9. instructions below are given for icinga, icinga-web and Apache2, as
  10. well as icinga2, icinga-web2 and nginx.
  11. Log file in ${VARBASE}/log/pnp4nagios will need to be rotated. Here is
  12. a sample line for newsyslog.conf:
  13. ${VARBASE}/log/pnp4nagios/pnp4nagios.log _icinga:_icinga 644 7 250 * Z
  14. Icinga, Icinga-web, Apache
  15. ==========================
  16. Apache2 configuration
  17. ---------------------
  18. Apache2 configuration for PNP4Nagios is stored under:
  19. ${VARBASE}/www/conf/modules.sample/pnp4nagios.conf
  20. It needs to be enabled by running the following command:
  21. # ln -s ../modules.sample/pnp4nagios.conf ${VARBASE}/www/conf/modules
  22. # rcctl restart apache2
  23. Icinga-web configuration
  24. ------------------------
  25. To integrate PNP4Nagios into the Icinga Web frontend you will need to
  26. install templates extensions which comes with icinga-web package:
  27. % cd ${VARBASE}/www/icinga-web/app/modules/Cronks/data/xml/extensions
  28. # ln -s pnp-host-extension.xml.dist pnp-host-extension.xml
  29. # ln -s pnp-service-extension.xml.dist pnp-service-extension.xml
  30. Icinga2, Icinga-web2, Nginx
  31. ===========================
  32. Pnp4nagios runs with php_fpm behind nginx in a chrooted environment.
  33. Prepare the chroot environment
  34. ------------------------------
  35. - follow the instructions in the rrdtool package README
  36. to chroot rrdtool
  37. - copy /bin/sh to ${VARBASE}/www/bin
  38. - copy ${SYSCONFDIR} ${VARBASE}/www${SYSCONFDIR}
  39. - copy ${LOCALBASE}/lib/kohana/system ${VARBASE}/www${LOCALBASE}/lib/kohana/system
  40. - edit ${VARBASE}/www${SYSCONFDIR}/config.php
  41. - ensure: $conf['rrdbase'] = "/pnp4nagios/rrd/";
  42. - ensure: $conf['nagios_base'] = "/icingaweb2";
  43. Icinga2 configuration
  44. ---------------------
  45. With Icinga2 enable the perfdata feature:
  46. # icinga2 feature enable perfdata
  47. Pnp4nagios will use the npcd daemon, and work in the 'bulk' mode.
  48. In ${SYSCONFDIR}/npcd.cfg update the 'perfdata_spool_dir'
  49. to point to '${VARBASE}/spool/icinga2/perfdata'. Additionally ensure
  50. the 'perfdata_file_run_cmd_args' has a '--bulk' argument specified.
  51. In ${SYSCONFDIR}/process_perfdata.cfg ensure the
  52. RRDPATH setting points to '${VARBASE}/www/pnp4nagios/rrd'.
  53. Finally enable npcd:
  54. # rcctl enable npcd
  55. Nginx configuration
  56. -------------------
  57. Below a minimal snippet for the nginx configuration:
  58. server {
  59. ...
  60. location /pnp4nagios {
  61. alias /var/www/pnp4nagios;
  62. }
  63. location ~ ^(/pnp4nagios.*\.php)(.*)$ {
  64. root /pnp4nagios;
  65. include ${SYSCONFDIR}/nginx/fastcgi_params;
  66. fastcgi_pass unix:run/php-fpm-pnp4nagios.sock;
  67. fastcgi_split_path_info ^(.+\.php)(.*)$;
  68. fastcgi_param PATH_INFO $fastcgi_path_info;
  69. fastcgi_param SCRIPT_FILENAME $document_root/index.php;
  70. }
  71. }
  72. Php_fpm configuration
  73. ---------------------
  74. Configure php_fpm pool, the most important configuration
  75. entries:
  76. [pnp4nagios]
  77. listen = ${VARBASE}/www/run/php-fpm-pnp4nagios.sock
  78. listen.owner = www
  79. listen.group = www
  80. listen.mode = 0660
  81. user = _icinga
  82. group = _icinga
  83. chroot = ${VARBASE}/www
  84. Icinga-web2 configuration
  85. -------------------------
  86. Pnp4nagios integration with Icinga-web2 is done via PNP
  87. module, that can be found here:
  88. - https://github.com/Icinga/icingaweb2-module-pnp
  89. For installation and configuration follow the modules
  90. instructions.