Index: trunk/ganglia_metrics/gmetricd.py |
— | — | @@ -107,8 +107,10 @@ |
108 | 108 | gmondFile = open(conf['gmondConf']) |
109 | 109 | addrRegex = re.compile(r"^\s*mcast_join\s*=\s*([0-9.:]+)") |
110 | 110 | portRegex = re.compile(r"^\s*port\s*=\s*([0-9]+)") |
| 111 | +ttlRegex = re.compile(r"^\s*ttl\s*=\s*([0-9]+)") |
111 | 112 | addr = None |
112 | 113 | port = None |
| 114 | +ttl = 1 |
113 | 115 | for line in gmondFile: |
114 | 116 | m = addrRegex.match(line) |
115 | 117 | if m != None: |
— | — | @@ -118,6 +120,13 @@ |
119 | 121 | m = portRegex.match(line) |
120 | 122 | if m != None: |
121 | 123 | port = m.group(1) |
| 124 | + continue |
| 125 | + |
| 126 | + m = ttlRegex.match(line) |
| 127 | + if m != None: |
| 128 | + ttl = m.group(1) |
| 129 | + continue |
| 130 | + |
122 | 131 | gmondFile.close() |
123 | 132 | |
124 | 133 | if addr == None or port == None: |
— | — | @@ -136,6 +145,7 @@ |
137 | 146 | |
138 | 147 | # Create a socket for metric transmission |
139 | 148 | transmitSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
| 149 | +transmitSocket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, int(ttl)) |
140 | 150 | transmitAddress = (addr, int(port)) |
141 | 151 | |
142 | 152 | # Create unix socket for volatile push metrics (e.g. HTTP request time) |