Commit 67e03f67 by Feanil Patel

We don't use these plugins.

They cost us build time and make the new-relic role more complicated.
parent e47d5109
......@@ -22,10 +22,6 @@
- role: splunkforwarder
when: COMMON_ENABLE_SPLUNKFORWARDER
- role: newrelic
NEWRELIC_LOGWATCH:
- logwatch-503.j2
- logwatch-cms-errors.j2
- logwatch-lms-errors.j2
when: COMMON_ENABLE_NEWRELIC
- role: minos
when: COMMON_ENABLE_MINOS
......@@ -35,8 +35,6 @@
- role: splunkforwarder
when: COMMON_ENABLE_SPLUNKFORWARDER
- role: newrelic
NEWRELIC_LOGWATCH:
- logwatch-xqueue-errors.j2
when: COMMON_ENABLE_NEWRELIC
post_tasks:
- debug: var="{{ ansible_ec2_instance_id }}"
......
......@@ -21,10 +21,6 @@ NEWRELIC_DEBIAN_KEY_ID: '548C16BF'
NEWRELIC_DEBIAN_KEY_URL: 'https://download.newrelic.com/{{ NEWRELIC_DEBIAN_KEY_ID }}.gpg'
NEWRELIC_LICENSE_KEY: "SPECIFY_KEY_HERE"
# Set this to newrelic logwatch
# agent template files to enable
# the logwatch agent
NEWRELIC_LOGWATCH: []
#
# OS packages
#
......@@ -38,19 +34,3 @@ newrelic_redhat_pkgs:
newrelic_debian_plugin_pkgs:
- ruby-bundler
- rubygems
newrelic_logwatch_repo: https://github.com/railsware/newrelic_platform_plugins
newrelic_logwatch_repo_dir: /opt/newrelic_platform_plugins
newrelic_logwatch_dir: "{{ newrelic_logwatch_repo_dir }}/newrelic_logwatcher_agent"
newrelic_logwatch_version: "8edd6d214e462b27fdd07d41712eb7b4fff2f7d8"
# s3_watcher
NEWRELIC_S3_WATCHER: false
newrelic_plugin_user: "{{ common_web_user }}"
newrelic_s3watcher_repo: https://github.com/edx/analytics-gasket
newrelic_s3watcher_version: "e33cf920aa172707b788834e176350f423c7c38d"
newrelic_s3watcher_repo_dir: /edx/app/s3watcher
newrelic_s3watcher_dir: "{{ newrelic_s3watcher_repo_dir }}/newrelic/s3-newrelic-plugin"
rbenv_root_dir: "/opt/rbenv"
---
dependencies:
- common
- supervisor
- role: rbenv
common_web_user: "root"
rbenv_user: "root"
rbenv_dir: "{{ rbenv_root_dir }}"
rbenv_ruby_version: "1.9.3-p547"
......@@ -62,17 +62,3 @@
- name: ensure started and enabled
service: name=newrelic-sysmond state=restarted enabled=yes
# tags=deploy here so that if we are deploying
# an application update on a server the config
# for the plugin will be updated with the appropriate
# edp
- include: newrelic-logwatcher.yml tags=deploy
when:
- NEWRELIC_LOGWATCH
- ansible_distribution == 'Ubuntu'
- include: s3-watcher.yml tags=deploy
when:
- NEWRELIC_S3_WATCHER
- ansible_distribution == 'Ubuntu'
---
# This task file is for the newrelic logwatcher plugin
# which is an agent that watches logfiles on the system
# for string matches
- name: Install newrelic plugin related packages
apt: pkg={{ item }} install_recommends=yes state=present
with_items: newrelic_debian_plugin_pkgs
- name: check out the newrelic logwatcher plugin
git: >
dest={{ newrelic_logwatch_repo_dir }}
repo={{ newrelic_logwatch_repo }} version={{ newrelic_logwatch_version }}
accept_hostkey=yes
- name: bundle install
shell: >
chdir={{ newrelic_logwatch_dir }}
creates=/var/lib/gems/1.8/gems/newrelic_plugin-1.0.2/
bundle install
notify: restart newrelic-logwatch-agent
- name: create agent configuration
template: >
src=opt/newrelic_platform_plugins/newrelic_logwatcher_agent/config/newrelic_plugin.yml.j2
dest={{ newrelic_logwatch_dir }}/config/newrelic_plugin.yml.copy
notify: restart newrelic-logwatch-agent
- template:
owner: root
src: etc/init/newrelic-logwatch-agent.conf.j2
dest: /etc/init/newrelic-logwatch-agent.conf
notify: restart newrelic-logwatch-agent
---
# This task file is for the newrelic s3watcher plugin
# which is an agent that obtains metrics from S3 for
# a given bucket
- name: Install newrelic plugin related packages
apt: pkg={{ item }} install_recommends=yes state=present
with_items: newrelic_debian_plugin_pkgs
- name: Install s3cmd
apt: pkg="s3cmd" install_recommends=yes state=present
- name: create {{ newrelic_s3watcher_repo_dir }}
file: >
path={{ newrelic_s3watcher_repo_dir }} state=directory
owner="{{ newrelic_plugin_user }}" group="{{ common_web_group }}"
mode=0755
- name: check out the s3 newrelic plugin
git: >
dest={{ newrelic_s3watcher_repo_dir }}
repo={{ newrelic_s3watcher_repo }} version={{ newrelic_s3watcher_version }}
accept_hostkey=yes
sudo_user: "{{ newrelic_plugin_user }}"
- name: create bundle install shell script
template:
owner: "{{ newrelic_plugin_user }}"
src: s3-watcher-bundle-install.sh.j2
dest: "{{ newrelic_s3watcher_repo_dir }}/s3-watcher-bundle-install.sh"
mode: 0755
sudo_user: "{{ newrelic_plugin_user }}"
- name: execute bundle install via rbenv
shell: ./s3-watcher-bundle-install.sh chdir={{ newrelic_s3watcher_repo_dir }}
- name: create agent configuration
template: >
src=opt/newrelic_platform_plugins/s3_watcher/config/newrelic_plugins.yml.j2
dest={{ newrelic_s3watcher_dir }}/config/newrelic_plugin.yml
sudo_user: "{{ newrelic_plugin_user }}"
- name: set agent as executable
file: >
path={{ newrelic_s3watcher_dir }}/newrelic_s3_agent
mode=0755
- name: create supervisor wrapper
template:
src: s3-watcher-supervisor.sh.j2
dest: "{{ newrelic_s3watcher_dir }}/s3-watcher-supervisor.sh"
mode: 0755
owner: "{{ newrelic_plugin_user }}"
sudo_user: "{{ newrelic_plugin_user }}"
- name: create supervisor config
template:
src: s3watcher.conf.j2
dest: "{{ supervisor_cfg_dir }}/s3watcher.conf"
owner: "{{ supervisor_user }}"
mode: 644
sudo_user: "{{ supervisor_user }}"
- name: update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update
changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != ""
- name: ensure s3watcher is started
supervisorctl: >
name=s3watcher
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
description "newrelic logwatch plugin"
start on runlevel [2345]
stop on runlevel [016]
respawn
chdir {{ newrelic_logwatch_dir }}
pre-start script
ami_id=$(ec2metadata --ami-id)
hostname=$(hostname)
sed "s/HOSTNAME/${ami_id}-${hostname}/" {{ newrelic_logwatch_dir }}/config/newrelic_plugin.yml.copy > {{ newrelic_logwatch_dir }}/config/newrelic_plugin.yml
end script
exec ruby newrelic_logwatcher_agent.rb
{% if SANDBOX_USERNAME is defined %}
{% set server_name = SANDBOX_USERNAME + '-nginx-503' %}
{% else %}
{% set server_name = COMMON_ENVIRONMENT|default('unknown-env') + '-' + COMMON_DEPLOYMENT|default('unknown-deployment') + '-nginx-503' + '-HOSTNAME' %}
{% endif %}
{{ server_name }}:
# Full path to the the log file
log_path: {{ nginx_log_dir|default('/edx/var/log/nginx') }}/error.log
# Returns the number of matches for this term. Use Linux Regex formatting.
term: "limiting requests"
# Provide any options to pass to grep when running.
# For example, to count non-matching lines, enter 'v'.
# Use the abbreviated format ('v' and not 'invert-match').
grep_options:
{% if SANDBOX_USERNAME is defined %}
{% set server_name = SANDBOX_USERNAME + '-certs-errors' %}
{% else %}
{% set server_name = COMMON_ENVIRONMENT|default('unknown-env') + '-' + COMMON_DEPLOYMENT|default('unknown-deployment') + '-certs-errors' + '-HOSTNAME'%}
{% endif %}
{{ server_name }}:
# Full path to the the log file
log_path: {{ COMMON_LOG_DIR|default('/edx/var/log') }}/certs/edx.log
# Returns the number of matches for this term. Use Linux Regex formatting.
term: " ERROR "
# Provide any options to pass to grep when running.
# For example, to count non-matching lines, enter 'v'.
# Use the abbreviated format ('v' and not 'invert-match').
grep_options:
{% if SANDBOX_USERNAME is defined %}
{% set server_name = SANDBOX_USERNAME + '-cms-errors' %}
{% else %}
{% set server_name = COMMON_ENVIRONMENT|default('unknown-env') + '-' + COMMON_DEPLOYMENT|default('unknown-deployment') + '-cms-errors' + '-HOSTNAME' %}
{% endif %}
{{ server_name }}:
# Full path to the the log file
log_path: {{ COMMON_LOG_DIR|default('/edx/var/log') }}/cms/edx.log
# Returns the number of matches for this term. Use Linux Regex formatting.
term: " ERROR "
# Provide any options to pass to grep when running.
# For example, to count non-matching lines, enter 'v'.
# Use the abbreviated format ('v' and not 'invert-match').
grep_options:
{% if SANDBOX_USERNAME is defined %}
{% set server_name = SANDBOX_USERNAME + '-lms-errors' %}
{% else %}
{% set server_name = COMMON_ENVIRONMENT|default('unknown-env') + '-' + COMMON_DEPLOYMENT|default('unknown-deployment') + '-lms-errors' + '-HOSTNAME' %}
{% endif %}
{{ server_name }}:
# Full path to the the log file
log_path: {{ COMMON_LOG_DIR|default('/edx/var/log') }}/lms/edx.log
# Returns the number of matches for this term. Use Linux Regex formatting.
term: " ERROR "
# Provide any options to pass to grep when running.
# For example, to count non-matching lines, enter 'v'.
# Use the abbreviated format ('v' and not 'invert-match').
grep_options:
{% if SANDBOX_USERNAME is defined %}
{% set server_name = SANDBOX_USERNAME + '-xqueue-errors' %}
{% else %}
{% set server_name = COMMON_ENVIRONMENT|default('unknown-env') + '-' + COMMON_DEPLOYMENT|default('unknown-deployment') + '-xqueue-errors' + '-HOSTNAME' %}
{% endif %}
{{ server_name }}:
# Full path to the the log file
log_path: {{ COMMON_LOG_DIR|default('/edx/var/log') }}/xqueue/edx.log
# Returns the number of matches for this term. Use Linux Regex formatting.
term: " ERROR "
# Provide any options to pass to grep when running.
# For example, to count non-matching lines, enter 'v'.
# Use the abbreviated format ('v' and not 'invert-match').
grep_options:
#
#
# This is a sample newrelic_plugin.yml file. Please move this file
# to the following location if it is not already there:
#
# ./config/newrelic_plugin.yml
#
# Where the current directory is the directory where your main program resides and is your current
# directory when you run the main program.
#
# Please make sure to update the license_key information with the license key for your New Relic
# account.
#
#
newrelic:
#
# Update with your New Relic account license key:
#
license_key: '{{ NEWRELIC_LICENSE_KEY }}'
#
# Set to '1' for verbose output, remove for normal output.
# All output goes to stdout/stderr.
#
# verbose: 1
#
# Agent Configuration:
#
agents:
{% for agent in NEWRELIC_LOGWATCH %}
{% include agent %}
{% endfor %}
# Please make sure to update the license_key information with the license key for your New Relic
# account.
#
newrelic:
#
# Update with your New Relic account license key:
#
license_key: {{ NEWRELIC_LICENSE_KEY }}
#
# Set to '1' for verbose output, remove for normal output.
# All output goes to stdout/stderr.
#
# verbose: 1
# Proxy configuration:
#proxy:
# address: localhost
# port: 8080
# user: nil
# password: nil
# Agent Configuration:
#
agents:
s3:
s3_access_key_id: {{ S3_ACCESS_KEY_ID }}
s3_secret_access_key: {{ S3_SECRET_ACCESS_KEY }}
s3_bucket_name: {{ S3_BUCKET_NAME }}
s3_region: {{ AWS_REGION }}
s3_cmd_config_file: {{ S3_CONFIG_FILENAME }}
#!/usr/bin/env bash
source {{ rbenv_root_dir }}/ruby_env
cd {{ newrelic_s3watcher_dir }}
bundle install
#!/usr/bin/env bash
source {{ rbenv_root_dir }}/ruby_env
cd {{ newrelic_s3watcher_dir }}
./newrelic_s3_agent
[program:s3watcher]
command={{ newrelic_s3watcher_dir }}/s3-watcher-supervisor.sh
priority=999
user={{ newrelic_plugin_user }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
killasgroup=true
stopasgroup=true
stopsignal=QUIT
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment