Cfengine: Testing ssh connectivity to the CE

From GridPP Wiki
Jump to: navigation, search

One of the common causes of the infamous maradona failure, is a node that is unable to transfer job information back to the ce, this cfengine snippet tests the node can ssh to the ce and alerts if not.

######################################################################
#
# Configuration file for Testing ssh into the ce
# cf.ce-ssh-test
#
######################################################################
control:
   ssh_to_ce01_test = ( ExecResult("/usr/bin/su - NONROOTUSER -c ${quote}/usr/bin/ssh CEHOSTNAME /bin/hostname${quote}") )
   
classes:
   ssh_to_ce01 = ( Regcmp(".*CEHOSTNAME.*",${ssh_to_ce01_test} ) )
   
alerts:
   !ssh_to_ce01::
        "Unable to ssh to CEHOSTNAME! Error was :- $(ssh_to_ce01_test)"
   

Hope this helps someone.