add php exporter
This commit is contained in:
parent
bca9798942
commit
f02c1270fe
44
README.md
44
README.md
@ -12,28 +12,28 @@ It has been tested on :
|
||||
Role variables
|
||||
--------------
|
||||
|
||||
| Variable | Type | Choices | Default | Comment |
|
||||
|----------------------------------------------|---------|----------------------------------------------|-------------|-----------------|
|
||||
| prometheus_server_enable | string | true / false | | |
|
||||
| prometheus_server_version | string | | latest | |
|
||||
| prometheus_server_monitor | string | | | |
|
||||
| prometheus_server_global_scrape_interval | string | | 15 | |
|
||||
| prometheus_server_global_evaluation_interval | string | | 15 | |
|
||||
| prometheus_server_job_name | string | | prometheus | |
|
||||
| prometheus_server_scrape_interval | string | | 5 | |
|
||||
| prometheus_server_scrape_timeout | string | | 5 | |
|
||||
| prometheus_exporter_packages | list | node / mysqld / postgresql / mongodb /phpfpm | | |
|
||||
| prometheus_node_exporter_targets | list | | | |
|
||||
| prometheus_mysqld_exporter_targets | list | | | |
|
||||
| prometheus_mongodb_exporter_targets | list | | | |
|
||||
| prometheus_postgres_exporter_targets | list | | | |
|
||||
| prometheus_mysqld_exporter_user | string | | | |
|
||||
| prometheus_mysqld_exporter_password | string | | | |
|
||||
| prometheus_mongodb_exporter_host | string | | localhost | |
|
||||
| prometheus_mongodb_exporter_port | string | | 27017 | |
|
||||
| prometheus_mongodb_exporter_user | string | | | |
|
||||
| prometheus_mongodb_exporter_pass | string | | | |
|
||||
| prometheus_server_version | string | | latest | |
|
||||
| Variable | Type | Choices | Default | Comment |
|
||||
|----------------------------------------------|---------|--------------------------------------------------------|-------------|-----------------|
|
||||
| prometheus_server_enable | string | true / false | | |
|
||||
| prometheus_server_version | string | | latest | |
|
||||
| prometheus_server_monitor | string | | | |
|
||||
| prometheus_server_global_scrape_interval | string | | 15 | |
|
||||
| prometheus_server_global_evaluation_interval | string | | 15 | |
|
||||
| prometheus_server_job_name | string | | prometheus | |
|
||||
| prometheus_server_scrape_interval | string | | 5 | |
|
||||
| prometheus_server_scrape_timeout | string | | 5 | |
|
||||
| prometheus_exporter_packages | list | node / mysqld / postgresql / mongodb / phpfpm / apache | | |
|
||||
| prometheus_node_exporter_targets | list | | | |
|
||||
| prometheus_mysqld_exporter_targets | list | | | |
|
||||
| prometheus_mongodb_exporter_targets | list | | | |
|
||||
| prometheus_postgres_exporter_targets | list | | | |
|
||||
| prometheus_mysqld_exporter_user | string | | | |
|
||||
| prometheus_mysqld_exporter_password | string | | | |
|
||||
| prometheus_mongodb_exporter_host | string | | localhost | |
|
||||
| prometheus_mongodb_exporter_port | string | | 27017 | |
|
||||
| prometheus_mongodb_exporter_user | string | | | |
|
||||
| prometheus_mongodb_exporter_pass | string | | | |
|
||||
| prometheus_server_version | string | | latest | |
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
@ -1,6 +1,8 @@
|
||||
---
|
||||
awh_services_docker_pull: "no"
|
||||
|
||||
prometheus_apache_port: 8080
|
||||
|
||||
prometheus_exporter_packages: []
|
||||
|
||||
prometheus_nodes_ip:
|
||||
|
@ -39,3 +39,10 @@
|
||||
state: restarted
|
||||
enabled: yes
|
||||
tags: ['prometheus']
|
||||
|
||||
- name: 'prometheus | apache exporter | restart service'
|
||||
systemd:
|
||||
name: prometheus-apache-exporter.service
|
||||
state: restarted
|
||||
enabled: yes
|
||||
tags: ['prometheus']
|
||||
|
51
tasks/apache_exporter.yml
Normal file
51
tasks/apache_exporter.yml
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
- name: 'prometheus | apache exporter | get latest release from GitHub'
|
||||
shell: curl --silent "https://api.github.com/repos/Lusitaniae/apache_exporter/releases/latest" | jq -r .tag_name | sed "s/v//"
|
||||
args:
|
||||
warn: false
|
||||
register: prometheus_apache_exporter_latest_version
|
||||
run_once: true
|
||||
|
||||
- name: 'prometheus | apache exporter | download'
|
||||
get_url:
|
||||
url: https://github.com/Lusitaniae/apache_exporter/releases/download/v{{ prometheus_apache_exporter_version|default(prometheus_apache_exporter_latest_version.stdout) }}/apache_exporter-{{ prometheus_apache_exporter_version|default(prometheus_apache_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
|
||||
dest: /tmp
|
||||
|
||||
- name: 'prometheus | apache exporter | unarchive'
|
||||
unarchive:
|
||||
remote_src: yes
|
||||
src: /tmp/apache_exporter-{{ prometheus_apache_exporter_version|default(prometheus_apache_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
|
||||
dest: /tmp
|
||||
|
||||
- name: 'prometheus | apache exporter | move to /usr/local/bin'
|
||||
copy:
|
||||
src: /tmp/apache_exporter-{{ prometheus_apache_exporter_version|default(prometheus_apache_exporter_latest_version.stdout) }}.linux-amd64/apache_exporter
|
||||
dest: /usr/local/bin/prometheus-apache-exporter
|
||||
remote_src: yes
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
notify:
|
||||
- 'prometheus | apache exporter | restart service'
|
||||
|
||||
- name: 'prometheus | apache exporter | install startup script'
|
||||
template:
|
||||
src: scripts/prometheus-apache-exporter-script.sh.j2
|
||||
dest: /usr/local/bin/prometheus-apache-exporter-script.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
- name: 'prometheus | apache exporter | install unit file to systemd'
|
||||
template:
|
||||
src: systemd/prometheus-apache-exporter.service.j2
|
||||
dest: /etc/systemd/system/prometheus-apache-exporter.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
|
||||
- name: 'prometheus | apache exporter | configure systemd to use service'
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
name: prometheus-apache-exporter.service
|
@ -34,3 +34,8 @@
|
||||
include_tasks: 'phpfpm_exporter.yml'
|
||||
when:
|
||||
- "'phpfpm' in prometheus_exporter_packages"
|
||||
|
||||
- name: 'prometheus | Apache exporter'
|
||||
include_tasks: 'apache_exporter.yml'
|
||||
when:
|
||||
- "'apache' in prometheus_exporter_packages"
|
||||
|
10
templates/systemd/prometheus-apache-exporter.service.j2
Normal file
10
templates/systemd/prometheus-apache-exporter.service.j2
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Prometheus Apache Exporter
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/prometheus-apache-exporter --scrape_uri="http://localhost:{{ prometheus_apache_port }}/server-status/?auto"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
x
Reference in New Issue
Block a user