Why Nagios plugin check_dig fails on one host and works on another

It turns out that language/locale settings affects the output of the check_dig Nagios plugin. On one Nagios server it worked as supposed, but on another it threw;

DNS WARNING – 0,004 seconds response time (dig returned an error status)
Performance Data: time=0,003554s;;;0,000000

Running the plugin by hand on the server which worked:

DNS OK – 0.059 seconds response time (www.google.dk. 280454 IN CNAME www.google.com.)|time=0.058764s;;;0.000000

and on the one that didn’t work:

DNS OK – 0,005 seconds response time (www.google.dk. 280481 IN CNAME www.google.com.)|time=0,004693s;;;0,000000

I took me some time to spot the difference, but on the last one, comma is used instead of dot as separator in the time output. Adding LC_NUMERIC=C in front of the check command solved the problem.