diff --git a/src/memcached.c b/src/memcached.c
index fb33880ff5cc68aae4764723742e4cc3e0944f99..b5a4b208365b8fba6d99453387f8c10d492ae916 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
vl.values = values;
vl.values_len = 1;
- vl.time = time (NULL);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "memcached", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
if ((octets_rx != 0) || (octets_tx != 0))
submit_counter2 ("memcached_octets", NULL, octets_rx, octets_tx);
- if (! isnan (gets) && !isnan (hits))
- submit_gauge ("percent", "hitratio", (hits / gets) * 100.0);
+ if (!isnan (gets) && !isnan (hits))
+ {
+ gauge_t rate = NAN;
+
+ if (gets != 0.0)
+ rate = 100.0 * hits / gets;
+
+ submit_gauge ("percent", "hitratio", rate);
+ }
+
return 0;
}
/* }}} */