mirror of https://github.com/Aidaho12/haproxy-wi
parent
c8eb548daf
commit
78b558282c
|
@ -5,4 +5,7 @@ apache_exporter_telemetry_endpoint: "/metrics"
|
||||||
apache_exporter_incecure: "false"
|
apache_exporter_incecure: "false"
|
||||||
stats_page: "stats"
|
stats_page: "stats"
|
||||||
apache_exporter_scrape_uri: "http://{{host}}/{{stats_page}}?auto"
|
apache_exporter_scrape_uri: "http://{{host}}/{{stats_page}}?auto"
|
||||||
|
apache_exporter_signature: "apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}"
|
||||||
prometheus_exporter_dir: "/opt/prometheus/exporters"
|
prometheus_exporter_dir: "/opt/prometheus/exporters"
|
||||||
|
prometheus_exporter_dist_dir: "{{ prometheus_exporter_dir }}/dist"
|
||||||
|
apache_exporter_dist_dir: "{{ prometheus_exporter_dist_dir }}/{{ apache_exporter_signature }}"
|
||||||
|
|
|
@ -29,37 +29,54 @@
|
||||||
mode: "u=rwx,go=rx"
|
mode: "u=rwx,go=rx"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Download apache_exporter binary to local folder
|
- name: download tarball
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
ignore_errors: yes
|
||||||
get_url:
|
get_url:
|
||||||
url: "https://github.com/Lusitaniae/apache_exporter/releases/download/v{{ apache_exporter_version }}/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
|
url: "https://github.com/Lusitaniae/apache_exporter/releases/download/v{{ apache_exporter_version }}/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
|
||||||
dest: "/tmp/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
|
dest: "{{ prometheus_exporter_dist_dir }}/{{ apache_exporter_signature }}.tar.gz"
|
||||||
checksum: "sha256:{{ __apache_exporter_checksum }}"
|
|
||||||
register: _download_binary
|
|
||||||
until: _download_binary is succeeded
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
delegate_to: localhost
|
|
||||||
check_mode: false
|
|
||||||
|
|
||||||
- name: Unpack apache_exporter binary
|
|
||||||
unarchive:
|
|
||||||
src: "/tmp/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
|
|
||||||
dest: "/tmp"
|
|
||||||
creates: "/tmp/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/apache_exporter"
|
|
||||||
delegate_to: localhost
|
|
||||||
check_mode: false
|
|
||||||
|
|
||||||
- name: Propagate apache_exporter binaries
|
|
||||||
become: true
|
|
||||||
copy:
|
|
||||||
src: "/tmp/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/apache_exporter"
|
|
||||||
dest: "{{prometheus_exporter_dir}}/apache_exporter"
|
|
||||||
mode: 0755
|
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify:
|
register: _download_binary
|
||||||
- restart apache exporter
|
until: _download_binary is succeeded
|
||||||
when: not ansible_check_mode
|
retries: 5
|
||||||
|
delay: 2
|
||||||
|
mode: "u=rwx,go=rx"
|
||||||
|
|
||||||
|
- name: make distribution directory
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
file:
|
||||||
|
path: "{{ apache_exporter_dist_dir }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "u=rwx,go=rx"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: untar tarball
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
unarchive:
|
||||||
|
src: "{{ prometheus_exporter_dist_dir }}/{{ apache_exporter_signature }}.tar.gz"
|
||||||
|
dest: "{{ prometheus_exporter_dist_dir }}"
|
||||||
|
remote_src: true
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "u=rwx,go=rx"
|
||||||
|
creates: "{{ apache_exporter_dist_dir }}/apache-prometheus-exporter"
|
||||||
|
|
||||||
|
- name: symlink
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
file:
|
||||||
|
src: "{{ apache_exporter_dist_dir }}/apache_exporter"
|
||||||
|
path: "{{ prometheus_exporter_dir }}/apache_exporter"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
force: true
|
||||||
|
state: link
|
||||||
|
notify: restart apache exporter
|
||||||
|
|
||||||
- name: Copy the apache_exporter systemd service file
|
- name: Copy the apache_exporter systemd service file
|
||||||
become: true
|
become: true
|
||||||
|
|
|
@ -51,6 +51,10 @@
|
||||||
dest: "{{ prometheus_exporter_dist_dir }}/{{ haproxy_exporter_signature }}.tar.gz"
|
dest: "{{ prometheus_exporter_dist_dir }}/{{ haproxy_exporter_signature }}.tar.gz"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
register: _download_binary
|
||||||
|
until: _download_binary is succeeded
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
mode: "u=rw,go=r"
|
mode: "u=rw,go=r"
|
||||||
|
|
||||||
- name: untar tarball
|
- name: untar tarball
|
||||||
|
|
|
@ -52,6 +52,10 @@
|
||||||
dest: "{{ prometheus_exporter_dist_dir }}/{{ nginx_exporter_signature }}.tar.gz"
|
dest: "{{ prometheus_exporter_dist_dir }}/{{ nginx_exporter_signature }}.tar.gz"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
register: _download_binary
|
||||||
|
until: _download_binary is succeeded
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
mode: "u=rwx,go=rx"
|
mode: "u=rwx,go=rx"
|
||||||
when: nginx_exporter_version is version('0.9.0', '>=')
|
when: nginx_exporter_version is version('0.9.0', '>=')
|
||||||
|
|
||||||
|
@ -64,6 +68,10 @@
|
||||||
dest: "{{ prometheus_exporter_dist_dir }}/{{ nginx_exporter_signature }}.tar.gz"
|
dest: "{{ prometheus_exporter_dist_dir }}/{{ nginx_exporter_signature }}.tar.gz"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
register: _download_binary
|
||||||
|
until: _download_binary is succeeded
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
mode: "u=rwx,go=rx"
|
mode: "u=rwx,go=rx"
|
||||||
when: nginx_exporter_version is version('0.8.0', '<=')
|
when: nginx_exporter_version is version('0.8.0', '<=')
|
||||||
|
|
||||||
|
@ -100,20 +108,6 @@
|
||||||
group: root
|
group: root
|
||||||
mode: "u=rwx,go=rx"
|
mode: "u=rwx,go=rx"
|
||||||
creates: "{{ nginx_exporter_dist_dir }}/nginx-prometheus-exporter"
|
creates: "{{ nginx_exporter_dist_dir }}/nginx-prometheus-exporter"
|
||||||
# when: nginx_exporter_version is version('0.9.0', '>=')
|
|
||||||
#
|
|
||||||
#- name: untar tarball alt
|
|
||||||
# become: true
|
|
||||||
# become_user: root
|
|
||||||
# unarchive:
|
|
||||||
# src: "{{ prometheus_exporter_dist_dir }}/{{ nginx_exporter_signature_alt }}.tar.gz"
|
|
||||||
# dest: "{{ nginx_exporter_dist_dir }}"
|
|
||||||
# remote_src: true
|
|
||||||
# owner: root
|
|
||||||
# group: root
|
|
||||||
# mode: "u=rwx,go=rx"
|
|
||||||
# creates: "{{ nginx_exporter_dist_dir }}/nginx-prometheus-exporter"
|
|
||||||
# when: nginx_exporter_version is version('0.8.0', '<=')
|
|
||||||
|
|
||||||
- name: symlink
|
- name: symlink
|
||||||
become: true
|
become: true
|
||||||
|
|
|
@ -329,7 +329,7 @@ $( function() {
|
||||||
if (data.indexOf('error:') != '-1') {
|
if (data.indexOf('error:') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error(data);
|
toastr.error(data);
|
||||||
} else if(data == 'no' || data == '' || data.indexOf('No') != '-1' || data.indexOf('No such file or directory') != '-1') {
|
} else if(data == 'no' || data == '' || data.indexOf('No') != '-1') {
|
||||||
$('#cur_haproxy_exp_ver').text('HAProxy exporter has been not installed');
|
$('#cur_haproxy_exp_ver').text('HAProxy exporter has been not installed');
|
||||||
} else {
|
} else {
|
||||||
$('#cur_haproxy_exp_ver').text(data);
|
$('#cur_haproxy_exp_ver').text(data);
|
||||||
|
@ -352,7 +352,7 @@ $( function() {
|
||||||
if (data.indexOf('error:') != '-1') {
|
if (data.indexOf('error:') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error(data);
|
toastr.error(data);
|
||||||
} else if(data == 'no' || data == '' || data.indexOf('No such file or directory') != '-1') {
|
} else if(data == 'no' || data == '' || data.indexOf('No') != '-1') {
|
||||||
$('#cur_nginx_exp_ver').text('NGINX exporter has not been installed');
|
$('#cur_nginx_exp_ver').text('NGINX exporter has not been installed');
|
||||||
} else {
|
} else {
|
||||||
$('#cur_nginx_exp_ver').text(data);
|
$('#cur_nginx_exp_ver').text(data);
|
||||||
|
@ -375,7 +375,7 @@ $( function() {
|
||||||
if (data.indexOf('error:') != '-1') {
|
if (data.indexOf('error:') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error(data);
|
toastr.error(data);
|
||||||
} else if(data == 'no' || data == '' || data.indexOf('No such file or directory') != '-1') {
|
} else if(data == 'no' || data == '' || data.indexOf('No') != '-1') {
|
||||||
$('#cur_apache_exp_ver').text('Apache exporter has not been installed');
|
$('#cur_apache_exp_ver').text('Apache exporter has not been installed');
|
||||||
} else {
|
} else {
|
||||||
$('#cur_apache_exp_ver').text(data);
|
$('#cur_apache_exp_ver').text(data);
|
||||||
|
|
Loading…
Reference in New Issue