r16856 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r16855‎ | r16856 | r16857 >
Date:12:42, 8 October 2006
Author:tstarling
Status:old
Tags:
Comment:
Set multicast TTL.
Modified paths:
  • /trunk/ganglia_metrics/gmetricd.py (modified) (history)

Diff [purge]

Index: trunk/ganglia_metrics/gmetricd.py
@@ -107,8 +107,10 @@
108108 gmondFile = open(conf['gmondConf'])
109109 addrRegex = re.compile(r"^\s*mcast_join\s*=\s*([0-9.:]+)")
110110 portRegex = re.compile(r"^\s*port\s*=\s*([0-9]+)")
 111+ttlRegex = re.compile(r"^\s*ttl\s*=\s*([0-9]+)")
111112 addr = None
112113 port = None
 114+ttl = 1
113115 for line in gmondFile:
114116 m = addrRegex.match(line)
115117 if m != None:
@@ -118,6 +120,13 @@
119121 m = portRegex.match(line)
120122 if m != None:
121123 port = m.group(1)
 124+ continue
 125+
 126+ m = ttlRegex.match(line)
 127+ if m != None:
 128+ ttl = m.group(1)
 129+ continue
 130+
122131 gmondFile.close()
123132
124133 if addr == None or port == None:
@@ -136,6 +145,7 @@
137146
138147 # Create a socket for metric transmission
139148 transmitSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 149+transmitSocket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, int(ttl))
140150 transmitAddress = (addr, int(port))
141151
142152 # Create unix socket for volatile push metrics (e.g. HTTP request time)