Skip to content

Commit

Permalink
fix TMPFILE reference
Browse files Browse the repository at this point in the history
  • Loading branch information
ricolin committed Apr 2, 2024
1 parent 061961e commit 0bc240b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion roles/osd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
- inventory_hostname == groups[ceph_osd_osds_group] | last

- name: Make sure `/var/lib/cron` directory exists
when: ceph_bluestore_frag_collect
ansible.builtin.file:
path: /var/lib/cron
state: directory
Expand All @@ -154,6 +155,7 @@
- name: Setup Cron job collect Bluestore fragmentation score for Prometheus
when: ceph_bluestore_frag_collect
ansible.builtin.cron:
name: "collect bluestore fragmentation score"
name: "Collect bluestore fragmentation score"
user: root
minute: "1"
job: "/var/lib/cron/prom-bs-frag-score-collector.sh"
6 changes: 3 additions & 3 deletions roles/osd/templates/prom-bs-frag-score-collector.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

export TMPFILE=/tmp/bluestore_allocator_score_block.prom.$$
osd_path=$(find /var/lib/ceph/{{ ceph_mon_fsid }}/ -type d -name "osd.*"| head -n 1)
if [ -z $osd_path ]; then
if [ ! -z $osd_path ]; then
cephadm --image "{{ cephadm_image }}" shell --fsid "{{ ceph_mon_fsid }}" \
--config "$osd_path/config" \
-m /var/lib/cron/bs-frag-score.sh -- ./mnt/bs-frag-score.sh > TMPFILE
-m /var/lib/cron/bs-frag-score.sh -- ./mnt/bs-frag-score.sh > $TMPFILE
else
cephadm --image "{{ cephadm_image }}" shell --fsid "{{ ceph_mon_fsid }}" \
-m /var/lib/cron/bs-frag-score.sh -- ./mnt/bs-frag-score.sh > TMPFILE
-m /var/lib/cron/bs-frag-score.sh -- ./mnt/bs-frag-score.sh > $TMPFILE
fi

mv $TMPFILE /tmp/bluestore_allocator_score_block.prom

0 comments on commit 0bc240b

Please sign in to comment.