cpanel

code - script - general - funcion - f08_requestweb.f - Chequeo carga servidor web apache con Apache Bench - Tupla de rendimiento

  1. #!/usr/bin/bash
  2. #-------------------------------------------------------------------
  3. # Funciones Entornos Unix - Brqx Site - Brqx Org
  4. # Brqx Org - Rct - 2010
  5. #-------------------------------------------------------------------
  6. VERSION_SCRIPT="V 1.0" # Version del Script actual
  7. FECHA_SCRIPT="Enero 2010"
  8. #-==================================================================
  9. #+ Funciones:
  10. #-------------------------------------------------------------------
  11. #- dame_peticiones_WEB
  12. #
  13. #-==================================================================
  14. #+ Explicacion:
  15. #---------

entity - Level 04 - script - funcion - apps - 08 - f08_requestweb.f - Chequeo carga servidor web apache con Apache Bench - Tupl

Código

Referencia al fuente - Source access: 

code - script - general - funcion - f08_requestweb.f - Chequeo carga servidor web apache con Apache Bench - Tupla de rendimiento

  1. #!/usr/bin/bash
  2. #-------------------------------------------------------------------
  3. # Funciones Entornos Unix - Brqx Site - Brqx Org
  4. # Brqx Org - Rct - 2010
  5. #-------------------------------------------------------------------
  6. VERSION_SCRIPT="V 1.0" # Version del Script actual
  7. FECHA_SCRIPT="Enero 2010"
  8. #-==================================================================
  9. #+ Funciones:
  10. #-------------------------------------------------------------------
  11. #- dame_peticiones_WEB
  12. #
  13. #-==================================================================
  14. #+ Explicacion:
  15. #-------------------------------------------------------------------
  16.  
  17. # Sacamos tres ficheros de salida
  18. #
  19. #-s: Por defecto sacamos un resumen
  20.  
  21.  
  22. #-------------------------------------------------------------------
  23. #-s Salida general
  24. #-==================================================================
  25. #- Queremos la siguiente Tupla :
  26. # URL : PETICIONES : CONCURRENCIA : TIEMPO TOTAL : TIEMPO_MIN : TIEMPO_AVG : TIEMPO_MAX
  27. # node/1 : 2000 : 15 : 0,779S : 168 : 204 : 244
  28.  
  29.  
  30. dame_peticiones_web()
  31. {
  32. PETICIONES=$1
  33. CONCURRENCIA=$2
  34. REFERENCIA=$3
  35. URL=$4
  36.  
  37. # URL por defecto certi.everis/node/1
  38. if [ "$URL" = "" ] ; then
  39. URL="certi.everis/node/1"
  40. fi
  41.  
  42. # Referencia por defecto : ARCHIVO
  43. if [ "$REFERENCIA" = "" ] ; then
  44. REFERENCIA="ARCHIVO"
  45. fi
  46.  
  47.  
  48. # Por defecto 10 ejecucciones
  49. if [ "$PETICIONES" = "" ] ; then
  50. PETICIONES=10
  51. fi
  52.  
  53. # Por defecto 10 ejecucciones
  54. if [ "$CONCURRENCIA" = "" ] ; then
  55. CONCURRENCIA=5
  56. fi
  57.  
  58.  
  59.  
  60. # Antes de llamar a ab, establecemos el formato de la fecha de salida
  61.  
  62. set timefmt '%H:%M:%S'
  63.  
  64. # Llamamos a ab con salida HTML
  65.  
  66. alias ab='/home/httpd-2.0.52/support/ab'
  67.  
  68. /home/httpd-2.0.52/support/ab -S -d -w -n ${PETICIONES} -c ${CONCURRENCIA} -e ${REFERENCIA}_peticiones_e -g ${REFERENCIA}_peticiones_g http://${URL} > ${REFERENCIA}_peticiones_s
  69.  
  70. #=------------------------------------------------------------------------------------------------#
  71. # TRATAMIENTO TUPLA GENERAL
  72. #=-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--#
  73.  
  74.  
  75. TUPLA_TOTAL=`cat ${REFERENCIA}_peticiones_s | grep "Time taken" | \
  76. tr "bgcolor=white" " " | tr "<" " " | tr ">" " " | tr "/" " " | tr "[a-zA-Z]" " " | tr -s " " | \
  77. cut -d " " -f5`
  78.  
  79. TIEMPO_TOTAL="`echo ${TUPLA_TOTAL} |cut -d "." -f1`,`echo ${TUPLA_TOTAL} | cut -d "." -f2 | cut -c1-3`"
  80.  
  81. COMPLETAS=`cat ${REFERENCIA}_peticiones_s | grep Complete | \
  82. tr "bgcolor=white" " " | tr "<" " " | tr ">" " " | tr "/" " " | tr "[a-zA-Z]" " " | tr -s " " | \
  83. cut -d " " -f5`
  84.  
  85. TUPLA_TIEMPO=`cat ${REFERENCIA}_peticiones_s | grep "Total:" | \
  86. tr "bgcolor=white" " " | tr "<" " " | tr ">" " " | tr "/" " " | tr "[a-zA-Z]" " " | tr -s " "`
  87.  
  88. TIEMPO_MIN="`echo ${TUPLA_TIEMPO} | cut -d " " -f2 | cut -d "." -f1`,`echo ${TUPLA_TIEMPO} | cut -d " " -f2 | cut -d "." -f2 | cut -c1-3`"
  89. TIEMPO_AVG="`echo ${TUPLA_TIEMPO} | cut -d " " -f3 | cut -d "." -f1`,`echo ${TUPLA_TIEMPO} | cut -d " " -f3 | cut -d "." -f2 | cut -c1-3`"
  90. TIEMPO_MAX="`echo ${TUPLA_TIEMPO} | cut -d " " -f4 | cut -d "." -f1`,`echo ${TUPLA_TIEMPO} | cut -d " " -f4 | cut -d "." -f2 | cut -c1-3`"
  91.  
  92.  
  93. #=-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--#
  94. # TRATAMIENTO G - PORCENTAJES
  95. #=------------------------------------------------------------------------------------------------#
  96.  
  97. echo "Tupla prueba AB :\
  98. ${URL}:${PETICIONES}:${CONCURRENCIA}:${TIEMPO_TOTAL}s:${TIEMPO_MIN}ms:${TIEMPO_AVG}ms:${TIEMPO_MAX}ms"
  99.  
  100. }

Categorías

Caracter: 
Arquetipo: 
Producto: 
cpanel
Molde: 
Letra: 

Archivo

archivo: 
f08_requestweb.f
Nombre de la funcion: 
dame_peticiones_web
encabezado: 
Chequeo carga servidor web apache con Apache Bench - Tupla de rendimiento
Descripcion: 
Usando la salida de Apache bench , la formateamos para crear una tupla de rendimiento. El objetivo es poder crear una tabla de rendimieento en base a una agenda de pruebas.

Contenido

Colocacion: 
08
Nivel: 
Level 04

Versión

Fecha_Script: 
Enero 2010
Ruta_Brqx: 
scripts/common/funciones/proceso
Version_Script: 
1.0
Distribuir contenido