From e4d1bffa5d9b8a8f63e43f4ff37aaa04690b80c0 Mon Sep 17 00:00:00 2001 From: ahochor Date: Wed, 7 Nov 2018 12:42:44 +0100 Subject: [PATCH 1/8] nginx exporter fix --- tasks/metrics.yml | 23 ++++++++++++++++++++--- templates/nginx_exporter.service.j2 | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tasks/metrics.yml b/tasks/metrics.yml index 6ea1350..8f114fa 100644 --- a/tasks/metrics.yml +++ b/tasks/metrics.yml @@ -1,15 +1,32 @@ --- - name: Download nginx_exporter from github and compile it locally become: no - shell: "export GOPATH=/tmp/nginx_exporter; go get github.com/discordianfish/nginx_exporter" + shell: "export GOPATH=/tmp/nginx_exporter; go get github.com/nginxinc/nginx-prometheus-exporter" args: creates: /tmp/nginx_exporter run_once: yes delegate_to: localhost +- name: check if build_exporter has been build + become: no + stat: + path: /tmp/nginx_exporter/src/github.com/nginxinc/nginx-prometheus-exporter/nginx-prometheus-exporter + register: result + run_once: yes + delegate_to: localhost + +- name: build nginx_exporter + become: no + shell: "export GOPATH=/tmp/nginx_exporter; make" + args: + chdir: /tmp/nginx_exporter/src/github.com/nginxinc/nginx-prometheus-exporter/ + run_once: yes + delegate_to: localhost + when: result.stat.exists==False + - name: install prometheus exporter copy: - src: /tmp/nginx_exporter/bin/nginx_exporter + src: /tmp/nginx_exporter/src/github.com/nginxinc/nginx-prometheus-exporter/nginx-prometheus-exporter dest: /opt/nginx_exporter mode: 0755 @@ -30,4 +47,4 @@ - name: ensure metrics service is enabled service: name: nginx_exporter - enabled: yes + enabled: yes \ No newline at end of file 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 From 0af7135e4b227c661e60d302994488fd6601aaef Mon Sep 17 00:00:00 2001 From: ahochor Date: Wed, 7 Nov 2018 14:05:36 +0100 Subject: [PATCH 2/8] travis gopath --- .pytest_cache/README.md | 8 ++++++++ .pytest_cache/v/cache/lastfailed | 3 +++ .pytest_cache/v/cache/nodeids | 1 + .travis.yml | 1 + tasks/metrics.yml | 4 ++-- 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 .pytest_cache/README.md create mode 100644 .pytest_cache/v/cache/lastfailed create mode 100644 .pytest_cache/v/cache/nodeids diff --git a/.pytest_cache/README.md b/.pytest_cache/README.md new file mode 100644 index 0000000..bb78ba0 --- /dev/null +++ b/.pytest_cache/README.md @@ -0,0 +1,8 @@ +# pytest cache directory # + +This directory contains data from the pytest's cache plugin, +which provides the `--lf` and `--ff` options, as well as the `cache` fixture. + +**Do not** commit this to version control. + +See [the docs](https://docs.pytest.org/en/latest/cache.html) for more information. diff --git a/.pytest_cache/v/cache/lastfailed b/.pytest_cache/v/cache/lastfailed new file mode 100644 index 0000000..944b87e --- /dev/null +++ b/.pytest_cache/v/cache/lastfailed @@ -0,0 +1,3 @@ +{ + "tests/test_default.py": true +} \ No newline at end of file diff --git a/.pytest_cache/v/cache/nodeids b/.pytest_cache/v/cache/nodeids new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/.pytest_cache/v/cache/nodeids @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index ae30b3f..d339d60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ env: - ANSIBLE=2.2.3 - ANSIBLE=2.3.2 - ANSIBLE=2.4.2 + - GOPATH=/tmp/nginx_exporter install: - pip install ansible==${ANSIBLE} ansible-lint>=3.4.15 molecule==1.25.0 docker git-semver testinfra>=1.7.0 script: diff --git a/tasks/metrics.yml b/tasks/metrics.yml index 8f114fa..410a9dc 100644 --- a/tasks/metrics.yml +++ b/tasks/metrics.yml @@ -1,5 +1,5 @@ --- -- name: Download nginx_exporter from github and compile it locally +- name: download nginx_exporter from github and compile it locally become: no shell: "export GOPATH=/tmp/nginx_exporter; go get github.com/nginxinc/nginx-prometheus-exporter" args: @@ -22,7 +22,7 @@ chdir: /tmp/nginx_exporter/src/github.com/nginxinc/nginx-prometheus-exporter/ run_once: yes delegate_to: localhost - when: result.stat.exists==False + when: result.stat.exists == False - name: install prometheus exporter copy: From b2bc3171fb5f953c0f47b8f96d5ff8590b57a790 Mon Sep 17 00:00:00 2001 From: ahochor Date: Wed, 7 Nov 2018 14:07:33 +0100 Subject: [PATCH 3/8] gopath travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ae30b3f..d339d60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ env: - ANSIBLE=2.2.3 - ANSIBLE=2.3.2 - ANSIBLE=2.4.2 + - GOPATH=/tmp/nginx_exporter install: - pip install ansible==${ANSIBLE} ansible-lint>=3.4.15 molecule==1.25.0 docker git-semver testinfra>=1.7.0 script: From 46306517386f0cc183600473280157eab39e8137 Mon Sep 17 00:00:00 2001 From: ahochor Date: Wed, 7 Nov 2018 14:11:14 +0100 Subject: [PATCH 4/8] removed env travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d339d60..ae30b3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ env: - ANSIBLE=2.2.3 - ANSIBLE=2.3.2 - ANSIBLE=2.4.2 - - GOPATH=/tmp/nginx_exporter install: - pip install ansible==${ANSIBLE} ansible-lint>=3.4.15 molecule==1.25.0 docker git-semver testinfra>=1.7.0 script: From 2c9b10e56758e363b12fdd74efe401ab501004b7 Mon Sep 17 00:00:00 2001 From: ahochor Date: Wed, 7 Nov 2018 14:12:37 +0100 Subject: [PATCH 5/8] removed env travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d339d60..ae30b3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ env: - ANSIBLE=2.2.3 - ANSIBLE=2.3.2 - ANSIBLE=2.4.2 - - GOPATH=/tmp/nginx_exporter install: - pip install ansible==${ANSIBLE} ansible-lint>=3.4.15 molecule==1.25.0 docker git-semver testinfra>=1.7.0 script: From 34198347b01d72dc664cd0e9bee7ae0c7655d200 Mon Sep 17 00:00:00 2001 From: ahochor Date: Thu, 8 Nov 2018 09:30:26 +0100 Subject: [PATCH 6/8] metrics --- tasks/metrics.yml | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/tasks/metrics.yml b/tasks/metrics.yml index 410a9dc..5f0cdd2 100644 --- a/tasks/metrics.yml +++ b/tasks/metrics.yml @@ -1,32 +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/nginxinc/nginx-prometheus-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: check if build_exporter has been build +- name: extract nginx_exporter become: no - stat: - path: /tmp/nginx_exporter/src/github.com/nginxinc/nginx-prometheus-exporter/nginx-prometheus-exporter - register: result + unarchive: + src: /tmp/nginx_exporter.tar.gz + dest: /tmp run_once: yes delegate_to: localhost -- name: build nginx_exporter - become: no - shell: "export GOPATH=/tmp/nginx_exporter; make" - args: - chdir: /tmp/nginx_exporter/src/github.com/nginxinc/nginx-prometheus-exporter/ - run_once: yes - delegate_to: localhost - when: result.stat.exists == False - -- name: install prometheus exporter +- name: install nginx exporter copy: - src: /tmp/nginx_exporter/src/github.com/nginxinc/nginx-prometheus-exporter/nginx-prometheus-exporter + src: /tmp/nginx-prometheus-exporter/ dest: /opt/nginx_exporter mode: 0755 @@ -47,4 +39,4 @@ - name: ensure metrics service is enabled service: name: nginx_exporter - enabled: yes \ No newline at end of file + enabled: yes From fbacf3b5f1a50609836bebb26991222b7b60a489 Mon Sep 17 00:00:00 2001 From: agatahochor Date: Thu, 8 Nov 2018 11:37:39 +0100 Subject: [PATCH 7/8] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 52308e9..ddd4f5a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .molecule .cache **__pycache__** +.pytest_cache/ From 2bf093ef1fb49ed53f2b5cf5476c1c7e91a93129 Mon Sep 17 00:00:00 2001 From: ahochor Date: Thu, 8 Nov 2018 11:39:26 +0100 Subject: [PATCH 8/8] removed .pytest_cache --- .pytest_cache/README.md | 8 -------- .pytest_cache/v/cache/lastfailed | 3 --- .pytest_cache/v/cache/nodeids | 1 - 3 files changed, 12 deletions(-) delete mode 100644 .pytest_cache/README.md delete mode 100644 .pytest_cache/v/cache/lastfailed delete mode 100644 .pytest_cache/v/cache/nodeids diff --git a/.pytest_cache/README.md b/.pytest_cache/README.md deleted file mode 100644 index bb78ba0..0000000 --- a/.pytest_cache/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# pytest cache directory # - -This directory contains data from the pytest's cache plugin, -which provides the `--lf` and `--ff` options, as well as the `cache` fixture. - -**Do not** commit this to version control. - -See [the docs](https://docs.pytest.org/en/latest/cache.html) for more information. diff --git a/.pytest_cache/v/cache/lastfailed b/.pytest_cache/v/cache/lastfailed deleted file mode 100644 index 944b87e..0000000 --- a/.pytest_cache/v/cache/lastfailed +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tests/test_default.py": true -} \ No newline at end of file diff --git a/.pytest_cache/v/cache/nodeids b/.pytest_cache/v/cache/nodeids deleted file mode 100644 index 0637a08..0000000 --- a/.pytest_cache/v/cache/nodeids +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file