|
10 | 10 | - name: Install nginx (RedHat)
|
11 | 11 | yum: name=nginx
|
12 | 12 | when: ansible_os_family == "RedHat"
|
| 13 | + |
| 14 | + - name: Install nginx config |
| 15 | + template: |
| 16 | + src: templates/graphite.conf.j2 |
| 17 | + dest: /etc/nginx/conf.d/graphite.conf |
| 18 | + |
| 19 | + - name: Start nginx |
| 20 | + service: name=nginx state=started |
| 21 | + |
| 22 | + # Ready to check the installation |
| 23 | + |
| 24 | + - name: Make sure processes are running |
| 25 | + shell: "pgrep {{ item }}" |
| 26 | + with_items: |
| 27 | + - carbon-cache |
| 28 | + - uwsgi |
| 29 | + - nginx |
| 30 | + |
| 31 | + - name: "Make sure we have a Graphite install at localhost:8080" |
| 32 | + shell: "curl -s http://localhost:8080 | grep 'Graphite Browser'" |
| 33 | + |
| 34 | + - name: Download a sample graph |
| 35 | + shell: "curl -so out 'http://localhost:8080/render/?width=586&height=308&_salt=1448804805.156&target=carbon.agents.*-a.cache.size'" |
| 36 | + |
| 37 | + - name: Make sure that we got a image |
| 38 | + shell: file out | grep -i image |
| 39 | + |
| 40 | + - name: "Insert a metric to carbon" |
| 41 | + shell: echo "local.random.diceroll 4711 $(date +%s)" | nc -w 2 0.0.0.0 2003 |
| 42 | + |
| 43 | + - name: Wait 5 sec |
| 44 | + pause: seconds=5 |
| 45 | + |
| 46 | + - name: Search for the value from graphite-web |
| 47 | + shell: "curl -s 'http://localhost:8080/render/?_salt=1448817576.96&target=local.random.diceroll&format=csv' | grep ',4711.0'" |
| 48 | + |
| 49 | + - name: Remove false positives from carbon creates.log |
| 50 | + lineinfile: |
| 51 | + dest: /opt/graphite/storage/log/carbon-cache/carbon-cache-a/creates.log |
| 52 | + line: "- REMOVED -" |
| 53 | + regexp: "{{ item }}" |
| 54 | + with_items: |
| 55 | + - "creating database file.*errors.wsp" |
| 56 | + - "new metric carbon.agents.*a.errors matched schema carbon" |
| 57 | + - "new metric carbon.agents.*a.errors matched aggregation schema default" |
| 58 | + failed_when: False |
| 59 | + |
| 60 | + - name: Search for errors in logs |
| 61 | + shell: test -f {{ item }} && cat {{ item }} |
| 62 | + register: logout |
| 63 | + failed_when: > |
| 64 | + 'error' in logout.stdout or |
| 65 | + 'Error' in logout.stdout or |
| 66 | + 'ERROR' in logout.stdout |
| 67 | + with_items: |
| 68 | + - /var/log/uwsgi_graphite.log |
| 69 | + - /var/log/uwsgi/app/graphite.log |
| 70 | + - /var/log/nginx/graphite.error.log |
| 71 | + - /var/log/nginx/error.log |
| 72 | + - /opt/graphite/storage/log/webapp/info.log |
| 73 | + - /opt/graphite/storage/log/webapp/exception.log |
| 74 | + - /opt/graphite/storage/log/carbon-cache/carbon-cache-a/query.log |
| 75 | + - /opt/graphite/storage/log/carbon-cache/carbon-cache-a/listener.log |
| 76 | + - /opt/graphite/storage/log/carbon-cache/carbon-cache-a/creates.log |
| 77 | + - /opt/graphite/storage/log/carbon-cache/carbon-cache-a/console.log |
0 commit comments