About docker container configuration
awer1967 opened this issue · 2 comments
Hi !
Wouldn't you mind to express how should I run container with the snmp notifier ?
I do it on that way (an usual configuration, no additional docker networks )
docker container run -p 9464:9464 -v /etc/snmp_notifier:/etc/snmp_notifier env_file=/etc/snmp_notifier/env_snmp.txt maxwo/snmp-notifier
where env_snmp.txt contains next strings
--web.listen-address=:9464
--snmp.version=V2c
--snmp.destination=another_host:162
--snmp.retries=1
--snmp.trap-oid-label="oid"
--snmp.trap-default-oid="1.3.6.1.4.1.98789.0.1"
--snmp.trap-description-template=/etc/snmp_notifier/description-template.tpl
--snmp.community="notpublicstring"
--alert.severity-label="severity"
When I run it I see next log
[root@my_host snmp_notifier]# docker run -v /etc/snmp_notifier:/etc/snmp_notifier -p 9464:9464 -p 162:162/udp --env-file /etc/snmp_notifier/env_snmp.txt maxwo/snmp-notifier
time="2020-05-20T12:26:01Z" level=info msg="Preparing to listen on: :9464" source="http_server.go:104"
my_host - - [20/May/2020:12:26:02 +0000] "POST /alerts HTTP/1.1" 200 0
my_host - - [20/May/2020:12:26:02 +0000] "POST /alerts HTTP/1.1" 200 0
my_host - - [20/May/2020:12:26:02 +0000] "POST /alerts HTTP/1.1" 200 0
my_host - - [20/May/2020:12:26:04 +0000] "POST /alerts HTTP/1.1" 200 0
my_host - - [20/May/2020:12:26:09 +0000] "POST /alerts HTTP/1.1" 200 0
So as you see I am able to receive webhooks from alertmanager
But I have no traps on another_host:162 at all.
What should I do to tune it, so that my container would be able to send traps ?
Meanwhile, it works fine from a command line . It gets webhooks and send traps with no issues.
Thanks for a really useful program. But it would be nice to add some info about docker container configuration.
Cheers
Andrii
Obviously that snmp_notifier doesn't pick up those flags/parameters as they're not specified in the ENTRYPOINT
It indeed misses the arguments when running the container.
You may use the @
syntax to provide configuration as a file:
docker run -p 9464:9464 -v /etc/snmp_notifier:/etc/snmp_notifier -v /etc/snmp_notifier/env_snmp.txt:/options.txt maxwo/snmp-notifier '@/options.txt'