diff --git a/ansible/playbooks/tasks/proxmox/config/main.yml b/ansible/playbooks/tasks/proxmox/config/main.yml index 95277fd6..cfb6dd02 100644 --- a/ansible/playbooks/tasks/proxmox/config/main.yml +++ b/ansible/playbooks/tasks/proxmox/config/main.yml @@ -47,7 +47,7 @@ ansible.builtin.include_tasks: qm_restart_cron.yml tags: - qm_restart_cron -- name: Proxmox Configs | Node Exporter Service - ansible.builtin.include_tasks: node-exporter.yml +- name: Proxmox Configs | Prometheus Exporters + ansible.builtin.include_tasks: prometheus-exporters.yml tags: - - node-exporter + - prometheus-exporter diff --git a/ansible/playbooks/tasks/proxmox/config/node-exporter.yml b/ansible/playbooks/tasks/proxmox/config/prometheus-exporters.yml similarity index 65% rename from ansible/playbooks/tasks/proxmox/config/node-exporter.yml rename to ansible/playbooks/tasks/proxmox/config/prometheus-exporters.yml index 47557506..11753099 100644 --- a/ansible/playbooks/tasks/proxmox/config/node-exporter.yml +++ b/ansible/playbooks/tasks/proxmox/config/prometheus-exporters.yml @@ -1,19 +1,19 @@ --- -- name: Proxmox Configs | Node Exporter Service +- name: Proxmox Configs | Node Exporter block: - - name: Proxmox Configs | Node Exporter Service | Download tarball + - name: Proxmox Configs | Node Exporter | Download tarball ansible.builtin.get_url: url: https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-amd64.tar.gz dest: /tmp vars: - - name: Proxmox Configs | Node Exporter Service | Unarchive + - name: Proxmox Configs | Node Exporter | Unarchive ansible.builtin.unarchive: remote_src: true src: /tmp/node_exporter-{{ node_exporter_version }}.linux-amd64.tar.gz dest: /tmp - - name: Proxmox Configs | Node Exporter Service | Move to /usr/local/bin + - name: Proxmox Configs | Node Exporter | Move to /usr/local/bin ansible.builtin.copy: src: /tmp/node_exporter-{{ node_exporter_version }}.linux-amd64/node_exporter dest: /usr/local/bin/node_exporter @@ -22,7 +22,7 @@ group: root mode: 0755 - - name: Proxmox Configs | Node Exporter Service | Install unit file to systemd + - name: Proxmox Configs | Node Exporter | Install unit file to systemd ansible.builtin.copy: dest: /etc/systemd/system/node-exporter.service owner: root @@ -43,7 +43,7 @@ [Install] WantedBy=multi-user.target - - name: Proxmox Configs | Node Exporter Service | Configure systemd to use service + - name: Proxmox Configs | Node Exporter | Configure systemd to use service ansible.builtin.systemd: daemon_reload: true enabled: true @@ -140,3 +140,53 @@ name: pve-exporter.service vars: pve_exporter_version: 3.0.2 + +- name: Proxmox Configs | Smartctl Exporter + block: + - name: Proxmox Configs | Smartctl Exporter | Download binary + ansible.builtin.get_url: + url: https://github.com/prometheus-community/smartctl_exporter/releases/download/v{{ smartctl_exporter_version }}/smartctl_exporter-{{ smartctl_exporter_version }}.linux-amd64.tar.gz + dest: /tmp + + - name: Proxmox Configs | Smartctl Exporter | Unarchive + ansible.builtin.unarchive: + remote_src: true + src: /tmp/smartctl_exporter-{{ smartctl_exporter_version }}.linux-amd64.tar.gz + dest: /tmp + + - name: Proxmox Configs | Smartctl Exporter | Move to /usr/local/bin + ansible.builtin.copy: + src: /tmp/smartctl_exporter-{{ smartctl_exporter_version }}.linux-amd64/smartctl_exporter + dest: /usr/local/bin/smartctl_exporter + remote_src: true + owner: root + group: root + mode: 0755 + + # TODO: change this from nobody to proper service accounts + - name: Proxmox Configs | Smartctl Exporter | Install unit file to systemd + ansible.builtin.copy: + dest: "/etc/systemd/system/smartctl-exporter.service" + mode: 0644 + content: | + # Ansible managed + [Unit] + Description=Smartctl Exporter + After=network.target + [Service] + Type=simple + User=root + ExecStart=/usr/local/bin/smartctl_exporter + SyslogIdentifier=smartctl_exporter + Restart=always + [Install] + WantedBy=multi-user.target + + - name: Proxmox Configs | Smartctl Exporter | Configure systemd to use service + ansible.builtin.systemd: + daemon_reload: true + enabled: true + state: started + name: smartctl-exporter.service + vars: + smartctl_exporter_version: 0.11.0 diff --git a/kubernetes/apps/monitoring/kube-prometheus-stack/app/scrapeconfigs/proxmox-exporters.yaml b/kubernetes/apps/monitoring/kube-prometheus-stack/app/scrapeconfigs/proxmox-exporters.yaml index 02f15a69..d198a753 100644 --- a/kubernetes/apps/monitoring/kube-prometheus-stack/app/scrapeconfigs/proxmox-exporters.yaml +++ b/kubernetes/apps/monitoring/kube-prometheus-stack/app/scrapeconfigs/proxmox-exporters.yaml @@ -10,4 +10,5 @@ spec: - 192.168.5.10:9100 # node-exporter - 192.168.5.10:8080 # cadvisor - 192.168.5.10:9221 # pve-exporter + - 192.168.5.10:9633 # smartctl exporter metricsPath: /metrics