From bc603de8668266fb9c586ed0aa51cab2c8e98790 Mon Sep 17 00:00:00 2001 From: Perflyst Date: Tue, 9 Mar 2021 18:41:33 +0100 Subject: [PATCH] Add metrics --- group_vars/all/vault | 19 ++++++++++------- group_vars/main/main.yml | 2 ++ host_vars/invidious.io/main.yml | 36 +++++++++++++++++++++++++++++++++ main.yml | 17 ++++++++++++++++ templates/Caddyfile.j2 | 6 ++++++ 5 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 host_vars/invidious.io/main.yml diff --git a/group_vars/all/vault b/group_vars/all/vault index 52f6b44..fdfe898 100644 --- a/group_vars/all/vault +++ b/group_vars/all/vault @@ -1,8 +1,13 @@ $ANSIBLE_VAULT;1.1;AES256 -30613534346431333631646634333061336363386330343564323661356666663233656137343132 -3034323166623230643138663761386234393537626262300a373139366231623230343361353937 -37663037323733623561356130373834396136336433636338646635666330666437323564636537 -3731636465626463300a613263333138613230346639646337313332366262613630643164666431 -34636632643161383436326338646366323031363237343965336633343131353165613961653063 -65316162613535353432613962353535333631326166383035366532366564653435613835356634 -396466653535653563393632313736613735 +39303330616163326665373337326635386164616335626366333638653464303532643530333762 +6636626430613433623534373263633663303431316339640a613930623530623336373663323038 +34666363393733363736323166343138656364373439366332623930633635616631386533306533 +3666663833353931360a636163646163363661666330633636353532323333386432633037653131 +65343530643931303834633961633934613037396336646439663163326635656238623936343165 +66386165653839323231333761343663613965326538303032363935643433306366643763393665 +30333033626162356564393439643866356266393362643664646365373535613764366130346438 +33313330613163623339386130653032333962343235653135653431376165656163336531663162 +61653763663162663933373236326365343365653233643830613237626639316666386530386434 +33633136393637343863306261396334333533643233633236353531663066613637653236316632 +31333435333835346364663638656266643230303163656362336566653638633361373532653834 +34396162656135333337 diff --git a/group_vars/main/main.yml b/group_vars/main/main.yml index b4bcd41..b130325 100644 --- a/group_vars/main/main.yml +++ b/group_vars/main/main.yml @@ -1,3 +1,4 @@ +--- ansible_python_interpreter: /usr/bin/python3 ansible_user: root ansible_port: 233 @@ -11,6 +12,7 @@ apt_packages: - net-tools - python3-setuptools - jq + - prometheus-node-exporter pip_install_packages: - name: docker diff --git a/host_vars/invidious.io/main.yml b/host_vars/invidious.io/main.yml new file mode 100644 index 0000000..e6e4e03 --- /dev/null +++ b/host_vars/invidious.io/main.yml @@ -0,0 +1,36 @@ +--- +prometheus_web_listen_address: "127.0.0.1:9090" +prometheus_scrape_configs: + - job_name: "prometheus" + static_configs: + - targets: ['localhost:9090'] + - job_name: "node" + static_configs: + - targets: ['localhost:9100'] + - job_name: "caddy" + static_configs: + - targets: ['127.0.0.1:2019'] + +grafana_url: "https://grafana.invidious.io" +grafana_domain: grafana.invidious.io +grafana_address: 127.0.0.1 +grafana_port: 2000 +grafana_security: + admin_user: admin + admin_password: "{{ vault_grafana_admin_password }}" + disable_gravatar: true + cookie_secure: true +grafana_auth: + anonymous: + enabled: true +grafana_datasources: + - name: Prometheus + type: prometheus + url: http://localhost:9090 +grafana_dashboards: + - dashboard_id: '1860' + revision_id: '22' + datasource: 'Prometheus' + - dashboard_id: '13460' + revision_id: '2' + datasource: 'Prometheus' diff --git a/main.yml b/main.yml index 570d7fd..e3923c5 100644 --- a/main.yml +++ b/main.yml @@ -27,11 +27,28 @@ name: "{{ apt_packages }}" tags: [apt,base] + - name: Bind node exporter to localhost + ansible.builtin.lineinfile: + path: /etc/default/prometheus-node-exporter + regexp: '^ARGS=' + line: ARGS=--web.listen-address=localhost:9100 + tags: [apt,base] + - name: unattended-upgrades import_role: name: jvn.unattended-upgrades tags: [unattended-upgrades] + - name: prometheus + import_role: + name: cloudalchemy.prometheus + tags: [prometheus] + + - name: grafana + import_role: + name: cloudalchemy.grafana + tags: [grafana] + - name: pip import_role: name: geerlingguy.pip diff --git a/templates/Caddyfile.j2 b/templates/Caddyfile.j2 index 22fe42c..1edd44a 100644 --- a/templates/Caddyfile.j2 +++ b/templates/Caddyfile.j2 @@ -6,6 +6,7 @@ body "User-agent: * Disallow: / " +} log { output file /var/log/caddy/access.log { roll_size 500mb @@ -68,3 +69,8 @@ docs.invidious.io { import common reverse_proxy http://127.0.0.1:3001 } + +grafana.invidious.io { + import common + reverse_proxy http://127.0.0.1:2000 +}