Changeset 3253


Ignore:
Timestamp:
08/06/13 12:53:41 (11 years ago)
Author:
sanmai
Message:
  • Work on LDAP monitoring plugin.
  • Adapt check_lat_cql_endpoint.py to new command line argument processing code.
Location:
monitoring/plugins/mpi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • monitoring/plugins/mpi/check_clarin_ldap.py

    r3242 r3253  
    1414special_plugin_description = "LDAP directory"
    1515special_plugin_file_name = os.path.basename(__file__)
    16 
    1716command_line_parameters = [("-h", "host",),
    1817                                                   ("-b", "bind DN",)]
  • monitoring/plugins/mpi/check_lat_cql_endpoint.py

    r3242 r3253  
    99CQL_NAMESPACE = "http://www.loc.gov/zing/srw/"
    1010
     11command_line_parameters = [("-h", "host",),
     12                           ("-u", "URL",)]
     13
    1114# Warning: check of validity of returned data relies on the XML namespace CQL_NAMESPACE of the returned XML markup.
    1215
    13 def special_main_subroutine(host, url=None) :
    14 
    15     if url:
    16         UP_URLs = (url,) # X- use frozenset
    17        
    18     else:
    19         UP_URLs = ('/',) # X- use frozenset
     16def special_main_subroutine(host,
     17                            URL = '/') :
     18 
     19    psb.set_trace()
     20    UP_URLs = (URL,) # X- use frozenset
    2021
    2122    valid_root_element_tag = "{%s}explainResponse" % (CQL_NAMESPACE)
     
    3435
    3536if __name__ == "__main__" :
    36     generic_tla_monitoring.main(special_main_subroutine)
     37    generic_tla_monitoring.main(special_main_subroutine,
     38                                command_line_parameters = command_line_parameters)
  • monitoring/plugins/mpi/generic_tla_monitoring.py

    r3246 r3253  
    169169              '--bindDN', bindDN,
    170170              "--bindPasswordFile", '/root/LDAP_passwdfile',
    171               '(objectClass=CLARINPerson),
     171              '(objectClass=CLARINPerson)',
    172172              'isMemberOf']
    173173
    174174    # Run OpenDJ's "ldapsearch" command line utility
    175     pdb.set_trace()
     175    #pdb.set_trace()
    176176   
    177177    process = subprocess.Popen(command,
     
    181181    stdout, stderr = process.communicate()
    182182
    183     print stdout
    184     print stderr
    185 
    186     pdb.set_trace()
    187 
    188     if response :
     183    #print stdout
     184    #print stderr
     185
     186    #pdb.set_trace()
     187
     188    if process.returncode == 0 :
    189189        return {
    190190                "code"      : "OK",
     
    301301
    302302    try :
    303         opts = filter(None, getopt.getopt(sys.argv[1:], command_line_parameters_getopt_string))[0] # X- fix other plugins with -u option
     303        opts = filter(None, getopt.getopt(sys.argv[1:], command_line_parameters_getopt_string))[0]
    304304    except getopt.GetoptError, err :
    305305        usage(command_line_parameters_usage_string)
    306306    else :
    307307        if len(command_line_parameters) == len(opts) :
     308            ## main_subroutine_argument_values is based on the argument order of special_main_subroutine(). They are not mapped to the argument names!
     309            ## Therefore, command_line_parameters must be in the same order as special_main_subroutine()'s arguments.
    308310            main_subroutine_argument_values = [parameter_value for parameter_name, parameter_value in opts]
    309311            # pdb.set_trace()
Note: See TracChangeset for help on using the changeset viewer.