Skip to content

Commit

Permalink
nginx: Add netdata collectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
JGoutin committed Aug 16, 2024
1 parent 2d651d4 commit 1c9f13d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions roles/nginx/files/netdata_httpcheck.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jobs:
- name: local
url: https://127.0.0.1
tls_skip_verify: yes
4 changes: 4 additions & 0 deletions roles/nginx/files/netdata_nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jobs:
- name: local
url: https://127.0.0.1/stub_status
tls_skip_verify: yes
4 changes: 4 additions & 0 deletions roles/nginx/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
- name: Firewall configuration
ansible.builtin.include_tasks: firewall.yml

- name: Netdata configuration
ansible.builtin.include_tasks: netdata.yml
when: common_netdata_enable | bool

- name: Ensure Nginx "rpmnew" and "rpmsave" files are absent
ansible.builtin.file:
path: "{{ item }}"
Expand Down
22 changes: 22 additions & 0 deletions roles/nginx/tasks/netdata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

- name: Ensure Netdata configuration directory is present
ansible.builtin.file:
path: /etc/netdata/go.d
state: directory
mode: '0755'

- name: Ensure Netdata collectors are configured
ansible.builtin.copy:
src: "netdata_{{ item }}.conf"
dest: "/etc/netdata/go.d/{{ item }}.conf"
mode: '0644'
with_items:
- nginx
- httpcheck

- name: Ensure Systemd Netdata service is restarted
ansible.builtin.systemd:
name: netdata
state: restarted
changed_when: false
10 changes: 10 additions & 0 deletions roles/nginx/templates/nginx-site.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ server {
# replace with the IP address of your resolver
resolver {{ nginx_resolver }};

{% if common_netdata_enable is defined -%}
# Local status page for monitoring
location = /stub_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
{%- endif %}

# Starting Extra security configuration
# =====================================

Expand Down

0 comments on commit 1c9f13d

Please sign in to comment.