Ignore:
Timestamp:
01/29/15 18:53:48 (9 years ago)
Author:
sdipsl
Message:

Send metrics results to a central place

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh

    r1153 r1162  
    175175    rm -f ${buffer}                                                    # cleaning behind us 
    176176    rm -f ${last_mail_date__file}                                      # cleaning behind us 
     177  fi 
     178 
     179  # Allways all good for now. 
     180  return 0 
     181} 
     182 
     183#D-#================================================================== 
     184#D-function IGCM_debug_sendAMQP_Metrics 
     185#D- * Purpose: Take over AMQP C client using mail as a message recipient 
     186#D- * One argument : Directory where metrics.json files can be found 
     187#D- * Attach encoded metrics.json files. 
     188 
     189function IGCM_debug_sendAMQP_Metrics { 
     190 
     191  typeset mail_recipient encodedBody 
     192  if [ X${ActivateBigBro} = Xtrue ] ; then 
     193    mail_recipient="superviseur@ipsl.jussieu.fr" 
     194    # Metrics tag on server side 
     195    code=7100 
     196    # Usual AMQP message to route messages on server side 
     197    encodedBody=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" |  base64 -w 0 ) 
     198    # send mail 
     199    attachmentsOptions="" 
     200    for metricsFile in $( ls $1/*json ) ; do 
     201      attachmentsOptions="-a ${metricsFile} ${attachmentsOptions}" 
     202    done 
     203    echo ${encodedBody}|mailx -s "[TEMPORARY AMQP CHANNEL]" ${attachmentsOptions} ${mail_recipient} 
    177204  fi 
    178205 
Note: See TracChangeset for help on using the changeset viewer.