Changeset 215 for trunk/jobmond


Ignore:
Timestamp:
03/01/06 16:18:37 (18 years ago)
Author:
bastiaans
Message:

jobmond/jobmond.conf:

  • added BATCH_HOST_TRANSLATE

jobmond/jobmond.py:

  • added translation of batch hostnames to ganglia hostnames
Location:
trunk/jobmond
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/jobmond/jobmond.conf

    r212 r215  
    66GMOND_CONF              : /etc/gmond.conf
    77DETECT_TIME_DIFFS       : 1
     8BATCH_HOST_TRANSLATE    : /gb2/gb/, /ib/gb/
  • trunk/jobmond/jobmond.py

    r212 r215  
    3333def loadConfig( filename ):
    3434
     35        def getlist( cfg_string ):
     36
     37                my_list = [ ]
     38
     39                for item_txt in cfg_string.split( ',' ):
     40
     41                        sep_char = None
     42
     43                        item_txt = item_txt.strip()
     44
     45                        for s_char in [ "'", '"' ]:
     46
     47                                if item_txt.find( s_char ) != -1:
     48
     49                                        if item_txt.count( s_char ) != 2:
     50
     51                                                print 'Missing quote: %s' %item_txt
     52                                                sys.exit( 1 )
     53
     54                                        else:
     55
     56                                                sep_char = s_char
     57                                                break
     58
     59                        if sep_char:
     60
     61                                item_txt = item_txt.split( sep_char )[1]
     62
     63                        my_list.append( item_txt )
     64
     65                return my_list
     66
    3567        cfg = ConfigParser.ConfigParser()
    3668
    3769        cfg.read( filename )
    3870
    39         global DEBUG_LEVEL, DAEMONIZE, TORQUE_SERVER, TORQUE_POLL_INTERVAL, GMOND_CONF, DETECT_TIME_DIFFS
    40 
     71        global DEBUG_LEVEL, DAEMONIZE, TORQUE_SERVER, TORQUE_POLL_INTERVAL, GMOND_CONF, DETECT_TIME_DIFFS, BATCH_HOST_TRANSLATE
    4172
    4273        # Specify debugging level here;
     
    74105        DETECT_TIME_DIFFS = cfg.getboolean( 'DEFAULT', 'DETECT_TIME_DIFFS' )
    75106
     107        # Regexp style hostname translation
     108        #
     109        # Usefull if your Torque hostnames are not the same as your
     110        # Ganglia hostnames (different network interfaces)
     111        #
     112        # Syntax: /orig/new/
     113        #
     114        BATCH_HOST_TRANSLATE = getlist( cfg.get( 'DEFAULT', 'BATCH_HOST_TRANSLATE' ) )
     115
    76116        return True
    77117
    78118from PBSQuery import PBSQuery
    79119
    80 import time, os, socket, string
     120import time, os, socket, string, re
    81121
    82122class DataProcessor:
     
    265305
    266306                                        if nodeslist.count( host ) == 0:
     307
     308                                                for translate_pattern in BATCH_HOST_TRANSLATE:
     309
     310                                                        translate_orig = translate_pattern.split( '/' )[1]
     311                                                        translate_new = translate_pattern.split( '/' )[2]
     312
     313                                                        host = re.sub( translate_orig, translate_new, host )
     314                                       
    267315                                                nodeslist.append( host )
    268316
Note: See TracChangeset for help on using the changeset viewer.