Closed SgtSiff closed 4 years ago
Hi, trap_in.php is a php interpreted script which needs to be executed by PHP.
So your snmptrapd.conf should contain : traphandle default < php binary > < trap_in with path >
See doc : https://github.com/patrickpr/trapdirector/blob/master/docs/01-install.md#snmptrapd-configuration
If you can't make it work, send me your snmptrapd.conf so I have a look.
/Patrick
Hi,
i ran into the same issue using the automated installation script.
It put the following line into snmptrapd.conf
traphandle default -a /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php
system is raspbian buster.
Hi,
There should be php binary with path instead of '-a' : can you send me the options you used with the script ? For a quick fix, replace '-a' by php binary with path.
Hi,
i already replaced it and it worked :)
i used the command line provided in the configuration section
Automatic installation As user root, execute this script : /usr/share/icingaweb2/modules/trapdirector/bin/installer.sh -c all -d /usr/share/icingaweb2/modules/trapdirector -p -a www-data -w /etc/icingaweb2
Hi,
I will make some checks so that the value of php binary is never empty (because then the script uses '-a' as value of php binary...).
What is the result of the following command on your system :
echo '<?php echo PHP_BINARY . "\n"; ?>' | <insert your php binary here>
Because it seems that this pre-defined constant (PHP_BINARY) is empty in your case.
Hi,
this is the result. As said, i'm using raspbian buster with default packages sources.
echo '<?php echo PHP_BINARY . "\n"; ?>' | php
/usr/bin/php7.3
Main question
I can't seem to get traps into icinga2. I believe I have everything setup correctly, and using the following command:
sudo snmptrapd -D -f -Loe
I was able to see that traps are being received:
2019-10-01 12:17:24 ip-x-x-x-x [x.x.x.x] (via UDP: [x.x.x.x]:xxxxx->[x.x.x.x]:xxx) TRAP, SNMP v1, community public SNMPv2-SMI::mib-2.33.2 Enterprise Specific Trap (4) Uptime: 3:43:47.45 SNMPv2-SMI::mib-2.33.1.6.2.1.1.7 = INTEGER: 7 SNMPv2-SMI::mib-2.33.1.6.2.1.2.7 = STRING: ".1.3.6.1.2.1.33.1.6.3.2"
However, nothing is being shown in trapdirector in icingaweb2. From running the command above, I believe I have traced it down to the following:
trace: run_shell_command(): mibgroup/utilities/execute.c, 60: run:shell: running '/usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php' /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php: 1: /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php: cannot open ?php: No such file /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php: 3: /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php: //: Permission denied /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php: 4: /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php: Syntax error: "(" unexpected
I thought it was a permissions thing, so I tried to CHMOD the trap_in.php file so ther permissions were as follows:
-rwxrwxrwx 1 root root 596 Sep 30 15:27 trap_in.php
But no luck.
Any suggestions?
Purpose Receive traps in icingaweb2 trapdirector.
Your Environment:
If related to the question in any way :
company | 1.0.0 director | 1.6.2 doc | 2.7.1 idoreports | 0.9.1 ipl | v0.3.0 map | 1.1.0 monitoring | 2.7.1 reporting | 0.9.2 theme-dark | 0.0.1 trapdirector | 1.0.2
icinga2 --version
):icinga2 - The Icinga 2 network monitoring daemon (version: r2.10.5-1)
Distributor ID: Ubuntu Description: Ubuntu 18.04.3 LTS Release: 18.04 Codename: bionic
Server version: Apache/2.4.29 (Ubuntu) Server built: 2019-09-16T12:58:48
PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.19-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies