Add the configuration of the solr exporter to the solr role. Open the firewall so that prometheus can read the solr metrics.
This commit is contained in:
parent
d976e483db
commit
22438d0882
|
@ -51,3 +51,13 @@ solr_cloud_mode: True
|
|||
solr_zk_external_cluster: False
|
||||
solr_zk_hosts: '127.0.0.1:2181'
|
||||
solr_zk_timeout: 15000
|
||||
|
||||
solr_prometheus_exporter: True
|
||||
solr_prometheus_port: 9983
|
||||
solr_prometheus_threads: 2
|
||||
solr_prometheus_bindir: '{{ solr_server_dir }}/contrib/prometheus-exporter/bin'
|
||||
solr_prometheus_command: 'solr-exporter'
|
||||
solr_prometheus_command_params: '-p {{ solr_prometheus_port }} -b {{ solr_zk_hosts }} -f {{ solr_prometheus_conf_file }} -n {{ solr_prometheus_threads }}'
|
||||
solr_prometheus_data_dir: '{{ solr_base_dir }}/solr_prometheus_exporter'
|
||||
solr_prometheus_conf_dir: '{{ solr_prometheus_data_dir }}/conf'
|
||||
solr_prometheus_conf_file: '{{ solr_prometheus_conf_dir }}/solr-exporter-config.xml'
|
||||
|
|
|
@ -2,3 +2,5 @@
|
|||
- name: solr restart
|
||||
service: name=solr state=restarted
|
||||
|
||||
- name: Restart Solr prometheus exporter
|
||||
service: name=solr_prometheus_exporter state=restarted enabled=yes
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
dependencies:
|
||||
- { role: '../../library/roles/oracle-jdk', when: openjdk_install is not defined or not openjdk_install }
|
||||
- { role: '../../library/roles/openjdk', when: openjdk_install | default(False) }
|
|
@ -62,3 +62,31 @@
|
|||
become_user: root
|
||||
when: solr_install
|
||||
tags: solr
|
||||
|
||||
- block:
|
||||
- name: Create the Solr prometheus exporter conf directory
|
||||
file: dest={{ solr_prometheus_conf_dir }} state=directory mode=0755
|
||||
|
||||
- name: Install the Solr prometheus exporter config file
|
||||
template: src=solr-exporter-config.xml dest={{ solr_prometheus_conf_file }} mode=0644
|
||||
notify: Restart Solr prometheus exporter
|
||||
|
||||
- name: Install the Solr prometheus exporter upstart script
|
||||
template: src=solr_prometheus_exporter.upstart.j2 dest=/etc/init/solr_prometheus_exporter.conf mode=0644 owner=root group=root
|
||||
when: ansible_service_mgr != 'systemd'
|
||||
|
||||
- name: Install the Solr prometheus exporter systemd unit
|
||||
template: src=solr_prometheus_exporter.systemd.j2 dest=/etc/systemd/system/solr_prometheus_exporter.service mode=0644 owner=root group=root
|
||||
when: ansible_service_mgr == 'systemd'
|
||||
notify: systemd reload
|
||||
|
||||
- name: Ensure that Solr prometheus exporter is started and enabled
|
||||
service: name=solr_prometheus_exporter state=started enabled=yes
|
||||
|
||||
become: True
|
||||
become_user: root
|
||||
when:
|
||||
- solr_install
|
||||
- solr_prometheus_exporter
|
||||
tags: [ 'solr', 'solr_prometheus', 'solr_prometheus_exporter' ]
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=solr_prometheus_exporter - Prometheus exporter for Solr metrics.
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ solr_user }}
|
||||
Group={{ solr_group }}
|
||||
ExecStart={{ solr_prometheus_bindir }}/{{ solr_prometheus_command }} {{ solr_prometheus_command_params }}
|
||||
Restart=on-failure
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
description "Solr exporter for Prometheus"
|
||||
start on (local-filesystems and net-device-up IFACE!=lo)
|
||||
stop on runlevel [016]
|
||||
|
||||
respawn
|
||||
respawn limit 10 5
|
||||
setuid {{ solr_user }}
|
||||
setgid {{ solr_group }}
|
||||
|
||||
script
|
||||
exec {{ solr_prometheus_bindir }}/{{ solr_prometheus_command }} {{ solr_prometheus_command_params }}
|
||||
end script
|
Loading…
Reference in New Issue