diff --git a/.gitignore b/.gitignore index 52308e9..ddd4f5a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .molecule .cache **__pycache__** +.pytest_cache/ diff --git a/tasks/metrics.yml b/tasks/metrics.yml index 6ea1350..5f0cdd2 100644 --- a/tasks/metrics.yml +++ b/tasks/metrics.yml @@ -1,15 +1,24 @@ --- -- name: Download nginx_exporter from github and compile it locally +- name: get nginx exporter become: no - shell: "export GOPATH=/tmp/nginx_exporter; go get github.com/discordianfish/nginx_exporter" - args: - creates: /tmp/nginx_exporter + get_url: + url: https://github.com/nginxinc/nginx-prometheus-exporter/releases/download/v0.1.0/nginx-prometheus-exporter-0.1.0-linux-amd64.tar.gz + dest: /tmp/nginx_exporter.tar.gz + mode: 0775 run_once: yes delegate_to: localhost -- name: install prometheus exporter +- name: extract nginx_exporter + become: no + unarchive: + src: /tmp/nginx_exporter.tar.gz + dest: /tmp + run_once: yes + delegate_to: localhost + +- name: install nginx exporter copy: - src: /tmp/nginx_exporter/bin/nginx_exporter + src: /tmp/nginx-prometheus-exporter/ dest: /opt/nginx_exporter mode: 0755 diff --git a/templates/nginx_exporter.service.j2 b/templates/nginx_exporter.service.j2 index 44ecca2..f9bf0ec 100644 --- a/templates/nginx_exporter.service.j2 +++ b/templates/nginx_exporter.service.j2 @@ -6,7 +6,7 @@ After=network.target [Service] Type=simple ExecReload=/bin/kill -HUP $MAINPID -ExecStart=/opt/nginx_exporter -nginx.scrape_uri=http://127.0.0.1:{{ nginx_status_port }}/nginx_status +ExecStart=/opt/nginx_exporter -nginx.scrape-uri=http://127.0.0.1:{{ nginx_status_port }}/nginx_status SyslogIdentifier=nginx_exporter Restart=always