Showing posts with label http. Show all posts
Showing posts with label http. Show all posts

Tuesday, 8 July 2014

Latest graphite on Amazon Linux at AWS

NOTE: someone broke master branch, so reverting to 0.9.x
  1. yum update -y;reboot
  2. yum -y groupinstall "Development Tools"
  3. yum -y install git-core python-pip mlocate
  4. yum -y install python-rrdtool pycairo-devel
  5. mkdir -p /root/graphite-install
  6. cd /root/graphite-install
  7. git clone https://github.com/graphite-project/carbon.git
  8. git clone https://github.com/graphite-project/whisper.git
  9. git clone https://github.com/graphite-project/ceres
  10. git clone https://github.com/graphite-project/graphite-web.git
  11. cd /root/graphite-install/whisper
  12. git checkout 0.9.x
  13. python setup.py install
  14. cd /root/graphite-install/ceres
  15. # only has master branch, but it works with others
  16. pip install -r requirements.txt
  17. python setup.py install
  18. cd /root/graphite-install/carbon
  19. git checkout 0.9.x
  20. pip install -r requirements.txt
  21. python setup.py install
  22. cd /root/graphite-install/graphite-web
  23. git checkout 0.9.x
  24. yum install libffi-devel -y # some developer broke things, add this
  25. pip install -r requirements.txt
  26. python check-dependencies.py
  27. python setup.py install 
  28. cp -v /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf
  29. cp -v /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf
  30. cp -v /opt/graphite/conf/storage-aggregation.conf.example /opt/graphite/conf/storage-aggregation.conf
  31. cp -v /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py
  32. cp -v /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
  33. vi /opt/graphite/webapp/graphite/local_settings.py
    1. set SECRET_KEY param
    2. uncomment DATABASE section
  34. add these lines to /root/.bash_profile
    1. export GRAPHITE_ROOT=/opt/graphite
    2. export PYTHONPATH=$GRAPHITE_ROOT/webapp:$GRAPHITE_ROOT/whisper
  35. source /root/.bash_profile
  36. django-admin.py syncdb --settings=graphite.settings
  37. yum -y install httpd24 mod24_wsgi
  38. mkdir /etc/httpd/vhosts.d
  39. add to end of /etc/httpd/conf/httpd.conf
    1. IncludeOptional vhosts.d/*.conf
  40. create /etc/httpd/vhosts.d/graphite.conf with below
  41. mkdir /var/run/wsgi;chmod -v 777 /var/run/wsgi
  42. apachectl -S
    1. check for errors
  43. service httpd start
  44. /opt/graphite/bin/carbon-cache.py start
  45. find /opt/graphite/storage -type d -exec chmod -v 777 {} \;
  46. find /opt/graphite/storage -type f -exec chmod -v 666 {} \;
  47. echo '127.0.1.3 graphite' >> /etc/hosts
  48. curl -I http://graphite
  49. on local machine
    1. make same /etc/hosts entry
    2. port forward 127.0.1.3:8081 to remote-server:80
    3. curl -I http://graphite:8081
  50. END

WSGISocketPrefix /var/run/wsgi

<VirtualHost *:80>
    ServerName graphite
    DocumentRoot "/opt/graphite/webapp"
    ErrorLog logs/webapp_error.log
    CustomLog logs/webapp_access.log common

    WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120
    WSGIProcessGroup graphite
    WSGIApplicationGroup %{GLOBAL}
    WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL}
    WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi

    Alias /content/ /opt/graphite/webapp/content/
    <Location "/content/">
        SetHandler None
        Require all granted
    </Location>
  
    Alias /media/ "@DJANGO_ROOT@/contrib/admin/media/"
    <Location "/media/">
        SetHandler None
        Require all granted
    </Location>
 
    <Directory /opt/graphite/conf/>
        Require all granted
    </Directory>
</VirtualHost>


Thursday, 25 April 2013

tcpdump HTTP headers


  1. tcpdump -vvvs 1024 -l -A port 80 | egrep '^[A-Z][a-zA-Z\-]+:|GET|POST'
    1. Match your port, here it is 80, could be 8080 or 443, e.g.

Wednesday, 13 March 2013

Get provisioned public key for AWS EC2 instance via curl

curl http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key

Tuesday, 2 October 2012

No http on port 2812 for monit


FAIL!

set httpd port 2812 and use the address localhost
  allow localhost

  1. Problem
    1. monit doesn't listen on port 2812
      1. even though it is clearly in the config file 
  2. Possible issues
    1. Is there a "delay" set in your config?
      1. monit won't listen until this delay has passed
  3. Solution
    1. Wait, usually a minute by default, and check the port again
    2. Get rid of the delay in the config and restart monit

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...