Browse Source

Added nvidia_smi_exporter for prometheus

pull/8/head
Egon Rijpkema 4 years ago
parent
commit
fb3b3399df
  1. 1
      ansible.cfg
  2. 5
      nvidia_smi_exporter.yml
  3. 5
      promtools/Dockerfile
  4. 36
      roles/nvidia_smi_exporter/tasks/main.yml
  5. 10
      roles/nvidia_smi_exporter/templates/nvidia-smi-exporter.service

1
ansible.cfg

@ -2,3 +2,4 @@ @@ -2,3 +2,4 @@
inventory = hosts
host_key_checking = False
forks = 20
stdout_callback = debug

5
nvidia_smi_exporter.yml

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
---
- hosts: gpu_node
become: True
roles:
- nvidia_smi_exporter

5
promtools/Dockerfile

@ -24,4 +24,9 @@ RUN go get github.com/HewlettPackard/lustre_exporter && \ @@ -24,4 +24,9 @@ RUN go get github.com/HewlettPackard/lustre_exporter && \
go build && \
cp /go/bin/lustre_exporter /results
RUN go get git.webhosting.rug.nl/HPC/nvidia_smi_exporter.git && \
cd "${GOPATH-$HOME/go}/src/git.webhosting.rug.nl/HPC/nvidia_smi_exporter.git" && \
go build && \
cp nvidia_smi_exporter.git /results/nvidia_smi_exporter
CMD /go/bin/proxy

36
roles/nvidia_smi_exporter/tasks/main.yml

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
---
- file:
path: /usr/local/prometheus
state: directory
mode: 0755
- name: Install smi exporter
copy:
src: "{{ playbook_dir }}/promtools/results/nvidia_smi_exporter"
dest: /usr/local/prometheus/nvidia_smi_exporter
mode: 0755
- name: Install service files.
template:
src: templates/nvidia-smi-exporter.service
dest: /etc/systemd/system/nvidia-smi-exporter.service
mode: 644
owner: root
group: root
tags:
- service-files
- name: install service files
command: systemctl daemon-reload
- name: enable service at boot
systemd:
name: nvidia-smi-exporter.service
enabled: yes
- name: make sure servcies are started.
systemd:
name: nvidia-smi-exporter.service
state: restarted
tags:
- start-service

10
roles/nvidia_smi_exporter/templates/nvidia-smi-exporter.service

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
[Unit]
Description=prometheus node exporter
[Service]
TimeoutStartSec=0
Restart=always
ExecStart=/usr/local/prometheus/nvidia_smi_exporter 9101 \
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save