diff --git a/defaults/main.yml b/defaults/main.yml index 131ce93..44d43ff 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,7 +15,7 @@ prometheus_mongodb_exporter_port: 27017 prometheus_phpfpm_sockets_directory: "/run/php/" prometheus_phpfpm_sockets_directory_additional: "/var/run/php*.sock" -prometheus_php-opcache_exporter_fcgi-uri: "unix:///var/run/php-000-default.sock" +prometheus_opcache_exporter_fcgi-uri: "unix:///var/run/php-000-default.sock" prometheus_postgres_exporter_systemd_user: "postgres" prometheus_postgres_exporter_host: "/var/run/postgresql/" diff --git a/handlers/main.yml b/handlers/main.yml index a518a1d..346ed8a 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -40,9 +40,9 @@ enabled: yes tags: ['prometheus'] -- name: 'prometheus | php-opcache exporter | restart service' +- name: 'prometheus | opcache exporter | restart service' systemd: - name: prometheus-php-opcache-exporter.service + name: prometheus-opcache-exporter.service state: restarted enabled: yes tags: ['prometheus'] diff --git a/tasks/main.yml b/tasks/main.yml index c23e7d3..618c4b0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -36,9 +36,9 @@ - "'phpfpm' in prometheus_exporter_packages" - name: 'prometheus | PHP opcache exporter' - include_tasks: 'php-opcache_exporter.yml' + include_tasks: 'opcache_exporter.yml' when: - - "'php-opcache' in prometheus_exporter_packages" + - "'opcache' in prometheus_exporter_packages" - name: 'prometheus | Apache exporter' include_tasks: 'apache_exporter.yml' diff --git a/tasks/php-opcache_exporter.yml b/tasks/opcache_exporter.yml similarity index 100% rename from tasks/php-opcache_exporter.yml rename to tasks/opcache_exporter.yml diff --git a/templates/conf/prometheus-php-opcache-exporter.j2 b/templates/conf/prometheus-php-opcache-exporter.j2 index 93babce..0b99670 100644 --- a/templates/conf/prometheus-php-opcache-exporter.j2 +++ b/templates/conf/prometheus-php-opcache-exporter.j2 @@ -1,4 +1,4 @@ # {{ ansible_managed }} -{% if (prometheus_php-opcache_exporter_fcgi-uri is defined) %} -ARGS='"--opcache.fcgi-uri="{{ prometheus_php-opcache_exporter_fcgi-uri }}"' +{% if (prometheus_opcache_exporter_fcgi-uri is defined) %} +ARGS='"--opcache.fcgi-uri="{{ prometheus_opcache_exporter_fcgi-uri }}"' {% endif %} diff --git a/templates/conf/prometheus.yml.j2 b/templates/conf/prometheus.yml.j2 index 7b44a42..e842c52 100644 --- a/templates/conf/prometheus.yml.j2 +++ b/templates/conf/prometheus.yml.j2 @@ -124,14 +124,14 @@ scrape_configs: {% endfor %} {% endif %} -{% if prometheus_php-opcache_exporter_targets is defined %} +{% if prometheus_opcache_exporter_targets is defined %} # PHP-FPM exporter # - - job_name: php-opcache + - job_name: opcache scrape_interval: 30s scrape_timeout: 10s static_configs: - targets: -{% for target in prometheus_php-opcache_exporter_targets %} +{% for target in prometheus_opcache_exporter_targets %} - {{ target }}:9101 {% endfor %} {% endif %} diff --git a/templates/systemd/prometheus-php-opcache-exporter.service.j2 b/templates/systemd/prometheus-php-opcache-exporter.service.j2 index 3e76aa2..f19caf7 100644 --- a/templates/systemd/prometheus-php-opcache-exporter.service.j2 +++ b/templates/systemd/prometheus-php-opcache-exporter.service.j2 @@ -4,8 +4,8 @@ After=network.target [Service] Type=simple -ExecStart=/usr/local/bin/prometheus-php-opcache-exporter -EnvironmentFile=/etc/default/prometheus-php-opcache-exporter +ExecStart=/usr/local/bin/prometheus-opcache-exporter +EnvironmentFile=/etc/default/prometheus-opcache-exporter [Install] WantedBy=multi-user.target