sonic-buildimage/dockers/docker-dhcp-relay/start.sh
Tamer Ahmed 1fd4a36371
[dhcp-relay]: Add DHCP Relay Monitor (#3886) (#4004)
* [dhcp-relay]: Add DHCP Relay Monitor (#3886)

DHCP relay MONitor (dhcpmon) keeps track of DORA messages. If DHCP Relay
is detected to be not forwarding DORA message, dhcpmon will log such event
to syslog. Under the hood dhcpmon keeps counts of clients DR messages,
forwarded DR messages, DHCP server OA messages, and forwarded OA messages.
dhcpmon will check every 12 sec (configurable) if counts are monotonically
increasing and record snapshot of those counters. dhcpmon will report
discrepancies when detected between current counters and snapshot counters.

pull-request: https://github.com/Azure/sonic-buildimage/pull/3886
signed-off-by: Tamer Ahmed <tamer.ahmed@microsoft.com>

* Eliminate dependency on libexplain

* Remove dependency on libexplain
2020-01-14 10:33:20 -08:00

28 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Remove stale rsyslog PID file if it exists
rm -f /var/run/rsyslogd.pid
# Start rsyslog
supervisorctl start rsyslogd
# If our supervisor config has entries in the "isc-dhcp-relay" group...
if [ $(supervisorctl status | grep -c "^isc-dhcp-relay:") -gt 0 ]; then
# Wait for all interfaces to come up and be assigned IPv4 addresses before
# starting the DHCP relay agent(s). If an interface the relay should listen
# on is down, the relay agent will not start. If an interface the relay
# should listen on is up but does not have an IP address assigned when the
# relay agent starts, it will not listen or send on that interface for the
# lifetime of the process.
/usr/bin/wait_for_intf.sh
# Start all DHCP relay agent(s)
supervisorctl start isc-dhcp-relay:*
fi
# If our supervisor config has entries in the "dhcpmon" group...
if [ $(supervisorctl status | grep -c "^dhcpmon:") -gt 0 ]; then
# Start all DHCP Monitor daemon(s)
supervisorctl start dhcpmon:*
fi