Closed thej4ck closed 4 years ago
the default v5 documentation speaks about another format of traps. thats why i'm opening thi issue.
maybe you do not have snmp trapper process in server container?
it's on, i followed all guides
bash-5.0$ ps axf | grep snmp 163 zabbix 0:00 /usr/sbin/zabbix_server: snmp trapper [processed data in 0.000032 sec, idle 1 sec] 205 zabbix 0:00 grep snmp
please show an example of received snmptrap from the log file.
bash-5.0$ cat /var/lib/zabbix/snmptraps/snmptraps.log
20200603.144409 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.144417 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.144425 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 HOST10.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.144428 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 HOST10.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.150000 ZBXTRAP 172.21.0.92 SNMPv2-MIB::authenticationFailure 0 (null) SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232.9.4.10
20200603.150000 ZBXTRAP 172.21.0.92 SNMPv2-MIB::authenticationFailure 0 (null) SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232.9.4.10
20200603.150409 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.150758 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.153838 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.153847 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.153850 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.153857 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.153910 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.154222 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.154224 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.154224 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.154225 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.154225 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.154225 ZBXTRAP 172.21.0.92 6 11003 (null) SNMPv2-MIB::sysName.0 ILOCZ232903MS.scao.locale SNMPv2-SMI::enterprises.232.11.2.11.1.0 4 SNMPv2-SMI::enterprises.232.11.2.8.1.0 Remote Insight Test Trap SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232
20200603.155958 ZBXTRAP 172.21.0.92 SNMPv2-MIB::authenticationFailure 0 (null) SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232.9.4.10
20200603.155958 ZBXTRAP 172.21.0.92 SNMPv2-MIB::authenticationFailure 0 (null) SNMP-COMMUNITY-MIB::snmpTrapAddress.0 172.21.0.92 SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 public SNMPv2-MIB::snmpTrapEnterprise.0 SNMPv2-SMI::enterprises.232.9.4.10
looks good. how did you configured snmp trap item?
i've default snmptrap item
screenshot?
it's the default from snmpv2 template
does zabbix log traps recieved, even there is not a configurated item related?
i've done something wrong?
Everything looks fine. Please check zabbix server log for any errors
it's default docker image i'm checking in the console output, because there is no log file, bot nothing signalled. That is why i'm opening the issue
Try to increase level of debug for SNMP trapper:
zabbix_server -R log_level_increase="snmp trapper"
() title:'snmp trapper [processed data in 0.019311 sec, idle 1 sec]'
163:20200604:064601.447 zbx_setproctitle() title:'snmp trapper [processing data]' 163:20200604:064601.447 In DCconfig_get_snmp_interfaceids_by_addr() addr:'172.21.0.92' 163:20200604:064601.447 End of DCconfig_get_snmp_interfaceids_by_addr():1 163:20200604:064601.447 In DCconfig_get_snmp_items_by_interfaceid() interfaceid:3 163:20200604:064601.447 End of DCconfig_get_snmp_items_by_interfaceid():1 163:20200604:064601.447 In substitute_key_macros_impl() data:'snmptrap.fallback' 163:20200604:064601.447 End of substitute_key_macros_impl():SUCCEED data:'snmptrap.fallback' 163:20200604:064601.447 In calc_timestamp() 163:20200604:064601.447 calc_timestamp() 20:00:04 09/01/0645 163:20200604:064601.447 End of calc_timestamp() timestamp:0 163:20200604:064601.447 In zbx_preprocess_item_value() 163:20200604:064601.447 End of zbx_preprocess_item_value() 163:20200604:064601.447 In zbx_ipc_socket_write() 163:20200604:064601.447 End of zbx_ipc_socket_write():SUCCEED 163:20200604:064601.447 zbx_setproctitle() title:'snmp trapper [processed data in 0.000418 sec, idle 1 sec]' 163:20200604:064602.447 zbx_setproctitle() title:'snmp trapper [processing data]' 163:20200604:064602.447 zbx_setproctitle() title:'snmp trapper [processed data in 0.000051 sec, idle 1 sec]' 163:20200604:064603.447 zbx_setproctitle() title:'snmp trapper [processing data]' 163:20200604:064603.447 zbx_setproctitle() title:'snmp trapper [processed data in 0.000054 sec, idle 1 sec]'
timestamp parsing issue?
just curious did you have to something special for /var/lib/zabbix/snmptraps/snmptraps.log to be created ? coz i keep getting Cannot open log file '/var/tmp/snmptrapfmt.trc' [File exists] and when i connect to snmp trap docker and vi that file i see this in that file
20200604.160151 (snmptrapfmt-7): Cannot append to logfile '/var/lib/zabbix/snmptraps/snmptraps.log' [Permission denied]
Ok, @narenmakwana your problem is about mount permissions. I've got the same problem. Notice that the snmptraps dir is root:root and not zabbix:root, so you cannot write on it. I changed the compose using a volume (on both server and snmptraps containers) and not a bind.
volumes:
After that, the service can write and zabbix scan read. But the problem in this issue comes after yours.
ok let me figure out how to do what you did (i m not expert with docker yet :) ) . in mean time i was curious how does one define snmp community to something else other then public ?
Use Macro for community.
sorry for lack of my understanding but i thought /etc/snmp/snmptrapd.conf has authCommunity log,execute,net public disableAuthorization yes traphandle default /usr/sbin/snmptrapfmthdlr
Also i dont want to use public so dont i need to edit snmp.onf file too ?
well i m using volumes and i m using compose yml which is on zabbix git hub https://github.com/zabbix/zabbix-docker/blob/5.0/docker-compose_v3_alpine_mysql_latest.yaml
I tried changing volumes from ro to rw and even removed ro but no luck :(
you have to change the two lines (in zabbix-server and in snmptrap)
in
i think thats what i did.
version: '3.5' services: zabbix-server: image: zabbix/zabbix-server-mysql:alpine-5.0-latest ports:
and
zabbix-snmptraps: image: zabbix/zabbix-snmptraps:alpine-5.0-latest ports:
sorry for my confusion but are you saying replace ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps WITH nmptraps:var/lib/zabbix/snmptraps ?
_sorry for my confusion but are you saying replace ./zbxenv/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps WITH snmptraps:var/lib/zabbix/snmptraps ?
yes
ok i think i suck at this :) so i tried as you said and got this error.
ERROR: Named volume "snmptraps:/var/lib/zabbix/snmptraps:rw" is used in service "zabbix-snmptraps" but no declaration was found in the volumes section.
so then added this at 2 places.
./zbx_env/snmptraps:/var/lib/zabbix/snmptraps
started everything but still same error.
timestamp parsing issue?
@dotneft it's a problem about timestamp parsing?
ok so i m not even getting TEXT format of snmp traps. in snmptrap.log i do see entries.
i may be wrong it might be something to do with community string.
let me know if u discover something
sure
any luck on fixing this ?
Please do something like this:
diff --git a/docker-compose_v3_alpine_mysql_latest.yaml b/docker-compose_v3_alpine_mysql_latest.yaml
index b767e44..c4a933b 100644
--- a/docker-compose_v3_alpine_mysql_latest.yaml
+++ b/docker-compose_v3_alpine_mysql_latest.yaml
@@ -14,7 +14,7 @@ services:
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- - ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro
+ - snmptraps:/var/lib/zabbix/snmptraps:rw
links:
- mysql-server:mysql-server
- zabbix-java-gateway:zabbix-java-gateway
@@ -80,7 +80,7 @@ services:
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- - ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro
+ - snmptraps:/var/lib/zabbix/snmptraps:rw
links:
- zabbix-server:zabbix-server
- zabbix-java-gateway:zabbix-java-gateway
@@ -130,7 +130,7 @@ services:
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- - ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro
+ - snmptraps:/var/lib/zabbix/snmptraps:rw
links:
- zabbix-server:zabbix-server
- zabbix-java-gateway:zabbix-java-gateway
@@ -361,7 +361,7 @@ services:
ports:
- "162:1162/udp"
volumes:
- - ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:rw
+ - snmptraps:/var/lib/zabbix/snmptraps
deploy:
resources:
limits:
@@ -446,6 +446,9 @@ networks:
config:
- subnet: 172.16.239.0/24
+volumes:
+ snmptraps:
+
secrets:
MYSQL_USER:
file: ./.MYSQL_USER
The issue will be fixed soon!
Fixed! Update compose files.
is this LOGFMT correct for zabbix? "$x ZBXTRAP $R $G $S $e $*\"/' \
this is the default used in dockerfile in 5.0 i use latest docker compose file. it all works, but not snmptraps. snmptraps.log is correctly populated when trap is recieved but it's not consumed by zabbix server. Zabbix container does correctly acces the shared volume on /var/lib/zabbix/snmptraps (RO from server, RW from snmptrap). I cannot no log in zabbix-server. is default config bugged?