forked from ISTI-ansible-roles/ansible-roles
d4science-ghn-cluster: couchdb: authentication data to support the couchdb ganglia plugin
d4science-ghn-cluster/group_vars/egi_smartexecutor: Install a nginx proxy in front of tomcat d4science-ghn-cluster/group_vars/ghn_smartgears_prod: Install the gcube keys. Get them from the workspace. library/roles/couchdb: Support ganglia and the installation of a specific ganglia plugin. library/roles/tomcat-multiple-instances/defaults/main.yml: Fix the jmx options. dnet-openaire/host_vars/node6.t.openaire.research-infrastructures.eu: jmx rules for tomcat and iptables.
This commit is contained in:
parent
1f77909502
commit
3d5a984427
|
@ -69,4 +69,7 @@ couchdb_replicator_options:
|
|||
|
||||
ganglia_enabled: False
|
||||
couchdb_ganglia_url: http://localhost:5984/_stats
|
||||
# If set, http basic auth is used for the connection
|
||||
#couchdb_ganglia_url_username: '{{ couchdb_ganglia_user}}'
|
||||
#couchdb_ganglia_url_password: '{{ couchdb_ganglia_user_pwd }}'
|
||||
couchdb_ganglia_refresh_rate: 60
|
||||
|
|
|
@ -26,6 +26,8 @@ class UpdateCouchdbThread(threading.Thread):
|
|||
self.metrics = {}
|
||||
self.settings = {}
|
||||
self.stats_url = params['stats_url']
|
||||
self.stats_url_username = params['stats_url_username']
|
||||
self.stats_url_password = params['stats_url_password']
|
||||
self._metrics_lock = threading.Lock()
|
||||
self._settings_lock = threading.Lock()
|
||||
|
||||
|
@ -47,15 +49,21 @@ class UpdateCouchdbThread(threading.Thread):
|
|||
self.running = False
|
||||
|
||||
@staticmethod
|
||||
def _get_couchdb_stats(url, refresh_rate):
|
||||
def _get_couchdb_stats(url, username, password, refresh_rate):
|
||||
if refresh_rate == 60 or refresh_rate == 300 or refresh_rate == 900:
|
||||
url += '?range=' + str(refresh_rate)
|
||||
else:
|
||||
logging.warning('The specified refresh_rate of %d is invalid and has been substituted with 60!' % refresh_rate)
|
||||
url += '?range=60'
|
||||
|
||||
if username != "":
|
||||
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
|
||||
passman.add_password(None, url, username, password)
|
||||
urllib2.install_opener(urllib2.build_opener(urllib2.HTTPBasicAuthHandler(passman)))
|
||||
|
||||
request = urllib2.Request(url)
|
||||
# Set time out for urlopen to 2 seconds otherwise we run into the possibility of hosing gmond
|
||||
c = urllib2.urlopen(url, None, 2)
|
||||
c = urllib2.urlopen(request, None, 2)
|
||||
json_data = c.read()
|
||||
c.close()
|
||||
|
||||
|
@ -87,7 +95,7 @@ class UpdateCouchdbThread(threading.Thread):
|
|||
|
||||
try:
|
||||
logging.debug(' opening URL: ' + str(self.stats_url))
|
||||
data = UpdateCouchdbThread._get_couchdb_stats(self.stats_url, self.refresh_rate)
|
||||
data = UpdateCouchdbThread._get_couchdb_stats(self.stats_url, self.stats_url_username, self.stats_url_password, self.refresh_rate)
|
||||
except:
|
||||
logging.warning('error refreshing metrics')
|
||||
logging.warning(traceback.print_exc(file=sys.stdout))
|
||||
|
@ -289,6 +297,8 @@ if __name__ == '__main__':
|
|||
logging.debug('running from the cmd line')
|
||||
parser = OptionParser()
|
||||
parser.add_option('-u', '--URL', dest='stats_url', default='http://127.0.0.1:5984/_stats', help='URL for couchdb stats page')
|
||||
parser.add_option('-U', '--user', dest='stats_url_username', default='')
|
||||
parser.add_option('-P', '--password', dest='stats_url_password', default='')
|
||||
parser.add_option('-q', '--quiet', dest='quiet', action='store_true', default=False)
|
||||
parser.add_option('-r', '--refresh-rate', dest='refresh_rate', default=60)
|
||||
parser.add_option('-d', '--debug', dest='debug', action='store_true', default=False)
|
||||
|
@ -297,6 +307,8 @@ if __name__ == '__main__':
|
|||
|
||||
descriptors = metric_init({
|
||||
'stats_url': options.stats_url,
|
||||
'stats_url_username': options.stats_url_username,
|
||||
'stats_url_password': options.stats_url_password,
|
||||
'refresh_rate': options.refresh_rate
|
||||
})
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
# The ganglia plugin comes from https://github.com/ganglia/gmond_python_modules
|
||||
#
|
||||
- name: Install the ganglia plugin for Couchdb
|
||||
copy: src=couchdb.py dest=/usr/lib/ganglia/python_modules/couchdb.py owner=root group=root mode=0644
|
||||
copy: src=couchdb.py dest=/usr/lib/ganglia/python_modules/couchdb.py owner=root group=root mode=0444
|
||||
notify: Restart ganglia monitor
|
||||
tags: ganglia
|
||||
tags: [ 'ganglia', 'couchdb' ]
|
||||
|
||||
- name: Distribute the ganglia (gmond) configuration for the Couchdb plugin
|
||||
template: src=couchdb.pyconf.j2 dest=/etc/ganglia/conf.d/couchdb.pyconf owner=root group=root mode=444
|
||||
template: src=couchdb.pyconf.j2 dest=/etc/ganglia/conf.d/couchdb.pyconf owner=root group=ganglia mode=0440
|
||||
notify: Restart ganglia monitor
|
||||
tags: ganglia
|
||||
tags: [ 'ganglia', 'couchdb' ]
|
||||
|
|
|
@ -9,6 +9,22 @@ modules {
|
|||
value = '{{ couchdb_ganglia_url }}'
|
||||
}
|
||||
|
||||
param stats_url_username {
|
||||
{% if couchdb_ganglia_url_username is defined %}
|
||||
value = '{{ couchdb_ganglia_url_username }}'
|
||||
{% else %}
|
||||
value = ''
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
param stats_url_password {
|
||||
{% if couchdb_ganglia_url_password is defined %}
|
||||
value = '{{ couchdb_ganglia_url_password }}'
|
||||
{% else %}
|
||||
value = ''
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
param refresh_rate {
|
||||
value = '{{ couchdb_ganglia_refresh_rate }}'
|
||||
}
|
||||
|
|
|
@ -51,5 +51,5 @@ tomcat_m_jmx_localhost_only: False
|
|||
# This is only an example. Insert a line for each tomcat instance. 'app_contexts' can be used to automatically configure apache or nginx virtualhost http/ajp proxy
|
||||
#
|
||||
#tomcat_m_instances:
|
||||
# - { http_enabled: True, http_port: '8180', http_address: '0.0.0.0', ajp_enabled: False, ajp_port: '8109', ajp_address: '127.0.0.1', restart_timeout: '{{ tomcat_m_restart_timeout }}', shutdown_port: '8105', java_home: '{{ jdk_java_home }}', user: '{{ tomcat_m_default_user }}', user_home: '{{ tomcat_m_instances_base_path }}', user_shell: '{{ tomcat_m_default_user_shell }}', instance_path: '{{ tomcat_m_instances_base_path }}/8180', max_threads: '{{ tomcat_m_max_threads }}', autodeploy: '{{ tomcat_m_webapps_autodeploy }}', unpack: '{{ tomcat_m_webapps_unpack }}', install_server_xml: True, default_conf: True, java_opts: '{{ tomcat_m_java_opts }}', java_gc_opts: '{{ tomcat_m_java_gc_opts }}', other_java_opts: '{{ tomcat_m_other_java_opts }}', jmx_enabled: '{{ tomcat_m_jmx_enabled }}', jmx_auth_enabled: '{{ tomcat_m_jmx_auth_enabled }}', jmx_auth_dir: '{{ tomcat_m_instances_base_path }}/8180/conf', jmx_port: '8182', jmx_monitorpass: '{{ set_in_a_vault_file }}', jmx_controlpass: '{{ set_in_a_vault_file }}', remote_debugging: '{{ tomcat_m_enable_remote_debugging }}', remote_debugging_port: '8100', access_log_enabled: True, log_rotation_freq: daily, log_retain: 30, allowed_hosts: [ 'xxx.xxx.xxx.xxx/32', 'yyy.yyy.yyy.yyy/32' ], app_contexts: [ 'app1', 'app2' ] }
|
||||
# - { http_enabled: True, http_port: '8180', http_address: '0.0.0.0', ajp_enabled: False, ajp_port: '8109', ajp_address: '127.0.0.1', restart_timeout: '{{ tomcat_m_restart_timeout }}', shutdown_port: '8105', java_home: '{{ jdk_java_home }}', user: '{{ tomcat_m_default_user }}', user_home: '{{ tomcat_m_instances_base_path }}', user_shell: '{{ tomcat_m_default_user_shell }}', instance_path: '{{ tomcat_m_instances_base_path }}/8180', max_threads: '{{ tomcat_m_max_threads }}', autodeploy: '{{ tomcat_m_webapps_autodeploy }}', unpack: '{{ tomcat_m_webapps_unpack }}', install_server_xml: True, default_conf: True, java_opts: '{{ tomcat_m_java_opts }}', java_gc_opts: '{{ tomcat_m_java_gc_opts }}', other_java_opts: '{{ tomcat_m_other_java_opts }}', jmx_enabled: '{{ tomcat_m_jmx_enabled }}', jmx_disable_additional_ports: '{{ tomcat_m_jmx_disable_additional_ports }}', jmx_auth_enabled: '{{ tomcat_m_jmx_auth_enabled }}', jmx_auth_dir: '{{ tomcat_m_instances_base_path }}/8180/conf', jmx_port: '8182', jmx_monitorpass: '{{ set_in_a_vault_file }}', jmx_controlpass: '{{ set_in_a_vault_file }}', remote_debugging: '{{ tomcat_m_enable_remote_debugging }}', remote_debugging_port: '8100', access_log_enabled: True, log_rotation_freq: daily, log_retain: 30, allowed_hosts: [ 'xxx.xxx.xxx.xxx/32', 'yyy.yyy.yyy.yyy/32' ], app_contexts: [ 'app1', 'app2' ] }
|
||||
|
||||
|
|
Loading…
Reference in New Issue