monitoringartist / dockbix-xxl

:whale: Dockerized Zabbix - server, web, proxy, java gateway, snmpd with additional extensions
https://hub.docker.com/u/monitoringartist/
GNU General Public License v2.0
377 stars 136 forks source link

SNMPTT not working #99

Closed hd1080 closed 6 years ago

hd1080 commented 7 years ago

Description

[SNMPTT is not working]

Steps to Reproduce

  1. [create host with SNMP interface]
  2. [check logs and see error message from SNMPTT]

Expected behavior: [that it works]

Actual behavior: [doesn't work, error message in logs]

Reproduces how often: [several times]

Versions

Server Version: 17.09.0-ce Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 89 Dirperm1 Supported: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0 runc version: 3f2f8b84a77f73d38244dd690525642a72156c64 init version: 949e6fa Security Options: apparmor seccomp Profile: default Kernel Version: 4.4.0-93-generic Operating System: Ubuntu 16.04.3 LTS OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 2.938GiB

Additional Information

log output:

2017-11-05 11:32:56,370 DEBG 'snmptrapd' stdout output:
********** SNMPTT v1.4beta2 started: Sun Nov  5 11:32:56 2017 **********

Could not load the Perl module SNMP!  If net_snmp_perl_enable is
enabled then the SNMP module is required.  Please see snmptt.html
for system requirements.  Note:  SNMPTT uses the Net-SNMP package's
SNMP module, NOT the CPAN Net::SNMP module!

2017-11-05 11:32:59,187 DEBG 'snmptrapd' stderr output:
Can't locate SNMP.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 12) line 1.

2017-11-05 11:32:59,187 DEBG 'snmptrapd' stderr output:
died at /usr/sbin/snmptt line 426.

You Docker knowledge level

Normal

jangaraj commented 6 years ago

Thank you. I can replicate this problem. I'll try to find a problem later.

hd1080 commented 6 years ago

Any update when this problem might be resolved? Would love to use dockbix but I need SNMP to work.

jangaraj commented 6 years ago

I didn't spend a lot of o time on this issue for now. It looks like a problem with Perl configuration. I'm happy to review any PR, which will solve this problem.

carlosarmentac commented 6 years ago

I found the error, and I fixed followind the next steps (using the latest):

  1. yum install net-snmp-perl -y
  2. Add those ENV Variables: 2.1 ZS_StartSNMPTrapper=1 2.2 ZS_SNMPTrapperFile=/tmp/zabbix_traps.tmp

Example of adding the ENV Vars: --env="ZS_StartSNMPTrapper=1" --env="ZS_SNMPTrapperFile=/tmp/zabbix_traps.tmp"

Disclaimer: This is a temporary solution, if you recreate the container, do you will need to follow the same process. The best is make a PR. I'm working on.

jangaraj commented 6 years ago

Thank you Carlos, for your input. Actually, I was removing some dependency of net-snmp-perl, which caused a problem. Now it's fixed, images have been rebuilt.

Test:

$ docker run \
    -d \
    --name dockbix \
    -p 80:80 \
    -p 10051:10051 \
    -v /etc/localtime:/etc/localtime:ro \
    --link dockbix-db:dockbix.db \
    --env="ZS_DBHost=dockbix.db" \
    --env="ZS_DBUser=zabbix" \
    --env="ZS_DBPassword=my_password" \
    --env="XXL_zapix=true" \
    --env="XXL_grapher=true" \
    --env="ZS_StartSNMPTrapper=1" \
    --env="SNMPTRAP_enabled=true" \
    monitoringartist/dockbix-xxl:latest
$ docker exec -ti dockbix cat /tmp/zabbix_traps.tmp
$ docker exec -ti dockbix snmptrap -c public -v 2c 127.0.0.1 "" 1.3.6.1.2.1.43.18.2.0.1
$ docker exec -ti dockbix cat /tmp/zabbix_traps.tmp
10:51:30 2018/02/02 mib-2.43.18.2.0.1 Normal "General event" 127.0.0.1 - ZBXTRAP 127.0.0.1 127.0.0.1
hd1080 commented 6 years ago

Thank you a lot. SNMP is working now 👍