Skip to content

Tapicero Heartbeat check fails on days 1-9 of the month

we were getting this on unstable.pixelated-project.org:

/usr/local/lib/nagios/plugins/check_last_regex_in_log -f /var/log/syslog -r "tapicero" -w 300 -c 600
CRITICAL: Last occurrence of "tapicero" in /var/log/syslog was 63264 sec ago | seconds=63264;300;600;0;

but actually, the last occurrence is not so far in the past:

root@unstable1:/tmp# tac /var/log/syslog | grep -i tapicero | head -1
Apr  8 17:27:52 unstable1 tapicero[20873]: Prepared storage user-5523d7f6d76ee2b7397c0ce14e5b1ca0

turns out that the cmd to capture the date+time of the last tapicero occurrence fails:

root@unstable1:/tmp# tac /var/log/syslog | grep -i tapicero | head -1 | cut -d' ' -f 1-3
Apr  8

it should return the time as well, but for 1-digit days, the additional space screws this up.

(from redmine: created on 2015-04-08, closed on 2015-04-08, relates #6537 (closed))