Author: ckauhaus
Date: Mon Dec 1 11:45:54 2008
New Revision: 7108
Log:
Corrected rule deletion bug: there were no interface ids in the rules, hence
rule deleteion did never take place.
Modified:
gocept.infrastructure/feature_monitoring_66066/puppet/modules/net_analyzer/files/nagios/globals/templates.cfg
gocept.infrastructure/feature_monitoring_66066/puppet/modules/sys_apps/files/conf.d_net
gocept.infrastructure/feature_monitoring_66066/puppet/modules/sys_apps/templates/conf.d_net.erb
Modified:
gocept.infrastructure/feature_monitoring_66066/puppet/modules/net_analyzer/files/nagios/globals/templates.cfg
==============================================================================
---
gocept.infrastructure/feature_monitoring_66066/puppet/modules/net_analyzer/files/nagios/globals/templates.cfg (original)
+++
gocept.infrastructure/feature_monitoring_66066/puppet/modules/net_analyzer/files/nagios/globals/templates.cfg Mon
Dec 1 11:45:54 2008
(at)(at) -44,7 +44,7 (at)(at)
normal_check_interval 10
retry_check_interval 2
notification_options w,u,c,r,f,s
- notification_interval 60
+ notification_interval 120
notification_period 24x7
}
Modified:
gocept.infrastructure/feature_monitoring_66066/puppet/modules/sys_apps/files/conf.d_net
==============================================================================
---
gocept.infrastructure/feature_monitoring_66066/puppet/modules/sys_apps/files/conf.d_net (original)
+++
gocept.infrastructure/feature_monitoring_66066/puppet/modules/sys_apps/files/conf.d_net Mon
Dec 1 11:45:54 2008
(at)(at) -13,56 +13,53 (at)(at)
# taken from net.example
depend() {
- functions interface_exists
+ functions interface_exists
}
postup() {
- # Here is an example that allows the use of iproute rules
- # which have been configured using the rules_eth0 variable.
- #rules_eth0=(
- # "from 24.80.102.112/32 to 192.168.1.0/24 table localnet
priority 100"
- # "from 216.113.223.51/32 to 192.168.1.0/24 table localnet
priority 100"
- #)
- local x="rules_${IFVAR}[(at)]"
- local -a rules=( "${!x}" )
- if [[ -n ${rules} ]] ; then
- einfo "Adding IP policy routing rules"
- eindent
- # Ensure that the kernel supports policy routing
- if ! ip rule list | grep -q "^" ; then
- eerror "You need to enable IP Policy Routing
(CONFIG_IP_MULTIPLE_TABLES)"
- eerror "in your kernel to use ip rules"
- else
- for x in "${rules[(at)]}" ; do
- ebegin "${x}"
- ip rule add ${x}
- eend $?
- done
- fi
- eoutdent
- # Flush the cache
- ip route flush cache dev "${IFACE}"
- fi
-
+ # Here is an example that allows the use of iproute rules
+ # which have been configured using the rules_eth0 variable.
+ #rules_eth0=(
+ # "from 24.80.102.112/32 to 192.168.1.0/24 table localnet
priority 100"
+ #)
+ local x="rules_${IFVAR}[(at)]"
+ local -a rules=( "${!x}" )
+ if [[ -n ${rules} ]] ; then
+ einfo "Adding IP policy routing rules"
+ eindent
+ # Ensure that the kernel supports policy routing
+ if ! ip rule list | grep -q "^" ; then
+ eerror "You need to enable IP Policy Routing
(CONFIG_IP_MULTIPLE_TABLES)"
+ eerror "in your kernel to use ip rules"
+ else
+ for x in "${rules[(at)]}" ; do
+ ebegin "${x}"
+ ip rule add dev ${IFACE} ${x}
+ eend $?
+ done
+ fi
+ eoutdent
+ # Flush the cache
+ ip route flush cache dev "${IFACE}"
+ fi
+ return 0
}
postdown() {
- # Automatically erase any ip rules created in the example postup above
- if interface_exists "${IFACE}" ; then
- # Remove any rules for this interface
- local rule
- ip rule list | grep " iif ${IFACE}[ ]*" | {
- while read rule ; do
- rule="${rule#*:}"
- ip rule del ${rule}
- done
- }
- # Flush the route cache
- ip route flush cache dev "${IFACE}"
- fi
-
- # Return 0 always
- return 0
+ # Automatically erase any ip rules created in the example postup above
+ if interface_exists "${IFACE}" ; then
+ # Remove any rules for this interface
+ local rule
+ ip rule list | grep " iif ${IFACE}[ ]*" | {
+ while read rule ; do
+ rule="${rule#*:}"
+ ip rule del ${rule}
+ done
+ }
+ # Flush the route cache
+ ip route flush cache dev "${IFACE}"
+ fi
+ return 0
}
# vim: set ft=sh:
Modified:
gocept.infrastructure/feature_monitoring_66066/puppet/modules/sys_apps/templates/conf.d_net.erb
==============================================================================
---
gocept.infrastructure/feature_monitoring_66066/puppet/modules/sys_apps/templates/conf.d_net.erb (original)
+++
gocept.infrastructure/feature_monitoring_66066/puppet/modules/sys_apps/templates/conf.d_net.erb Mon
Dec 1 11:45:54 2008
(at)(at) -1,25 +1,25 (at)(at)
# Managed by Puppet: do not edit this file directly. It will be overwritten!
<%
- require 'ipaddr'
- # We assume that the default gateway is the first address in a IP net.
- def default_gateway(network)
- gateway_override = scope.lookupvar('location::ip4_gw_'+iface)
- if not gateway_override.blank? then
- return gateway_override
- else
- return (IPAddr.new(network) | 1)
- end
+require 'ipaddr'
+# We assume that the default gateway is the first address in a IP net.
+def default_gateway(network)
+ gateway_override = scope.lookupvar('location::ip4_gw_'+iface)
+ if not gateway_override.blank? then
+ return gateway_override
+ else
+ return (IPAddr.new(network) | 1)
end
+end
- if bridged
- net_device = "br#{iface}"
+if bridged
+ net_device = "br#{iface}"
-%>
config_eth<%= iface %>=( "null" )
bridge_br<%= iface %>="eth<%= iface %>"
<%
- else
- net_device = "eth#{iface}"
- end
+else
+ net_device = "eth#{iface}"
+end
-%>
<% if not ip4.blank? %>
|