bad fractional math in bash
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Monitoring Plugins |
Fix Released
|
Medium
|
Unassigned |
Bug Description
When using pmp-check-
percona@
Percona Monitoring Plugins pmp-check-
-- Test delay with Show Slave Status
percona@
OK 6 seconds of replication delay | replication_
-- Test delay against heartbeat table
percona@
[: 139: Illegal number: -0.000700
[: 139: Illegal number: -0.000700
OK -0.000700 seconds of replication delay | replication_
Patch proposal:
--- pmp-check-
+++ pmp-check-
@@ -91,9 +91,9 @@
if [ "${LEVEL:-""}" = "NULL" ]; then
NOTE="UNK replica is stopped"
- elif [ $(echo "${LEVEL:-0} ${OPT_CRIT}" | awk '{print ($1 > $2)}') = 1 ]; then
+ elif [ "${LEVEL:-0}" -gt "${OPT_CRIT}" ]; then
- elif [ $(echo "${LEVEL:-0} ${OPT_WARN}" | awk '{print ($1 > $2)}') = 1 ]; then
+ elif [ "${LEVEL:-0}" -gt "${OPT_WARN}" ]; then
else
NOTE="OK $NOTE | $PERFDATA"
percona@
OK 6.999160 seconds of replication delay | replication_
percona@
WARN 10.999280 seconds of replication delay | replication_
percona@
OK -0.000920 seconds of replication delay | replication_
Changed in percona-monitoring-plugins: | |
status: | Incomplete → In Progress |
importance: | Undecided → Medium |
milestone: | none → 1.1 |
Changed in percona-monitoring-plugins: | |
status: | Invalid → Confirmed |
Changed in percona-monitoring-plugins: | |
milestone: | none → 1.1.4 |
Changed in percona-monitoring-plugins: | |
status: | Confirmed → Fix Committed |
Changed in percona-monitoring-plugins: | |
status: | Fix Committed → Fix Released |
Hi Matthew,
I am not sure whether the checking against fraction of seconds make any sense.
Why do you need to check against -w 6.1 and 6 is not OK?
About why it returns "OK -0.000700 seconds" on the first test - I am not able to reproduce that (fractional result).
It appears to be possible if the actual query includes NOW() but it's not.
Can you please show me the output from your host on these queries?
SELECT MAX(UNIX_ TIMESTAMP( UTC_TIMESTAMP) - UNIX_TIMESTAMP(ts)) AS delay from heartbeat where server_id=104129; TIMESTAMP( ) - UNIX_TIMESTAMP(ts)) AS delay from heartbeat where server_id=104129;
SELECT MAX(UNIX_
Also what's the version of pt-heartbeat in use on the master?
Thanks,
Roman