Browse Source

Add prometheus metrics

master
meskio 6 months ago
parent
commit
2d9912b32e
Signed by: meskio
GPG Key ID: 52B8F5AC97A2DA86
  1. 14
      after
  2. 13
      playbook.yml

14
after

@ -0,0 +1,14 @@
#!/bin/bash -xe
res=0
if [ $RESULT == "success" ]
then
res=1
fi
echo "
# TYPE laminar_run_count counter
laminar_run_count $RUN
# TYPE laminar_last_run_status gauge
laminar_last_run_status{image=\"$image\"} $res
" | curl --data-binary @- {{ prometheus_pushgateway }}/metrics/job/laminar/instance/{{ ansible_host }}/task/$JOB

13
playbook.yml

@ -5,6 +5,7 @@
vars:
laminar_home: "/var/lib/laminar/"
registry: "localhost:5000"
prometheus_pushgateway: "http://localhost:9091"
pre_tasks:
- name: Update apt cache if needed
@ -48,6 +49,7 @@
- nginx
- mmdebstrap
- jq
- prometheus-pushgateway
state: latest
- name: config docker registry
@ -186,3 +188,14 @@
- name: enable webhook
service: name=webhook state=started enabled=yes
- name: enable prometheus pushgateway
service: name=prometheus-pushgateway state=started enabled=yes
- name: configure after for metrics
template:
src: after
dest: "{{ laminar_home }}/cfg/after"
owner: laminar
group: laminar
mode: u=rwx,g=rwx,o=rx

Loading…
Cancel
Save