949bdee24e
When BGP routes are missing, DHCP packets get relayed over mgmt interface. This results in dhcpmon alerting that DHCP packets are not being relayed. This is PR include mgmt interface as uplink device, and so, if DHCP packet gets relayed over mgmt interface, regular dhcpmon alert will not be issues. Instead, dhcpmon will check the mgmt interface counts and issue a separate alert regarding packets travelling through mgmt network. In addition, this PR includes the following enhancements: 1. Add SIGUSR1 handler that prints out current packet counts 2. Increase alert grace window to 3 minutes from currently 2 minutes 3. Time is now computed more accurately 4. Print vlan name before counters signed-off-by: Tamer Ahmed <tamer.ahmed@microsoft.com>
126 lines
3.7 KiB
Django/Jinja
126 lines
3.7 KiB
Django/Jinja
[supervisord]
|
|
logfile_maxbytes=1MB
|
|
logfile_backups=2
|
|
nodaemon=true
|
|
|
|
[program:start.sh]
|
|
command=/usr/bin/start.sh
|
|
priority=1
|
|
autostart=true
|
|
autorestart=false
|
|
stdout_logfile=syslog
|
|
stderr_logfile=syslog
|
|
|
|
[program:rsyslogd]
|
|
command=/usr/sbin/rsyslogd -n
|
|
priority=2
|
|
autostart=false
|
|
autorestart=false
|
|
stdout_logfile=syslog
|
|
stderr_logfile=syslog
|
|
|
|
{# If our configuration has VLANs... #}
|
|
{% if VLAN %}
|
|
{# Count how many VLANs require a DHCP relay agent... #}
|
|
{% set num_relays = { 'count': 0 } %}
|
|
{% for vlan_name in VLAN %}
|
|
{% if VLAN[vlan_name]['dhcp_servers'] %}
|
|
{% set _dummy = num_relays.update({'count': num_relays.count + 1}) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{# If one or more of the VLANs require a DHCP relay agent... #}
|
|
{% if num_relays.count > 0 %}
|
|
[group:isc-dhcp-relay]
|
|
programs=
|
|
{%- set add_preceding_comma = { 'flag': False } %}
|
|
{% for vlan_name in VLAN %}
|
|
{% if VLAN[vlan_name]['dhcp_servers'] %}
|
|
{% if add_preceding_comma.flag %},{% endif %}
|
|
{% set _dummy = add_preceding_comma.update({'flag': True}) %}
|
|
isc-dhcp-relay-{{ vlan_name }}
|
|
{%- endif %}
|
|
{% endfor %}
|
|
|
|
|
|
{# Create a program entry for each DHCP relay agent instance #}
|
|
{% for vlan_name in VLAN %}
|
|
{% if VLAN[vlan_name]['dhcp_servers'] %}
|
|
[program:isc-dhcp-relay-{{ vlan_name }}]
|
|
{# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #}
|
|
command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id {{ vlan_name }}
|
|
{#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #}
|
|
{% for (name, prefix) in VLAN_INTERFACE %}
|
|
{% if prefix | ipv4 and name != vlan_name %} -iu {{ name }}{% endif -%}
|
|
{% endfor %}
|
|
{% for (name, prefix) in INTERFACE %}
|
|
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
|
|
{% endfor %}
|
|
{% for (name, prefix) in PORTCHANNEL_INTERFACE %}
|
|
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
|
|
{% endfor %}
|
|
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} {{ dhcp_server }}{% endfor %}
|
|
|
|
priority=3
|
|
autostart=false
|
|
autorestart=false
|
|
stdout_logfile=syslog
|
|
stderr_logfile=syslog
|
|
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
[group:dhcpmon]
|
|
programs=
|
|
{%- set add_preceding_comma = { 'flag': False } %}
|
|
{% for vlan_name in VLAN %}
|
|
{% if VLAN[vlan_name]['dhcp_servers'] %}
|
|
{% if add_preceding_comma.flag %},{% endif %}
|
|
{% set _dummy = add_preceding_comma.update({'flag': True}) %}
|
|
dhcpmon-{{ vlan_name }}
|
|
{%- endif %}
|
|
{% endfor %}
|
|
|
|
|
|
{# Create a program entry for each DHCP MONitor instance #}
|
|
{% set relay_for_ipv4 = { 'flag': False } %}
|
|
{% for vlan_name in VLAN %}
|
|
{% if VLAN[vlan_name]['dhcp_servers'] %}
|
|
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %}
|
|
{% if dhcp_server | ipv4 %}
|
|
{% set _dummy = relay_for_ipv4.update({'flag': True}) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if relay_for_ipv4.flag %}
|
|
{% set _dummy = relay_for_ipv4.update({'flag': False}) %}
|
|
[program:dhcpmon-{{ vlan_name }}]
|
|
{# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #}
|
|
command=/usr/sbin/dhcpmon -id {{ vlan_name }}
|
|
{#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #}
|
|
{% for (name, prefix) in VLAN_INTERFACE %}
|
|
{% if prefix | ipv4 and name != vlan_name %} -iu {{ name }}{% endif -%}
|
|
{% endfor %}
|
|
{% for (name, prefix) in INTERFACE %}
|
|
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
|
|
{% endfor %}
|
|
{% for (name, prefix) in PORTCHANNEL_INTERFACE %}
|
|
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
|
|
{% endfor %}
|
|
{% if MGMT_INTERFACE %}
|
|
{% for (name, prefix) in MGMT_INTERFACE %}
|
|
{% if prefix | ipv4 %} -im {{ name }}{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
priority=4
|
|
autostart=false
|
|
autorestart=false
|
|
stdout_logfile=syslog
|
|
stderr_logfile=syslog
|
|
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
{% endif %}
|