patrickpr / trapdirector

Icingaweb2 module for receiving and handling snmp traps
GNU General Public License v3.0
53 stars 15 forks source link

php-fpm7.2 traphandle on Ubuntu doesn't work #30

Closed blindzero closed 4 years ago

blindzero commented 4 years ago

Main question

traphandle created by install script with php-fpm7.2 seems not to work

Purpose

I called the bin/installer script and this created a traphandle default /usr/sbin/php-fpm7.2 /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php

The PHP file path is correct, php-fpm7.2 is there. In syslog I always see

Apr 13 20:21:41 icinga2 snmptrapd[1023]: Usage: php-fpm7.2 [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>] [-D] [-F [-O]]
and following general help files

Your Environment

If related to the question in any way :

icinga2 - The Icinga 2 network monitoring daemon (version: r2.11.3-1)

Copyright (c) 2012-2020 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
  Platform: Ubuntu
  Platform version: 18.04.4 LTS (Bionic Beaver)
  Kernel: Linux
  Kernel version: 4.15.0-96-generic
  Architecture: x86_64

Build information:
  Compiler: GNU 8.3.0
  Build host: runner-LTrJQZ9N-project-298-concurrent-0

Application information:

General paths:
  Config directory: /etc/icinga2
  Data directory: /var/lib/icinga2
  Log directory: /var/log/icinga2
  Cache directory: /var/cache/icinga2
  Spool directory: /var/spool/icinga2
  Run directory: /run/icinga2

Old paths (deprecated):
  Installation root: /usr
  Sysconf directory: /etc
  Run directory (base): /run
  Local state directory: /var

Internal paths:
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid
patrickpr commented 4 years ago

Hi,

Thanks for the feedback. The install script gets the php binary from the web server, and in this case you use php-fpm. This is OK for web server but you need the php binary to execute a php file in command line.

1) Find your php binary : must be /usr/bin/php

2) Replace in snmptrapd.conf :

traphandle default /usr/sbin/php-fpm7.2 /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php

by traphandle default /usr/bin/php /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php

(if your php binary is /usr/bin/php)

I'll make some more tests in the install script generator on the web page to avoid this problem and also update the docs.

Patrick

blindzero commented 4 years ago

@patrickpr Doh! Yeah...as more an infrastructure guy I am just too far away from that web stuff ;) Solved it perfectly. Would be great if installer could avoid it.

Thanks, M.