patrickpr / trapdirector

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

Traps are in not in database #31

Closed mabfuss closed 4 years ago

mabfuss commented 4 years ago

The traps are in /var/log/messages but not in the database. But therefore i can not see the traps in icingaweb2.

/var/log/messages May 3 23:51:45 icinga snmptrapd[1284]: 2020-05-03 23:51:45 192.168.0.17(via UDP: [192.168.0.17]:162->[192.168.168.50]:162) TRAP, SNMP v1, community public#012#011.1.3.6.1.4.1.12356.101.1.1041 Enterprise Specific Trap (505) Uptime: 101 d ays, 20:59:00.27#012#011.1.3.6.1.4.1.12356.100.1.1.1.0 = STRING: "FG100ETK19010031"#011.1.3.6.1.2.1.1.5.0 = STRING: nsfbhqfw3.pcsoft.de May 3 23:51:45 icinga snmptrapd[1284]: Usage: php-fpm [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p ] [-g ] [-c ] [-d foo[=bar]] [-y ] [-D] [-F [-O]] May 3 23:51:45 icinga snmptrapd[1284]: -c | Look for php.ini file in this directory May 3 23:51:45 icinga snmptrapd[1284]: -n No php.ini file will be used May 3 23:51:45 icinga snmptrapd[1284]: -d foo[=bar] Define INI entry foo with value 'bar' May 3 23:51:45 icinga snmptrapd[1284]: -e Generate extended information for debugger/profiler May 3 23:51:45 icinga snmptrapd[1284]: -h This help May 3 23:51:45 icinga snmptrapd[1284]: -i PHP information May 3 23:51:45 icinga snmptrapd[1284]: -m Show compiled in modules May 3 23:51:45 icinga snmptrapd[1284]: -v Version number May 3 23:51:45 icinga snmptrapd[1284]: -p, --prefix

May 3 23:51:45 icinga snmptrapd[1284]: Specify alternative prefix path to FastCGI process manager (default: /usr). May 3 23:51:45 icinga snmptrapd[1284]: -g, --pid May 3 23:51:45 icinga snmptrapd[1284]: Specify the PID file location. May 3 23:51:45 icinga snmptrapd[1284]: -y, --fpm-config May 3 23:51:45 icinga snmptrapd[1284]: Specify alternative path to FastCGI process manager config file. May 3 23:51:45 icinga snmptrapd[1284]: -t, --test Test FPM configuration and exit May 3 23:51:45 icinga snmptrapd[1284]: -D, --daemonize force to run in background, and ignore daemonize option from config file May 3 23:51:45 icinga snmptrapd[1284]: -F, --nodaemonize May 3 23:51:45 icinga snmptrapd[1284]: force to stay in foreground, and ignore daemonize option from config file May 3 23:51:45 icinga snmptrapd[1284]: -O, --force-stderr May 3 23:51:45 icinga snmptrapd[1284]: force output to stderr in nodaemonize even if stderr is not a TTY May 3 23:51:45 icinga snmptrapd[1284]: -R, --allow-to-run-as-root May 3 23:51:45 icinga snmptrapd[1284]: Allow pool to run as root (disabled by default) May 4 02:19:46 icinga journal[2712]: ool www: [TrapDirector] [Info]: Loggin started May 4 02:19:46 icinga journal[2712]: ool www: [TrapDirector] [Info]: Found database in config file: trapdbdb May 4 02:19:46 icinga journal[2712]: ool www: [TrapDirector] [Info]: DSN : mysql:dbname=trapdb;host=127.0.0.1;port=3306;user trap / prefix : traps May 4 02:19:46 icinga journal[2712]: ool www: [TrapDirector] [Debug]: No enabled plugins May 4 02:19:46 icinga journal[2712]: ool www: [TrapDirector] [Debug]: Registered plugin NetworkRule

/etc/snmp/snmptrapd.conf

Example configuration file for snmptrapd

#

No traps are handled by default, you must edit this file!

#

authCommunity log,execute,net public

traphandle SNMPv2-MIB::coldStart /usr/bin/bin/my_great_script cold

traphandle default /usr/sbin/php-fpm /usr/share/icingaweb2/modules/trapdirector/bin/trap_in.php authCommunity log,execute,net public

Your Environment:

  • trapdirector version: 1.0.4b
  • Icinga Web 2 version and modules: 2.7.3
  • Icinga 2 version (icinga2 --version): 2.11.3-1
  • Operating System and version: CentOS 8.1.1911
  • Webserver, PHP versions: HTTPD 2.4.37, PHP 7.2.11

Thanks!

patrickpr commented 4 years ago

Hi,

Thanks for the feedback.

/var/log/messages says that the problem is from php binary. Have a look at this issue : https://github.com/patrickpr/trapdirector/issues/30#issuecomment-613918030

mabfuss commented 4 years ago

Perfect. Thanks!