TEXT   19

AWS HC Data Gathering

Guest on 21st August 2022 08:18:14 AM

  1. AWS HealthCheck Data Gathering
  2.  
  3.  
  4. Started Tracking this from our HealthCheck DOS Issue and HAProxy Solution
  5.  
  6.  
  7. [jhipp@gov-tic-prod-hsrmdb01a ~]$ sudo su - cacheusr
  8. Last login: Wed Nov 11 16:00:03 EST 2020 on pts/0
  9.  
  10. [cacheusr@gov-tic-prod-hsrmdb01a ~]$ crontab -l |grep aws
  11. 59 * * * * /intersystems/VAHSRM001/sys/scripts/aws_hc.sh
  12.  
  13.  
  14. ***
  15. Long-Story Short, at the end of the hour it scrapes data at the last minute to
  16. see how many HealthCheck requests were received
  17. ***
  18.  
  19.  
  20. [cacheusr@gov-tic-prod-hsrmdb01a ~]$ cat /intersystems/VAHSRM001/sys/scripts/aws_hc.sh
  21. #!/bin/sh
  22.  
  23. /bin/sleep 55
  24.  
  25. YEAR=`/usr/bin/date +"%Y"`
  26. HOUR=`/usr/bin/date +"%H"`
  27. DAY=`/usr/bin/date +"%D"`
  28.  
  29. FILE="/var/log/httpd/access_log"
  30. LOGFILE="/var/log/custom/aws_hc.log"
  31.  
  32. COUNT=`/usr/bin/grep "$YEAR:$HOUR" $FILE |/bin/wc -l`
  33. PER_SECOND=`/usr/bin/expr $COUNT / 3600`
  34.  
  35. /bin/echo -e "$DAY\t$HOUR\t$PER_SECOND" >> $LOGFILE
  36.  
  37.  
  38. (Log File - Accessible from Browser)
  39.  
  40. [cacheusr@gov-tic-prod-hsrmdb01a ~]$ ls -l /var/log/custom/ |grep aws
  41. -rw-r--r--. 1 cacheusr cacheusr   67494 Nov 16 13:59 aws_hc.log
  42.  
  43. [cacheusr@gov-tic-prod-hsrmdb01a ~]$ head /var/log/custom/aws_hc.log
  44. DAY             HOUR    PER_SECOND
  45. 05/11/20        21      96
  46. 05/11/20        22      95
  47. 05/11/20        23      95
  48. 05/12/20        00      96
  49. 05/12/20        01      96
  50. 05/12/20        02      96
  51. 05/12/20        03      74
  52. 05/12/20        04      96
  53. 05/12/20        05      96
  54.  
  55.  
  56. https://gov-tic-prod-hsrmdb01a.ccra.va.gov/aws_hc.log
  57.  
  58.  
  59. [cacheusr@gov-tic-prod-hsrmdb01a ~]$ curl https://gov-tic-prod-hsrmdb01a.ccra.va.gov/aws_hc.log
  60. ...
  61. ...
  62. ...
  63. ...
  64. ...
  65. 10/29/20        03      3
  66. 10/29/20        04      16
  67. 10/29/20        05      16
  68. 10/29/20        06      18
  69. 10/29/20        07      23
  70. 10/29/20        08      35
  71. 10/29/20        09      47
  72. 10/29/20        10      54
  73. 10/29/20        11      59
  74. 10/29/20        12      58
  75. 10/29/20        13      58
  76. 10/29/20        14      60

Raw Paste


Login or Register to edit or fork this paste. It's free.