Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with trap_in.php #12

Closed
SgtSiff opened this issue Oct 1, 2019 · 6 comments
Closed

Problems with trap_in.php #12

SgtSiff opened this issue Oct 1, 2019 · 6 comments
Assignees
Labels
config error Error in configuration

Comments

@SgtSiff
Copy link

SgtSiff commented Oct 1, 2019

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

  • Icinga 2 version (icinga2 --version):

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

  • Operating System and version:

Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic

  • Webserver, PHP versions:

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

@SgtSiff SgtSiff closed this as completed Oct 1, 2019
@patrickpr patrickpr self-assigned this Oct 1, 2019
@patrickpr patrickpr added the config error Error in configuration label Oct 1, 2019
@patrickpr
Copy link
Owner

patrickpr commented Oct 1, 2019

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

@bitboy85
Copy link

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.

@patrickpr
Copy link
Owner

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.

@patrickpr patrickpr reopened this Dec 18, 2019
@bitboy85
Copy link

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

@patrickpr
Copy link
Owner

patrickpr commented Dec 19, 2019

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.

@bitboy85
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config error Error in configuration
Projects
None yet
Development

No branches or pull requests

3 participants