mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-08-15 03:02:32 +02:00
Added support for DNS resolving for SNMP traps image
This commit is contained in:
@ -6,6 +6,8 @@ ZBX_SNMP_TRAP_DATE_FORMAT=${ZBX_SNMP_TRAP_DATE_FORMAT:-"+%Y%m%d.%H%M%S"}
|
||||
|
||||
ZBX_SNMP_TRAP_FORMAT=${ZBX_SNMP_TRAP_FORMAT:-"\n"}
|
||||
|
||||
ZBX_SNMP_TRAP_USE_DNS=${ZBX_SNMP_TRAP_USE_DNS:-"false"}
|
||||
|
||||
date=$(date "$ZBX_SNMP_TRAP_DATE_FORMAT")
|
||||
|
||||
# The name of the host that sent the notification, as determined by gethostbyaddr(3).
|
||||
@ -40,4 +42,6 @@ done
|
||||
|
||||
! [ -z $trap_address ] && sender_addr=$trap_address
|
||||
|
||||
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
||||
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
||||
|
||||
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
||||
|
Reference in New Issue
Block a user