summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-11-20 18:31:18 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-08-18 16:38:10 (GMT)
commit7bbd155a72eb439efd338f2e217b47332460a250 (patch)
tree483cee2022ee46852690d1daf051e135e5b6e261
parentc8d8b584475692d0e325e3f6658a0d3e5d464d4a (diff)
downloadmonitoring-plugins-7bbd155a72eb439efd338f2e217b47332460a250.tar.gz
Counter increments were incorrect; remove the leading space from perfdata
-rw-r--r--plugins/check_mysql.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 212910d..8d1f99a 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -166,21 +166,24 @@ main (int argc, char **argv)
166 while ( (row = mysql_fetch_row (res)) != NULL) { 166 while ( (row = mysql_fetch_row (res)) != NULL) {
167 int i; 167 int i;
168 168
169 for(i = 0; i < LENGTH_METRIC_UNIT - 1; i++) { 169 for(i = 0; i < LENGTH_METRIC_UNIT; i++) {
170 if (strcmp(row[0], metric_unit[i]) == 0) { 170 if (strcmp(row[0], metric_unit[i]) == 0) {
171 xasprintf(&perf, "%s %s", perf, perfdata(metric_unit[i], 171 xasprintf(&perf, "%s%s ", perf, perfdata(metric_unit[i],
172 atol(row[1]), "", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0)); 172 atol(row[1]), "", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0));
173 continue; 173 continue;
174 } 174 }
175 } 175 }
176 for(i = 0; i < LENGTH_METRIC_COUNTER - 1; i++) { 176 for(i = 0; i < LENGTH_METRIC_COUNTER; i++) {
177 if (strcmp(row[0], metric_counter[i]) == 0) { 177 if (strcmp(row[0], metric_counter[i]) == 0) {
178 xasprintf(&perf, "%s %s", perf, perfdata(metric_counter[i], 178 xasprintf(&perf, "%s%s ", perf, perfdata(metric_counter[i],
179 atol(row[1]), "c", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0)); 179 atol(row[1]), "c", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0));
180 continue; 180 continue;
181 } 181 }
182 } 182 }
183 } 183 }
184 /* remove trailing space */
185 if (strlen(perf) > 0)
186 perf[strlen(perf) - 1] = '\0';
184 } 187 }
185 188
186 if(check_slave) { 189 if(check_slave) {