- Timestamp:
- 03/21/13 15:32:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/parse_ganglia.py
r696 r697 133 133 134 134 #print 'keep: %s' %t 135 self.conf_lijst.append( t)135 self.conf_lijst.append( self.removeQuotes(t) ) 136 136 137 137 def getConfLijst( self ): … … 190 190 return (new_dict, count) 191 191 192 def getConfDict( self ):193 194 return self.conf_dict195 192 196 193 def makeConfDict( self ): … … 248 245 #print 'leaving makeConfDict(): conf dict size %d' %len( self.conf_dict ) 249 246 247 def checkConfDict( self ): 248 249 if len( self.conf_lijst ) == 0: 250 251 raise Exception("Something went wrong generating conf list for %s" %self.file_name ) 252 253 if len( self.conf_dict ) == 0: 254 255 self.makeConfDict() 256 257 def getConfDict( self ): 258 259 self.checkConfDict() 260 return self.conf_dict 261 262 def getUdpSendChannels( self ): 263 264 self.checkConfDict() 265 return self.conf_dict[ 'udp_send_channel' ] 266 267 def getSectionLastOption( self, section, option ): 268 269 """ 270 Get last option set in a config section that could be set multiple times in multiple (include) files. 271 272 i.e.: getSectionLastOption( 'globals', 'send_metadata_interval' ) 273 """ 274 275 self.checkConfDict() 276 value = None 277 278 if not self.conf_dict.has_key( section ): 279 280 return None 281 282 # Could be set multiple times in multiple (include) files: get last one set 283 for c in self.conf_dict[ section ]: 284 285 if c.has_key( option ): 286 287 cluster_name = c[ option ][0] 288 289 return cluster_name 290 291 def getClusterName( self ): 292 293 return self.getSectionLastOption( 'cluster', 'name' ) 294 250 295 GMOND_LOCATION = '/etc/ganglia/gmond.conf' 251 296 … … 257 302 258 303 pprint.pprint( g.getConfDict(), width=1 ) 304 305 print g.getClusterName() 306 print g.getUdpSendChannels() 259 307 260 308 print 'exiting..'
Note: See TracChangeset
for help on using the changeset viewer.